KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > command > BaseEndpoint


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.command;
19
20 /**
21  * A default endpoint.
22  *
23  * @version $Revision: 426366 $
24  */

25 public class BaseEndpoint implements Endpoint {
26
27     private String JavaDoc name;
28     BrokerInfo brokerInfo;
29
30     public BaseEndpoint(String JavaDoc name) {
31         this.name = name;
32     }
33
34     public String JavaDoc getName() {
35         return name;
36     }
37
38     public String JavaDoc toString() {
39         String JavaDoc brokerText = "";
40         BrokerId brokerId = getBrokerId();
41         if (brokerId != null) {
42             brokerText = " broker: " + brokerId;
43         }
44         return "Endpoint[name:" + name + brokerText + "]";
45     }
46
47     /**
48      * Returns the broker ID for this endpoint, if the endpoint is a broker or
49      * null
50      */

51     public BrokerId getBrokerId() {
52         if (brokerInfo != null) {
53             return brokerInfo.getBrokerId();
54         }
55         return null;
56     }
57
58     /**
59      * Returns the broker information for this endpoint, if the endpoint is a
60      * broker or null
61      */

62     public BrokerInfo getBrokerInfo() {
63         return brokerInfo;
64     }
65
66     public void setBrokerInfo(BrokerInfo brokerInfo) {
67         this.brokerInfo = brokerInfo;
68     }
69
70 }
71
Popular Tags