Package org.apache.synapse.config

Examples of org.apache.synapse.config.Property


            String endpointName = (String) iter.next();
            Object endpt = synCfg.getNamedEndpoint(endpointName);

            if (endpt instanceof Property) {
                OMElement endpoint = fac.createOMElement("endpoint", synNS);
                Property dp = (Property) endpt;
                endpoint.addAttribute(fac.createOMAttribute(
                        "name", nullNS, endpointName));
                endpoint.addAttribute(fac.createOMAttribute(
                        "key", nullNS, dp.getKey()));
                definitions.addChild(endpoint);

            } else if (endpt instanceof Endpoint) {
                EndpointSerializer.serializeEndpoint((Endpoint) endpt, definitions);
            } else {
View Full Code Here


            }

        } else {
            OMAttribute key = rules.getAttribute(new QName(Constants.NULL_NAMESPACE, "key"));
            if (key != null) {
                Property dp = new Property();
                dp.setName("namespace");
                dp.setType(Property.DYNAMIC_TYPE);
                dp.setKey(key.getAttributeValue());
                dp.setMapper(MediatorFactoryFinder.getInstance());
                config.setMainMediator(dp);
            } else {
                SynapseMediator sm = (SynapseMediator)
                        MediatorFactoryFinder.getInstance().getMediator(rules);
                if (sm.getList().isEmpty()) {
View Full Code Here

     * </pre>
     *
     * @param elem
     */
    public static void defineProperty(SynapseConfiguration config, OMElement elem) {
        Property prop = PropertyFactory.createProperty(elem);
        if(prop.getType() == Property.SRC_TYPE) {
            try {
                prop.setValue(org.apache.synapse.config.Util.getObject(
                        new URL(prop.getSrc().toString())));
            } catch (MalformedURLException e) {
                handleException("Source URL is not valid");
            }
        }
        config.addProperty(prop.getName(), prop);
    }
View Full Code Here

     */
    public static void defineSequence(SynapseConfiguration config, OMElement ele) {
        OMAttribute name = ele.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
        OMAttribute key = ele.getAttribute(new QName(Constants.NULL_NAMESPACE, "key"));
        if (name != null && key != null) {
            Property dp = new Property();
            dp.setType(Property.DYNAMIC_TYPE);
            dp.setKey(key.getAttributeValue());
            dp.setMapper(MediatorFactoryFinder.getInstance());
            config.addNamedSequence(name.getAttributeValue(), dp);
        } else {
            SequenceMediator seq = (SequenceMediator)
                    MediatorFactoryFinder.getInstance().getMediator(ele);
            config.addNamedSequence(seq.getName(), seq);
View Full Code Here

    public static void defineEndpoint(SynapseConfiguration config, OMElement ele) {

        OMAttribute name = ele.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
        OMAttribute key = ele.getAttribute(new QName(Constants.NULL_NAMESPACE, "key"));
        if (name != null && key != null) {
            Property dp = new Property();
            dp.setType(Property.DYNAMIC_TYPE);
            dp.setKey(key.getAttributeValue());
            dp.setMapper(EndpointFactory.getInstance());
            config.addNamedEndpoint(name.getAttributeValue(), dp);
        } else {
            Endpoint endpoint = EndpointFactory.createEndpoint(ele, false);
            // add this endpoint to the configuration
            config.addNamedEndpoint(endpoint.getName(), endpoint);
View Full Code Here

     */
    private ApplicationContext appContext = null;

    public boolean mediate(MessageContext synCtx) {

        Property dp = synCtx.getConfiguration().getPropertyObject(configKey);

        // if the configKey refers to a dynamic property
        if (dp != null && dp.isDynamic()) {
            if (!dp.isCached() || dp.isExpired()) {
                buildAppContext(synCtx);
            }
        // if the property is not a DynamicProperty, we will create an ApplicationContext only once
        } else {
            if (appContext == null) {
View Full Code Here

        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

        Map props = new HashMap();
        Property prop = new Property();
        prop.setType(Property.DYNAMIC_TYPE);
        prop.setKey("file:./../../repository/conf/sample/resources/transform/transform_unittest.xslt");
        props.put("xslt-key", prop);

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
        transformMediator.mediate(synCtx);
View Full Code Here

        Mediator mediator = mf.createMediator(REG_PROP_MEDIATOR_CONFIG);
        assertTrue(mediator.mediate(mc));
    }

    public void testRegPropWithFunctionMediatorFactory() throws Exception {
        Property prop = new Property();
        prop.setValue(MY_MEDIATOR_FOO_FUNC);
        prop.setSrc(new URL("http://MyFooMediator.js"));
        Map props = new HashMap();
        props.put("MyFooMediator", prop);
        MessageContext mc = TestUtils.getTestContext("<foo/>", props);

        ScriptMediatorFactory mf = new ScriptMediatorFactory();
View Full Code Here

        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

        Map props = new HashMap();
        Property prop = new Property();
        prop.setType(Property.DYNAMIC_TYPE);
        prop.setKey("file:./../../repository/conf/sample/resources/transform/transform_unittest.xslt");
        props.put("xslt-key", prop);

        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
        transformMediator.mediate(synCtx);
View Full Code Here

        // set XSLT transformation URL
        transformMediator.setXsltKey("xslt-key");

        Map props = new HashMap();
        Property prop = new Property();
        prop.setType(Property.DYNAMIC_TYPE);
        prop.setKey("file:./../../repository/conf/sample/resources/transform/transform_unittest.xslt");
        props.put("xslt-key", prop);
       
        // invoke transformation, with static enveope
        MessageContext synCtx = TestUtils.getTestContext(ENCLOSING_SOURCE, props);
        transformMediator.mediate(synCtx);
View Full Code Here

TOP

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

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.