KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > model > JCAResourceMdl


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
24 /*
25  * JCAResource.java
26  *
27  * Created on March 5, 2002, 3:58 PM
28  */

29
30 package com.sun.enterprise.management.model;
31
32 import java.util.Set JavaDoc;
33 import java.util.Iterator JavaDoc;
34 import javax.management.ObjectName JavaDoc;
35
36 public class JCAResourceMdl extends J2EEResourceMdl {
37
38     private static String JavaDoc MANAGED_OBJECT_TYPE = "JCAResource";
39     /** Creates new JCAResource */
40     String JavaDoc resourceAdapter = null;
41     String JavaDoc username = null;
42     String JavaDoc password = null;
43     String JavaDoc[] propNames = null;
44     String JavaDoc[] propValues = null;
45                         
46     public JCAResourceMdl(String JavaDoc name, String JavaDoc raName,
47                             String JavaDoc username, String JavaDoc password,
48                             String JavaDoc[] propNames, String JavaDoc[] propValues) {
49         super(name);
50         resourceAdapter = raName;
51         this.username = username;
52         this.password = password;
53         this.propNames = propNames;
54         this.propValues = propValues;
55     }
56     public JCAResourceMdl(String JavaDoc name, String JavaDoc serverName, String JavaDoc raName,
57                             String JavaDoc username, String JavaDoc password,
58                             String JavaDoc[] propNames, String JavaDoc[] propValues) {
59         super(name, serverName);
60         resourceAdapter = raName;
61         this.username = username;
62         this.password = password;
63         this.propNames = propNames;
64         this.propValues = propValues;
65     }
66     
67     /**
68      * The type of the J2EEManagedObject as specified by JSR77. The class that implements a specific type must override this
69      * method and return the appropriate type string.
70      */

71     public String JavaDoc getj2eeType() {
72         return MANAGED_OBJECT_TYPE;
73     }
74     
75     public String JavaDoc[] getconnectionFactories(){
76         Set JavaDoc s = findNames("j2eeType=JCAConnectionFactory,J2EEServer="+ this.getJ2EEServer() + ",JCAResource=" + getname());
77         Iterator JavaDoc it = s.iterator();
78         String JavaDoc [] ret = new String JavaDoc[s.size()];
79         int i =0;
80         while(it.hasNext()) {
81             ret[i++] = ((ObjectName JavaDoc)it.next()).toString();
82         }
83         return ret;
84     }
85     
86     public String JavaDoc getresourceAdapter() {
87         return resourceAdapter;
88     }
89
90     public String JavaDoc getusername() {
91         return username;
92     }
93
94     public String JavaDoc getpassword() {
95         return password;
96     }
97
98     public String JavaDoc[] getpropNames() {
99         return propNames;
100     }
101
102     public String JavaDoc[] getpropValues() {
103         return propValues;
104     }
105 }
106
Popular Tags