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_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
 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
Beispiel #4
0
    def __find_in_location(self, location, element_type, name, required=False):
        """
        Find the element with the specified name and type and return its WLST mbean.
        :param location: the WLST location of the attribute
        :param element_type: the thype of the element to be found
        :param name: the name of the element to find
        :param required: indicates exception should be thrown if not found
        :return: the mbean for the destination
        :raises BundleAwareException of the specified type: if element is not found, and required is True
        """
        method_name = '__find_in_location'

        location = LocationContext(location).append_location(element_type)
        if self.__alias_helper.get_wlst_mbean_type(location) is not None:
            existing_names = self.__get_existing_object_list(location)
            if name in existing_names:
                location_type, location_name = self.__alias_helper.get_model_type_and_name(location)
                self.__logger.fine('WLSDPLY-19204', element_type, name, location_type, location_name,
                                   class_name=self._class_name, method_name=method_name)
                token = self.__alias_helper.get_name_token(location)
                location.add_name_token(token, name)
                path = self.__alias_helper.get_wlst_attributes_path(location)
                return self.__wlst_helper.get_mbean_for_wlst_path(path)

        if required:
            ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19202', element_type, name)
            self.__logger.throwing(class_name=self._class_name, method_name=method_name, error=ex)
            raise ex

        return None
Beispiel #5
0
    def _create_placeholder_jms_template(self, template_name,
                                         resource_location):
        """
        :param template_name: the name of the template to be added
        :param resource_location: the location where the template should be added
        """
        _method_name = '_create_placeholder_jms_template'
        original_location = self.wlst_helper.get_pwd()
        template_location = LocationContext(resource_location).append_location(
            TEMPLATE)
        existing_names = deployer_utils.get_existing_object_list(
            template_location, self.aliases)

        if template_name not in existing_names:
            self.logger.info('WLSDPLY-09500',
                             template_name,
                             class_name=self._class_name,
                             method_name=_method_name)

        template_token = self.aliases.get_name_token(template_location)
        template_location.add_name_token(template_token, template_name)
        result = deployer_utils.create_and_cd(template_location,
                                              existing_names, self.aliases)

        self.wlst_helper.cd(original_location)
        return result
