KickJava   Java API By Example, From Geeks To Geeks.

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


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 package com.sun.enterprise.management.model;
25
26 import java.util.*;
27 import javax.management.*;
28 import com.sun.enterprise.deployment.EjbBundleDescriptor;
29 import com.sun.enterprise.deployment.WebServicesDescriptor;
30 import com.sun.enterprise.deployment.WebServiceEndpoint;
31 import com.sun.enterprise.management.util.J2EEModuleCallBack;
32
33 public class EJBModuleMdl extends J2EEModuleMdl {
34
35     private static String JavaDoc MANAGED_OBJECT_TYPE = "EJBModule";
36     
37     private String JavaDoc ejbModuleName = null;
38     private String JavaDoc applicationName = null;
39     private boolean hasWebServices=false;
40     private String JavaDoc[] endpointAddresses = null;
41     
42     public EJBModuleMdl(J2EEModuleCallBack module, EjbBundleDescriptor ejbBundle) {
43     super(module);
44     this.ejbModuleName = module.getName() ;
45     this.applicationName = module.getParentName();
46     if(isStandAloneModule(applicationName))
47         this.applicationName = "null";
48     WebServicesDescriptor wsDesc = ejbBundle.getWebServices();
49     if (wsDesc.hasWebServices()) {
50         hasWebServices = true;
51         Vector endpointList = new Vector();
52         for (Iterator endpoints = wsDesc.getEndpoints().iterator();
53             endpoints.hasNext();) {
54         WebServiceEndpoint wse = (WebServiceEndpoint) endpoints.next();
55         endpointList.add(wse.getEndpointAddressUri());
56         }
57         endpointAddresses = new String JavaDoc[endpointList.size()];
58         endpointList.copyInto(endpointAddresses);
59     }
60     }
61  
62     public String JavaDoc[] getejbs() {
63         Set appMods = findNames("EJBModule=" + this.ejbModuleName+",J2EEServer=" + getJ2EEServer()+",J2EEApplication="+this.applicationName);
64         
65         Iterator it = appMods.iterator();
66         String JavaDoc [] mods = new String JavaDoc[appMods.size()];
67         int i =0;
68         while(it.hasNext()) {
69             mods[i++] = ((ObjectName)it.next()).toString();
70         }
71         return mods;
72     }
73     
74     /**
75      * The type of the J2EEManagedObject as specified by JSR77. The class that implements a specific type must override this method and return the appropriate type string.
76      */

77     public String JavaDoc getj2eeType() {
78         return MANAGED_OBJECT_TYPE;
79     }
80     
81     /** Accessor method for the parent key */
82     public String JavaDoc getJ2EEApplication() {
83         return this.applicationName;
84     }
85     
86     public String JavaDoc getModuleName() {
87         return this.ejbModuleName;
88     }
89     
90 }
91
Popular Tags