Package org.apache.synapse.core.axis2

Examples of org.apache.synapse.core.axis2.ProxyService


            log.debug("ProxyService Undeployment of the proxy named : "
                    + artifactName + " : Started");
        }
       
        try {
            ProxyService proxy = getSynapseConfiguration().getProxyService(artifactName);
            if (proxy != null) {
                if (log.isDebugEnabled()) {
                    log.debug("Stopping the ProxyService named : " + artifactName);
                }
                proxy.stop(getSynapseConfiguration());
                getSynapseConfiguration().removeProxyService(artifactName);
                if (log.isDebugEnabled()) {
                    log.debug("ProxyService Undeployment of the proxy named : "
                            + artifactName + " : Completed");
                }
                log.info("ProxyService named '" + proxy.getName() + "' has been undeployed");
            } else if (log.isDebugEnabled()) {
                log.debug("Proxy service " + artifactName + " has already been undeployed");
            }
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError(
View Full Code Here


        if (log.isDebugEnabled()) {
            log.debug("Restoring the ProxyService with name : " + artifactName + " : Started");
        }

        try {
            ProxyService proxy
                    = getSynapseConfiguration().getProxyService(artifactName);
            OMElement proxyElem = ProxyServiceSerializer.serializeProxy(null, proxy);
            if (proxy.getFileName() != null) {
                String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
                        + File.separator + MultiXMLConfigurationBuilder.PROXY_SERVICES_DIR
                        + File.separator + proxy.getFileName();
                writeToFile(proxyElem, fileName);
                if (log.isDebugEnabled()) {
                    log.debug("Restoring the ProxyService with name : "
                            + artifactName + " : Completed");
                }
View Full Code Here

        return startup;
    }

    public static ProxyService defineProxy(SynapseConfiguration config, OMElement elem,
                                           Properties properties) {
        ProxyService proxy = null;

        try {
            proxy = ProxyServiceFactory.createProxy(elem, properties);
            if (proxy != null) {
                config.addProxyService(proxy.getName(), proxy);
            }
        } catch (Exception e) {
            String msg = "Proxy Service configuration: " + elem.getAttributeValue((
                    new QName(XMLConfigConstants.NULL_NAMESPACE, "name"))) + " cannot be built";
            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES, msg, e);
View Full Code Here

        }

        // add proxy services
        Iterator itr = synCfg.getProxyServices().iterator();
        while (itr.hasNext()) {
            ProxyService service = (ProxyService) itr.next();
            ProxyServiceSerializer.serializeProxy(definitions, service);
        }

        // Add Event sources
        for (SynapseEventSource eventSource : synCfg.getEventSources()) {
View Full Code Here

        synapseConfig.addEntry(entry.getKey(), entry);
        assertItemAdded(entry.getKey(), ENTRY);
        synapseConfig.removeEntry(entry.getKey());
        assertItemRemoved(entry.getKey(), ENTRY);

        ProxyService proxy = new ProxyService("proxy1");
        synapseConfig.addProxyService(proxy.getName(), proxy);
        assertItemAdded(proxy.getName(), PROXY);
        synapseConfig.removeProxyService(proxy.getName());
        assertItemRemoved(proxy.getName(), PROXY);

        Startup startup = new SimpleQuartz();
        startup.setName("startup1");
        synapseConfig.addStartup(startup);
        assertItemAdded(startup.getName(), STARTUP);
View Full Code Here

            Iterator proxyDefinitions = FileUtils.iterateFiles(proxyServicesDir, extensions, false);
            while (proxyDefinitions.hasNext()) {
                File file = (File) proxyDefinitions.next();
                OMElement document = getOMElement(file);
                ProxyService proxy = SynapseXMLConfigurationFactory.defineProxy(synapseConfig,
                        document, properties);
                if (proxy != null) {
                    proxy.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                            file.getAbsolutePath(), proxy.getName());
                 }
             }
        }
    }
View Full Code Here

        if (CarbonConstants.POLICY_ADDED == event.getEventType()) {
            updateProxyServicePolicies(axisService, synapseConfig);
        }

        if (CarbonConstants.AxisEvent.TRANSPORT_BINDING_ADDED == event.getEventType()) {
            ProxyService proxy = synapseConfig.getProxyService(axisService.getName());
            if (proxy != null) {
                proxy.getTransports().clear();
                List<String> transports = axisService.getExposedTransports();
                for (String trp : transports) {
                    proxy.getTransports().add(trp);
                }
            }
        }

        if (AxisEvent.SERVICE_DEPLOY == event.getEventType()) {
            ProxyService proxySvc = synapseConfig.getProxyService(axisService.getName());
            if (proxySvc != null) {
                try {
                    ServicePersistenceManager spm = new ServicePersistenceManager(
                            synapseConfig.getAxisConfiguration());
                    for (Parameter p : axisService.getParameters()) {
                        spm.updateServiceParameter(axisService, p);
                    }
                } catch (Exception e) {

                }
            }
        }

        if (AxisEvent.SERVICE_REMOVE == event.getEventType()) {

            Parameter keepServiceHistoryParam = axisService.getParameter(
                    CarbonConstants.KEEP_SERVICE_HISTORY_PARAM);
            boolean keepHistory = keepServiceHistoryParam != null
                    && JavaUtils.isTrue(keepServiceHistoryParam.getValue());

            if (!keepHistory) {
                ProxyService proxySvc = synapseConfig.getProxyService(axisService.getName());
                if (proxySvc != null) {
                    synapseConfig.removeProxyService(axisService.getName());
                    MediationPersistenceManager pm = getMediationPersistenceManager();
                    pm.deleteItem(proxySvc.getName(), proxySvc.getFileName(),
                            ServiceBusConstants.ITEM_TYPE_PROXY_SERVICE);
                    log.info("Deleted the proxy service : " + proxySvc.getName());

                } else if (log.isDebugEnabled()) {
                    log.debug("Proxy Service representing the service " + axisService.getName()
                            + " of type proxy is not found in the SynapseConfiguration");
                }
View Full Code Here

    public boolean isParameterLocked(String s) { return false; }

    private void onEngageModule(AxisService service, AxisModule module,
                                SynapseConfiguration config) {
        if (config.getProxyService(service.getName()) != null) {
            ProxyService proxy = config.getProxyService(service.getName());
            if (module.getModule() instanceof Rampart) {
                proxy.setWsSecEnabled(true);
            } else if (module.getModule() instanceof SandeshaModule) {
                proxy.setWsRMEnabled(true);
            }
        }
    }
View Full Code Here

    }

    private void onDisEngageModule(AxisService service, AxisModule module,
                                   SynapseConfiguration config) {
        if (config.getProxyService(service.getName()) != null) {
            ProxyService proxy = config.getProxyService(service.getName());
            if (module.getModule() instanceof Rampart) {
                proxy.setWsSecEnabled(false);
            } else if (module.getModule() instanceof SandeshaModule) {
                proxy.setWsRMEnabled(false);
            }
        }
    }
View Full Code Here

                        " to update policies");
            }
            return;
        }

        ProxyService proxyService = config.getProxyService(axisService.getName());
        try {
            Registry registry = this.configSystemRegistry;
            String servicePath = RegistryResources.ROOT + "axis2" +
                    RegistryConstants.PATH_SEPARATOR + "service-groups" +
                    RegistryConstants.PATH_SEPARATOR +
                    axisService.getAxisServiceGroup().getServiceGroupName() +
                    RegistryConstants.PATH_SEPARATOR + "services" +
                    RegistryConstants.PATH_SEPARATOR + axisService.getName();

            String servicePoliciesPath = servicePath
                    + RegistryConstants.PATH_SEPARATOR + "policies";

            List<PolicyInfo> remainingPolicies = new ArrayList<PolicyInfo>();
            for (PolicyInfo info : proxyService.getPolicies()) {
                if (!info.getPolicyKey().startsWith("conf:" + servicePoliciesPath)) {
                    remainingPolicies.add(info);
                }
            }
            proxyService.setPolicies(remainingPolicies);

            if (registry.resourceExists(servicePoliciesPath)) {
                // there are service level policies
                Resource servicePoliciesResource = registry.get(servicePoliciesPath);
                if (servicePoliciesResource instanceof Collection) {
                    Collection servicePoliciesCollection = (Collection) servicePoliciesResource;
                    for (String servicePolicyResourcePath :
                            servicePoliciesCollection.getChildren()) {
                        PolicyInfo pi = handlePolicy(config,
                                proxyService, servicePolicyResourcePath, (UserRegistry) registry);
                        if (pi != null) {
                            pi.setPolicyKey("conf:" + pi.getPolicyKey());
                            proxyService.addPolicyInfo(pi);
                        }
                    }
                }
            }

            // Update exposed transports
            if (axisService.getExposedTransports() != null &&
                    !axisService.getExposedTransports().isEmpty()) {
                proxyService.setTransports(
                        new ArrayList<String>(axisService.getExposedTransports()));
            } else {
                proxyService.setTransports(new ArrayList());
            }

            persistChanges(axisService.getName(), axisService.getAxisConfiguration());
        } catch (RegistryException e) {
            log.error("Error checking the policies from the registry", e);
View Full Code Here

TOP

Related Classes of org.apache.synapse.core.axis2.ProxyService

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.