Package org.apache.synapse.config

Examples of org.apache.synapse.config.SynapseConfiguration


     */
    public void init(AxisConfiguration axisCfg) {

        log.info("Initializing Synapse...");

        SynapseConfiguration synCfg = null;

        // if the system property synapse.xml is specified, use it.. else default config
        String config = System.getProperty(Constants.SYNAPSE_XML);
        if (config != null) {
            log.info("System property '" + Constants.SYNAPSE_XML +
View Full Code Here


    public static MessageContext getSynapseMessageContext(org.apache.axis2.context.MessageContext axisMsgCtx) {

        // we get the configuration on each message from the Axis2 configuration since the Synapse configuration
        // may be updated externally and thus should not be cached.

        SynapseConfiguration synCfg = getSynapseConfig(axisMsgCtx);
        SynapseEnvironment   synEnv = getSynapseEnvironment(axisMsgCtx);

        if (synCfg == null || synEnv == null) {
            initializeSynapse(axisMsgCtx);
            synCfg = getSynapseConfig(axisMsgCtx);
View Full Code Here

            // is this a second thread which came in just after initialization?
            return;
        }

        log.info("Initializing Synapse...");
        SynapseConfiguration synCfg = null;
        AxisConfiguration axisCfg = mc.getConfigurationContext().getAxisConfiguration();

        // if the system property synapse.xml is specified, use it.. else default config
        String config = System.getProperty(Constants.SYNAPSE_XML);
        if (config != null) {
View Full Code Here

    ExtensionFactoryFinder extensionFacFinder = ExtensionFactoryFinder.getInstance();

    public SynapseConfiguration getConfiguration(InputStream is) {

        log.info("Generating the Synapse configuration model by parsing the XML configuration");
        SynapseConfiguration config = new SynapseConfiguration();

        OMElement root = null;
        try {
            root = new StAXOMBuilder(is).getDocumentElement();
        } catch (XMLStreamException e) {
            handleException("Error parsing Synapse configuration : " + e.getMessage(), e);
        }
        root.build();

        OMContainer definitions = root.getFirstChildWithName(Constants.DEFINITIONS_ELT);
        if (definitions != null) {

            Iterator iter = definitions.getChildren();
            while (iter.hasNext()) {
                Object o = iter.next();
                if (o instanceof OMElement) {
                    OMElement elt = (OMElement) o;
                    if (Constants.SEQUENCE_ELT.equals(elt.getQName())) {
                        defineSequence(config, elt);
                    } else if (Constants.ENDPOINT_ELT.equals(elt.getQName())) {
                        defineEndpoint(config, elt);
                    } else if (Constants.PROPERTY_ELT.equals(elt.getQName())) {
                        defineProperty(config, elt);
                    } else {
                        defineExtension(config, elt);
                    }
                }
            }
        }

        OMElement elem = root.getFirstChildWithName(Constants.RULES_ELT);
        if (elem == null) {
            handleException("A valid Synapse configuration MUST specify the main mediator using the <rules> element");
        } else {
            SynapseMediator sm = (SynapseMediator) MediatorFactoryFinder.getInstance().getMediator(elem);
            if (sm.getList().isEmpty()) {
                handleException("Invalid configuration, the main mediator specified by the <rules> element is empty");
            } else {
                config.setMainMediator(sm);
            }
        }

        if (is != null) {
            try {
View Full Code Here

     * When an Axis2 Service parameter update happens this method will get notified
     * @param name parameter name
     * @param value parameter value
     */
    public void parameterChanged(String name, Object value) {
        SynapseConfiguration config = ConfigHolder.getInstance().
                getSynapseEnvironmentService(tanentId).getSynapseEnvironment().
                getSynapseConfiguration();

        ProxyService proxy = config.getProxyService(service.getName());

        if(proxy != null) {

            if(service.getParameter(name) != null) {
                //if this is a parameter set
View Full Code Here

     * @param axisConfig AxisConfiguration to which this deployer belongs
     * @param synapseEnvironment SynapseEnvironment to which this deployer belongs
     */
    private void registerDeployer(AxisConfiguration axisConfig, SynapseEnvironment synapseEnvironment) {

        SynapseConfiguration synCfg = synapseEnvironment.getSynapseConfiguration();
        DeploymentEngine deploymentEngine = (DeploymentEngine) axisConfig.getConfigurator();
        SynapseArtifactDeploymentStore deploymentStore = synCfg.getArtifactDeploymentStore();

        String synapseConfigPath = ServiceBusUtils.getSynapseConfigAbsPath(
                synapseEnvironment.getServerContextInformation());
        String messageProcessorDirPath = synapseConfigPath
                + File.separator + MultiXMLConfigurationBuilder.MESSAGE_PROCESSOR_DIR;

        for (MessageProcessor processor : synCfg.getMessageProcessors().values()) {
            if (processor.getFileName() != null) {
                deploymentStore.addRestoredArtifact(
                        messageProcessorDirPath + File.separator + processor.getFileName());
            }
        }
View Full Code Here

     */
    public EndpointMetaData[] endpointData(int pageNumber, int endpointsPerPage) throws EndpointAdminException {
        final Lock lock = getLock();
        try {
            lock.lock();
            SynapseConfiguration synapseConfiguration = getSynapseConfiguration();
            Map<String, Endpoint> namedEndpointMap = synapseConfiguration.getDefinedEndpoints();
            Collection<Endpoint> namedEndpointCollection = namedEndpointMap.values();

            List<Endpoint> epList = new ArrayList<Endpoint>();
            for (Endpoint ep : namedEndpointCollection) {
                epList.add(ep);
View Full Code Here

    public String[] getEndPointsNames() throws EndpointAdminException {
        final Lock lock = getLock();
        try {
            lock.lock();
            SynapseConfiguration synapseConfiguration = getSynapseConfiguration();
            Map<String, Endpoint> namedEndpointMap = synapseConfiguration.getDefinedEndpoints();
            Collection<Endpoint> namedEndpointCollection = namedEndpointMap.values();
            return listToNames(namedEndpointCollection.toArray(
                    new Endpoint[namedEndpointCollection.size()]));
        } finally {
            lock.unlock();
View Full Code Here

                if (getSynapseConfiguration().getLocalRegistry()
                        .get(endpointName) != null) {
                    handleFault("The name " + endpointName +
                            " is already used within the configuration", null);
                } else {
                    SynapseConfiguration config = getSynapseConfiguration();
                    if (config.getEndpoint(endpointName) != null) {
                        handleFault("A endpoint with name "
                                + endpointName + " is already there.", null);
                    }
                    SynapseXMLConfigurationFactory.defineEndpoint(
                            config, endpointElement, config.getProperties());
                    Endpoint endpoint = config.getEndpoint(endpointName);
                    if (endpoint != null) {
                        if (endpoint instanceof AbstractEndpoint) {
                            endpoint.setFileName(
                                    ServiceBusUtils.generateFileName(endpoint.getName()));
                        }
View Full Code Here

     */
    public String getEndpoint(String endpointName) throws EndpointAdminException {
        final Lock lock = getLock();
        try {
            lock.lock();
            SynapseConfiguration synapseConfiguration = getSynapseConfiguration();
            assertNameNotEmpty(endpointName);
            endpointName = endpointName.trim();
            if (synapseConfiguration.getEndpoint(endpointName) != null) {
                OMElement ele = EndpointSerializer.getElementFromEndpoint(
                        synapseConfiguration.getEndpoint(endpointName));
                return ele.toString();
            } else {
                handleFault("The endpoint named " + endpointName + " does not exist", null);
            }
        } finally {
View Full Code Here

TOP

Related Classes of org.apache.synapse.config.SynapseConfiguration

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.