Package org.milyn.payload

Examples of org.milyn.payload.Exports


    public void setReportPath(String reportPath) {
        this._reportPath = reportPath;
    }

    private void init(SmooksTransformModel model) {
        Exports exports = Exports.getExports(_smooks.getApplicationContext());

        // Must define 1 exported result type
        if (exports == null) {
            _log.debug("Smooks configuration '" + model.getConfig() + "'will not make updates to the Exchange Message payload because it does not define any <core:exports>.  See Smooks User Guide.");
            return;
        }
        if (exports.getExports().size() != 1) {
            throw TransformMessages.MESSAGES.smooksConfigurationNoExports();
        }

        _export = exports.getExports().iterator().next();

        // Only support String (character based) or Java Results for now...
        Class<?> exportType = _export.getType();
        if (StringResult.class.isAssignableFrom(exportType)) {
            return;
View Full Code Here


public class ExportsTest
{
    @Test
    public void createSingleExports()
    {
        Exports exports = new Exports(StringResult.class);
        Collection<Export> exportTypes = exports.getExports();
        assertFalse(exportTypes.isEmpty());
        assertEquals(exportTypes.iterator().next().getType(), StringResult.class);
    }
View Full Code Here

    public void createMultipleExports()
    {
        Set<Export> results = new HashSet<Export>();
        results.add(new Export(StringResult.class));
        results.add(new Export(JavaResult.class));
        Exports exports = new Exports(results);

        Collection<Export> exportTypes = exports.getExports();
        assertEquals(2, exportTypes.size());
    }
View Full Code Here

    context.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception
      {
                from("direct:a")
                .process(new SmooksProcessor(new Smooks().setExports(new Exports(JavaResult.class)), context)
                .addVisitor(new Value("customer", "/order/header/customer", String.class)));
      }
     
    });
    enableJMX();
View Full Code Here

  @Override
  protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                from("direct:a")
                .process(new SmooksProcessor(new Smooks().setExports(new Exports(StringResult.class)), context))
                .to("direct:b");
               
                from("direct:b").convertBodyTo(String.class).process(new DirectBProcessor());
            }
        };
View Full Code Here

  protected RouteBuilder createRouteBuilder() throws Exception {
     
        return new RouteBuilder() {
            public void configure() {
                from("file://target/smooks").
                process(new SmooksProcessor(new Smooks().setExports(new Exports(StringResult.class)), context)).
            to("mock:a");
            }
        };
  }
View Full Code Here

    context.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception
      {
                from("direct:a")
                .process(new SmooksProcessor(new Smooks().setExports(new Exports(JavaResult.class)), context)
                .addVisitor(new Value("x", "/coord/@x", Integer.class)));
      }
     
    });
    enableJMX();
View Full Code Here

    public void test_multi_value() throws Exception {
    context.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception
      {
                from("direct:b").process(new SmooksProcessor(new Smooks().setExports(new Exports(JavaResult.class)), context).
                    addVisitor(new Value("x", "/coord/@x", Integer.class)).
                    addVisitor(new Value("y", "/coord/@y", Double.class)));
      }
    });
    context.start();
View Full Code Here

    public void test_bean() throws Exception {
    context.addRoutes(new RouteBuilder() {
      @Override
      public void configure() throws Exception
      {
                from("direct:c").process(new SmooksProcessor(new Smooks().setExports(new Exports(JavaResult.class)), context).
                addVisitor(new Bean(Coordinate.class, "coordinate").
            bindTo("x", "/coord/@x").
            bindTo("y", "/coord/@y")));
      }
    });
View Full Code Here

     * @param exchange   The Camel {@link Exchange}.
     * @param fromStream The InputStream that will be unmarshalled into an Object instance.
     */
    public Object unmarshal(final Exchange exchange, final InputStream fromStream) throws Exception {
        final ExecutionContext execContext = smooks.createExecutionContext();
        final Exports exports = Exports.getExports(smooks.getApplicationContext());
        final Result[] results = exports.createResults();
        smooks.filterSource(execContext, new StreamSource(fromStream), results);
        return getResult(exports, results, exchange);
    }
View Full Code Here

TOP

Related Classes of org.milyn.payload.Exports

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.