def _add_jms_resources(self, resource_nodes, location):
        """
        Special processing to process child nodes in specific order
        :param resource_nodes: the JMS resource model nodes
        :param location: the location to add resources
        """
        if not len(resource_nodes):
            return

        location = LocationContext(location).append_location(JMS_RESOURCE)
        if not self._check_location(location):
            return

        # SAF imported destination may reference error handling, and vice versa
        self.topology_helper.create_placeholder_named_elements(
            location, SAF_ERROR_HANDLING, resource_nodes)

        for element_name in self.resource_elements:
            model_nodes = dictionary_utils.get_dictionary_element(
                resource_nodes, element_name)
            self._add_named_elements(element_name, model_nodes, location)
        return
示例#2
0
    def _create_subfolders(self, location, model_nodes):
        """
        Create the child MBean folders at the specified location.
        :param location: the location
        :param model_nodes: the model dictionary
        :raises: CreateException: if an error occurs
        """
        _method_name = '_create_subfolders'

        self.logger.entering(location.get_folder_path(), class_name=self.__class_name, method_name=_method_name)
        model_subfolder_names = self.alias_helper.get_model_subfolder_names(location)
        for key in model_nodes:
            if key in model_subfolder_names:
                subfolder_nodes = model_nodes[key]
                # don't check for empty subfolder nodes here, some create methods allow them

                sub_location = LocationContext(location).append_location(key)

                if self.alias_helper.requires_artificial_type_subfolder_handling(sub_location):
                    self.logger.finest('WLSDPLY-12116', key, str(sub_location), subfolder_nodes,
                                       class_name=self.__class_name, method_name=_method_name)
                    self._create_named_subtype_mbeans(key, subfolder_nodes, location, True)
                elif self.alias_helper.supports_multiple_mbean_instances(sub_location):
                    self.logger.finest('WLSDPLY-12109', key, str(sub_location), subfolder_nodes,
                                       class_name=self.__class_name, method_name=_method_name)
                    self._create_named_mbeans(key, subfolder_nodes, location)
                elif self.alias_helper.is_artificial_type_folder(sub_location):
                    # these should have been handled inside create_named_subtype_mbeans
                    ex = exception_helper.create_create_exception('WLSDPLY-12120', str(sub_location),
                                                                  key, str(location))
                    self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                    raise ex
                else:
                    self.logger.finest('WLSDPLY-12110', key, str(sub_location), subfolder_nodes,
                                       class_name=self.__class_name, method_name=_method_name)
                    self._create_mbean(key, subfolder_nodes, location)

        self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
        return
示例#3
0
 def testReplaceVariableValueSegmentInString(self):
     short_name = self._helper.get_folder_short_name(
         LocationContext().append_location('JDBCSystemResource'))
     expected = dict()
     expected[short_name + '.Database2.URL--Host'] = \
         'den00chv'
     replacement_dict = dict()
     replacement_dict[
         'JDBCSystemResource[Database2].JdbcResource.JDBCDriverParams.URL'] = dict(
         )
     list_entry = dict()
     list_entry[
         variable_injector.REGEXP_PATTERN] = '(?<=HOST=)[\w.-]+(?=\))'
     list_entry[variable_injector.REGEXP_SUFFIX] = 'Host'
     replacement_dict[
         'JDBCSystemResource[Database2].JdbcResource.JDBCDriverParams.URL'][
             variable_injector.REGEXP] = [list_entry]
     replacement_dict[
         'JDBCSystemResource[Database2].JdbcResource.JDBCDriverParams.URL'][
             variable_injector.VARIABLE_VALUE] = 'den00chv'
     actual = self._helper.inject_variables(replacement_dict)
     self._compare_to_expected_dictionary(expected, actual)
