Package org.apache.axis2.description

Examples of org.apache.axis2.description.AxisModule


        return module;
    }

    private AxisModule getAxisModule(String moduleId) throws ModuleMgtException {
        AxisModule module = this.axisConfig.getModule(moduleId);
        if (module == null) {
            log.error("Module  " + moduleId + "cannnot be found!");
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.MODULE_NOT_FOUND);
        }
        return module;
View Full Code Here


     * @return params module parameter array
     * @throws ModuleMgtException is thrown in case of error
     */
    public String[] getModuleParameters(String moduleName, String moduleVersion) throws ModuleMgtException {

        AxisModule module = getAxisModule(moduleName, moduleVersion);
        if (module == null) {
            log.error("Module  " + module + "cannnot be found!");
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.MODULE_NOT_FOUND);
        }

        ArrayList<String> parameters = new ArrayList<String>();

        ArrayList moduleParams = module.getParameters();

        for (Object serviceParam : moduleParams) {
            Parameter parameter = (Parameter) serviceParam;
            if (parameter.getParameterElement() != null) {
                parameters.add(parameter.getParameterElement().toString());
View Full Code Here

        }
    }

    private String setModuleParameter(String moduleName, String moduleVersion, String parameterStr) throws ModuleMgtException {

        AxisModule module = getAxisModule(moduleName, moduleVersion);
        if (module == null) {
            log.error("Module  " + module + "cannnot be found!");
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.MODULE_NOT_FOUND);
        }

        OMElement paramEle;
        try {
            XMLStreamReader xmlSR = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(
                    parameterStr.getBytes()));
            paramEle = new StAXOMBuilder(xmlSR).getDocumentElement();
        } catch (XMLStreamException e) {
            String msg = "Cannot create OMElement from parameter: " + parameterStr;
            log.error(msg, e);
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.ERROR_PARAM_REMOVE);
        }

        try {
            Parameter parameter = ParameterUtil.createParameter(paramEle);
            if (module.getParameter(parameter.getName()) == null || !module.getParameter(parameter.getName()).isLocked()) {
                module.addParameter(parameter);
                pf.getModulePM().updateModuleParameter(module, parameter);
            }
        } catch (Exception e) {
            String msg = "Cannot persist module parameter for operation " + module.getName();
            log.error(msg, e);
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.ERROR_PARAM_REMOVE);
        }

        return "Succesfully updated service parameters";
View Full Code Here

        return "Succesfully updated service parameters";
    }

    public String removeModuleParameter(String moduleName, String moduleVersion, String parameterName) throws ModuleMgtException {

        AxisModule module = getAxisModule(moduleName, moduleVersion);
        if (module == null) {
            log.error("Module  " + module + "cannnot be found!");
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.MODULE_NOT_FOUND);
        }

       try {
            Parameter parameter = ParameterUtil.createParameter(parameterName, null);
            module.removeParameter(parameter);
            pf.getModulePM().removeModuleParameter(module, parameter);
        } catch (Exception e) {
            String msg = "Cannot persist parameter removal from module  " + module.getName();
            log.error(msg, e);
            throw new ModuleMgtException(ModuleMgtException.ERROR, ModuleMgtMessageKeys.ERROR_PARAM_REMOVE);
        }

        return "Successfully removed parameter " + parameterName + " from " + moduleName + ":" + moduleVersion + " module";
View Full Code Here

                                         ModuleMgtMessageKeys.DISENGAGE_ADDRESSING_GLOBALLY);
        }

        // Check whether this file can be deleted.
        // We should proceed only if this file can be deleted.
        AxisModule module = axisConfig.getModule(moduleId);
        if (module == null) {
            log.error("Module  " + moduleId + "cannnot be found!");
            throw new ModuleMgtException(ModuleMgtException.ERROR,
                                         ModuleMgtMessageKeys.MODULE_NOT_FOUND);
        }

        if (module.getFileName() != null) {
            String fileName = module.getFileName().getPath();
            File file = new File(fileName);
            if (!file.canWrite()) {
                throw new ModuleMgtException(ModuleMgtException.WARNING,
                                             ModuleMgtMessageKeys.MODULE_DELETE_ERROR);
            }

            if (isEngaged(module)) {
                throw new ModuleMgtException(ModuleMgtException.WARNING,
                                             ModuleMgtMessageKeys.ENGAGED_MODULE_REMOVE);
            }
           
            disengageModuleFromSystem(moduleId);

            // Delete the MAR file
            if (file.exists()) {
                if (!(file.isDirectory() && FileManipulator.deleteDir(file))) {
                    if (!file.delete()) {
                        throw new ModuleMgtException(ModuleMgtException.WARNING,
                                                     ModuleMgtMessageKeys.MODULE_DELETE_ERROR);
                    }
                }
            } else {
                throw new ModuleMgtException(ModuleMgtException.WARNING,
                                             ModuleMgtMessageKeys.MODULE_FILE_NOT_FOUND);
            }
        } else {
            throw new ModuleMgtException(ModuleMgtException.WARNING,
                                         ModuleMgtMessageKeys.SYSTEM_MODULE_DELETE);
        }

        try {
            pf.getModulePM().removeModule(module);
            axisConfig.removeModule(module.getName(), module.getVersion());
        } catch (Exception e) {
            log.error("Error while removing module : " + moduleId, e);
            throw new ModuleMgtException(ModuleMgtException.WARNING, ModuleMgtMessageKeys.ERROR_MODULE_REMOVE);
        }