Beispiel #6
0
    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 _configure_logger(self, logger_name, logger, document, existing_names,
                          config_location):
        """
        Configure the specified logger in the document.
        The logger will be added if it is not currently in the document.
        :param logger_name: the name of the logger to be configured
        :param logger: the dictionary of the logger to be configured
        :param document: the document to be updated
        :param existing_names: the names of existing loggers
        :param config_location: the location of ODL configuration in the model
        """
        _method_name = '_configure_logger'

        logger_location = LocationContext(config_location).append_location(
            _LOGGER)
        token = self.aliases.get_name_token(logger_location)
        logger_location.add_name_token(token, logger_name)
        logger_path = self.aliases.get_model_folder_path(logger_location)

        if logger_name not in existing_names:
            try:
                document.addLogger(logger_name)
            except IllegalArgumentException, iae:
                self.logger.severe('WLSDPLY-19704',
                                   logger_name,
                                   logger_path,
                                   iae.getLocalizedMessage(),
                                   class_name=self.__class_name,
                                   method_name=_method_name)
    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._aliases.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
    def get_jolt_connection_pool(self):
        """
        Discover the global resource Jolt Connection Pool
        :return: model name for the folder: dictionary containing the discovered JoltConnectionPool
        """
        _method_name = 'get_jolt_connection_pool'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.JOLT_CONNECTION_POOL
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        jolt_pools = self._find_names_in_folder(location)
        if jolt_pools is not None:
            _logger.info('WLSDPLY-06449',
                         len(jolt_pools),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._aliases.get_name_token(location)
            for jolt_pool in jolt_pools:
                _logger.info('WLSDPLY-06450',
                             jolt_pool,
                             class_name=_class_name,
                             method_name=_method_name)
                result[jolt_pool] = OrderedDict()
                location.add_name_token(name_token, jolt_pool)
                self._populate_model_parameters(result[jolt_pool], 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_embedded_ldap_configuration(self):
     """
     Get the Embedded LDAP server configuration for the domain and only return the configuration
     when there are non-default settings other than the credential value.
     :return: name for the model:dictionary containing the discovered Embedded LDAP configuration
     """
     _method_name = 'get_embedded_ldap_configuration'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.EMBEDDED_LDAP
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     embedded_ldap_configuration = self._find_singleton_name_in_folder(
         location)
     if embedded_ldap_configuration is not None:
         location.add_name_token(
             self._alias_helper.get_name_token(location),
             embedded_ldap_configuration)
         self._populate_model_parameters(result, location)
         # IFF credential is the only attribute, skip adding the Embedded LDAP server configuration
         if len(result
                ) == 1 and model_constants.CREDENTIAL_ENCRYPTED in result:
             result = OrderedDict()
             _logger.info('WLSDPLY-06639',
                          class_name=_class_name,
                          method_name=_method_name)
         else:
             _logger.info('WLSDPLY-06640',
                          class_name=_class_name,
                          method_name=_method_name)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
    def get_webapp_container(self):
        """
        Discover the WebAppContainer global resource settings
        :return: model name for the folder: dictionary containing the discovered WebAppContainer
        """
        _method_name = '_get_webapp_container'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.WEBAPP_CONTAINER
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        webapp_container = self._find_singleton_name_in_folder(location)
        if webapp_container is not None:
            _logger.info('WLSDPLY-06615',
                         class_name=_class_name,
                         method_name=_method_name)
            location.add_name_token(self._aliases.get_name_token(location),
                                    webapp_container)
            self._populate_model_parameters(result, location)
            self._discover_subfolders(result, location)
            new_name = self._add_mimemapping_file_to_archive(result)
            if new_name:
                result[model_constants.MIME_MAPPING_FILE] = new_name

        _logger.exiting(class_name=_class_name,
                        method_name=_method_name,
                        result=model_top_folder_name)
        return model_top_folder_name, result
Beispiel #12
0
 def discover_domain_mbean(self, model_top_folder_name):
     """
     Discover the domain specific MBean and its configuration attributes.
     :return: model name for domain MBean:dictionary containing the discovered Domain MBean attributes
     """
     _method_name = 'discover_domain_mbean'
     _logger.entering(model_top_folder_name,
                      class_name=_class_name,
                      method_name=_method_name)
     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-06644',
                      model_top_folder_name,
                      class_name=_class_name,
                      method_name=_method_name)
         location.add_name_token(self._aliases.get_name_token(location),
                                 name)
         self._populate_model_parameters(result, location)
         # if any subfolders exist, discover
         self._discover_subfolders(result, location)
     _logger.exiting(class_name=_class_name, method_name=_method_name)
     return model_top_folder_name, result
Beispiel #13
0
    def _create_mbean(self, type_name, model_nodes, base_location, log_created=False):
        """
        Create the specified type of MBean that support a single instance in the specified location.
        :param type_name: the model folder type
        :param model_nodes: the model dictionary of the specified model folder type
        :param base_location: the base location object to use to create the MBean
        :param log_created: whether or not to log created at INFO level, by default it is logged at the FINE level
        :raises: CreateException: if an error occurs
        """
        _method_name = '_create_mbean'

        self.logger.entering(type_name, str(base_location), log_created,
                             class_name=self.__class_name, method_name=_method_name)
        if model_nodes is None or len(model_nodes) == 0 or not self._is_type_valid(base_location, type_name):
            return

        location = LocationContext(base_location).append_location(type_name)
        result, message = self.alias_helper.is_version_valid_location(location)
        if result == ValidationCodes.VERSION_INVALID:
            self.logger.warning('WLSDPLY-12123', message,
                                class_name=self.__class_name, method_name=_method_name)
            return

        create_path = self.alias_helper.get_wlst_create_path(location)
        existing_folder_names = self._get_existing_folders(create_path)

        mbean_type, mbean_name = self.alias_helper.get_wlst_mbean_type_and_name(location)

        token_name = self.alias_helper.get_name_token(location)
        if token_name is not None:
            if self.alias_helper.requires_unpredictable_single_name_handling(location):
                existing_subfolder_names = deployer_utils.get_existing_object_list(location, self.alias_helper)
                if len(existing_subfolder_names) > 0:
                    mbean_name = existing_subfolder_names[0]

            location.add_name_token(token_name, mbean_name)

        self._process_flattened_folder(location)
        if mbean_type not in existing_folder_names:
            if log_created:
                self.logger.info('WLSDPLY-12102', type_name, class_name=self.__class_name, method_name=_method_name)
            else:
                self.logger.fine('WLSDPLY-12102', type_name, class_name=self.__class_name, method_name=_method_name)

            self.wlst_helper.create_and_cd(self.alias_helper, mbean_type, mbean_name, location, create_path)
        else:
            if log_created:
                self.logger.info('WLSDPLY-20013', type_name, class_name=self.__class_name, method_name=_method_name)
            else:
                self.logger.fine('WLSDPLY-12102', type_name, class_name=self.__class_name, method_name=_method_name)

            attribute_path = self.alias_helper.get_wlst_attributes_path(location)
            self.wlst_helper.cd(attribute_path)

        self.logger.finest('WLSDPLY-12111', self.alias_helper.get_model_folder_path(location),
                           self.wlst_helper.get_pwd(), class_name=self.__class_name, method_name=_method_name)
        self._set_attributes(location, model_nodes)
        self._create_subfolders(location, model_nodes)
        self.logger.exiting(class_name=self.__class_name, method_name=_method_name)
        return
    def __set_admin_server_name(self):
        """
        Set the name of the AdminServer, if required.
        :raises: CreateException: if an error occurs
        """
        _method_name = '__set_admin_server_name'

        # Test to see if the name was specified to see whether we need to do this or not...
        self.wlst_helper.cd('/')
        self.__default_admin_server_name = self.wlst_helper.get(
            ADMIN_SERVER_NAME)
        if self._admin_server_name != self.__default_admin_server_name:
            location = LocationContext().append_location(SERVER)
            token_name = self.alias_helper.get_name_token(location)
            if token_name is not None:
                location.add_name_token(token_name,
                                        self.__default_admin_server_name)

            wlst_path = self.alias_helper.get_wlst_attributes_path(location)
            self.wlst_helper.cd(wlst_path)
            #
            # We cannot use the aliases for the Server Name attribute since we
            # filter out any name fields.
            #
            self.wlst_helper.set_if_needed(NAME, self._admin_server_name,
                                           SERVER,
                                           self.__default_admin_server_name)
            self.logger.info('WLSDPLY-12229',
                             self.__default_admin_server_name,
                             self._admin_server_name,
                             class_name=self.__class_name,
                             method_name=_method_name)
        else:
            self._admin_server_name = self.__default_admin_server_name
        return
Beispiel #15
0
    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_wtc_servers(self):
        """
        Discover the WTC servers from the domain.
        :return: model folder name: dictionary containing the discovered WTCServers
        """
        _method_name = 'get_wtc_servers'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.WTC_SERVER
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        wtc_servers = self._find_names_in_folder(location)
        if wtc_servers is not None:
            _logger.info('WLSDPLY-06451',
                         len(wtc_servers),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._aliases.get_name_token(location)
            for wtc_server in wtc_servers:
                _logger.info('WLSDPLY-06452',
                             wtc_server,
                             class_name=_class_name,
                             method_name=_method_name)
                result[wtc_server] = OrderedDict()
                location.add_name_token(name_token, wtc_server)
                self._populate_model_parameters(result[wtc_server], location)
                self._discover_subfolders(result[wtc_server], 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
Beispiel #17
0
    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
Beispiel #18
0
    def get_clusters(self):
        """
        Discover the Clusters in the domain.
        :return:  model name for the dictionary and the dictionary containing the cluster information
        """
        _method_name = 'get_clusters'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.CLUSTER
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        clusters = self._find_names_in_folder(location)
        if clusters is not None:
            _logger.info('WLSDPLY-06601',
                         len(clusters),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for cluster in clusters:
                _logger.info('WLSDPLY-06602',
                             cluster,
                             class_name=_class_name,
                             method_name=_method_name)
                location.add_name_token(name_token, cluster)
                result[cluster] = OrderedDict()
                self._populate_model_parameters(result[cluster], location)
                self._discover_subfolders(result[cluster], location)
                location.remove_name_token(name_token)
            location.pop_location()

        _logger.exiting(class_name=_class_name,
                        method_name=_method_name,
                        result=model_top_folder_name)
        return model_top_folder_name, result
    def create_placeholder_server_templates(self, topology):
        """
        Create a placeholder server template for each name in the topology.
        This is necessary because there is a circular dependency between clusters and server templates.
        :param topology: the topology model nodes
        """
        _method_name = 'create_placeholder_server_templates'
        original_location = self.wlst_helper.get_pwd()
        template_location = LocationContext().append_location(SERVER_TEMPLATE)

        if self.alias_helper.get_wlst_mbean_type(
                template_location) is not None:
            existing_names = deployer_utils.get_existing_object_list(
                template_location, self.alias_helper)

            template_nodes = dictionary_utils.get_dictionary_element(
                topology, SERVER_TEMPLATE)
            for template_name in template_nodes:
                if template_name not in existing_names:
                    self.logger.info('WLSDPLY-19400',
                                     template_name,
                                     class_name=self.__class_name,
                                     method_name=_method_name)

                    template_token = self.alias_helper.get_name_token(
                        template_location)
                    template_location.add_name_token(template_token,
                                                     template_name)
                    deployer_utils.create_and_cd(template_location,
                                                 existing_names,
                                                 self.alias_helper)

        self.wlst_helper.cd(original_location)
Beispiel #20
0
 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
Beispiel #21
0
    def __find_saf_destination_mbean(self, location, destination_name):
        """
        Find the SAF destination with the specified name and return its WLST mbean.
        :param location: the WLST location of the attribute
        :param destination_name: the name of the SAF destination to find
        :return: the mbean for the SAF destination
        :raises BundleAwareException of the specified type: if SAF destination is not found
        """
        method_name = '__find_saf_destination_mbean'
        resource_location = self.__get_parent_location(location, JMS_RESOURCE)
        destination_location = LocationContext(resource_location).append_location(SAF_IMPORTED_DESTINATION)
        existing_sets = self.__get_existing_object_list(destination_location)

        token_name = self.__alias_helper.get_name_token(destination_location)
        for set_name in existing_sets:
            if token_name is not None:
                destination_location.add_name_token(token_name, set_name)
            for type_name in self.__saf_destination_type_names:
                mbean = self.__find_in_location(destination_location, type_name, destination_name)
                if mbean is not None:
                    return mbean

        _resource_type, resource_name = self.__alias_helper.get_model_type_and_name(resource_location)
        ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19203', destination_name, resource_name)
        self.__logger.throwing(class_name=self._class_name, method_name=method_name, error=ex)
        raise ex
Beispiel #22
0
    def get_migratable_targets(self):
        """
        Discover the migratable targets for the domain, including auto generated migratable targets for the server.
        :return: model name for the folder: dictionary containing the discovered migratable targets
        """
        _method_name = 'get_migratable_targets'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        model_top_folder_name = model_constants.MIGRATABLE_TARGET
        result = OrderedDict()
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        targets = self._find_names_in_folder(location)
        if targets is not None:
            _logger.info('WLSDPLY-06607',
                         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-06608',
                             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)
        return model_top_folder_name, result
    def _create_placeholder_coherence_cluster(self, cluster_name):
        """
        Create a placeholder Coherence cluster system resource to be referenced from a topology element.
        The new cluster will be created at the root domain level.
        :param cluster_name: the name of the Coherence cluster system resource to be added
        """
        _method_name = '_create_placeholder_coherence_cluster'
        original_location = self.wlst_helper.get_pwd()
        cluster_location = LocationContext().append_location(
            COHERENCE_CLUSTER_SYSTEM_RESOURCE)
        existing_names = deployer_utils.get_existing_object_list(
            cluster_location, self.alias_helper)

        if cluster_name not in existing_names:
            self.logger.info('WLSDPLY-12230',
                             cluster_name,
                             class_name=self.__class_name,
                             method_name=_method_name)

            cluster_token = self.alias_helper.get_name_token(cluster_location)
            cluster_location.add_name_token(cluster_token, cluster_name)
            deployer_utils.create_and_cd(cluster_location, existing_names,
                                         self.alias_helper)

        self.wlst_helper.cd(original_location)
Beispiel #24
0
    def get_unix_machines(self):
        """
        Discover the Machines in the domains that represent unix machines.
        :return: dictionary with the unix machine and node manager information
        """
        _method_name = 'get_unix_machines'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.UNIX_MACHINE
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        machines = self._find_names_in_folder(location)
        if machines is not None:
            _logger.info('WLSDPLY-06609',
                         len(machines),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for machine in machines:
                _logger.info('WLSDPLY-06610',
                             machine,
                             class_name=_class_name,
                             method_name=_method_name)
                location.add_name_token(name_token, machine)
                result[machine] = OrderedDict()
                self._populate_model_parameters(result[machine], location)
                self._discover_subfolders(result[machine], 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
Beispiel #25
0
    def _is_alias_folder(self, path):
        """
        Check if the delimited path is a folder or attribute
        :param path: '|' delimited path
        :return: true if it is a folder otherwise false
        """
        debug("DEBUG: Entering is_alias_folder %s", path)
        path_tokens = path.split(PATH_TOKEN)
        model_context = ModelContext("test", {})
        location = LocationContext()
        last_token = path_tokens[-1]
        aliases = Aliases(model_context,
                          wlst_mode=WlstModes.OFFLINE,
                          exception_type=ExceptionType.COMPARE)

        found = True
        name_token_next = False
        for path_token in path_tokens[1:]:
            if name_token_next:
                token_name = aliases.get_name_token(location)
                location.add_name_token(token_name, path_token)
                name_token_next = False
            else:
                location.append_location(path_token)
                if last_token == path_token:
                    break
                name_token_next = aliases.supports_multiple_mbean_instances(
                    location)
            attrib_names = aliases.get_model_attribute_names(location)
            if last_token in attrib_names:
                found = False

        debug("DEBUG: is_alias_folder %s %s", path, found)

        return found
Beispiel #26
0
 def discover_security_configuration(self):
     """
     Discover the security configuration for the domain.
     :return: name for the model:dictionary containing the discovered security configuration
     """
     _method_name = 'discover_security_configuration'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.SECURITY_CONFIGURATION
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     security_configuration = self._find_singleton_name_in_folder(location)
     if security_configuration is not None:
         _logger.info('WLSDPLY-06622',
                      class_name=_class_name,
                      method_name=_method_name)
         location.add_name_token(
             self._alias_helper.get_name_token(location),
             security_configuration)
         self._populate_model_parameters(result, location)
         try:
             self._discover_subfolders(result, location)
         except DiscoverException, de:
             _logger.warning('WLSDPLY-06200',
                             self._wls_version,
                             de.getLocalizedMessage(),
                             class_name=_class_name,
                             method_name=_method_name)
             result = OrderedDict()
    def get_mail_sessions(self):
        """
        Discover the mail sessions from the domain.
        :return: model name for the dictionary and the dictionary containing the mail session information
        """
        _method_name = 'get_mail_sessions'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.MAIL_SESSION
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        mail_sessions = self._find_names_in_folder(location)
        if mail_sessions is not None:
            _logger.info('WLSDPLY-06344',
                         len(mail_sessions),
                         class_name=_class_name,
                         method_name=_method_name)
            name_token = self._alias_helper.get_name_token(location)
            for mail_session in mail_sessions:
                _logger.info('WLSDPLY-06345',
                             mail_session,
                             class_name=_class_name,
                             method_name=_method_name)
                result[mail_session] = OrderedDict()
                mail_session_result = result[mail_session]
                location.add_name_token(name_token, mail_session)
                self._populate_model_parameters(mail_session_result, location)
                _fix_passwords_in_mail_session_properties(mail_session_result)
                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
Beispiel #28
0
    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
 def get_path_services(self):
     """
     Discover the path services for weblogic message grouping.
     :return: model file name: dictionary containing discovered path services
     """
     _method_name = 'get_path_services'
     _logger.entering(class_name=_class_name, method_name=_method_name)
     result = OrderedDict()
     model_top_folder_name = model_constants.PATH_SERVICE
     location = LocationContext(self._base_location)
     location.append_location(model_top_folder_name)
     path_services = self._find_names_in_folder(location)
     if path_services is not None:
         _logger.info('WLSDPLY-06355',
                      len(path_services),
                      class_name=_class_name,
                      method_name=_method_name)
         name_token = self._alias_helper.get_name_token(location)
         for path_service in path_services:
             _logger.info('WLSDPLY-06356',
                          path_service,
                          class_name=_class_name,
                          method_name=_method_name)
             result[path_service] = OrderedDict()
             location.add_name_token(name_token, path_service)
             self._populate_model_parameters(result[path_service], 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
Beispiel #30
0
    def get_jms_servers(self):
        """
        Discover the JMS servers from the domain.
        :return: model folder name: dictionary containing the discovered JMS servers
        """
        _method_name = 'get_jms_servers'
        _logger.entering(class_name=_class_name, method_name=_method_name)
        result = OrderedDict()
        model_top_folder_name = model_constants.JMS_SERVER
        location = LocationContext(self._base_location)
        location.append_location(model_top_folder_name)
        jms_servers = self._find_names_in_folder(location)
        if jms_servers is not None:
            _logger.info('WLSDPLY-06470', len(jms_servers), class_name=_class_name, method_name=_method_name)
            typedef = self._model_context.get_domain_typedef()
            name_token = self._alias_helper.get_name_token(location)
            for jms_server in jms_servers:
                if typedef.is_system_jms_server(jms_server):
                    _logger.info('WLSDPLY-06490', typedef.get_domain_type(), jms_server, class_name=_class_name,
                                 method_name=_method_name)
                else:
                    _logger.info('WLSDPLY-06471', jms_server, class_name=_class_name, method_name=_method_name)
                    location.add_name_token(name_token, jms_server)
                    result[jms_server] = OrderedDict()
                    self._populate_model_parameters(result[jms_server], location)
                    self._discover_subfolders(result[jms_server], 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