KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > region > virtual > CompositeDestination


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.broker.region.virtual;
19
20 import org.apache.activemq.broker.region.Destination;
21
22 import java.util.Collection JavaDoc;
23
24 /**
25  *
26  * @version $Revision: 426366 $
27  */

28 public abstract class CompositeDestination implements VirtualDestination {
29
30     private String JavaDoc name;
31     private Collection JavaDoc forwardTo;
32     private boolean forwardOnly = true;
33     private boolean copyMessage = true;
34
35     public Destination intercept(Destination destination) {
36         return new CompositeDestinationInterceptor(destination, getForwardTo(), isForwardOnly(), isCopyMessage());
37     }
38
39     public String JavaDoc getName() {
40         return name;
41     }
42
43     /**
44      * Sets the name of this composite destination
45      */

46     public void setName(String JavaDoc name) {
47         this.name = name;
48     }
49
50     public Collection JavaDoc getForwardTo() {
51         return forwardTo;
52     }
53
54     /**
55      * Sets the list of destinations to forward to
56      */

57     public void setForwardTo(Collection JavaDoc forwardDestinations) {
58         this.forwardTo = forwardDestinations;
59     }
60
61     public boolean isForwardOnly() {
62         return forwardOnly;
63     }
64
65     /**
66      * Sets if the virtual destination is forward only (and so there is no
67      * physical queue to match the virtual queue) or if there is also a physical
68      * queue with the same name).
69      */

70     public void setForwardOnly(boolean forwardOnly) {
71         this.forwardOnly = forwardOnly;
72     }
73
74     public boolean isCopyMessage() {
75         return copyMessage;
76     }
77
78     /**
79      * Sets whether a copy of the message will be sent to each destination.
80      * Defaults to true so that the forward destination is set as the
81      * destination of the message
82      */

83     public void setCopyMessage(boolean copyMessage) {
84         this.copyMessage = copyMessage;
85     }
86
87 }
88
Popular Tags