KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > serverresources > beans > WS70BaseResourceBean


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * WS70BaseResourceBean.java
21  */

22
23 package org.netbeans.modules.j2ee.sun.ws7.serverresources.beans;
24
25 import java.beans.*;
26
27 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.WS70Resources;
28 import org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.PropertyElement;
29
30 import org.netbeans.modules.j2ee.sun.ide.editors.NameValuePair;
31
32
33 /**
34  * Code reused from Appserver common API module
35
36  */

37 public class WS70BaseResourceBean extends Object JavaDoc implements java.io.Serializable JavaDoc {
38
39     protected String JavaDoc name;
40     private String JavaDoc jndiName;
41     protected String JavaDoc description;
42     private String JavaDoc isEnabled;
43     protected NameValuePair[] extraParams;
44     
45     transient protected PropertyChangeSupport propertySupport;
46     
47     /**
48      * Creates a new instance of WS70BaseResourceBean
49      */

50     public WS70BaseResourceBean() {
51         propertySupport = new PropertyChangeSupport(this);
52     }
53     
54     protected void initPropertyChangeSupport(){
55         if(propertySupport==null)
56             propertySupport = new PropertyChangeSupport ( this );
57
58     }
59     
60     public void addPropertyChangeListener (PropertyChangeListener listener) {
61         initPropertyChangeSupport();
62         propertySupport.addPropertyChangeListener (listener);
63     }
64
65     public void removePropertyChangeListener (PropertyChangeListener listener) {
66         initPropertyChangeSupport();
67         propertySupport.removePropertyChangeListener (listener);
68     }
69     
70     public String JavaDoc getName() {
71         return name;
72     }
73     public void setName(String JavaDoc value) {
74         String JavaDoc oldValue = name;
75         this.name = value;
76         initPropertyChangeSupport();
77         propertySupport.firePropertyChange ("name", oldValue, name);//NOI18N
78
}
79     public String JavaDoc getJndiName() {
80         return jndiName;
81     }
82     public void setJndiName(String JavaDoc value) {
83         String JavaDoc oldValue = jndiName;
84         this.jndiName = value;
85         initPropertyChangeSupport();
86         propertySupport.firePropertyChange ("jndiName", oldValue, jndiName);//NOI18N
87
}
88     public String JavaDoc getDescription() {
89         return description;
90     }
91     public void setDescription(String JavaDoc value) {
92         String JavaDoc oldValue = description;
93         this.description = value;
94         initPropertyChangeSupport();
95         propertySupport.firePropertyChange ("description", oldValue, description);//NOI18N
96
}
97     public String JavaDoc getIsEnabled() {
98         return isEnabled;
99     }
100     public void setIsEnabled(String JavaDoc value) {
101         String JavaDoc oldValue = isEnabled;
102         this.isEnabled = value;
103         initPropertyChangeSupport();
104         propertySupport.firePropertyChange ("isEnabled", oldValue, isEnabled);//NOI18N
105
}
106     public NameValuePair[] getExtraParams() {
107         if(this.extraParams == null)
108             this.extraParams = new NameValuePair[0];
109         return this.extraParams;
110     }
111     public void setExtraParams(Object JavaDoc[] value) {
112         NameValuePair[] pairs = new NameValuePair[value.length];
113         for (int i = 0; i < value.length; i++) {
114             NameValuePair val = (NameValuePair)value[i];
115             NameValuePair pair = new NameValuePair();
116             pair.setParamName(val.getParamName());
117             pair.setParamValue(val.getParamValue());
118             //pair.setParamDescription(val.getParamDescription());
119
pairs[i] = pair;
120         }
121         NameValuePair[] oldValue = extraParams;
122         this.extraParams = pairs;
123         initPropertyChangeSupport();
124         propertySupport.firePropertyChange ("extraParams", oldValue, extraParams);//NOI18N
125
}
126     
127     public WS70Resources getResourceGraph(){
128         return org.netbeans.modules.j2ee.sun.ws7.serverresources.dd.impl.WS70Resources.createGraph();
129     }
130     
131     public PropertyElement populatePropertyElement(PropertyElement prop, NameValuePair pair){
132         prop.setName(pair.getParamName());
133         prop.setValue(pair.getParamValue());
134         return prop;
135     }
136 }
137
Popular Tags