KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > webservice > monitoring > EndpointImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * EndpointImpl.java
26  *
27  * Created on March 14, 2005, 10:35 AM
28  */

29
30 package com.sun.enterprise.webservice.monitoring;
31
32 import java.util.List JavaDoc;
33 import java.util.ArrayList JavaDoc;
34
35 import com.sun.enterprise.deployment.WebServiceEndpoint;
36
37 /**
38  * Implementation of the endpoint interface
39  *
40  * @author Jerome Dochez
41  */

42 public class EndpointImpl implements Endpoint {
43     
44     public final static String JavaDoc NAME = "MONITORING_ENDPOINT";
45     public final static String JavaDoc MESSAGE_ID = "MONITORING_MESSAGE_ID";
46     public final static String JavaDoc REQUEST_TRACE = "MONITORING_REQUEST_MESSAGE_TRACE";
47     
48     final String JavaDoc endpointSelector;
49     final EndpointType type;
50     WebServiceEndpoint endpointDesc;
51     List JavaDoc<MessageListener> listeners = new ArrayList JavaDoc<MessageListener>();
52     
53     /** Creates a new instance of EndpointImpl */
54     EndpointImpl(String JavaDoc endpointSelector, EndpointType type) {
55         this.endpointSelector = endpointSelector;
56         this.type = type;
57     }
58     
59     /**
60      * @return the endpoint URL as a string. This is the URL
61      * web service clients use to invoke the endpoint.
62      */

63     public String JavaDoc getEndpointSelector() {
64         return endpointSelector;
65     }
66         
67     /**
68      * @return the endpoint type
69      */

70     public EndpointType getEndpointType() {
71         return type;
72     }
73     
74     /**
75      * Returns the Transport type
76      */

77     public TransportType getTransport() {
78         return TransportType.HTTP;
79     }
80     
81     /**
82      * registers a new SOAPMessageListener for this endpoint
83      * @param the listener instance to register.
84      */

85     public void addListener(MessageListener newListener) {
86         listeners.add(newListener);
87     }
88     
89     /**
90      * unregiters a SOAPMessageListener for this endpoint
91      * @param the listener instance to unregister.
92      */

93     public void removeListener(MessageListener listener) {
94         listeners.remove(listener);
95     }
96     
97     /**
98      * Returns true if this endpoint has listeners registered
99      * @return true if at least one listener is registered
100      */

101     public boolean hasListeners() {
102         return !listeners.isEmpty();
103     }
104     
105     /**
106      * Return the deployment descriptors associated with this
107      * endpoint.
108      */

109     public WebServiceEndpoint getDescriptor() {
110         return endpointDesc;
111     }
112     
113     /**
114      * Set the WebServiceEndpoint DOL descriptor
115      */

116     public void setDescriptor(WebServiceEndpoint endpointDesc) {
117         
118         if (endpointDesc!=null) {
119             endpointDesc.addExtraAttribute(EndpointImpl.NAME, this);
120         }
121         this.endpointDesc = endpointDesc;
122     }
123 }
124
Popular Tags