Package org.apache.camel.model

Examples of org.apache.camel.model.ToDefinition


        Object key = node;
        if (node instanceof FromDefinition) {
            FromDefinition fromType = (FromDefinition) node;
            key = fromType.getUriOrRef();
        } else if (node instanceof ToDefinition) {
            ToDefinition toType = (ToDefinition) node;
            key = toType.getUriOrRef();
        }
        NodeData answer = nodeMap.get(key);
        if (answer == null) {
            String id = "node" + (nodeMap.size() + 1);
            answer = new NodeData(id, node, imagePrefix);
View Full Code Here


            FromDefinition fromType = (FromDefinition)node;
            this.tooltop = fromType.getLabel();
            this.label = removeQueryString(this.tooltop);
            this.url = "http://camel.apache.org/message-endpoint.html";
        } else if (node instanceof ToDefinition) {
            ToDefinition toType = (ToDefinition)node;
            this.tooltop = toType.getLabel();
            this.label = removeQueryString(this.tooltop);
            this.edgeLabel = "";
            this.url = "http://camel.apache.org/message-endpoint.html";
        } else if (node instanceof FilterDefinition) {
            this.image = imagePrefix + "MessageFilterIcon.png";
View Full Code Here

        public Processor createProcessor(RouteContext routeContext, ProcessorDefinition definition) throws Exception {
            if (definition instanceof SplitDefinition) {
                // add additional output to the splitter
                SplitDefinition split = (SplitDefinition) definition;
                split.addOutput(new ToDefinition("mock:extra"));
            }

            if (definition instanceof SetBodyDefinition) {
                SetBodyDefinition set = (SetBodyDefinition) definition;
                set.setExpression(new ConstantExpression("body was altered"));
View Full Code Here

        mockCondition = new ConditionSupport() {
            public boolean matchProcess(Exchange exchange, Processor processor, ProcessorDefinition definition) {
                // match when sending to mocks
                if (definition instanceof ToDefinition) {
                    ToDefinition to = (ToDefinition) definition;
                    return to.getUriOrRef().startsWith("mock");
                }
                return false;
            }
        };
View Full Code Here

  }

  @SuppressWarnings("rawtypes")
  @Override
  public ProcessorDefinition createCamelDefinition() {
    ToDefinition answer = new ToDefinition();
    CamelModelHelper.setUri(answer, this);
    super.savePropertiesToCamelDefinition(answer);
    return answer;
  }
View Full Code Here

    System.out.println("Created: " + routeDef);

    assertSingleInput(routeDef, FromDefinition.class);
    assertSize(routeDef.getOutputs(), 2);
    ChoiceDefinition c1 = assertOutput(routeDef, 0, ChoiceDefinition.class);
    ToDefinition ed4 = assertOutput(routeDef, 1, ToDefinition.class);
    assertEquals("choice -> to", "seda:d", ed4.getUri());

    List<WhenDefinition> whenClauses = c1.getWhenClauses();
    assertSize(whenClauses, 1);
    WhenDefinition wd1 = whenClauses.get(0);
    ToDefinition ed2 = assertSingleOutput(wd1, ToDefinition.class);
    assertEquals("when -> to", "seda:b", ed2.getUri());
   
    OtherwiseDefinition od1 = c1.getOtherwise();
    assertNotNull("Should have Otherwise", od1);
    ToDefinition ed3 = assertSingleOutput(od1, ToDefinition.class);
    assertEquals("otherwise -> to", "seda:c", ed3.getUri());

    RouteContainer routeContainer = new RouteContainer();
    RouteSupport route2 = new Route(routeDef, routeContainer);
    System.out.println("Created route: " + route2);
    assertRoute(route);
View Full Code Here

    RouteDefinition routeDef = route.createRouteDefinition();
    System.out.println("Created: " + routeDef);

    FromDefinition ed1 = assertSingleInput(routeDef, FromDefinition.class);
    FilterDefinition fd1 = assertSingleOutput(routeDef, FilterDefinition.class);
    ToDefinition ed2 = assertSingleOutput(fd1, ToDefinition.class);

    assertEquals("ed1.uri", "seda:a", ed1.getUri());
    assertEquals("ed2.uri", "seda:b", ed2.getUri());
  }
View Full Code Here

    System.out.println("Created: " + routeDef);

    assertSingleInput(routeDef, FromDefinition.class);
    assertSize(routeDef.getOutputs(), 2);
    assertOutput(routeDef, 0, UnmarshalDefinition.class);
    ToDefinition ed4 = assertOutput(routeDef, 1, ToDefinition.class);
    assertEquals("unmarshal -> to", "seda:b", ed4.getUri());
  }
View Full Code Here

  @Override
  public void savePropertiesToCamelDefinition(ProcessorDefinition processor) {
    // TODO Auto-generated method stub
    super.savePropertiesToCamelDefinition(processor);
    if (processor instanceof ToDefinition) {
      ToDefinition node = (ToDefinition) processor;
      CamelModelHelper.setUri(node, this);
    } else {
      throw new IllegalArgumentException(
          "ProcessorDefinition not an instanceof ToDefinition. Was "
              + processor.getClass().getName());
View Full Code Here

      ProcessorDefinition processor) {

    super.loadPropertiesFromCamelDefinition(processor);

    if (processor instanceof ToDefinition) {
      ToDefinition node = (ToDefinition) processor;
      String value = CamelModelHelper.getUri(node);
      setUri(value);
    } else {
      throw new IllegalArgumentException(
          "ProcessorDefinition not an instanceof ToDefinition. Was "
View Full Code Here

TOP

Related Classes of org.apache.camel.model.ToDefinition

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.