KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > management > j2ee > J2EEModule


1 /*
2  * JBoss, Home of Professional Open Source
3  * Copyright 2005, JBoss Inc., and individual contributors as indicated
4  * by the @authors tag. See the copyright.txt in the distribution for a
5  * full listing of individual contributors.
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation; either version 2.1 of
10  * the License, or (at your option) any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this software; if not, write to the Free
19  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21  */

22 package org.jboss.management.j2ee;
23
24 import javax.management.MalformedObjectNameException JavaDoc;
25 import javax.management.ObjectName JavaDoc;
26 import java.security.InvalidParameterException JavaDoc;
27 import java.util.ArrayList JavaDoc;
28 import java.util.Arrays JavaDoc;
29 import java.util.List JavaDoc;
30
31 /**
32  * Root class of the JBoss JSR-77 implementation of J2EEModule.
33  *
34  * @author <a HREF="mailto:andreas@jboss.org">Andreas Schaefer</a>
35  * @author <a HREF="mailto:scott.stark@jboss.org">Scott Stark</a>
36  * @author <a HREF="mailto:thomas.diesler@jboss.org">Thomas Diesler</a>
37  * @version $Revision: 40550 $
38  */

39 public abstract class J2EEModule extends J2EEDeployedObject
40    implements J2EEModuleMBean
41 {
42    // Attributes ----------------------------------------------------
43

44    // list of object names as strings
45
private List JavaDoc mJVMs = new ArrayList JavaDoc();
46
47    // Constructors --------------------------------------------------
48

49    /**
50     * Constructor taking the Name of this Object
51     *
52     * @param pName Name to be set which must not be null
53     * @param pParent Object Name of its parent which can either
54     * be a J2EEApplication or J2EEServer if a
55     * standalone module (not packed into an EAR file)
56     * @param pDeploymentDescriptor
57     * @throws InvalidParameterException If the given Name is null
58     */

59    public J2EEModule(String JavaDoc pType,
60                      String JavaDoc pName,
61                      ObjectName JavaDoc pParent,
62                      String JavaDoc[] pJVMs,
63                      String JavaDoc pDeploymentDescriptor)
64            throws
65            MalformedObjectNameException JavaDoc,
66            InvalidParentException
67    {
68       super(pType, pName, pParent, pDeploymentDescriptor);
69       mJVMs = new ArrayList JavaDoc(Arrays.asList(pJVMs == null ? new String JavaDoc[0] : pJVMs));
70    }
71
72    // Public --------------------------------------------------------
73

74    /**
75     * @jmx:managed-attribute
76     */

77    public String JavaDoc[] getjavaVMs()
78    {
79       return (String JavaDoc[]) mJVMs.toArray(new String JavaDoc[mJVMs.size()]);
80    }
81
82    /**
83     * @jmx:managed-operation
84     */

85    public String JavaDoc getjavaVM(int pIndex)
86    {
87       if (pIndex >= 0 && pIndex < mJVMs.size())
88       {
89          return (String JavaDoc) mJVMs.get(pIndex);
90       }
91       else
92       {
93          return null;
94       }
95    }
96 }
97
Popular Tags