User: schaefera Date: 01/11/19 23:01:39 Modified: src/main/org/jboss/management/j2ee ConnectorModule.java EjbModule.java EntityBean.java IpAddress.java J2EEApplication.java J2EEDeployedObject.java J2EEManagedObject.java J2EEModule.java J2EEResource.java JDBC.java JDBCConnection.java JDBCConnectionPool.java JDBCDataSource.java JNDI.java JVM.java JavaMail.java MessageDrivenBean.java Node.java Port.java StatefulSessionBean.java StatelessSessionBean.java WebModule.java Added: src/main/org/jboss/management/j2ee InvalidParentException.java J2EEApplicationMBean.java J2EEManagedObjectMBean.java J2EEManagement.java J2EEManagementMBean.java J2EEServer.java J2EEServerMBean.java SingleJBossServerManagement.java WrapperException.java Log: Adjustment of JBossMGT to the changes in JSR-77 and a first real implementation of JSR-77 (managmeent domain and single JBoss server). Revision Changes Path 1.2 +12 -3 jboss/src/main/org/jboss/management/j2ee/ConnectorModule.java Index: ConnectorModule.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/ConnectorModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ConnectorModule.java 2001/08/09 06:30:58 1.1 +++ ConnectorModule.java 2001/11/20 07:01:39 1.2 @@ -10,6 +10,9 @@ import java.util.ArrayList; import java.util.List; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.J2EEApplication; import javax.management.j2ee.J2EEServer; import javax.management.j2ee.JVM; @@ -22,7 +25,7 @@ * JBoss specific implementation. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ */ public class ConnectorModule extends J2EEModule @@ -46,12 +49,18 @@ * * @throws InvalidParameterException If the given Name is null **/ - public ConnectorModule( String pName, String pDeploymentDescriptor, J2EEApplication[] pApplications, J2EEServer[] pServer, JVM pJVM, ResourceAdapter[] pAdapters ) { - super( pName, pDeploymentDescriptor, pApplications, pServer, pJVM ); + public ConnectorModule( String pName, ObjectName pApplication, String pDeploymentDescriptor ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "ConnectorModule", pName, pApplication, pDeploymentDescriptor ); +/* if( pAdapters == null || pAdapters.length == 0 ) { throw new InvalidParameterException( "Resource Adapters may not be null or empty" ); } mResourceAdapters = new ArrayList( Arrays.asList( pAdapters ) ); +*/ } // ------------------------------------------------------------------------- 1.2 +12 -3 jboss/src/main/org/jboss/management/j2ee/EjbModule.java Index: EjbModule.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/EjbModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- EjbModule.java 2001/08/09 06:30:58 1.1 +++ EjbModule.java 2001/11/20 07:01:39 1.2 @@ -10,6 +10,9 @@ import java.util.ArrayList; import java.util.List; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.EJB; import javax.management.j2ee.J2EEApplication; import javax.management.j2ee.J2EEServer; @@ -22,7 +25,7 @@ * JBoss specific implementation. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ */ public class EjbModule extends J2EEModule @@ -46,12 +49,18 @@ * * @throws InvalidParameterException If the given Name is null **/ - public EjbModule( String pName, String pDeploymentDescriptor, J2EEApplication[] pApplications, J2EEServer[] pServer, JVM pJVM, EJB[] pEJBs ) { - super( pName, pDeploymentDescriptor, pApplications, pServer, pJVM ); + public EjbModule( String pName, ObjectName pApplication, String pDeploymentDescriptor ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "EjbModule", pName, pApplication, pDeploymentDescriptor ); +/* if( pEJBs == null || pEJBs.length == 0 ) { throw new InvalidParameterException( "EJB list may not be null or empty" ); } mEJBs = new ArrayList( Arrays.asList( pEJBs ) ); +*/ } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/EntityBean.java Index: EntityBean.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/EntityBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- EntityBean.java 2001/08/09 06:30:58 1.1 +++ EntityBean.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public EntityBean( String pName ) { - super( pName ); + public EntityBean( String pName, ObjectName pEJBModule ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "EntityBean", pName, pEJBModule ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/IpAddress.java Index: IpAddress.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/IpAddress.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IpAddress.java 2001/08/09 06:30:58 1.1 +++ IpAddress.java 2001/11/20 07:01:39 1.2 @@ -8,6 +8,9 @@ import java.security.InvalidParameterException; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.Port; /** @@ -30,8 +33,12 @@ /** * @throws InvalidParameterException If given list is null or empty **/ - public IpAddress( String pName, String pAddress ){ - super( pName ); + public IpAddress( String pName, ObjectName pNode, String pAddress ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "IpAddress", pName, pNode ); if( pAddress == null || pAddress.length() == 0 ) { throw new InvalidParameterException( "There driver must always be defined" ); } 1.2 +18 -20 jboss/src/main/org/jboss/management/j2ee/J2EEApplication.java Index: J2EEApplication.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEApplication.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEApplication.java 2001/08/09 06:30:58 1.1 +++ J2EEApplication.java 2001/11/20 07:01:39 1.2 @@ -11,18 +11,19 @@ import java.util.ArrayList; import java.util.List; -import javax.management.j2ee.J2EEServer; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; /** * This class is the connection between the JSR and the * JBoss specific implementation. * -* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.1 $ +* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schafer</a> +* @version $Revision: 1.2 $ */ public class J2EEApplication extends J2EEDeployedObject - implements javax.management.j2ee.J2EEApplication + implements J2EEApplicationMBean { // ------------------------------------------------------------------------- // Members @@ -42,34 +43,31 @@ * * @throws InvalidParameterException If the given Name is null **/ - public J2EEApplication( String pName, String pDeploymentDescriptor, J2EEModule[] pModules ) { - super( pName, pDeploymentDescriptor ); - if( pModules == null || pModules.length == 0 ) { - throw new InvalidParameterException( "At least one modules must be added to the application" ); - } - mModules = new ArrayList( Arrays.asList( pModules ) ); + public J2EEApplication( String pName, ObjectName pServer, String pDeploymentDescriptor ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "J2EEApplication", pName, pServer, pDeploymentDescriptor ); } // Public -------------------------------------------------------- - public javax.management.j2ee.J2EEModule[] getModules() { - return (J2EEModule[]) mModules.toArray( new J2EEModule[ 0 ] ); + public ObjectName[] getModules() { + return (ObjectName[]) mModules.toArray( new ObjectName[ 0 ] ); } - public javax.management.j2ee.J2EEModule getModule( int pIndex ) { + public ObjectName getModule( int pIndex ) { if( pIndex >= 0 && pIndex < mModules.size() ) - { - return (J2EEModule) mModules.get( pIndex ); - } - else { - return null; + return (ObjectName) mModules.get( pIndex ); } + return null; } public String toString() { - return "J2EEApplication [ " + - ", Modules: " + mModules + + return "J2EEApplication { " + super.toString() + " } [ " + + "modules: " + mModules + " ]"; } 1.2 +22 -4 jboss/src/main/org/jboss/management/j2ee/J2EEDeployedObject.java Index: J2EEDeployedObject.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEDeployedObject.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEDeployedObject.java 2001/08/09 06:30:58 1.1 +++ J2EEDeployedObject.java 2001/11/20 07:01:39 1.2 @@ -1,6 +1,9 @@ package org.jboss.management.j2ee; -public class J2EEDeployedObject +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + +public abstract class J2EEDeployedObject extends J2EEManagedObject implements javax.management.j2ee.J2EEDeployedObject { @@ -22,8 +25,17 @@ * * @throws InvalidParameterException If the given Name is null **/ - public J2EEDeployedObject( String pName, String pDeploymentDescriptor ) { - super( pName ); + public J2EEDeployedObject( + String pType, + String pName, + ObjectName pParent, + String pDeploymentDescriptor + ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( pType, pName, pParent ); mDeploymentDescriptor = pDeploymentDescriptor; } @@ -33,6 +45,12 @@ public String getDeploymentDescriptor() { return mDeploymentDescriptor; + } + + public String toString() { + return "J2EEDeployedObject { " + super.toString() + " } [ " + + "deployment descriptor: " + mDeploymentDescriptor + + " ]"; } - + } 1.2 +136 -21 jboss/src/main/org/jboss/management/j2ee/J2EEManagedObject.java Index: J2EEManagedObject.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEManagedObject.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEManagedObject.java 2001/08/09 06:30:58 1.1 +++ J2EEManagedObject.java 2001/11/20 07:01:39 1.2 @@ -8,38 +8,110 @@ import java.io.Serializable; import java.security.InvalidParameterException; +import java.util.Hashtable; +import javax.management.JMException; +import javax.management.MalformedObjectNameException; +import javax.management.MBeanServer; +import javax.management.ObjectName; + import javax.management.j2ee.EventProvider; import javax.management.j2ee.StateManageable; import javax.management.j2ee.StatisticsProvider; +import org.jboss.system.ServiceMBeanSupport; + /** * JBoss specific implementation. * * @author Marc Fleury **/ public abstract class J2EEManagedObject + extends ServiceMBeanSupport implements javax.management.j2ee.J2EEManagedObject, Serializable { // ------------------------------------------------------------------------- + // Static + // ------------------------------------------------------------------------- + + private static String sDomainName = null; +// protected static MBeanServer sServer = null; + + public static String getDomainName() { + return sDomainName; + } + +/* + public static MBeanServer getServer() { + return sServer; + } +*/ + + // ------------------------------------------------------------------------- // Members // ------------------------------------------------------------------------- - private String name = null; + private ObjectName mParent = null; + private ObjectName mName = null; // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- /** - * Constructor taking the Name of this Object + * Constructor for the root J2EEManagement object * - * @param pName Name to be set which must not be null + * @param pDomainName Name of the domain + * @param pType Type of the Managed Object which must be defined + * @param pName Name of the Managed Object which must be defined * - * @throws InvalidParameterException If the given Name is null + * @throws InvalidParameterException If the given Domain Name, Type or Name is null **/ - public J2EEManagedObject( String pName ) { - setName( pName ); + public J2EEManagedObject( String pDomainName, String pType, String pName ) + throws + MalformedObjectNameException + { + if( pDomainName == null ) { + throw new InvalidParameterException( "Domain Name must be set" ); + } + sDomainName = pDomainName; + Hashtable lProperties = new Hashtable(); + lProperties.put( "type", pType ); + lProperties.put( "name", pName ); + mName = new ObjectName( getDomainName(), lProperties ); + System.out.println( "J2EEManagedObject(), create root with name: " + mName ); + } + + /** + * Constructor for any Managed Object except the root J2EEMangement. + * + * @param pType Type of the Managed Object which must be defined + * @param pName Name of the Managed Object which must be defined + * @param pParent Object Name of the parent of this Managed Object + * which must be defined + * + * @throws InvalidParameterException If the given Type, Name or Parent is null + **/ + public J2EEManagedObject( String pType, String pName, ObjectName pParent ) + throws + MalformedObjectNameException, + InvalidParentException + { + try { + Hashtable lProperties = pParent.getKeyPropertyList(); + System.out.println( "J2EEManagedObject(), parent properties: " + lProperties ); + System.out.println( "J2EEManagedObject(), parent type: " + lProperties.get( "type" ) ); + System.out.println( "J2EEManagedObject(), parent name: " + lProperties.get( "name" ) ); + lProperties.put( lProperties.get( "type" ), lProperties.get( "name" ) ); + lProperties.put( "type", pType ); + lProperties.put( "name", pName ); + mName = new ObjectName( getDomainName(), lProperties ); + System.out.println( "J2EEManagedObject(), properties: " + lProperties ); + setParent( pParent ); + } + catch( Exception e ) { + e.printStackTrace(); + } } // ------------------------------------------------------------------------- @@ -47,22 +119,16 @@ // ------------------------------------------------------------------------- public String getName() { - return name; + return mName.toString(); + } + + public ObjectName getObjectName() { + System.out.println( "J2EEManagedObject.getObjectName(), name: " + mName ); + return mName; } - /** - * Set the name of the J2EEManagedObject. All objects of this type must have a - * name. The name must not be null. - * - * @param pName New Name to be set - * - * @throws InvalidParameterException If the given Name is null - **/ - public void setName( String pName ) - throws - InvalidParameterException - { - name = pName; + public ObjectName getObjectName( MBeanServer pServer, ObjectName pName ) { + return getObjectName(); } public boolean isStateManageable() { @@ -76,5 +142,54 @@ public boolean isEventProvider() { return this instanceof EventProvider; } - + + public String toString() { + return "J2EEManagedObject [ name: " + mName + ", parent: " + mParent + " ];"; + } + + public ObjectName getParent() { + return mParent; + } + + public void setParent( ObjectName pParent ) + throws + InvalidParentException + { + if( pParent == null ) { + throw new InvalidParameterException( "Parent must be set" ); + } + mParent = pParent; + } + + public void postRegister( java.lang.Boolean pRegistrationDone ) { + super.postRegister( pRegistrationDone ); + System.out.println( "J2EEManagedObject.postRegister(), parent: " + mParent ); + if( pRegistrationDone.booleanValue() && mParent != null ) { + try { + // Notify the parent about its new child + getServer().invoke( + mParent, + "addChild", + new Object[] { mName }, + new String [] { ObjectName.class.getName() } + ); + } + catch( JMException jme ) { + jme.printStackTrace(); +/* + throw new InvalidParentException( + "Problem to notify the parent about its new child", + jme + ); +*/ + } + } + } + + public void addChild( ObjectName pChild ) { + //AS ToDo: Remove later is just here to compile + } + public void removeChild( ObjectName pChild ) { + //AS ToDo: Remove later is just here to compile + } } 1.2 +19 -4 jboss/src/main/org/jboss/management/j2ee/J2EEModule.java Index: J2EEModule.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEModule.java 2001/08/09 06:30:58 1.1 +++ J2EEModule.java 2001/11/20 07:01:39 1.2 @@ -11,18 +11,22 @@ import java.util.Arrays; import java.util.List; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.J2EEApplication; import javax.management.j2ee.J2EEServer; import javax.management.j2ee.JVM; + /** * This class is the connection between the JSR and the * JBoss specific implementation. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ */ -public class J2EEModule +public abstract class J2EEModule extends J2EEDeployedObject implements javax.management.j2ee.J2EEModule { @@ -42,8 +46,18 @@ * * @throws InvalidParameterException If the given Name is null **/ - public J2EEModule( String pName, String pDeploymentDescriptor, J2EEApplication[] pApplications, J2EEServer[] pServer, JVM pJVM ) { - super( pName, pDeploymentDescriptor ); + public J2EEModule( + String pType, + String pName, + ObjectName pApplication, + String pDeploymentDescriptor + ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( pType, pName, pApplication, pDeploymentDescriptor ); +/* if( pApplications == null || pApplications.length == 0 ) { throw new InvalidParameterException( "At least one applications must be set at the module" ); } @@ -52,6 +66,7 @@ mServers = new ArrayList( Arrays.asList( pServer ) ); } mJVM = pJVM; +*/ } // Public -------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/J2EEResource.java Index: J2EEResource.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEResource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- J2EEResource.java 2001/08/09 06:30:58 1.1 +++ J2EEResource.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public J2EEResource( String pName ) { - super( pName ); + public J2EEResource( String pType, String pName, ObjectName pServer ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( pType, pName, pServer ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/JDBC.java Index: JDBC.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JDBC.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBC.java 2001/08/09 06:30:58 1.1 +++ JDBC.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.JDBCConnection; /** @@ -30,8 +33,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public JDBC( String pName, JDBCConnection[] pConnections ) { - super( pName ); + public JDBC( String pName, ObjectName pServer, JDBCConnection[] pConnections ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "JDBC", pName, pServer ); if( pConnections == null ) { mConnections = new JDBCConnection[ 0 ]; } 1.2 +10 -3 jboss/src/main/org/jboss/management/j2ee/JDBCConnection.java Index: JDBCConnection.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JDBCConnection.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCConnection.java 2001/08/09 06:30:58 1.1 +++ JDBCConnection.java 2001/11/20 07:01:39 1.2 @@ -8,12 +8,15 @@ import java.security.InvalidParameterException; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.JDBCDataSource; /** * @author Marc Fleury **/ -public class JDBCConnection +public abstract class JDBCConnection extends J2EEManagedObject implements javax.management.j2ee.JDBCConnection { @@ -33,8 +36,12 @@ * * @throws InvalidParameterException If given driver is null **/ - public JDBCConnection( String pName, JDBCDataSource pDriver ) { - super( pName ); + public JDBCConnection( String pType, String pName, ObjectName pServer, JDBCDataSource pDriver ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( pType, pName, pServer ); if( pDriver == null ) { throw new InvalidParameterException( "There driver must always be defined" ); } 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/JDBCConnectionPool.java Index: JDBCConnectionPool.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JDBCConnectionPool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCConnectionPool.java 2001/08/09 06:30:58 1.1 +++ JDBCConnectionPool.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.JDBCDataSource; /** @@ -29,8 +32,12 @@ * * @throws InvalidParameterException If given driver is null **/ - public JDBCConnectionPool( String pName, JDBCDataSource pDriver ) { - super( pName, pDriver ); + public JDBCConnectionPool( String pName, ObjectName pServer, JDBCDataSource pDriver ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "J2EEConnectionPool", pName, pServer, pDriver ); } // ------------------------------------------------------------------------- 1.2 +10 -3 jboss/src/main/org/jboss/management/j2ee/JDBCDataSource.java Index: JDBCDataSource.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JDBCDataSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JDBCDataSource.java 2001/08/09 06:30:58 1.1 +++ JDBCDataSource.java 2001/11/20 07:01:39 1.2 @@ -6,12 +6,15 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ **/ public class JDBCDataSource extends J2EEManagedObject @@ -30,8 +33,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public JDBCDataSource( String pName ) { - super( pName ); + public JDBCDataSource( String pName, ObjectName pServer ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "JDBCDataSource", pName, pServer ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/JNDI.java Index: JNDI.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JNDI.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JNDI.java 2001/08/09 06:30:58 1.1 +++ JNDI.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public JNDI( String pName ) { - super( pName ); + public JNDI( String pName, ObjectName pServer ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "JNDI", pName, pServer ); } // ------------------------------------------------------------------------- 1.2 +9 -3 jboss/src/main/org/jboss/management/j2ee/JVM.java Index: JVM.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JVM.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JVM.java 2001/08/09 06:30:58 1.1 +++ JVM.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.Node; /** @@ -33,12 +36,15 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public JVM( String pName, String pClasspath, String pJavaVendor, String pJavaVersion, Node pNode ) { - super( pName ); + public JVM( String pName, ObjectName pNode, String pClasspath, String pJavaVendor, String pJavaVersion ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "JVM", pName, pNode ); mClasspath = pClasspath; mJavaVendor = pJavaVendor; mJavaVersion = pJavaVersion; - mNode = pNode; } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/JavaMail.java Index: JavaMail.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/JavaMail.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- JavaMail.java 2001/08/09 06:30:58 1.1 +++ JavaMail.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public JavaMail( String pName ) { - super( pName ); + public JavaMail( String pName, ObjectName pServer ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "JavaMail", pName, pServer ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/MessageDrivenBean.java Index: MessageDrivenBean.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/MessageDrivenBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MessageDrivenBean.java 2001/08/09 06:30:58 1.1 +++ MessageDrivenBean.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.EJB; /** @@ -28,8 +31,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public MessageDrivenBean( String pName ) { - super( pName ); + public MessageDrivenBean( String pName, ObjectName pApplication ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "MessageDrivenBean", pName, pApplication ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/Node.java Index: Node.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/Node.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Node.java 2001/08/09 06:30:58 1.1 +++ Node.java 2001/11/20 07:01:39 1.2 @@ -8,6 +8,9 @@ import java.security.InvalidParameterException; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.IpAddress; import javax.management.j2ee.JVM; @@ -40,8 +43,12 @@ * * @throws InvalidParameterException If list of IPAddresses or Java VMs is null or empty **/ - public Node( String pName, String pHardwareType, String pOsType, JVM[] pJavaVMs, IpAddress[] pIpAddresses ) { - super( pName ); + public Node( String pName, ObjectName pServer, String pHardwareType, String pOsType, JVM[] pJavaVMs, IpAddress[] pIpAddresses ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "Node", pName, pServer ); hardwareType = pHardwareType; if( pIpAddresses == null || pIpAddresses.length == 0 ) { throw new InvalidParameterException( "There must always be at least one IpAddress defined" ); 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/Port.java Index: Port.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/Port.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Port.java 2001/08/09 06:30:58 1.1 +++ Port.java 2001/11/20 07:01:39 1.2 @@ -9,6 +9,9 @@ import java.security.InvalidParameterException; import java.util.Arrays; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.IpAddress; public class Port @@ -29,8 +32,12 @@ /** * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public Port( String pName, int pPort, IpAddress[] pIpAddresses ) { - super( pName ); + public Port( String pName, ObjectName pIpAddress, int pPort, IpAddress[] pIpAddresses ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "IpAddress", pName, pIpAddress ); mPort = pPort; if( pIpAddresses == null || pIpAddresses.length == 0 ) { throw new InvalidParameterException( "At least one IP Addresses must be defined" ); 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/StatefulSessionBean.java Index: StatefulSessionBean.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/StatefulSessionBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StatefulSessionBean.java 2001/08/09 06:30:58 1.1 +++ StatefulSessionBean.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public StatefulSessionBean( String pName ) { - super( pName ); + public StatefulSessionBean( String pName, ObjectName pEjbModule ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "StatefulSessionBean", pName, pEjbModule ); } // ------------------------------------------------------------------------- 1.2 +9 -2 jboss/src/main/org/jboss/management/j2ee/StatelessSessionBean.java Index: StatelessSessionBean.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/StatelessSessionBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- StatelessSessionBean.java 2001/08/09 06:30:58 1.1 +++ StatelessSessionBean.java 2001/11/20 07:01:39 1.2 @@ -6,6 +6,9 @@ */ package org.jboss.management.j2ee; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + /** * @author Marc Fleury **/ @@ -26,8 +29,12 @@ * * @throws InvalidParameterException If list of nodes or ports was null or empty **/ - public StatelessSessionBean( String pName ) { - super( pName ); + public StatelessSessionBean( String pName, ObjectName pEjbModule ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "StatelessSessionBean", pName, pEjbModule ); } // ------------------------------------------------------------------------- 1.2 +10 -3 jboss/src/main/org/jboss/management/j2ee/WebModule.java Index: WebModule.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/WebModule.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- WebModule.java 2001/08/09 06:30:58 1.1 +++ WebModule.java 2001/11/20 07:01:39 1.2 @@ -10,6 +10,9 @@ import java.util.ArrayList; import java.util.List; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectName; + import javax.management.j2ee.J2EEApplication; import javax.management.j2ee.J2EEServer; import javax.management.j2ee.JVM; @@ -22,7 +25,7 @@ * JBoss specific implementation. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> -* @version $Revision: 1.1 $ +* @version $Revision: 1.2 $ */ public class WebModule extends J2EEModule @@ -46,8 +49,12 @@ * * @throws InvalidParameterException If the given Name is null **/ - public WebModule( String pName, String pDeploymentDescriptor, J2EEApplication[] pApplications, J2EEServer[] pServer, JVM pJVM, Servlet[] pServlets ) { - super( pName, pDeploymentDescriptor, pApplications, pServer, pJVM ); + public WebModule( String pName, ObjectName pApplication, String pDeploymentDescriptor, J2EEApplication[] pApplications, J2EEServer[] pServer, JVM pJVM, Servlet[] pServlets ) + throws + MalformedObjectNameException, + InvalidParentException + { + super( "WebModule", pName, pApplication, pDeploymentDescriptor ); if( pServlets == null || pServlets.length == 0 ) { throw new InvalidParameterException( "Servlet list may not be null or empty" ); } 1.1 jboss/src/main/org/jboss/management/j2ee/InvalidParentException.java Index: InvalidParentException.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.management.j2ee; /** * Exception thrown when a given parent has either a * wrong ObjectName, is not available or could not be * reached. * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> * @version $Revision: 1.1 $ **/ public class InvalidParentException extends WrapperException { public InvalidParentException( String pMessage, Throwable pThrowable ) { super( pMessage, pThrowable ); } } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEApplicationMBean.java Index: J2EEApplicationMBean.java =================================================================== package org.jboss.management.j2ee; import javax.management.j2ee.J2EEApplication; /** * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public interface J2EEApplicationMBean extends J2EEApplication { } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEManagedObjectMBean.java Index: J2EEManagedObjectMBean.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.management.j2ee; import java.io.Serializable; import java.security.InvalidParameterException; import java.util.Hashtable; import javax.management.ObjectName; import javax.management.j2ee.J2EEManagedObject; import org.jboss.system.Service; /** * JBoss specific implementation. * * @author Marc Fleury **/ public interface J2EEManagedObjectMBean extends J2EEManagedObject, Service { // ------------------------------------------------------------------------- // Static // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // Properties (Getters/Setters) // ------------------------------------------------------------------------- public ObjectName getObjectName(); public ObjectName getParent(); public void setParent( ObjectName pParent ) throws InvalidParentException; public void addChild( ObjectName pChild ); public void removeChild( ObjectName pChild ); } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEManagement.java Index: J2EEManagement.java =================================================================== package org.jboss.management.j2ee; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.List; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * Is the entry point of all managed objects in the management * domain. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public class J2EEManagement extends J2EEManagedObject implements J2EEManagementMBean { // ------------------------------------------------------------------------- // Members // ------------------------------------------------------------------------- private List mApplications = new ArrayList(); private List mDeployments = new ArrayList(); private List mServers = new ArrayList(); // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- public J2EEManagement( String pDomainName ) throws MalformedObjectNameException, InvalidParentException { super( pDomainName, "J2EEManagement", "Manager" ); } // ------------------------------------------------------------------------- // Properties (Getters/Setters) // ------------------------------------------------------------------------- public ObjectName[] getApplications() { return (ObjectName[]) mApplications.toArray( new ObjectName[ 0 ] ); } public ObjectName getApplication( int pIndex ) { if( pIndex >= 0 && pIndex < mApplications.size() ) { return (ObjectName) mApplications.get( pIndex ); } return null; } public ObjectName[] getDeployments() { return (ObjectName[]) mDeployments.toArray( new ObjectName[ 0 ] ); } public ObjectName getDeployment( int pIndex ) { if( pIndex >= 0 && pIndex < mDeployments.size() ) { return (ObjectName) mDeployments.get( pIndex ); } return null; } public ObjectName[] getServers() { return (ObjectName[]) mServers.toArray( new ObjectName[ 0 ] ); } public ObjectName getServer( int pIndex ) { if( pIndex >= 0 && pIndex < mServers.size() ) { return (ObjectName) mServers.get( pIndex ); } return null; } public String toString() { return "J2EEManagement { " + super.toString() + " } [ " + "applications: " + mApplications + ", deployements: " + mDeployments + ", servers: " + mServers + " ]"; } public void addChild( ObjectName pChild ) { Hashtable lProperties = pChild.getKeyPropertyList(); String lType = lProperties.get( "type" ) + ""; if( "J2EEApplication".equals( lType ) ) { mApplications.add( pChild ); } else if( "J2EEDeployments".equals( lType ) ) { mDeployments.add( pChild ); } else if( "J2EEServer".equals( lType ) ) { mServers.add( pChild ); } } public void removeChild( ObjectName pChild ) { //AS ToDo } } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEManagementMBean.java Index: J2EEManagementMBean.java =================================================================== package org.jboss.management.j2ee; import javax.management.j2ee.J2EEManagement; /** * Is the entry point of all managed objects in the management * domain. * * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a> * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public interface J2EEManagementMBean extends J2EEManagement, J2EEManagedObjectMBean { } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEServer.java Index: J2EEServer.java =================================================================== package org.jboss.management.j2ee; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; /** * Is the access point to management information for a single J2EE Server * Core implementation representing a logical core server of one instance * of a J2EE platform product. * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public class J2EEServer extends J2EEManagedObject implements J2EEServerMBean { // ------------------------------------------------------------------------- // Members // ------------------------------------------------------------------------- private List mApplications = new ArrayList(); private List mResources = new ArrayList(); private List mNodes = new ArrayList(); private List mPorts = new ArrayList(); private List mJVMs = new ArrayList(); private String mJ2eeVendor = null; // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- public J2EEServer( String pName, ObjectName pDomain ) throws MalformedObjectNameException, InvalidParentException { super( "J2EEServer", pName, pDomain ); } public J2EEServer( String pName, ObjectName pDomain, ObjectName[] pApplications, ObjectName[] pResources, ObjectName[] pNodes, ObjectName[] pPorts, ObjectName[] pJVMs, String pJ2eeVendor ) throws MalformedObjectNameException, InvalidParentException { super( "J2EEServer", pName, pDomain ); mApplications.addAll( Arrays.asList( pApplications ) ); mResources.addAll( Arrays.asList( pResources ) ); mNodes.addAll( Arrays.asList( pNodes ) ); mPorts.addAll( Arrays.asList( pPorts ) ); mJVMs.addAll( Arrays.asList( pJVMs ) ); mJ2eeVendor = pJ2eeVendor; } // ------------------------------------------------------------------------- // Properties (Getters/Setters) // ------------------------------------------------------------------------- /** * @return The actual list of Applications deployed on this server. The * list is never null but maybe empty. **/ public ObjectName[] getApplications() { return (ObjectName[]) mApplications.toArray( new ObjectName[ 0 ] ); } /** * Looks up an application with the given index * * @param pIndex Index of the requested application * * @return Application found for the given index or null * if index is out of bounds. **/ public ObjectName getApplication( int pIndex ) { if( pIndex >= 0 && pIndex < mApplications.size() ) { return (ObjectName) mApplications.get( pIndex ); } return null; } /** * @return The actual list of Ports which is never null **/ public ObjectName[] getPorts() { return (ObjectName[]) mPorts.toArray( new ObjectName[ 0 ] ); } /** * Looks up an Port with the given index * * @param pIndex Index of the requested Port * * @return Port found for the given index or null * if index is out of bounds. **/ public ObjectName getPort( int pIndex ) { if( pIndex >= 0 && pIndex < mPorts.size() ) { return (ObjectName) mPorts.get( pIndex ); } return null; } /** * @return The actual list of Nodes which is never null **/ public ObjectName[] getNodes() { return (ObjectName[]) mNodes.toArray( new ObjectName[ 0 ] ); } /** * Looks up an Node with the given index * * @param pIndex Index of the requested Node * * @return Node found for the given index or null * if index is out of bounds. **/ public ObjectName getNode( int pIndex ) { if( pIndex >= 0 && pIndex < mNodes.size() ) { return (ObjectName) mNodes.get( pIndex ); } return null; } /** * @return The actual list of Resources which is never null * **/ public ObjectName[] getResources() { return (ObjectName[]) mResources.toArray( new ObjectName[ 0 ] ); } /** * Looks up an Resource with the given index * * @param pIndex Index of the requested Resource * * @return Resource found for the given index or null * if index is out of bounds. **/ public ObjectName getResource( int pIndex ) { if( pIndex >= 0 && pIndex < mResources.size() ) { return (ObjectName) mResources.get( pIndex ); } return null; } /** * @return The actual list of JavaVMs which is never empty **/ public ObjectName[] getJavaVMs() { return (ObjectName[]) mJVMs.toArray( new ObjectName[ 0 ] ); } /** * Looks up an JVM with the given index * * @param pIndex Index of the requested JVM * * @return JVM found for the given index or null * if index is out of bounds. **/ public ObjectName getJavaVM( int pIndex ) { if( pIndex >= 0 && pIndex < mJVMs.size() ) { return (ObjectName) mJVMs.get( pIndex ); } return null; } /** * @return The Indentifications of the J2EE plattform vendor or * this server. **/ public String getJ2eeVendor() { return mJ2eeVendor; } public String toString() { return "J2EEServer { " + super.toString() + " } [ " + "applications: " + mApplications + ", resources: " + mResources + ", nodes: " + mNodes + ", ports: " + mPorts + ", JVMs: " + mJVMs + ", J2EE vendor: " + mJ2eeVendor + " ]"; } } 1.1 jboss/src/main/org/jboss/management/j2ee/J2EEServerMBean.java Index: J2EEServerMBean.java =================================================================== package org.jboss.management.j2ee; import javax.management.j2ee.J2EEServer; /** * Is the entry point of all managed objects in the management * domain. * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public interface J2EEServerMBean extends J2EEServer, J2EEManagedObjectMBean { } 1.1 jboss/src/main/org/jboss/management/j2ee/SingleJBossServerManagement.java Index: SingleJBossServerManagement.java =================================================================== package org.jboss.management.j2ee; import java.util.ArrayList; import java.util.Arrays; import java.util.Hashtable; import java.util.List; import javax.management.JMException; import javax.management.MalformedObjectNameException; import javax.management.MBeanServer; import javax.management.ObjectName; /** * Represents the single JBoss server management domain * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> **/ public class SingleJBossServerManagement extends J2EEManagement { // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- public SingleJBossServerManagement() throws MalformedObjectNameException, InvalidParentException { super( "SingleJBoss" ); } // ------------------------------------------------------------------------- // Properties (Getters/Setters) // ------------------------------------------------------------------------- public void postRegister( java.lang.Boolean pRegistrationDone ) { super.postRegister( pRegistrationDone ); if( pRegistrationDone.booleanValue() ) { // Create Server Component System.out.println( "SingleJBossServerManagement.getObjectName(), name: " + getObjectName() ); try { System.out.println( "SingleJBossServerManagement.getObjectName(), create J2EEServer instance" ); ObjectName lServer = getServer().createMBean( "org.jboss.management.j2ee.J2EEServer", null, new Object[] { "Single", getObjectName() }, new String[] { String.class.getName(), ObjectName.class.getName() } ).getObjectName(); /* pServer.invoke( lServer, "start", new Object[] {}, new String[] {} ); */ } catch( JMException jme ) { jme.printStackTrace(); } catch( Exception e ) { e.printStackTrace(); } } } public String toString() { return "SingleJBossServerManagement { " + super.toString() + " } []"; } } 1.1 jboss/src/main/org/jboss/management/j2ee/WrapperException.java Index: WrapperException.java =================================================================== /* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.management.j2ee; /** * Exception containing another target exception * for further informations * * @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a> * @version $Revision: 1.1 $ **/ public abstract class WrapperException extends Exception { public Throwable mTarget; public WrapperException( String pMessage, Throwable pThrowable ) { super( pMessage ); mTarget = pThrowable; } public Throwable getTargetException() { return mTarget; } }
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development