KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > repository > JmsDestinationResource


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 package com.sun.enterprise.repository;
24
25 import java.io.Serializable JavaDoc;
26 import com.sun.enterprise.util.LocalStringManagerImpl;
27
28
29 /**
30  * Resource info for Jms Destination info,
31  * both topic and queue.
32  *
33  * @author Kenneth Saks
34  */

35
36 public class JmsDestinationResource extends J2EEResourceBase
37     implements Serializable JavaDoc {
38
39     private static LocalStringManagerImpl localStrings =
40         new LocalStringManagerImpl(JmsCnxFactoryResource.class);
41
42     private boolean isQueue_;
43
44     public JmsDestinationResource(String JavaDoc name) {
45         super(name);
46     }
47
48     protected J2EEResource doClone(String JavaDoc name) {
49         JmsDestinationResource clone = new JmsDestinationResource(name);
50         clone.setIsQueue(getIsQueue());
51         return clone;
52     }
53
54     public int getType() {
55         return J2EEResource.JMS_DESTINATION;
56     }
57
58     //START IASRI 4675235
59
public String JavaDoc getTypeString() {
60         if (getIsQueue()) return IASJ2EEResourceFactoryImpl.JMS_QUEUE;
61         return IASJ2EEResourceFactoryImpl.JMS_TOPIC;
62     }
63     //END IASRI 4675235
64

65     public boolean getIsQueue() {
66         return isQueue_;
67     }
68     
69     public void setIsQueue(boolean isQueue) {
70         isQueue_ = isQueue;
71     }
72
73     public String JavaDoc toString() {
74         //START IASRI 4675235
75
String JavaDoc propsString = getPropsString();
76
77         String JavaDoc npMsg = localStrings.getLocalString("enterprise.repository.resource_noproperties", "No Properties");
78
79         return "< JMS Destination: " + getName() + ", " +
80                   getTypeString()+ ", " +
81                   ((propsString.length() > 0) ?
82                   propsString : npMsg) + " >";
83         //END IASRI 4675235
84
}
85 }
86
Popular Tags