Package org.switchyard

Examples of org.switchyard.Property


     * {@inheritDoc}
     */  
    @Override
    public Object get(Object key) {
        if (key != null) {
            Property property = getProperty(key.toString(), _scope);
            if (property != null) {
                return property.getValue();
            }
        }
        return null;
    }
View Full Code Here


     * {@inheritDoc}
     */  
    @Override
    public Object remove(Object key) {
        if (key != null) {
            Property property = getProperty(key.toString(), _scope);
            if (property != null) {
                removeProperty(property);
                return property.getValue();
            }
        }
        return null;
    }
View Full Code Here

    public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception {
        final Message message = exchange.getMessage();
        if (message != null) {
            Object content = message.getContent();
            if (target instanceof HttpResponseBindingData) {
                Property responseCode = exchange.getContext().getProperty(HttpContextMapper.HTTP_RESPONSE_STATUS);
                if (!((responseCode != null) && responseCode.hasLabel(EndpointLabel.HTTP.label()))) {
                    int status = HttpServletResponse.SC_ACCEPTED;
                    if (exchange.getState() == ExchangeState.FAULT) {
                        status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
                    } else if (content == null) {
                        status = HttpServletResponse.SC_NO_CONTENT;
View Full Code Here

        mock.waitForOKMessage();
        List<Exchange> exchanges = new ArrayList<Exchange>();
        mock.getMessages().drainTo(exchanges);
        assertEquals(1, exchanges.size());
        Exchange exchange = exchanges.get(0);
        Property property = exchange.getContext().getProperty(Mapper.PROPERTY);
        assertNotNull(property);
        assertEquals(Mapper.VALUE, property.getValue());

        handler.stop();
    }
View Full Code Here

        Message requestMsg = ex.createMessage().setContent(input);
        ex.send(requestMsg);
        handler.waitForFaultMessage();
        Exchange exchange = handler.getFaults().iterator().next();
        Property faultInfoProperty = exchange.getContext().getProperty(SOAPComposition.SOAP_FAULT_INFO);
        Assert.assertNotNull(faultInfoProperty);
        Assert.assertEquals(faultStr, faultInfoProperty.getValue().toString());
    }
View Full Code Here

        org.switchyard.Exchange syExchange = createSwitchYardExchange();
       
        org.switchyard.Message message = ExchangeMapper.mapCamelToSwitchYard(exchange, syExchange,
                ExchangePhase.IN);
       
        Property property = message.getContext().getProperty("CamelFileName");
        assertTrue(property != null);       
        assertTrue("foobar".equals(property.getValue()));
    }
View Full Code Here

    public void setProperty() {
        testKit.registerInOutService(REFERENCE_A, new BaseHandler() {
            @Override
            public void handleMessage(Exchange exchange) throws HandlerException {
                // Verify that a property was set on the request message by the invoker
                Property inProp = exchange.getContext(exchange.getMessage())
                        .getProperty(TEST_IN_PROPERTY, Scope.MESSAGE);
                Assert.assertNotNull(inProp);
                Assert.assertEquals(TEST_IN_PROPERTY, inProp.getValue());
               
                // Set an out property which will be verified in the test bean class
                Message reply = exchange.createMessage();
                exchange.getContext(reply)
                    .setProperty(TEST_OUT_PROPERTY, TEST_OUT_PROPERTY, Scope.MESSAGE);
View Full Code Here

                                + "</SOAP-ENV:fault>";
                    setContent(message, response);
                }
                exchange.sendFault(message);
            } else {
                Property soapActionProp = exchange.getContext().getProperty("Soapaction");
                if (soapActionProp == null) {
                    soapActionProp = exchange.getContext().getProperty("SOAPAction");
                }
                String soapAction = "";
                if (soapActionProp != null) {
                    soapAction = (String) soapActionProp.getValue();
                } else {
                    soapActionProp = exchange.getContext().getProperty("Content-Type");
                    if (soapActionProp == null) {
                        soapActionProp = exchange.getContext().getProperty("Content-type");
                    }
                    if (soapActionProp != null) {
                        soapAction = (String) soapActionProp.getValue();
                    }
                }
                response = "<test:sayHelloResponse xmlns:test=\"urn:switchyard-component-soap:test-ws:1.0\">"
                             + "   <return>Hello " + toWhom + "! The soapAction received is " + soapAction + "</return>"
                             + "</test:sayHelloResponse>";
View Full Code Here

     * @param context The SwitchYard Context
     * @return The To address
     */
    public static String getToAddress(Context context) {
        String address = null;
        Property toProp = context.getProperty(WSA_TO_STR);
        if (toProp == null) {
            toProp = context.getProperty(WSA_TO_STR.toLowerCase());
        }
        if (toProp != null) {
            Element toEl = (Element)toProp.getValue();
            address = toEl.getFirstChild().getNodeValue();
        }
        return address;
    }
View Full Code Here

        }
    }

    @Override
    public Property getProperty(String name) {
        Property property = getProperty(name, Scope.MESSAGE);
        return property == null ? getProperty(name, Scope.EXCHANGE) : property;
    }
View Full Code Here

TOP

Related Classes of org.switchyard.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.