KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > tests > j2eeserver > plugin > jsr88 > EjbConfigBean


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
21 package org.netbeans.tests.j2eeserver.plugin.jsr88;
22
23 import javax.enterprise.deploy.spi.exceptions.*;
24 import javax.enterprise.deploy.spi.*;
25 import java.beans.*;
26 import javax.enterprise.deploy.model.*;
27
28 import java.util.*;
29
30 /**
31  *
32  * @author gfink
33  */

34 public class EjbConfigBean implements DConfigBean {
35
36     DDBean bean;
37     EjbModuleConfigBean module;
38     DepConfig config;
39     Collection children = new HashSet();
40     String JavaDoc EJBREF = "ejb-ref";
41     String JavaDoc EJBLOCALREF = "ejb-local-ref";
42     String JavaDoc RESOURCEREF = "resource-ref";
43
44     public EjbConfigBean(DDBean bean, EjbModuleConfigBean module, DepConfig config) {
45         this.bean = bean; this.config = config; this.module = module;
46         this.ejbName = bean.getChildBean("ejb-name")[0].getText();
47     }
48       
49     public DConfigBean getDConfigBean(DDBean dDBean) throws ConfigurationException {
50         DConfigBean ret = null;
51         if(dDBean.getXpath().endsWith(EJBREF) || dDBean.getXpath().endsWith(EJBLOCALREF))
52             ret = new EjbRefConfigBean(dDBean, config);
53         else if (dDBean.getXpath().endsWith(RESOURCEREF))
54             ret = new ResourceRefConfigBean(dDBean, module, config);
55         if(ret != null) children.add(ret);
56         return ret;
57     }
58     
59     public DDBean getDDBean() {
60         return bean;
61     }
62     
63     public String JavaDoc[] getXpaths() {
64         return new String JavaDoc[] { EJBREF, EJBLOCALREF, RESOURCEREF };
65     }
66     
67     public void notifyDDChange(XpathEvent xpathEvent) {
68     }
69     
70     public void removeDConfigBean(DConfigBean dConfigBean) throws BeanNotFoundException {
71         children.remove(dConfigBean);
72         propertyChangeSupport.firePropertyChange(dConfigBean.getClass().toString(),dConfigBean,null);
73     }
74     
75       /** Utility field used by bound properties. */
76       private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
77       
78       /** Holds value of property jndiName. */
79       private String JavaDoc jndiName;
80       
81       /** Holds value of property configurationName. */
82       private String JavaDoc configurationName;
83       
84       /** Holds value of property securityProxy. */
85       private String JavaDoc securityProxy;
86       
87       /** Holds value of property ejbName. */
88       private String JavaDoc ejbName;
89       
90     public void addPropertyChangeListener(PropertyChangeListener listener) {
91         propertyChangeSupport.addPropertyChangeListener(listener);
92     }
93     
94     public void removePropertyChangeListener(PropertyChangeListener listener) {
95         propertyChangeSupport.removePropertyChangeListener(listener);
96     }
97     
98     /** Getter for property jndiName.
99      * @return Value of property jndiName.
100      */

101     public String JavaDoc getJndiName() {
102         return this.jndiName;
103     }
104     
105     /** Setter for property jndiName.
106      * @param jndiName New value of property jndiName.
107      */

108     public void setJndiName(String JavaDoc jndiName) {
109         String JavaDoc oldJndiName = this.jndiName;
110         this.jndiName = jndiName;
111         propertyChangeSupport.firePropertyChange("jndiName", oldJndiName, jndiName);
112     }
113     
114     /** Getter for property configurationName.
115      * @return Value of property configurationName.
116      */

117     public String JavaDoc getConfigurationName() {
118         return this.configurationName;
119     }
120     
121     /** Setter for property configurationName.
122      * @param configurationName New value of property configurationName.
123      */

124     public void setConfigurationName(String JavaDoc configurationName) {
125         String JavaDoc oldConfigurationName = this.configurationName;
126         this.configurationName = configurationName;
127         propertyChangeSupport.firePropertyChange("configurationName", oldConfigurationName, configurationName);
128     }
129     
130     /** Getter for property securityProxy.
131      * @return Value of property securityProxy.
132      */

133     public String JavaDoc getSecurityProxy() {
134         return this.securityProxy;
135     }
136     
137     /** Setter for property securityProxy.
138      * @param securityProxy New value of property securityProxy.
139      */

140     public void setSecurityProxy(String JavaDoc securityProxy) {
141         String JavaDoc oldSecurityProxy = this.securityProxy;
142         this.securityProxy = securityProxy;
143         propertyChangeSupport.firePropertyChange("securityProxy", oldSecurityProxy, securityProxy);
144     }
145     
146     /** Getter for property ejbName.
147      * @return Value of property ejbName.
148      */

149     public String JavaDoc getEjbName() {
150         return this.ejbName;
151     }
152     
153 }
154
Popular Tags