KickJava   Java API By Example, From Geeks To Geeks.

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


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  * JCAConnectionFactoryMdl.java
26  *
27  * Created on March 5, 2002, 4:00 PM
28  */

29
30 package com.sun.enterprise.management.model;
31
32 import javax.management.ObjectName JavaDoc;
33 import java.util.Set JavaDoc;
34
35 public class JCAConnectionFactoryMdl extends J2EEManagedObjectMdl {
36
37     private static String JavaDoc MANAGED_OBJECT_TYPE = "JCAConnectionFactory";
38     private String JavaDoc jcaResourceName;
39     private String JavaDoc jcaConnectionFactoryName;
40     private String JavaDoc managedConnFactory;
41     /** Creates new JCAConnectionFactoryMdl */
42     public JCAConnectionFactoryMdl(String JavaDoc jcaResName, String JavaDoc jcaConnFactName, String JavaDoc managedConFact) {
43         super(jcaConnFactName,false,false,false);
44         this.jcaResourceName = jcaResName;
45         this.jcaConnectionFactoryName = jcaConnFactName;
46         this.managedConnFactory = managedConFact;
47     }
48     public JCAConnectionFactoryMdl(String JavaDoc jcaResName, String JavaDoc serverName, String JavaDoc jcaConnFactName, String JavaDoc managedConFact) {
49         super(jcaConnFactName,serverName, false,false,false);
50         this.jcaResourceName = jcaResName;
51         this.jcaConnectionFactoryName = jcaConnFactName;
52         this.managedConnFactory = managedConFact;
53     }
54     
55     /**
56      * The type of the J2EEManagedObject as specified by JSR77. The class that implements a specific type must override this
57      * method and return the appropriate type string.
58      */

59     public String JavaDoc getj2eeType() {
60         return MANAGED_OBJECT_TYPE;
61     }
62     
63     /**
64      * The name of the J2EEManagedObject. All managed objects must have a unique name within the context of the management
65      * domain. The name must not be null.
66      */

67     public String JavaDoc getobjectName() {
68         Set JavaDoc s = findNames("j2eeType="+getj2eeType()+",name="+this.jcaConnectionFactoryName+",JCAResource="+this.getJCAResource()+",J2EEServer="+this.getJ2EEServer());
69         Object JavaDoc [] objs = s.toArray();
70         if (objs.length > 0) {
71             String JavaDoc name = ((ObjectName JavaDoc)objs[0]).toString();
72             return name;
73         } else {
74             return null;
75         }
76     }
77     
78     public String JavaDoc getmanagedConnectionFactory(){
79         Set JavaDoc s = findNames("j2eeType=JCAManagedConnectionFactory,name=" + this.managedConnFactory + ",J2EEServer="+this.getJ2EEServer());
80         Object JavaDoc [] objs = s.toArray();
81         if (objs.length > 0) {
82             String JavaDoc name = ((ObjectName JavaDoc)objs[0]).toString();
83             return name;
84         } else {
85             return null;
86         }
87     }
88     
89     public String JavaDoc getJCAResource(){
90         return this.jcaResourceName;
91     }
92     
93     
94
95 }
96
Popular Tags