View Full Code Here

            throws ModuleMgtException {
        if (moduleId.startsWith("addressing")) {
            throw new ModuleMgtException(ModuleMgtException.WARNING,
                                         ModuleMgtMessageKeys.DISENGAGE_ADDRESSING_GLOBALLY);
        }
        AxisModule module = getAxisModule(moduleId);
        try {
            if (axisConfig.isEngaged(module)) {
                if (RAHAS_MODULE_NAME.equalsIgnoreCase(module.getName()) || RAMPART_MODULE_NAME.equalsIgnoreCase(module.getName())) {
                    Map services = axisConfig.getServices();
                    for (Iterator iter = services.values().iterator(); iter.hasNext();) {
                        AxisService service = (AxisService) iter.next();

                        if (isRequiredForSecurityScenario(service.getName(), moduleId)) {
                            throw new ModuleMgtException(ModuleMgtException.WARNING,
                                    ModuleMgtMessageKeys.SERVICES_WITH_SECURITY_SCENARIOS);
                        }
                    }
                }

                if (RAMPART_MODULE_NAME.equalsIgnoreCase(module.getName())) {
                    // Check whether it is possible to disengage Rampart
                    AxisModule rahasModule = axisConfig.getModule(RAHAS_MODULE_NAME);
                    if (axisConfig.isEngaged(rahasModule)) {
                        throw new ModuleMgtException(ModuleMgtException.WARNING,
                                                     ModuleMgtMessageKeys.RAHAS_RAMPART_DISENGAGE);
                    }
                }
View Full Code Here

    public void setParameters(RMParameterBean parameters) throws AxisFault {


        ConfigurationContext configurationContext = getConfigContext();
        AxisConfiguration axisConfiguration = configurationContext.getAxisConfiguration();
        AxisModule sandeshaModule = axisConfiguration.getModule("sandesha2");

        // saving the parameters to registry
        String moduleVersion = sandeshaModule.getVersion().toString();
        if (moduleVersion == null) {
            moduleVersion = RegistryResources.ModuleProperties.UNDEFINED;
        }
        String moduleResourcePath = RegistryResources.MODULES + "sandesha2/" + moduleVersion;
View Full Code Here

    }

    public RMParameterBean getParameters() throws AxisFault  {

        AxisConfiguration axisConfiguration = getAxisConfig();
        AxisModule sandeshaModule = axisConfiguration.getModule("sandesha2");
        RMParameterBean rmParameterBean = new RMParameterBean();

        rmParameterBean.setConnectionString(getParameterValue("db.connectionstring", sandeshaModule));
        rmParameterBean.setDriverName(getParameterValue("db.driver", sandeshaModule));
        rmParameterBean.setPassword(getParameterValue("db.password", sandeshaModule));
View Full Code Here

     * @return InvocationResponse.CONTINUE in order to continue after the handling
     * @throws AxisFault if any errors occured during the processing
     */
    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {

        AxisModule cachingModule =
                msgContext.getConfigurationContext().getAxisConfiguration().getModule("wso2caching");
        if(cachingModule == null) {
            return InvocationResponse.CONTINUE;
        }
        if (!msgContext.getAxisOperation().isEngaged(cachingModule) &&
View Full Code Here

        if (engagedModules != null && engagedModules.size() > 0) {
            int i = 0;
            engagedModuleNames = new String[engagedModules.size()];
            for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
                AxisModule module = (AxisModule) iterator.next();
                engagedModuleNames[i++] = module.getName();
            }
        }
        sgmd.setEngagedModules(engagedModuleNames);

        List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
View Full Code Here

TOP

Related Classes of org.apache.axis2.description.AxisModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.