Package org.switchyard

Examples of org.switchyard.Property


    }
   
    @Test
    public void testNullContextValue() {
        _context.setProperty(PROP_NAME, null);
        Property p = _context.getProperty(PROP_NAME);
        Assert.assertNotNull(p);
        Assert.assertNull(p.getValue());
    }
View Full Code Here


            }
        }
    }

    private Validator<?> get(Exchange exchange) {
        Property contentType = exchange.getContext().getProperty(Exchange.CONTENT_TYPE);
        Property validatedType = exchange.getContext().getProperty(KEY_VALIDATED_TYPE);

        if (contentType != null) {
            if (validatedType != null && contentType.getValue().equals(validatedType.getValue())) {
                // Avoid to apply same validator twice. That may occur if any transformer is not applied and
                // then the ValidateHandler is triggered twice with same contentType in the same exchange.
                return null;
            }
            return _registry.getValidator((QName)contentType.getValue());
View Full Code Here

     * @param create create a new security context if one does not already exist in the exchange or if it is not still valid
     * @return the security context, or null if create is false and one didn't already exist or was not valid
     */
    public SecurityContext getContext(Exchange exchange, boolean create) {
        SecurityContext securityContext = null;
        Property property = exchange.getContext().getProperty(EXCHANGE_PROPERTY, Scope.EXCHANGE);
        if (property != null) {
            Object object = property.getValue();
            if (object instanceof SecurityContext) {
                securityContext = (SecurityContext)object;
            } else if (object instanceof SealedObject) {
                PrivateCrypto privateCrypto = _systemSecurity.getPrivateCrypto();
                if (privateCrypto == null) {
View Full Code Here

            PrivateCrypto privateCrypto = _systemSecurity.getPrivateCrypto();
            if (privateCrypto != null) {
                object = privateCrypto.seal(object);
            }
        }
        Property property = exchange.getContext().setProperty(EXCHANGE_PROPERTY, object, Scope.EXCHANGE);
        if (property != null) {
            property.addLabels(BehaviorLabel.TRANSIENT.label());
        }
    }
View Full Code Here

        Exchange lastExchange = outHandler.getLastExchange();
        assertNotNull(lastExchange);

//        assertEquals(REQUEST, lastExchange.getMessage().getContent());

        Property messageId = message.getContext().getProperty(Exchange.MESSAGE_ID);
        assertNotNull("Message id must be available after sending message and receiving response", messageId);
        Property relatesTo = lastExchange.getContext().getProperty(Exchange.RELATES_TO);
        assertNotNull("Relates to must be specified for outgoing message", relatesTo);
        assertEquals("Relates to property should point to in message id", messageId.getValue(), relatesTo.getValue());
    }
View Full Code Here

        // if no TM is available, there's nothing to do
        if (_transactionManager == null) {
            return;
        }
       
        Property prop = exchange.getContext().getProperty(BEFORE_INVOKED_PROPERTY, Scope.EXCHANGE);
        if (prop != null && Boolean.class.cast(prop.getValue())) {
            // OUT phase in IN_OUT exchange or 2nd invocation in IN_ONLY exchange
            handleAfter(exchange);
        } else {
            exchange.getContext().setProperty(BEFORE_INVOKED_PROPERTY, Boolean.TRUE, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
            handleBefore(exchange);
View Full Code Here

        if (_transactionManager == null) {
            return;
        }
       
        try {
            Property rollbackOnFaultProperty = exchange.getContext().getProperty(Exchange.ROLLBACK_ON_FAULT);
            if (rollbackOnFaultProperty != null && rollbackOnFaultProperty.getValue() != null
                    && Boolean.class.cast(rollbackOnFaultProperty.getValue())) {
                    Transaction transaction = getCurrentTransaction();
                    if (transaction != null) {
                        transaction.setRollbackOnly();
                    }
            }
View Full Code Here

        QName currentType = TransformSequence.getCurrentMessageType(exchange);
        if (currentType != null) {
            exchange.getContext().setProperty(Exchange.CONTENT_TYPE, currentType).addLabels(BehaviorLabel.TRANSIENT.label());
        } else {
            // make sure no property is used for current scope
            Property p = exchange.getContext().getProperty(Exchange.CONTENT_TYPE);
            if (p != null) {
                exchange.getContext().removeProperty(p);
            }
        }
    }
View Full Code Here

    private void defaultExpectations(Exchange ex) {
        when(ex.getProvider().getName()).thenReturn(TEST_SERVICE);
        when(ex.getConsumer().getName()).thenReturn(TEST_REFERENCE);
        when(ex.getState()).thenReturn(ExchangeState.OK);
        Property property = mock(Property.class);
        when(property.getValue()).thenReturn(new Long(10));
        when(ex.getContext().getProperty(ExchangeCompletionEvent.EXCHANGE_DURATION)).thenReturn(property);
        when(ex.getContext().getPropertyValue(ExchangeCompletionEvent.GATEWAY_NAME)).thenReturn(TEST_GATEWAY);
    }
View Full Code Here

                }
            }
            return headers.toString();
        }
        if (companyName.equals("requestInfo")) {
            Property prop = context.getProperty(HttpComposition.HTTP_REQUEST_INFO);
            return ((HttpRequestInfo) prop.getValue()).toString();
        }

        // Note the property becomes lower cased when executed on AS7
        Property prop = context.getProperty("content-type");
        if (prop == null) {
            prop = context.getProperty("Content-type");
        }
        if (prop == null) {
            prop = context.getProperty("Content-Type");
        }
        String contentType = (prop == null) ? null : (String) prop.getValue();
        if (contentType != null) {
            if (contentType.contains("text/plain")) {
                if (companyName.equalsIgnoreCase("vineyard")) {
                    symbol = "WINE";
                }
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.