Package org.apache.synapse.config

Examples of org.apache.synapse.config.Property


        if (!sequenceMap.containsKey(correlationValue)) {
            sequenceID = UUIDGenerator.getUUID();
            if (log.isDebugEnabled()) {
                log.debug("setting sequenceID " + sequenceID + " for correlation " + correlationValue);
            }
            Property sequenceProperty = new Property();
            sequenceProperty.setValue(sequenceID);
            sequenceProperty.setExpiryTime(System.currentTimeMillis() + SEQUENCE_EXPIRY_TIME);
            sequenceMap.put(correlationValue, sequenceProperty);
        } else {
            sequenceID = (String) ((Property) sequenceMap.get(correlationValue)).getValue();
            if (log.isDebugEnabled()) {
                log.debug("got sequenceID " + sequenceID + " for correlation " + correlationValue);
View Full Code Here


    private synchronized void cleanupSequenceMap() {
        Iterator itKey = sequenceMap.keySet().iterator();
        while (itKey.hasNext()) {
            Object key = itKey.next();
            Property sequenceProperty = (Property) sequenceMap.get(key);
            if (sequenceProperty.isExpired()) {
                sequenceMap.remove(key);
            }
        }
    }
View Full Code Here

        // if any of the schemas are not loaded or expired, load or re-load them
        Iterator iter = schemaKeys.iterator();
        while (iter.hasNext()) {
            String propKey = (String) iter.next();
            Property dp = msgCtx.getConfiguration().getPropertyObject(propKey);
            if (dp != null && dp.isDynamic()) {
                if (!dp.isCached() || dp.isExpired()) {
                    reCreate = true;       // request re-initialization of Validator
                }
            }
        }
View Full Code Here

        boolean shouldTrace = shouldTrace(synCtx.getTracingState());
        if (shouldTrace) {
            trace.trace("Start : Spring mediator");
        }
        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

        } catch (XMLStreamException e) {
            handleException("Error gettting transform source " + e.getMessage(), e);
        }

        // build transformer - if necessary
        Property dp = msgCtx.getConfiguration().getPropertyObject(xsltKey);

        // if the xsltKey refers to a dynamic property
        if (dp != null && dp.isDynamic()) {
            if (!dp.isCached() || dp.isExpired()) {
                synchronized(transformerLock) {
                    try {
                        transformer = TransformerFactory.newInstance().
                            newTransformer(Util.getStreamSource(
                                msgCtx.getConfiguration().getProperty(xsltKey)
View Full Code Here

        // if any of the schemas are not loaded or expired, load or re-load them
        Iterator iter = schemaKeys.iterator();
        while (iter.hasNext()) {
            String propKey = (String) iter.next();
            Property dp = msgCtx.getConfiguration().getPropertyObject(propKey);
            if (dp != null && dp.isDynamic()) {
                if (!dp.isCached() || dp.isExpired()) {
                    reCreate = true;       // request re-initialization of Validator
                }
            }
        }
View Full Code Here

        } catch (XMLStreamException e) {
            handleException("Error gettting transform source " + e.getMessage(), e);
        }

        // build transformer - if necessary
        Property dp = msgCtx.getConfiguration().getPropertyObject(xsltKey);

        // if the xsltKey refers to a dynamic property
        if (dp != null && dp.isDynamic()) {
            if (!dp.isCached() || dp.isExpired()) {
                synchronized(transformerLock) {
                    try {
                        transformer = TransformerFactory.newInstance().
                            newTransformer(Util.getStreamSource(
                                msgCtx.getConfiguration().getProperty(xsltKey)
View Full Code Here

    public void testSetAndReadGlobalProperty() throws Exception {

        MessageContext synCtx = TestUtils.getTestContext("<empty/>");

        SynapseConfiguration synCfg = new SynapseConfiguration();
        Property prop = new Property();
        prop.setName("name");
        prop.setType(Property.VALUE_TYPE);
        prop.setValue("value");
        synCfg.addProperty("name", prop);
        synCtx.setConfiguration(synCfg);

        assertTrue(
            "value".equals(Axis2MessageContext.getStringValue(
View Full Code Here

        Mediator mediator = mf.createMediator(INLINE_MEDIATOR_CONFIG);
        assertTrue(mediator.mediate(null));
    }

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

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

        OMAttribute name = elem.getAttribute(new QName(Constants.NULL_NAMESPACE, "name"));
        if (name == null) {
            handleException("The 'name' attribute is required for a property definition");
            return null;
        } else {
            Property property = new Property();
            property.setName(name.getAttributeValue());
            String value = elem.getAttributeValue(new QName(Constants.NULL_NAMESPACE, "value"));
            String src = elem.getAttributeValue(new QName(Constants.NULL_NAMESPACE, "src"));
            String key = elem.getAttributeValue(new QName(Constants.NULL_NAMESPACE, "key"));
            OMElement content = elem.getFirstElement();
            if(value != null) {
                property.setType(Property.VALUE_TYPE);
                property.setValue(value);
            } else if(src != null) {
                property.setType(Property.SRC_TYPE);
                try {
                    property.setSrc(new URL(src));
                } catch (MalformedURLException e) {
                    handleException("Given src attribute " + src + "is not a propper URL.");
                }
            } else if(key != null) {
                property.setType(Property.DYNAMIC_TYPE);
                property.setKey(key);
            } else if(content != null) {
                if (content instanceof OMText) {
                    property.setType(Property.INLINE_STRING_TYPE);
                    property.setValue(content.getText());
                } else {
                    property.setType(Property.INLINE_XML_TYPE);
                    property.setValue(content);
                }
            }
            return property;
        }
    }
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.