KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > MockDDBean


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 package org.netbeans.modules.j2ee.sun.share.configbean;
21
22 import java.util.Map JavaDoc;
23 import java.util.HashMap JavaDoc;
24 /**
25  *
26  * @author vkraemer
27  */

28 public class MockDDBean implements javax.enterprise.deploy.model.DDBean JavaDoc {
29     
30     private String JavaDoc xpath = null;
31     /** Creates a new instance of MockDDBean */
32
33     private static int instanceCounter = 0;
34     private int instanceVal = 0;
35     public MockDDBean() {
36         instanceVal = instanceCounter++;
37     }
38     
39     public void addXpathListener(String JavaDoc xpath, javax.enterprise.deploy.model.XpathListener JavaDoc xpl) {
40     }
41     
42     public String JavaDoc[] getAttributeNames() {
43         return new String JavaDoc[0];
44     }
45     
46     public String JavaDoc getAttributeValue(String JavaDoc attrName) {
47         return null;
48     }
49     
50     public javax.enterprise.deploy.model.DDBean JavaDoc[] getChildBean(String JavaDoc xpath) {
51         javax.enterprise.deploy.model.DDBean JavaDoc[] retVal =
52             new javax.enterprise.deploy.model.DDBean JavaDoc[1];
53         MockDDBean mock = new MockDDBean();
54         mock.setXpath(xpath);
55         retVal[0] = mock;
56         return retVal;
57     }
58     
59     public String JavaDoc getId() {
60         return null;
61     }
62     
63     javax.enterprise.deploy.model.DDBeanRoot JavaDoc ddbr;
64     
65     public void setRoot(javax.enterprise.deploy.model.DDBeanRoot JavaDoc ddbr) {
66         this.ddbr = ddbr;
67     }
68     
69     public javax.enterprise.deploy.model.DDBeanRoot JavaDoc getRoot() {
70         return ddbr;
71     }
72     
73     public String JavaDoc getText() {
74         return "mockDDBean_"+instanceVal+"_textVal";
75     }
76     
77 /* public String[] getText(String xpath) {
78         return new String[0];
79     }
80 */

81     public void setXpath(String JavaDoc xpath) {
82         this.xpath = xpath;
83     }
84     
85     public String JavaDoc getXpath() {
86         return xpath;
87     }
88     
89     private Map JavaDoc pairs = new HashMap JavaDoc();
90     
91     public void setText(Map JavaDoc pairs) {
92         this.pairs = pairs;
93     }
94     
95     public String JavaDoc[] getText(String JavaDoc key) {
96         return (String JavaDoc[]) pairs.get(key);
97     }
98         
99     
100     public void removeXpathListener(String JavaDoc xpath, javax.enterprise.deploy.model.XpathListener JavaDoc xpl) {
101     }
102     
103 }
104
Popular Tags