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.servicemix.eip.support;
018    
019    /**
020     * The RoutingRule interface is used by content based routers.
021     * If the rule predicate matches the MessageExchange, the
022     * target defined on the rule will be used as the destination for
023     * the given MessageExchange.
024     *  
025     * @author gnodet
026     * @version $Revision: 376451 $
027     * @org.apache.xbean.XBean element="routing-rule" 
028     */
029    public class RoutingRule {
030        
031        private Predicate predicate;
032        private ExchangeTarget target;
033        
034        public RoutingRule() {
035        }
036        
037        public RoutingRule(Predicate predicate, ExchangeTarget target) {
038            this.predicate = predicate;
039            this.target = target;
040        }
041        
042        /* (non-Javadoc)
043         * @see org.apache.servicemix.components.eip.support.RoutingRule#getPredicate()
044         */
045        public Predicate getPredicate() {
046            return predicate;
047        }
048    
049        /* (non-Javadoc)
050         * @see org.apache.servicemix.components.eip.support.RoutingRule#getTarget()
051         */
052        public ExchangeTarget getTarget() {
053            return target;
054        }
055    
056        /**
057         * @param predicate The predicate to set.
058         */
059        public void setPredicate(Predicate predicate) {
060            this.predicate = predicate;
061        }
062    
063        /**
064         * @param target The target to set.
065         */
066        public void setTarget(ExchangeTarget target) {
067            this.target = target;
068        }
069    
070    }