Package org.switchyard.transform

Examples of org.switchyard.transform.TransformSequence


        final QName B = new QName("b");
        final QName C = new QName("c");
        final QName D = new QName("d");
       
        BaseTransformerRegistry xformReg = new BaseTransformerRegistry();
        TransformSequence transSequence = TransformSequence.from(A).to(B).to(C).to(D);

        DefaultMessage message = new DefaultMessage().setContent(A);

        // Apply transform sequence ... no relevant transformers in the reg... nothing should
        // happen i.e. content should still be "a"...
        transSequence.apply(message, xformReg);
        Assert.assertEquals(A, message.getContent());

        // Add just th "a" to "b" transformer... run again... should transform to "b", but no further...
        xformReg.addTransformer(new MockTransformer(A, B));
        transSequence.apply(message, xformReg);
        Assert.assertEquals(B, message.getContent());

        // Add the rest of the transforms now... should transform the last steps in one go...
        xformReg.addTransformer(new MockTransformer(B, C)).addTransformer(new MockTransformer(C, D));
        transSequence.apply(message, xformReg);
        Assert.assertEquals(D, message.getContent());
    }
View Full Code Here


       
        BaseTransformerRegistry _registry = new BaseTransformerRegistry();
        _registry.addTransformer(new TestTransformer2(A, B));
        _registry.addTransformer(new TestTransformer2(B, C));
       
        TransformSequence transformSequence = _registry.getTransformSequence(A, C);
        DefaultMessage message = new DefaultMessage().setContent(A);
        transformSequence.apply(message, _registry);
        Assert.assertEquals(C, message.getContent());     
    }
View Full Code Here

        } else {
            initOutTransformSequence(exchange);
        }
       
        // Apply transforms to the message...
        TransformSequence transformSequence = _registry.getTransformSequence(TransformSequence.getCurrentMessageType(exchange), TransformSequence.getTargetMessageType(exchange));
        if (transformSequence != null) {
            transformSequence.associateWith(exchange.getMessage());
        }
   
        TransformSequence.applySequence(exchange, _registry);
        if (!TransformSequence.assertTransformsApplied(exchange)) {
            QName actualPayloadType = TransformSequence.getCurrentMessageType(exchange);
View Full Code Here

        // if there's a direct hit, set that and bail
        if (_registry.hasTransformer(from, to)) {
            return TransformSequence.from(from).to(to);
        }

        TransformSequence transformSequence = null;
        LinkedList<QName> path = new LinkedList<QName>();
       
        // walk the graph to see if we can resolve the path
        if (resolvePath(path, from, to, _hops)) {
            transformSequence = TransformSequence.from(from);
            for (QName type : path) {
                transformSequence.to(type);
            }
        }
        return transformSequence;
    }
View Full Code Here

TOP

Related Classes of org.switchyard.transform.TransformSequence

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.