KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > transport > TransportServerSupport


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.transport;
19
20 import org.apache.activemq.util.ServiceSupport;
21
22 import java.net.URI JavaDoc;
23
24 /**
25  * A useful base class for implementations of {@link TransportServer}
26  *
27  * @version $Revision: 1.1 $
28  */

29 public abstract class TransportServerSupport extends ServiceSupport implements TransportServer {
30
31     private URI JavaDoc connectURI;
32     private URI JavaDoc bindLocation;
33     private TransportAcceptListener acceptListener;
34
35     public TransportServerSupport() {
36     }
37
38     public TransportServerSupport(URI JavaDoc location) {
39         this.connectURI = location;
40         this.bindLocation = location;
41     }
42
43     /**
44      * @return Returns the acceptListener.
45      */

46     public TransportAcceptListener getAcceptListener() {
47         return acceptListener;
48     }
49
50     /**
51      * Registers an accept listener
52      *
53      * @param acceptListener
54      */

55     public void setAcceptListener(TransportAcceptListener acceptListener) {
56         this.acceptListener = acceptListener;
57     }
58
59     /**
60      * @return Returns the location.
61      */

62     public URI JavaDoc getConnectURI() {
63         return connectURI;
64     }
65
66     /**
67      * @param location
68      * The location to set.
69      */

70     public void setConnectURI(URI JavaDoc location) {
71         this.connectURI = location;
72     }
73
74     protected void onAcceptError(Exception JavaDoc e) {
75         if (acceptListener != null) {
76             acceptListener.onAcceptError(e);
77         }
78     }
79
80     public URI JavaDoc getBindLocation() {
81         return bindLocation;
82     }
83
84     public void setBindLocation(URI JavaDoc bindLocation) {
85         this.bindLocation = bindLocation;
86     }
87 }
88
Popular Tags