KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > MessageDestinationDescriptor


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 package com.sun.enterprise.deployment;
25
26 /**
27  * This class represents information about a web service
28  * endpoint.
29  *
30  * @author Kenneth Saks
31  */

32
33 import java.util.Set JavaDoc;
34 import java.util.HashSet JavaDoc;
35 import java.util.Iterator JavaDoc;
36
37 import com.sun.enterprise.deployment.types.MessageDestinationReferencer;
38
39 public class MessageDestinationDescriptor extends Descriptor implements NamedDescriptor{
40
41     private String JavaDoc msgDestName;
42
43     // JNDI name of physical destination to which this logical
44
// destination is mapped.
45
private String JavaDoc jndiName;
46     private String JavaDoc mappedName;
47
48     // Set of MessageDestinationReferencer descriptors pointing to me.
49
private Set JavaDoc referencers = new HashSet JavaDoc();
50
51     // bundle in which I am defined
52
private BundleDescriptor bundleDescriptor;
53
54     public MessageDestinationDescriptor() {
55     }
56
57     public MessageDestinationDescriptor(String JavaDoc name, String JavaDoc description) {
58         super("", description);
59         msgDestName = name;
60     }
61
62     public boolean hasName() {
63         return (msgDestName != null);
64     }
65
66     public void setName(String JavaDoc name) {
67         msgDestName = name;
68     }
69
70     public String JavaDoc getName() {
71         return msgDestName;
72     }
73
74     public void setDisplayName(String JavaDoc displayName) {
75         setLocalizedDisplayName(null, displayName);
76     }
77
78     public String JavaDoc getDisplayName() {
79         return getLocalizedDisplayName(null);
80     }
81
82     public Set JavaDoc getAllReferencers() {
83         return referencers;
84     }
85
86     public void addReferencer(MessageDestinationReferencer referencer) {
87         referencers.add(referencer);
88     }
89
90     public void removeReferencer(MessageDestinationReferencer referencer) {
91         referencers.remove(referencer);
92     }
93
94     public BundleDescriptor getBundleDescriptor() {
95         return bundleDescriptor;
96     }
97
98     public void setBundleDescriptor(BundleDescriptor bundleDesc) {
99         if( bundleDesc == null ) {
100             for(Iterator JavaDoc iter = referencers.iterator(); iter.hasNext();) {
101                 MessageDestinationReferencer next =
102                     (MessageDestinationReferencer) iter.next();
103                 next.setMessageDestination(null);
104             }
105             referencers.clear();
106         }
107         bundleDescriptor = bundleDesc;
108     }
109
110     public String JavaDoc getJndiName() {
111         return (jndiName != null) ? jndiName : mappedName;
112     }
113
114     public void setJndiName(String JavaDoc physicalDestinationName) {
115         jndiName = physicalDestinationName;
116     }
117
118     public String JavaDoc getMappedName() {
119         return mappedName;
120     }
121
122     public void getMappedName(String JavaDoc mappedName) {
123         this.mappedName = mappedName;
124     }
125 }
126
Popular Tags