예제 #1
0
    def create_and_cd(self,
                      alias_helper,
                      type_name,
                      name,
                      location,
                      create_path=None):
        """
        Create a new MBean instance and change directories to its attributes location.
        :param alias_helper: the alias helper object
        :param type_name: the WLST type
        :param name: the name for the new object
        :param location: the location
        :param create_path: the WLST path from which to create the new MBean
        :return: the result from cd()
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'create_and_cd'

        try:
            if create_path is not None:
                wlst_helper.cd(create_path)
            wlst_helper.create(name, type_name)
            result = wlst_helper.cd(
                alias_helper.get_wlst_attributes_path(location))
        except PyWLSTException, pwe:
            ex = exception_helper.create_exception(self.__exception_type,
                                                   'WLSDPLY-19104',
                                                   type_name,
                                                   name,
                                                   pwe.getLocalizedMessage(),
                                                   error=pwe)
            self.__logger.throwing(ex,
                                   class_name=self.__class_name,
                                   method_name=_method_name)
            raise ex
    def create(self, wlst_name, wlst_type, base_provider_type=None):
        """
        Create the mbean folder with the provided name at the current location.
        :param wlst_name: the MBean name
        :param wlst_type: the MBean type
        :param base_provider_type: the base security provider type, if required
        :return: the MBean object returned by the underlying WLST create() method
        :raises: BundleAwareException of the specified type: if an error occurs
        """
        _method_name = 'create'

        try:
            mbean = wlst_helper.create(wlst_name, wlst_type, base_provider_type)
        except PyWLSTException, pwe:
            if base_provider_type is None:
                ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19103', wlst_type, wlst_name,
                                                       pwe.getLocalizedMessage(), error=pwe)
                self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name)
            else:
                ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19134', base_provider_type,
                                                       wlst_type, wlst_name, pwe.getLocalizedMessage(), error=pwe)
            raise ex