View Javadoc
1   /*
2    * Copyright 2010 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.openehealth.ipf.platform.camel.core.config;
17  
18  import org.apache.camel.builder.RouteBuilder;
19  
20  /**
21   * RouteBuilders, Interceptors, ExceptionClauses should extend this
22   * class in order to be picked up and configured/customized from the
23   * {@link CustomRouteBuilderConfigurer}. 
24   * 
25   * @author Boris Stanojevic
26   */
27  public abstract class CustomRouteBuilder extends RouteBuilder
28         implements Comparable<CustomRouteBuilder> {
29  
30      private RouteBuilder intercepted;
31  
32  
33      @Override
34      public int compareTo(CustomRouteBuilder customRouteBuilder) {
35          if (customRouteBuilder.getIntercepted() == null
36                  && getIntercepted() != null){
37              return -1;
38          }else if(customRouteBuilder.getIntercepted() != null
39                  && getIntercepted() == null){
40              return 1;
41          }else{
42              return 0;
43          }
44      }
45  
46      public RouteBuilder getIntercepted() {
47          return intercepted;
48      }
49  
50      public void setIntercepted(RouteBuilder intercepted) {
51          this.intercepted = intercepted;
52      }
53  
54  }