Package org.apache.axis2.description

Examples of org.apache.axis2.description.AxisModule


        assertTrue(s1.equals("testParam"));
        assertTrue(s2.equals("5"));
    }

    public void testNewModuleAddition() throws Exception {
        AxisModule am = new AxisModule();
        am.setName("newModule");
        am.setVersion(new Version("1.0"));
        pf.getModulePM().handleNewModuleAddition(am, "newModule", "1.0");
        Resource re = pf.getModulePM().getModule("newModule", "1.0");
        assertNotNull(re);

        String modulePath = RegistryResources.MODULES + "newModule" + File.separator
View Full Code Here


        assertTrue(str1.equals("newModule"));
        assertTrue(str2.equals("1.0"));
    }

    public void testModuleParameterUpdate() throws Exception {
        AxisModule am = new AxisModule();
        am.setName("Module1");
        Version v = new Version("1.0");
        am.setVersion(v);
        pf.getModulePM().handleNewModuleAddition(am, "Module1", "1.0");

        Parameter parm = new Parameter();
        parm.setName("TestParam");
        parm.setValue("TestValue");
View Full Code Here

        String sgResourcePath = RegistryResources.SERVICE_GROUPS + sgName;
        assertFalse(configRegistry.resourceExists(sgResourcePath));
    }

    public void testRemoveModule() throws Exception {
        AxisModule am = new AxisModule();
        am.setName("DModule");
        am.setVersion(new Version("1.0"));
        pf.getModulePM().handleNewModuleAddition(am, "DModule", "1.0");

        pf.getModulePM().removeModule(am);
        String modulePath = RegistryResources.MODULES + "DModule" + File.separator + "1.0";
        assertFalse(configRegistry.resourceExists(modulePath));
View Full Code Here

    public void testengageModuleForService() throws Exception {
        AxisServiceGroup asvGroup = new AxisServiceGroup(ac);
        asvGroup.setServiceGroupName("testAsvG");
        AxisService asv = new AxisService("testAsv");
        asvGroup.addService(asv);
        AxisModule am = new AxisModule();
        am.setName("Module2");
        Version v = new Version("1.0");
        am.setVersion(v);
        pf.getServiceGroupPM().handleNewServiceGroupAddition(asvGroup);
        pf.getServicePM().handleNewServiceAddition(asv);
        pf.getModulePM().handleNewModuleAddition(am, "Module2", "1.0");
        asv.engageModule(am);
        pf.getServicePM().engageModuleForService(am, asv);
View Full Code Here

                    }
                }

                // Add the Modules Engaged to this service
                for (Object module : axisService.getEngagedModules()) {
                    AxisModule axisModule = (AxisModule) module;
                    String moduleResourcePath = PersistenceUtils.getResourcePath(axisModule);
                    if (!isGloballyEngaged(moduleResourcePath)
                            && !axisService.getParent().isEngaged(axisModule.getName())) {
                        configRegistry.addAssociation(serviceResourcePath, moduleResourcePath,
                                RegistryResources.Associations.ENGAGED_MODULES);
                    }
                }

                // Save the operation-module engagements
                for (Iterator iter = axisService.getOperations(); iter.hasNext();) {
                    AxisOperation axisOperation = (AxisOperation) iter.next();
                    for (Object o : axisOperation.getEngagedModules()) {
                        AxisModule axisModule = (AxisModule) o;
                        String moduleResourcePath = PersistenceUtils.getResourcePath(axisModule);
                        if (!isGloballyEngaged(moduleResourcePath)
                                && !axisService.getParent().isEngaged(axisModule.getName())
                                && !axisService.isEngaged(axisModule.getName())) {
                            configRegistry.addAssociation(PersistenceUtils
                                    .getResourcePath(axisOperation), moduleResourcePath,
                                    RegistryResources.Associations.ENGAGED_MODULES);
                        }
                    }
View Full Code Here

                        axisOperation.getEngagedModules().clear();

                        Association[] associations = configRegistry.getAssociations(operationPath,
                                RegistryResources.Associations.ENGAGED_MODULES);
                        for (Association association : associations) {
                            AxisModule axisModule = getExistingAxisModule(association.getDestinationPath());
                            if (!isGloballyEngaged(association.getDestinationPath())) {
                                if (!axisService.isEngaged(axisModule)) {
                                    axisOperation.engageModule(axisModule);
                                }
                            }
                        }
                        // Handle operation parameters
                        loadParameters(axisOperation, operationPath);

                        // Handle operation documentation
                        loadDocumentation(axisOperation, operationPath);
                    }
                } else {
                    wsdlChangeDetected = true;
                    writeAxisDescription(axisOperation, axisOperation.getName().getLocalPart(),
                            PersistenceUtils.getResourcePath(axisOperation));
                    writeParameters(axisOperation.getParameters(),
                            PersistenceUtils.getResourcePath(axisOperation));

                    for (Object o : axisOperation.getEngagedModules()) {
                        AxisModule axisModule = (AxisModule) o;
                        String moduleResourcePath = PersistenceUtils.getResourcePath(axisModule);
                        if (!isGloballyEngaged(moduleResourcePath)
                                && !axisService.getParent().isEngaged(axisModule.getName())
                                && !axisService.isEngaged(axisModule.getName())) {
                            configRegistry.addAssociation(PersistenceUtils
                                    .getResourcePath(axisOperation), moduleResourcePath,
                                    RegistryResources.Associations.ENGAGED_MODULES);
                        }
                    }
                }
            }

            // sync up the operations, required by the proxy services : Ruwan
            String operationsPath = service.getPath() + RegistryResources.OPERATIONS;
            if(configRegistry.resourceExists(operationsPath)){
                Collection operationsCollection = (Collection) configRegistry.get(operationsPath);
                for (String opPath : operationsCollection.getChildren()) {
                    String opName = opPath.substring(operationsPath.length()).replace("/", "");
                    if (axisService.getOperation(new QName(opName)) == null) {
                        wsdlChangeDetected = true;
                        // new service do not have the operation
                        configRegistry.delete(opPath);
                    }
                }             
            }

            // Fetch and attach Binding, Binding operation and their Message policies
            Map endPointMap = axisService.getEndpoints();
            for (Object o : endPointMap.entrySet()) {
                Map.Entry entry = (Map.Entry) o;
                AxisEndpoint point = (AxisEndpoint) entry.getValue();
                AxisBinding currentAxisBinding = point.getBinding();

                // Fetch binding policies
                String bindingPath = serviceResourcePath + RegistryResources.ServiceProperties
                        .BINDINGS + currentAxisBinding.getName().getLocalPart();
                if (configRegistry.resourceExists(bindingPath)) {
                    if (isProxyService) {
                        // This is to ensure that binding level policies applied from the UI
                        // get precedence over service level policies for proxy services
                        java.util.Collection<PolicyComponent> attachedPolicies = axisService.getPolicySubject().
                                getAttachedPolicyComponents();
                        if (attachedPolicies != null && !attachedPolicies.isEmpty()) {
                            List properties = getPropertyValues(bindingPath,
                                    RegistryResources.ServiceProperties.POLICY_UUID);
                            if (properties != null && properties.size() > 0) {
                                List<String> removablePolicies = new ArrayList<String>();
                                for (PolicyComponent pc : attachedPolicies) {
                                    if (pc instanceof Policy) {
                                        String id = ((Policy) pc).getId();
                                        if (properties.contains(id)) {
                                            removablePolicies.add(id);
                                        }
                                    }
                                }

                                for (String id : removablePolicies) {
                                    axisService.getPolicySubject().detachPolicyComponent(id);
                                }
                            }
                        }
                    }
                    loadPolicies(currentAxisBinding, getPropertyValues(bindingPath,
                            RegistryResources.ServiceProperties.POLICY_UUID),
                            serviceResourcePath);
                    Iterator operationsItr = currentAxisBinding.getChildren();
                    while (operationsItr.hasNext()) {
                        AxisBindingOperation bindingOp = (AxisBindingOperation) operationsItr.next();

                        // Fetch and attach binding operation policies
                        String bindingOpPath = PersistenceUtils
                                .getBindingOperationPath(serviceResourcePath, bindingOp);
                        if (configRegistry.resourceExists(bindingOpPath)) {
                            loadPolicies(bindingOp, getPropertyValues(bindingOpPath,
                                    RegistryResources.ServiceProperties.POLICY_UUID),
                                    serviceResourcePath);
                            // Fetch and attach MessageIn policies for this operation
                            loadPolicies(bindingOp.getChild(
                                    WSDLConstants.MESSAGE_LABEL_IN_VALUE), getPropertyValues(
                                    bindingOpPath, RegistryResources.ServiceProperties
                                            .MESSAGE_IN_POLICY_UUID), serviceResourcePath);
                            // Fetch and attach MessageOut policies for this operation
                            loadPolicies(bindingOp.getChild(
                                    WSDLConstants.MESSAGE_LABEL_OUT_VALUE), getPropertyValues(
                                    bindingOpPath, RegistryResources.ServiceProperties
                                            .MESSAGE_OUT_POLICY_UUID), serviceResourcePath);
                        } else {
                            writeAxisDescription(bindingOp, bindingOp.getName().getLocalPart(),
                                    PersistenceUtils.getBindingOperationPath(
                                            serviceResourcePath, bindingOp));
                        }
                    }
                } else {
                    handleNewBindingAddition(serviceResourcePath, currentAxisBinding);
                }

            }
            // Disengage all the statically engaged modules (i.e. those module
            // engaged from the services.xml file)
            axisService.getEngagedModules().clear();

            // Engage modules to service
            Association[] engModules = configRegistry.getAssociations(serviceResourcePath,
                    RegistryResources.Associations.ENGAGED_MODULES);
            for (Association association : engModules) {
                AxisModule axisModule = getExistingAxisModule(association.getDestinationPath());
                if (!isGloballyEngaged(association.getDestinationPath())) {
                    axisService.disengageModule(axisModule);
                    axisService.engageModule(axisModule);
                }
            }
