001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel;
018    
019    import java.util.List;
020    import java.util.Map;
021    
022    import org.apache.camel.spi.RouteContext;
023    
024    /**
025     * A <a href="http://camel.apache.org/routes.html">Route</a>
026     * defines the processing used on an inbound message exchange
027     * from a specific {@link org.apache.camel.Endpoint} within a {@link org.apache.camel.CamelContext}
028     */
029    public interface Route {
030    
031        String ID_PROPERTY = "id";
032        String PARENT_PROPERTY = "parent";
033        String GROUP_PROPERTY = "group";
034    
035        /**
036         * Gets the route id
037         *
038         * @return the route id
039         */
040        String getId();
041    
042        /**
043         * Gets the inbound endpoint
044         */
045        Endpoint getEndpoint();
046    
047        /**
048         * Gets the inbound {@link Consumer}
049         */
050        Consumer getConsumer();
051    
052        /**
053         * This property map is used to associate information about the route.
054         *
055         * @return properties
056         */
057        Map<String, Object> getProperties();
058    
059        /**
060         * Gets the route context
061         *
062         * @return the route context
063         */
064        RouteContext getRouteContext();
065    
066        /**
067         * A strategy callback allowing special initialization when services is starting.
068         *
069         * @param services the service
070         * @throws Exception is thrown in case of error
071         */
072        void onStartingServices(List<Service> services) throws Exception;
073    
074        /**
075         * Returns the services for this particular route
076         */
077        List<Service> getServices();
078    
079        /**
080         * Adds a service to this route
081         *
082         * @param service the service
083         */
084        void addService(Service service);
085    
086        /**
087         * Returns a navigator to navigate this route by navigating all the {@link Processor}s.
088         *
089         * @return a navigator for {@link Processor}.
090         */
091        Navigate<Processor> navigate();
092    
093    }