KickJava   Java API By Example, From Geeks To Geeks.

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


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 WebModuleConfigBean implements DConfigBeanRoot {
35
36     DDBean bean;
37     DepConfig config;
38     Collection children = new HashSet();
39     String JavaDoc WEBAPP = "/";
40     String JavaDoc EJBREF = "web-app/ejb-ref";
41     String JavaDoc RESOURCEREF = "web-app/resource-ref/res-ref-name";
42
43     public WebModuleConfigBean(DDBean bean, DepConfig config) {
44         this.bean = bean; this.config = config;
45     }
46       
47     public DConfigBean getDConfigBean(DDBean dDBean) throws ConfigurationException {
48         DConfigBean ret = null;
49         if(dDBean.getXpath().endsWith(EJBREF))
50             ret = new EjbRefConfigBean(dDBean, config);
51         else if(dDBean.getXpath().endsWith(RESOURCEREF))
52             ret = new ResourceRefConfigBean(dDBean, config);
53         else if (dDBean.getXpath().endsWith(WEBAPP))
54             ret = this;
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[] { WEBAPP, RESOURCEREF, EJBREF };
65
return new String JavaDoc[] { RESOURCEREF, EJBREF };
66     }
67     
68     public void notifyDDChange(XpathEvent xpathEvent) {
69     }
70     
71     public void removeDConfigBean(DConfigBean dConfigBean) throws BeanNotFoundException {
72         children.remove(dConfigBean);
73         propertyChangeSupport.firePropertyChange(dConfigBean.getClass().toString(),dConfigBean,null);
74     }
75     
76       /** Utility field used by bound properties. */
77       private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
78       
79       /** Holds value of property securityDomain. */
80       private String JavaDoc securityDomain;
81       
82       /** Holds value of property contextRoot. */
83       private String JavaDoc contextRoot;
84       
85     public void addPropertyChangeListener(PropertyChangeListener listener) {
86         propertyChangeSupport.addPropertyChangeListener(listener);
87     }
88     
89     public void removePropertyChangeListener(PropertyChangeListener listener) {
90         propertyChangeSupport.removePropertyChangeListener(listener);
91     }
92     
93     /** Getter for property securityDomain.
94      * @return Value of property securityDomain.
95      */

96     public String JavaDoc getSecurityDomain() {
97         return this.securityDomain;
98     }
99     
100     /** Setter for property securityDomain.
101      * @param securityDomain New value of property securityDomain.
102      */

103     public void setSecurityDomain(String JavaDoc securityDomain) {
104         String JavaDoc oldSecurityDomain = this.securityDomain;
105         this.securityDomain = securityDomain;
106         propertyChangeSupport.firePropertyChange("securityDomain", oldSecurityDomain, securityDomain);
107     }
108     
109     /** Getter for property contextRoot.
110      * @return Value of property contextRoot.
111      *
112      */

113     public String JavaDoc getContextRoot() {
114         return this.contextRoot;
115     }
116     
117     /** Setter for property contextRoot.
118      * @param contextRoot New value of property contextRoot.
119      *
120      */

121     public void setContextRoot(String JavaDoc contextRoot) {
122         this.contextRoot = contextRoot;
123     }
124     
125     public DConfigBean getDConfigBean(DDBeanRoot dDBeanRoot) {
126         return null;
127     }
128     
129 }
130
Popular Tags