View Full Code Here

            globallyEngagedModules = axisConfig.getEngagedModules();
            loadRepository(repoLocation);

            for (Object globallyEngagedModule : globallyEngagedModules) {
                AxisModule module = (AxisModule) globallyEngagedModule;
                if (log.isDebugEnabled()) {
                    log.debug("Globally engaging module: " + module.getName());
                }
            }

            // Remove all the transports made available in the tenant's axis2.xml
            axisConfig.getTransportsOut().clear();
View Full Code Here

    }

    public boolean isGlobalyEngaged(AxisModule axisModule) {
        String modName = axisModule.getName();
        for (Object globallyEngagedModule : globallyEngagedModules) {
            AxisModule module = (AxisModule) globallyEngagedModule;
            if (modName.startsWith(module.getName())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

            // Engage modules to service group
            Association[] associations = configRegistry.getAssociations(sgResource.getPath(),
                    RegistryResources.Associations.ENGAGED_MODULES);
            for (Association association : associations) {
                AxisModule axisModule = getExistingAxisModule(association.getDestinationPath());
                if (!isGloballyEngaged(association.getDestinationPath())) {
                    serviceGroup.disengageModule(axisModule);
                    serviceGroup.engageModule(axisModule);
                }
            }
View Full Code Here

                String sgResourcePath = RegistryResources.SERVICE_GROUPS + sgName;
                configRegistry.put(sgResourcePath, serviceGroupResource);

                // Handle ServiceGroup-Module engagement
                for (Object o : serviceGroup.getEngagedModules()) {
                    AxisModule axisModule = (AxisModule) o;
                    if (!axisConfig.isEngaged(axisModule.getName())) {
                        String moduleResourcePath = PersistenceUtils.getResourcePath(axisModule);
                        configRegistry.addAssociation(sgResourcePath, moduleResourcePath,
                                RegistryResources.Associations.ENGAGED_MODULES);
                    }
                }
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.