示例#4
0
    def target_server_groups_to_dynamic_clusters(self, server_groups_to_target):
        """
        Target dynamic clusters to dynamic cluster server groups. Dynamic cluster server groups are not user
        expandable. Thus if a dynamic server group is not targeted to a dynamic cluster, don't target to admin
        server. The dynamic cluster server groups are not required to be targeted.
        :param server_groups_to_target: the list of dynamic cluster server groups to target
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'target_server_groups_to_dynamic_clusters'

        self.logger.entering(server_groups_to_target, class_name=self.__class_name, method_name=_method_name)
        if len(server_groups_to_target) == 0:
            return list()

        location = LocationContext()
        root_path = self.aliases.get_wlst_attributes_path(location)
        self.wlst_helper.cd(root_path)

        # Get the clusters and and their members
        cluster_map = self._get_clusters_and_members_map()
        dynamic_cluster_names = list()
        for cluster_name in cluster_map:
            if DYNAMIC_SERVERS in cluster_map[cluster_name]:
                dynamic_cluster_names.append(cluster_name)

        domain_info = self.model.get_model_domain_info()
        dc_server_group_targeting_limits = \
            dictionary_utils.get_dictionary_element(domain_info, DYNAMIC_CLUSTER_SERVER_GROUP_TARGETING_LIMITS)
        if len(dc_server_group_targeting_limits) > 0:
            dc_server_group_targeting_limits = \
                self._get_dynamic_cluster_server_group_targeting_limits(dc_server_group_targeting_limits, cluster_map)
        dynamic_cluster_assigns = \
            self.get_dc_to_server_groups_map(dynamic_cluster_names, server_groups_to_target,
                                             dc_server_group_targeting_limits)  # type: dict
        self.logger.finer('WLSDPLY-12240', str(dc_server_group_targeting_limits),
                          class_name=self.__class_name, method_name=_method_name)

        self.logger.exiting(result=str(dynamic_cluster_assigns), class_name=self.__class_name, method_name=_method_name)
        return dynamic_cluster_assigns
    def discover_domain_parameters(self):
        """
        Discover the domain attributes and non-resource domain subfolders.
        """
        _method_name = 'discover_domain_parameters'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        domain_home = '/'
        location = LocationContext(self._base_location)
        # This is temporary until a do not ignore is created for DomainName
        success, wlst_value = self._get_attribute_value_with_get(model_constants.DOMAIN_NAME, domain_home)
        if success and wlst_value:
            self._dictionary[model_constants.DOMAIN_NAME] = wlst_value

        self._populate_model_parameters(self._dictionary, location)

        model_folder_name, folder_result = self._get_admin_console()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_cdi_container()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_jta()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_jmx()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_restful_management_services()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_log_filters()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_reliable_delivery_policies()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_xml_entity_caches()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_xml_registries()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_domain_log()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
        model_folder_name, folder_result = self._get_nm_properties()
        discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)

        _logger.exiting(class_name=_class_name, method_name=_method_name)
示例#6
0
    def get_singleton_service(self):
        """
        Discover the SingletonService global resource settings
        :return: model name for the folder: dictionary containing the discovered SingletonService
        """
        _method_name = 'get_singleton_service'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.SINGLETON_SERVICE
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        singleton_services = self._find_names_in_folder(location)
        if singleton_services is not None:
            _logger.info('WLSDPLY-06445', len(singleton_services), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for singleton_service in singleton_services:
                _logger.info('WLSDPLY-06446', singleton_service, class_name=_class_name, method_name=_method_name)
                result[singleton_service] = OrderedDict()
                location.add_name_token(name_token, singleton_service)
                self._populate_model_parameters(result[singleton_service], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
示例#7
0
 def get_wldf_system_resources(self):
     """
     Discover each WLDF system resource in the domain.
     :return: model name for the WLDF system resource:dictionary containing the discovered WLDF system resources
     """
     _method_name = 'get_wldf_system_resources'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.WLDF_SYSTEM_RESOURCE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     wldf_resources = self._find_names_in_folder(location)
     if wldf_resources is not None:
         _logger.info('WLSDPLY-06357', len(wldf_resources), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for wldf_resource in wldf_resources:
             _logger.info('WLSDPLY-06358', wldf_resource, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, wldf_resource)
             result[wldf_resource] = OrderedDict()
             self._populate_model_parameters(result[wldf_resource], location)
             self._discover_subfolders(result[wldf_resource], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
示例#8
0
 def get_jdbc_stores(self):
     """
     Discover the JDBC stores used for weblogic persistence
     :return: model file name: dictionary containing discovered JDBC stores
     """
     _method_name = 'get_jdbc_stores'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.JDBC_STORE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     jdbc_stores = self._find_names_in_folder(location)
     if jdbc_stores is not None:
         _logger.info('WLSDPLY-06350', len(jdbc_stores), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for jdbc_store in jdbc_stores:
             _logger.info('WLSDPLY-06351', jdbc_store, class_name=_class_name, method_name=_method_name)
             result[jdbc_store] = OrderedDict()
             location.add_name_token(name_token, jdbc_store)
             self._populate_model_parameters(result[jdbc_store], location)
             self.archive_jdbc_create_script(jdbc_store, result[jdbc_store])
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
示例#9
0
 def get_file_stores(self):
     """
     Discover the file stores used for weblogic persistence
     :return: model folder name: dictionary with the discovered file stores
     """
     _method_name = 'get_file_stores'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.FILE_STORE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     file_stores = self._find_names_in_folder(location)
     if file_stores is not None:
         _logger.info('WLSDPLY-06346', len(file_stores), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for file_store in file_stores:
             _logger.info('WLSDPLY-06347', file_store, class_name=_class_name, method_name=_method_name)
             result[file_store] = OrderedDict()
             location.add_name_token(name_token, file_store)
             self._populate_model_parameters(result[file_store], location)
             self.archive_file_store_directory(file_store, result[file_store])
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
示例#10
0
 def get_foreign_jndi_providers(self):
     """
     Discover Foreign JNDI providers from the domain.
     :return: model name for the dictionary and the dictionary containing the foreign JNDI provider information
     """
     _method_name = 'get_foreign_jndi_providers'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.FOREIGN_JNDI_PROVIDER
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     providers = self._find_names_in_folder(location)
     if providers is not None:
         _logger.info('WLSDPLY-06342', len(providers), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for provider in providers:
             _logger.info('WLSDPLY-06343', provider, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, provider)
             result[provider] = OrderedDict()
             self._populate_model_parameters(result[provider], location)
             self._discover_subfolders(result[provider], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
示例#11
0
 def get_saf_agents(self):
     """
     Discover the SAF agents from the domain.
     :return: model folder name: dictionary containing the discovered SAF agents
     """
     _method_name = 'get_saf_agents'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SAF_AGENT
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     agents = self._find_names_in_folder(location)
     if agents is not None:
         _logger.info('WLSDPLY-06472', len(agents), class_name=_class_name, method_name=_method_name)
         name_token = self._aliases.get_name_token(location)
         for agent in agents:
             _logger.info('WLSDPLY-06473', agent, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, agent)
             result[agent] = OrderedDict()
             self._populate_model_parameters(result[agent], location)
             self._discover_subfolders(result[agent], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
 def get_server_templates(self):
     """
     Discover Server Templates in the domain.
     :return: model name for the dictionary and the dictionary containing the server template information
     """
     _method_name = 'get_server_templates'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SERVER_TEMPLATE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     templates = self._find_names_in_folder(location)
     if templates is not None:
         _logger.info('WLSDPLY-06605', len(templates), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for template in templates:
             _logger.info('WLSDPLY-06606', template, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, template)
             result[template] = OrderedDict()
             self._populate_model_parameters(result[template], location)
             self._discover_subfolders(result[template], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
示例#13
0
    def _add_group_params(self, group_name_nodes, location):
        """
        Add each group param entry from group name nodes and set its attributes.
        A two-pass approach is required since the new folder's name does not always match the group name.
        Special processing for error destination attributes (build mbean)
        :param group_name_nodes: the nodes containing group parameter names
        :param location: the WLST location where the parameters should be added
        """
        _method_name = '_add_group_params'
        if len(group_name_nodes) == 0:
            return

        parent_type, parent_name = self.get_location_type_and_name(location)
        template_path = self.alias_helper.get_wlst_subfolders_path(location)
        groups_location = LocationContext(location)
        groups_location.append_location(GROUP_PARAMS)
        groups_token = self.alias_helper.get_name_token(groups_location)
        name_attribute = self.alias_helper.get_wlst_attribute_name(groups_location, SUB_DEPLOYMENT_NAME)
        mbean_type = self.alias_helper.get_wlst_mbean_type(groups_location)

        # loop once to create and name any missing folders.
        folder_map = self._build_folder_map(groups_location, groups_token, name_attribute)

        for group_name in group_name_nodes:
            sub_deployment_name = self._get_subdeployment_name(group_name_nodes, group_name)
            folder_name = dictionary_utils.get_element(folder_map, sub_deployment_name)
            if folder_name is None:
                self.wlst_helper.cd(template_path)
                group = self.wlst_helper.create(sub_deployment_name, mbean_type)
                group.setSubDeploymentName(sub_deployment_name)

        # loop a second time to set attributes
        new_folder_map = self._build_folder_map(groups_location, groups_token, name_attribute)

        for group_name in group_name_nodes:
            sub_deployment_name = self._get_subdeployment_name(group_name_nodes, group_name)
            is_add = sub_deployment_name not in folder_map
            log_helper.log_updating_named_folder(GROUP_PARAMS, group_name, parent_type, parent_name, is_add,
                                                 self._class_name, _method_name)

            folder_name = dictionary_utils.get_element(new_folder_map, sub_deployment_name)
            groups_location.add_name_token(groups_token, folder_name)
            self.wlst_helper.cd(self.alias_helper.get_wlst_attributes_path(groups_location))

            group_nodes = group_name_nodes[group_name]
            self.set_attributes(groups_location, group_nodes)
    def _get_xml_entity_caches(self):
        """
        Discover the XML entity caches that are used by the servers in the domain.
        :return: model name for the folder: dictionary containing the discovered xml entity caches
        """
        _method_name = '_get_xml_entity_caches'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.XML_ENTITY_CACHE
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        caches = self._find_names_in_folder(location)
        if caches is not None:
            _logger.info('WLSDPLY-06632', len(caches), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for cache in caches:
                _logger.info('WLSDPLY-06633', cache, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, cache)
                result[cache] = OrderedDict()
                self._populate_model_parameters(result[cache], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
 def _get_virtual_targets(self):
     """
     Discover the virtual targets used for targeting partition resources.
     :return: model name for virtual targets:dictionary with the discovered virtual targets
     """
     _method_name = '_get_virtual_targets'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.VIRTUAL_TARGET
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     targets = self._find_names_in_folder(location)
     if targets:
         _logger.info('WLSDPLY-06710', len(targets), class_name=_class_name, method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for target in targets:
             _logger.info('WLSDPLY-06711', target, class_name=_class_name, method_name=_method_name)
             location.add_name_token(name_token, target)
             result[target] = OrderedDict()
             self._populate_model_parameters(result[target], location)
             self._discover_subfolders(result[target], location)
             location.remove_name_token(name_token)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
     return model_top_folder_name, result
    def _get_xml_registries(self):
        """
        Discover the XML registries that are used by the servers.
        :return: model name for the folder: dictionary containing the discovered log xml registries
        """
        _method_name = '_get_xml_registries'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.XML_REGISTRY
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        registries = self._find_names_in_folder(location)
        if registries is not None:
            _logger.info('WLSDPLY-06634', len(registries), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for registry in registries:
                _logger.info('WLSDPLY-06635', registry, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, registry)
                result[registry] = OrderedDict()
                self._populate_model_parameters(result[registry], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
    def _get_reliable_delivery_policies(self):
        """
        Discover the reliable delivery policies that are used for soap message delivery in the servers.
        :return: model name for the folder: dictionary containing the discovered ws reliable delivery policies
        """
        _method_name = '_get_reliable_delivery_policies'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.WS_RELIABLE_DELIVERY_POLICY
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        policies = self._find_names_in_folder(location)
        if policies is not None:
            _logger.info('WLSDPLY-06630', len(policies), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for policy in policies:
                _logger.info('WLSDPLY-06631', policy, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, policy)
                result[policy] = OrderedDict()
                self._populate_model_parameters(result[policy], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
    def _get_log_filters(self):
        """
        Discover the log filters that are used in the different types of Logs in the domain.
        :return: model name for the folder: dictionary containing the discovered log filters
        """
        _method_name = '_get_log_filters'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.LOG_FILTER
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        filters = self._find_names_in_folder(location)
        if filters is not None:
            _logger.info('WLSDPLY-06628', len(filters), class_name=_class_name, method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for logfilter in filters:
                _logger.info('WLSDPLY-06629', logfilter, class_name=_class_name, method_name=_method_name)
                location.add_name_token(name_token, logfilter)
                result[logfilter] = OrderedDict()
                self._populate_model_parameters(result[logfilter], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
        return model_top_folder_name, result
示例#19
0
    def get_shared_libraries(self):
        """
        Discover the shared library deployment information from the domain. Collect any shared library binaries into
        the discovered archive file. If the shared library cannot be collected into the archive, the shared library
        source path will be removed from the model and the shared library un-targeted.
        :return: model name for the dictionary and the dictionary containing the shared library information
        """
        _method_name = 'get_shared_libraries'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.LIBRARY
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        libraries = self._find_names_in_folder(location)
        if libraries:
            _logger.info('WLSDPLY-06381',
                         len(libraries),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for library in libraries:
                _logger.info('WLSDPLY-06382',
                             library,
                             class_name=_class_name,
                             method_name=_method_name)
                location.add_name_token(name_token, library)
                result[library] = OrderedDict()
                self._populate_model_parameters(result[library], location)
                self._add_shared_libraries_to_archive(library, result[library])
                self._discover_subfolders(result[library], location)
                location.remove_name_token(name_token)

        _logger.exiting(class_name=_class_name,
                        method_name=_method_name,
                        result=model_top_folder_name)
        return model_top_folder_name, result
示例#20
0
def format_variable_name(location, attribute, aliases):
    """
    Return a variable name for the specified attribute and location.
    Example: ServerTemp.template1.SSL.ListenPort
    :param location: the location of the attribute
    :param attribute: the attribute to be evaluated
    :param aliases: for information about the location and attribute
    :return: the variable name
    """
    _method_name = 'format_variable_name'

    short_list = __traverse_location(LocationContext(location), attribute, list(), aliases)

    short_name = ''
    for node in short_list:
        if node is not None and len(node) > 0:
            short_name += node + '.'
    short_name += attribute

    short_name = short_name.replace('/', '.')
    short_name = _white_space_replacement.sub('-', short_name)
    short_name = _fake_name_replacement.sub('', short_name)
    return short_name
示例#21
0
 def _dynamic_target(self, target, location):
     """
     Determine if the Migratable Target is connected to a dynamic server. This is determined in online mode
     only when the dynamic server and dynamic migratable target are created.
     :param target: migratable target to test for connection to dynamic server
     :param location: current location context
     :return: True if a dynamic server Migratable Target
     """
     if target.endswith('(migratable)'):
         server_name = target.split('(migratable)')[0].strip()
         server_location = LocationContext()
         server_location.append_location(model_constants.SERVER)
         server_location.add_name_token(
             self._aliases.get_name_token(server_location), server_name)
         wlst_path = self._aliases.get_wlst_attributes_path(server_location)
         if self._wlst_helper.path_exists(wlst_path):
             return self._dynamic_server(server_name, server_location)
     return False
 def _get_restful_management_services(self):
     """
     Discover the wlst restful management services enablement for the domain.
     :return: model name for the mbean:dictionary containing the discovered restful management services mbean
     """
     _method_name = '_get_restful_management_services'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     model_top_folder_name = model_constants.RESTFUL_MANAGEMENT_SERVICES
     result = OrderedDict()
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     name = self._find_singleton_name_in_folder(location)
     if name is not None:
         _logger.info('WLSDPLY-06616', class_name=_class_name, method_name=_method_name)
         location.add_name_token(self._alias_helper.get_name_token(location), name)
         self._populate_model_parameters(result, location)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
 def _get_cdi_container(self):
     """
     Discover the domain level CdiContainer configuration attributes.
     :return: model name for CdiContainer: dictionary containing the discovered CdiContainer attributes
     """
     _method_name = '_get_cdi_container'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     model_top_folder_name = model_constants.CDI_CONTAINER
     result = OrderedDict()
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     name = self._find_singleton_name_in_folder(location)
     if name is not None:
         _logger.info('WLSDPLY-06643', class_name=_class_name, method_name=_method_name)
         location.add_name_token(self._alias_helper.get_name_token(location), name)
         self._populate_model_parameters(result, location)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
示例#24
0
    def _create_subfolders(self, location, model_nodes):
        """
        Create the child MBean folders at the specified location.
        :param location: the location
        :param model_nodes: the model dictionary
        :raises: CreateException: if an error occurs
        """
        _method_name = '_create_subfolders'

        self.logger.entering(location.get_folder_path(), class_name=self.__class_name, method_name=_method_name)
        model_subfolder_names = self.alias_helper.get_model_subfolder_names(location)
        for key in model_nodes:
            if key in model_subfolder_names:
                subfolder_nodes = model_nodes[key]
                sub_location = LocationContext(location).append_location(key)
                # both create and update are merge to model so will process a subfolder with an empty node
                if self.alias_helper.requires_artificial_type_subfolder_handling(sub_location):
                    self.logger.finest('WLSDPLY-12116', key, str(sub_location), subfolder_nodes,
                                       class_name=self.__class_name, method_name=_method_name)
                    self._create_security_provider_mbeans(key, subfolder_nodes, location, True)
                elif len(subfolder_nodes) != 0:
                    if self.alias_helper.supports_multiple_mbean_instances(sub_location):
                        self.logger.finest('WLSDPLY-12109', key, str(sub_location), subfolder_nodes,
                                           class_name=self.__class_name, method_name=_method_name)
                        self._create_named_mbeans(key, subfolder_nodes, location)
                    elif self.alias_helper.is_artificial_type_folder(sub_location):
                        ex = exception_helper.create_create_exception('WLSDPLY-12120', str(sub_location),
                                                                      key, str(location))
                        self.logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
                        raise ex
                    else:
                        self.logger.finest('WLSDPLY-12110', key, str(sub_location), subfolder_nodes,
                                           class_name=self.__class_name, method_name=_method_name)
                        self._create_mbean(key, subfolder_nodes, location)

        self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
        return
示例#25
0
 def get_self_tuning(self):
     """
     Discover the self-tuning attributes from the domain.
     :return: model folder name: dictionary containing the discovered self tuning
     """
     _method_name = 'get_self_tuning'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SELF_TUNING
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     tuning = self._find_singleton_name_in_folder(location)
     if tuning is not None:
         location.add_name_token(self._alias_helper.get_name_token(location), tuning)
         _logger.info('WLSDPLY-06441', class_name=_class_name, method_name=_method_name)
         self._discover_subfolders(result, location)
     _logger.exiting(class_name=_class_name, method_name=_method_name, result=result)
     return model_top_folder_name, result
 def _get_jmx(self):
     """
     Discover the JMX agents configured in the domain.
     :return: model name for JMX:dictionary containing the discovered JMX attributes
     """
     _method_name = '_get_jmx'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     model_top_folder_name = model_constants.JMX
     result = OrderedDict()
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     name = self._find_singleton_name_in_folder(location)
     if name is not None:
         _logger.info('WLSDPLY-06615', class_name=_class_name, method_name=_method_name)
         location.add_name_token(self._alias_helper.get_name_token(location), name)
         self._populate_model_parameters(result, location)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
示例#27
0
    def __walk_model_node(self, model_node, validation_location):
        _method_name = '__walk_model_node'

        valid_folder_keys = self._aliases.get_model_subfolder_names(validation_location)
        valid_attr_infos = self._aliases.get_model_attribute_names_and_types(validation_location)

        for key, value in model_node.iteritems():

            if key in valid_folder_keys:
                new_location = LocationContext(validation_location).append_location(key)

                if self._aliases.is_artificial_type_folder(new_location):
                    # key is an ARTIFICIAL_TYPE folder
                    valid_attr_infos = self._aliases.get_model_attribute_names_and_types(new_location)

                    self.__walk_attributes(value, valid_attr_infos, new_location)
                else:
                    self.__walk_section_folder(value, new_location)

            elif key in valid_attr_infos:
                # aliases.get_model_attribute_names_and_types(location) filters out
                # attributes that ARE NOT valid in the wlst_version being used, so if
                # we're in this section of code we know key is a bonafide "valid" attribute
                self.__walk_attribute(model_node, key, validation_location)
 def testWithSegmentInDictionary(self):
     expected = dict()
     short_name = self._helper.get_folder_short_name(
         LocationContext().append_location('MailSession'))
     expected[
         short_name +
         '.MailSession-0.Properties--SmtpHost'] = 'stbeehive.oracle.com'
     expected[
         short_name +
         '.MyMailSession.Properties--SmtpHost'] = 'stbeehive.oracle.com'
     expected[
         short_name +
         '.MailSession-0.Properties--ImapHost'] = 'stbeehive.oracle.com'
     expected[
         short_name +
         '.MyMailSession.Properties--ImapHost'] = 'stbeehive.oracle.com'
     replacement_dict = dict()
     replacement_dict['MailSession.Properties'] = dict()
     list_entry1 = dict()
     list_entry1[variable_injector.REGEXP_PATTERN] = 'mail.smtp.host'
     list_entry1[variable_injector.REGEXP_SUFFIX] = 'SmtpHost'
     list_entry2 = dict()
     list_entry2[variable_injector.REGEXP_PATTERN] = 'mail.imap.host'
     list_entry2[variable_injector.REGEXP_SUFFIX] = 'ImapHost'
     replacement_dict['MailSession.Properties'][
         variable_injector.REGEXP] = [list_entry1, list_entry2]
     actual = self._helper.inject_variables(replacement_dict)
     self._compare_to_expected_dictionary(expected, actual)
     self.assertEqual(
         '@@PROP:' + short_name + '.MyMailSession.Properties--SmtpHost@@',
         self._model['resources']['MailSession']['MyMailSession']
         ['Properties']['mail.smtp.host'])
     self.assertEqual(
         '@@PROP:' + short_name + '.MyMailSession.Properties--ImapHost@@',
         self._model['resources']['MailSession']['MyMailSession']
         ['Properties']['mail.imap.host'])
    def __walk_model_node(self, model_node, validation_location):
        _method_name = '__process_model_node'

        valid_folder_keys = self._alias_helper.get_model_subfolder_names(validation_location)
        valid_attr_infos = self._alias_helper.get_model_attribute_names_and_types(validation_location)
        model_folder_path = self._alias_helper.get_model_folder_path(validation_location)

        for key, value in model_node.iteritems():

            if key in valid_folder_keys:
                new_location = LocationContext(validation_location).append_location(key)

                if self._alias_helper.is_artificial_type_folder(new_location):
                    # key is an ARTIFICIAL_TYPE folder
                    valid_attr_infos = self._alias_helper.get_model_attribute_names_and_types(new_location)

                    self.__walk_attributes(value, valid_attr_infos, new_location)
                else:
                    self.__walk_section_folder(value, new_location)

            elif key in valid_attr_infos:
                # aliases.get_model_attribute_names_and_types(location) filters out
                # attributes that ARE NOT valid in the wlst_version being used, so if
                # we're in this section of code we know key is a bonafide "valid" attribute
                valid_data_type = valid_attr_infos[key]
                if valid_data_type in ['properties']:
                    valid_prop_infos = {}
                    properties = validation_utils.get_properties(value)
                    self.__walk_properties(properties, valid_prop_infos, validation_location)

                else:
                    path_tokens_attr_keys = \
                        self._alias_helper.get_model_uses_path_tokens_attribute_names(validation_location)

                    self.__walk_attribute(key, value, valid_attr_infos, path_tokens_attr_keys, model_folder_path,
                                          validation_location)
    def _check_folder(self, location, aliases):
        test_value = ['one', 'two']
        expected_value = ','.join(test_value)

        attr_infos = aliases.get_model_attribute_names_and_types(location)
        for key in attr_infos.keys():
            model_type = attr_infos[key]
            if model_type.startswith(
                    "delimited_string") and not model_type.endswith("[space]"):

                wlst_name = aliases.get_wlst_attribute_name(location, key)
                if wlst_name is not None:
                    model_name, value = aliases.get_model_attribute_name_and_value(
                        location, wlst_name, test_value)
                    message = "Value for attribute " + key + " in location " + str(location.get_folder_path()) + \
                        " should be comma-delimited"
                    self.assertEqual(expected_value, value, message)

        folder_names = aliases.get_model_subfolder_names(location)
        for folder_name in folder_names:
            new_location = LocationContext(location).append_location(
                folder_name)
            self._check_folder(new_location, aliases)
        return