User: schaefera
Date: 02/03/05 17:07:47
Modified: src/main/org/jboss/management/j2ee J2EEDeployedObject.java
J2EEServer.java
Added: src/main/org/jboss/management/j2ee J2EEDomainTarget.java
JCAConnectionFactory.java
JCAConnectionFactoryMBean.java
JCAManagedConnectionFactory.java
JCAManagedConnectionFactoryMBean.java
JCAResource.java JCAResourceMBean.java
JMSResource.java JMSResourceMBean.java
ResourceAdapter.java ResourceAdapterMBean.java
ResourceAdapterModule.java
ResourceAdapterModuleMBean.java
Log:
Added some new JSR-77 components written by Scott McLaughlin adding
JCA, JMS and ResourceAdaptor as JSR-77 components.
I also added a new test to see how XMBean and the newest version of
XDoclet can be used to generate the XMBeans as easiest as possible.
Revision Changes Path
1.7 +2 -2 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- J2EEDeployedObject.java 26 Feb 2002 06:14:46 -0000 1.6
+++ J2EEDeployedObject.java 6 Mar 2002 01:07:46 -0000 1.7
@@ -24,7 +24,7 @@
* {@link javax.management.j2ee.J2EEDeployedObject J2EEDeployedObject}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>.
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*
* <p><b>Revisions:</b>
*
@@ -49,7 +49,7 @@
"META-INF/application.xml",
"WEB-INF/web.xml",
"META-INF/ejb-jar.xml",
- "META-INF/??AS??.xml"
+ "META-INF/ra.xml"
};
// Attributes ----------------------------------------------------
1.8 +9 -7 jboss/src/main/org/jboss/management/j2ee/J2EEServer.java
Index: J2EEServer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/management/j2ee/J2EEServer.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- J2EEServer.java 27 Feb 2002 04:36:45 -0000 1.7
+++ J2EEServer.java 6 Mar 2002 01:07:46 -0000 1.8
@@ -19,7 +19,7 @@
* J2EEServer}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*
* <p><b>Revisions:</b>
*
@@ -118,7 +118,7 @@
"J2EEApplication".equals( lType ) ||
"J2EEModule".equals( lType ) ||
"EjbModule".equals( lType ) ||
- "ConnectorModule".equals( lType ) ||
+ "ResourceAdapterModule".equals( lType ) ||
"WebModule".equals( lType )
) {
mDeployedObjects.add( pChild );
@@ -128,12 +128,13 @@
mJVMs.add( pChild );
} else
if( "JNDI".equals( lType ) ||
- "JMS".equals( lType ) ||
+ "JMSResource".equals( lType ) ||
"URL".equals( lType ) ||
"JTA".equals( lType ) ||
"JavaMail".equals( lType ) ||
"JDBC".equals( lType ) ||
- "RMI IIOP".equals( lType )
+ "RMI IIOP".equals( lType ) ||
+ "JCAResource".equals( lType )
) {
mResources.add( pChild );
}
@@ -145,7 +146,7 @@
"J2EEApplication".equals( lType ) ||
"J2EEModule".equals( lType ) ||
"EjbModule".equals( lType ) ||
- "ConnectorModule".equals( lType ) ||
+ "ResourceAdapterModule".equals( lType ) ||
"WebModule".equals( lType )
) {
mDeployedObjects.remove( pChild );
@@ -155,12 +156,13 @@
mJVMs.remove( pChild );
} else
if( "JNDI".equals( lType ) ||
- "JMS".equals( lType ) ||
+ "JMSResource".equals( lType ) ||
"URL".equals( lType ) ||
"JTA".equals( lType ) ||
"JavaMail".equals( lType ) ||
"JDBC".equals( lType ) ||
- "RMI IIOP".equals( lType )
+ "RMI IIOP".equals( lType ) ||
+ "JCAResource".equals( lType )
) {
mResources.remove( pChild );
}
1.1 jboss/src/main/org/jboss/management/j2ee/J2EEDomainTarget.java
Index: J2EEDomainTarget.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
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;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.J2EEDomain J2EEDomain}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>.
* @version $Revision: 1.1 $
*
* @jmx:mbean description="sample for jboss xmbean.dtd"
* persistPolicy="Never"
* persistPeriod="10"
* persistLocation="pl1"
* persistName="JBossXMLExample1"
* currencyTimeLimit="10"
* descriptor="name=\"testdescriptor\" value=\"testvalue\""
* state-action-on-update="RESTART"
*
* <p><b>Revisions:</b>
*
* <p><b>20011126 Andreas Schaefer:</b>
* <ul>
* <li> Adjustments to the JBoss Guidelines
* </ul>
*
* <p><b>20020304 Andreas Schaefer:</b>
* <ul>
* <li> Moved to XMBean
* </ul>
**/
public class J2EEDomainTarget
extends J2EEManagedObject
// implements J2EEDomainTargetMBean
{
// -------------------------------------------------------------------------
// Members
// -------------------------------------------------------------------------
private List mDeployedObjects = new ArrayList();
private List mServers = new ArrayList();
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
*
* @jmx:managed-constructor
**/
public J2EEDomainTarget( String pDomainName )
throws
MalformedObjectNameException,
InvalidParentException
{
super( pDomainName, "J2EEDomain", "Manager" );
}
// -------------------------------------------------------------------------
// Properties (Getters/Setters)
// -------------------------------------------------------------------------
/**
* @jmx:managed-attribute description="List of all deployed Objects"
* access="READ"
* persistPolicy="Never"
* persistPeriod="30"
* currencyTimeLimit="30"
**/
public ObjectName[] getDeployedObjects()
{
return (ObjectName[]) mDeployedObjects.toArray( new ObjectName[ 0 ] );
}
/**
* @jmx:managed-operation description="Returns the requested deployed Object"
impact="INFO"
**/
public ObjectName getDeployedObject( int pIndex )
{
if( pIndex >= 0 && pIndex < mDeployedObjects.size() ) {
return (ObjectName) mDeployedObjects.get( pIndex );
}
return null;
}
/**
* @jmx:managed-attribute description="List of all Servers on this Managment
Domain"
* access="READ"
* persistPolicy="Never"
* persistPeriod="30"
* currencyTimeLimit="30"
**/
public ObjectName[] getServers() {
return (ObjectName[]) mServers.toArray( new ObjectName[ 0 ] );
}
/**
* @jmx:managed-operation description="Returns the requested Server" impact="INFO"
**/
public ObjectName getServer( int pIndex ) {
if( pIndex >= 0 && pIndex < mServers.size() ) {
return (ObjectName) mServers.get( pIndex );
}
return null;
}
public String toString() {
return "J2EEDomainTarget { " + super.toString() + " } [ " +
"deployed objects: " + mDeployedObjects +
", servers: " + mServers +
" ]";
}
/**
* @jmx:managed-operation description="adds a new child of this Management
Domain" impact="INFO"
**/
public void addChild( ObjectName pChild ) {
Hashtable lProperties = pChild.getKeyPropertyList();
String lType = lProperties.get( "type" ) + "";
if(
"J2EEApplication".equals( lType ) ||
"J2EEModule".equals( lType )
) {
mDeployedObjects.add( pChild );
} else if( "J2EEServer".equals( lType ) ) {
mServers.add( pChild );
}
}
/**
* @jmx:managed-operation description="removes a new child of this Management
Domain" impact="ACTION"
**/
public void removeChild( ObjectName pChild ) {
//AS ToDo
}
}
1.1
jboss/src/main/org/jboss/management/j2ee/JCAConnectionFactory.java
Index: JCAConnectionFactory.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import java.util.Set;
import javax.management.AttributeChangeNotification;
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBean;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.JCAConnectionFactory JCAConnectionFactory}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Finishing first real implementation
* </ul>
**/
public class JCAConnectionFactory extends J2EEManagedObject implements
JCAConnectionFactoryMBean
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private long mStartTime = -1;
private int mState = ServiceMBean.STOPPED;
private ObjectName mService;
private ObjectName mManagedConnectionFactory;
// Static --------------------------------------------------------
private static final String[] sTypes = new String[] {
"j2ee.object.created",
"j2ee.object.deleted",
"state.stopped",
"state.stopping",
"state.starting",
"state.running",
"state.failed"
};
public static ObjectName create( MBeanServer pServer, String pName,ObjectName
pService ) {
Logger lLog = Logger.getLogger( JCAConnectionFactory.class );
ObjectName lServer = null;
try {
lServer = (ObjectName) pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=J2EEServer,*" ),
null
).iterator().next();
}
catch( Exception e ) {
lLog.error( "Could not locate JSR-77 Server: " + pName, e );
return null;
}
// First create its parent, the JCA resource
ObjectName lJCAResource = null;
try {
// Check if the JCA Resource exists and if not create one
Set lNames = pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=JCAResource,*" ),
null
);
if( lNames.isEmpty() ) {
// Now create the JCA resource
lJCAResource = JCAResource.create( pServer, "JCA" );
} else {
lJCAResource = (ObjectName) lNames.iterator().next();
}
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JCA resource", e );
return null;
}
try {
return pServer.createMBean(
"org.jboss.management.j2ee.JCAConnectionFactory",
null,
new Object[] {
pName,
lJCAResource,
pService
},
new String[] {
String.class.getName(),
ObjectName.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JCAConnectionFactory: " + pName, e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pName ) {
Logger lLog = Logger.getLogger( JCAConnectionFactory.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() + ":type=JCAConnectionFactory,name=" +
pName + ",*"
);
ObjectName lJCAConnectionFactory = (ObjectName) pServer.queryNames(
lSearch,
null
).iterator().next();
// Now remove the JCA Connection Factory
pServer.unregisterMBean( lJCAConnectionFactory );
// Now let us try to destroy the JDBC Manager
JCAResource.destroy( pServer, "JCA" );
}
catch( Exception e ) {
lLog.error( "Could not destroy JSR-77 JCAConnectionFactory: " + pName, e );
}
}
// Constructors --------------------------------------------------
/**
* @param pName Name of the JCAConnectionFactory
*
* @throws InvalidParameterException If list of nodes or ports was null or empty
**/
public JCAConnectionFactory(String pName, ObjectName pServer, ObjectName
pService) throws MalformedObjectNameException, InvalidParentException
{
super( "JCAConnectionFactory", pName, pServer );
mService = pService;
}
// Public --------------------------------------------------------
// javax.managment.j2ee.EventProvider implementation -------------
public String[] getTypes() {
return sTypes;
}
public String getType( int pIndex ) {
if( pIndex >= 0 && pIndex < sTypes.length ) {
return sTypes[ pIndex ];
} else {
return null;
}
}
// javax.management.j2ee.StateManageable implementation ----------
public long getStartTime() {
return mStartTime;
}
public int getState() {
return mState;
}
/**
* This method is only overwriten because to catch the exception
* which is not specified in {@link javax.management.j2ee.StateManageable
* StateManageable} interface.
**/
public void start()
{
try {
super.start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
public void startRecursive() {
// No recursive start here
try {
start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
// javax.management.j2ee.JCAConnectionFactory implementation -----------------
public ObjectName getManagedConnectionFactory()
{
return mManagedConnectionFactory;
}
// org.jboss.ServiceMBean overrides ------------------------------------
public void postCreation() {
// If set then register for its events
try {
getServer().addNotificationListener( mService, new Listener(), null, null );
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service is null or
//AS ToDo: not found.
jme.printStackTrace();
}
sendNotification(
new Notification(
sTypes[ 0 ],
getName(),
1,
System.currentTimeMillis(),
"JCA Connection Factory created"
)
);
}
public void preDestruction() {
Logger lLog = getLog();
if( lLog.isInfoEnabled() ) {
lLog.info( "JCAConnectionFactory.preDeregister(): " + getName() );
}
sendNotification(
new Notification(
sTypes[ 1 ],
getName(),
1,
System.currentTimeMillis(),
"JCA Connection Factory deleted"
)
);
}
// ServiceMBeanSupport overrides ---------------------------------
public void startService() {
try {
getServer().invoke(
mService,
"start",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service could not
be started
jme.printStackTrace();
}
}
public void stopService() {
try {
getServer().invoke(
mService,
"stop",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service could not
be stopped
jme.printStackTrace();
}
}
// java.lang.Object overrides ------------------------------------
public String toString() {
return "JCAConnectionFactory { " + super.toString() + " } [ " +
" ]";
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
private class Listener implements NotificationListener {
public void handleNotification( Notification pNotification, Object pHandback )
{
if( pNotification instanceof AttributeChangeNotification ) {
AttributeChangeNotification lChange = (AttributeChangeNotification)
pNotification;
if( "State".equals( lChange.getAttributeName() ) )
{
mState = ( (Integer) lChange.getNewValue() ).intValue();
if( mState == ServiceMBean.STARTED ) {
mStartTime = lChange.getTimeStamp();
} else {
mStartTime = -1;
}
// Now send the event to the JSR-77 listeners
sendNotification(
new Notification(
sTypes[ getState() + 2 ],
getName(),
1,
System.currentTimeMillis(),
"State changed"
)
);
}
}
}
}
}
1.1
jboss/src/main/org/jboss/management/j2ee/JCAConnectionFactoryMBean.java
Index: JCAConnectionFactoryMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.ObjectName;
import javax.management.j2ee.StateManageable;
/**
* MBean Mangement Inteface for {@link org.jboss.management.j2ee.JCAConnectionFactory
* JCAConnectionFactory}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface JCAConnectionFactoryMBean extends StateManageable,
J2EEManagedObjectMBean
{
public ObjectName getManagedConnectionFactory();
}
1.1
jboss/src/main/org/jboss/management/j2ee/JCAManagedConnectionFactory.java
Index: JCAManagedConnectionFactory.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.Notification;
import org.jboss.logging.Logger;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.JCAManagedConnectionFactory
JCAManagedConnectionFactory}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Finishing first real implementation
* </ul>
**/
public class JCAManagedConnectionFactory extends J2EEManagedObject implements
JCAManagedConnectionFactoryMBean
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
private static final String[] sTypes = new String[] {
"j2ee.object.created",
"j2ee.object.deleted",
"state.stopped",
"state.stopping",
"state.starting",
"state.running",
"state.failed"
};
public static ObjectName create( MBeanServer pServer, String pName, ObjectName
pParent ) {
Logger lLog = Logger.getLogger( JCAManagedConnectionFactory.class );
try {
// Now create the JCAManagedConnectionFactory Representant
return pServer.createMBean(
"org.jboss.management.j2ee.JCAManagedConnectionFactory",
null,
new Object[] {
pName,
pParent
},
new String[] {
String.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JCAManagedConnectionFactory: " +
pName, e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pName ) {
Logger lLog = Logger.getLogger( JCAManagedConnectionFactory.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() +
":type=JCAManagedConnectionFactory,name=" + pName + ",*"
);
ObjectName lJCAManagedConnectionFactory = (ObjectName) pServer.queryNames(
lSearch,
null
).iterator().next();
// Now remove the JCAManagedConnectionFactory
pServer.unregisterMBean( lJCAManagedConnectionFactory );
}
catch( Exception e ) {
lLog.error( "Could not destroy JSR-77 JCAManagedConnectionFactory: " +
pName, e );
}
}
// Constructors --------------------------------------------------
/**
* @param pName Name of the JCAManagedConnectionFactory
*
* @throws InvalidParameterException If list of nodes or ports was null or empty
**/
public JCAManagedConnectionFactory(String pName, ObjectName pServer) throws
MalformedObjectNameException, InvalidParentException
{
super( "JCAManagedConnectionFactory", pName, pServer );
}
// Public --------------------------------------------------------
// org.jboss.ServiceMBean overrides ------------------------------------
public void postCreation() {
sendNotification(
new Notification(
sTypes[ 0 ],
getName(),
1,
System.currentTimeMillis(),
"Managed Connection Factory created"
)
);
}
public void preDestruction() {
Logger lLog = getLog();
if( lLog.isInfoEnabled() ) {
lLog.info( "JCAManagedConnectionFactory.preDeregister(): " + getName() );
}
sendNotification(
new Notification(
sTypes[ 1 ],
getName(),
1,
System.currentTimeMillis(),
"Managed Connection Factory deleted"
)
);
}
// org.jboss.ServiceMBean overrides ------------------------------------
// java.lang.Object overrides ------------------------------------
public String toString() {
return "JCAManagedConnectionFactory { " + super.toString() + " } [ " +
" ]";
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}
1.1
jboss/src/main/org/jboss/management/j2ee/JCAManagedConnectionFactoryMBean.java
Index: JCAManagedConnectionFactoryMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
/**
* MBean Mangement Inteface for {@link
org.jboss.management.j2ee.JCAManagedConnectionFactory
* JCAManagedConnectionFactory}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface JCAManagedConnectionFactoryMBean extends J2EEManagedObjectMBean
{
}
1.1 jboss/src/main/org/jboss/management/j2ee/JCAResource.java
Index: JCAResource.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.management.AttributeChangeNotification;
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBean;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.JCAResource JCAResource}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public class JCAResource extends J2EEResource implements JCAResourceMBean
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private long mStartTime = -1;
private int mState = ServiceMBean.STOPPED;
private ObjectName mService;
private List mConnectionFactories = new ArrayList();
// Static --------------------------------------------------------
private static final String[] sTypes = new String[] {
"j2ee.object.created",
"j2ee.object.deleted",
"state.stopped",
"state.stopping",
"state.starting",
"state.running",
"state.failed"
};
public static ObjectName create( MBeanServer pServer, String pName ) {
Logger lLog = Logger.getLogger( JCAResource.class );
ObjectName lServer = null;
try {
lServer = (ObjectName) pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=J2EEServer,*" ),
null
).iterator().next();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JCAResource", e );
return null;
}
try {
// Now create the JNDI Representant
return pServer.createMBean(
"org.jboss.management.j2ee.JCAResource",
null,
new Object[] {
pName,
lServer
},
new String[] {
String.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JCAResource", e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pName ) {
Logger lLog = Logger.getLogger( JCAResource.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() + ":type=JCAResource,name=" + pName +
",*"
);
Set lNames = pServer.queryNames(
lSearch,
null
);
if( !lNames.isEmpty() ) {
ObjectName lJCAResource = (ObjectName) lNames.iterator().next();
// Now check if the JCAResource does not contains another Connection
Factory
ObjectName[] lConnectionFactories = (ObjectName[]) pServer.getAttribute(
lJCAResource,
"ConnectionFactories"
);
if( lConnectionFactories.length == 0 ) {
// Remove it because it does not reference any JDBC DataSources
pServer.unregisterMBean( lJCAResource );
}
}
}
catch( Exception e ) {
lLog.error( "Could not destroy JSR-77 JCAResource", e );
}
}
// Constructors --------------------------------------------------
/**
* @param pName Name of the JDBC
*
* @throws InvalidParameterException If list of nodes or ports was null or empty
**/
public JCAResource(String pName, ObjectName pServer) throws
MalformedObjectNameException, InvalidParentException
{
super( "JCAResource", pName, pServer );
}
// Public --------------------------------------------------------
// javax.managment.j2ee.EventProvider implementation -------------
public String[] getTypes() {
return sTypes;
}
public String getType( int pIndex ) {
if( pIndex >= 0 && pIndex < sTypes.length ) {
return sTypes[ pIndex ];
} else {
return null;
}
}
// javax.management.j2ee.StateManageable implementation ----------
public long getStartTime() {
return mStartTime;
}
public int getState() {
return mState;
}
public void startService() {
mState = ServiceMBean.STARTING;
sendNotification(
new Notification(
sTypes[ 4 ],
getName(),
1,
System.currentTimeMillis(),
"JCAResource starting"
)
);
mState = ServiceMBean.STARTED;
sendNotification(
new Notification(
sTypes[ 5 ],
getName(),
2,
System.currentTimeMillis(),
"JCAResource started"
)
);
}
public void startRecursive() {
// No recursive start here
start();
Iterator i = mConnectionFactories.iterator();
ObjectName lJCAResource = null;
while( i.hasNext() ) {
lJCAResource = (ObjectName) i.next();
try {
getServer().invoke(
lJCAResource,
"start",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
getLog().error( "Could not stop JSR-77 JCAResource: " + lJCAResource,
jme );
}
}
}
public void stopService() {
Iterator i = mConnectionFactories.iterator();
while( i.hasNext() ) {
ObjectName lJCAResource = (ObjectName) i.next();
try {
getServer().invoke(
lJCAResource,
"stop",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
getLog().error( "Could not stop JSR-77 JCAResource: " + lJCAResource,
jme );
}
}
mState = ServiceMBean.STOPPING;
sendNotification(
new Notification(
sTypes[ 2 ],
getName(),
1,
System.currentTimeMillis(),
"JCAResource stopping"
)
);
mState = ServiceMBean.STOPPED;
sendNotification(
new Notification(
sTypes[ 3 ],
getName(),
2,
System.currentTimeMillis(),
"JCAResource stopped"
)
);
}
// org.jboss.ServiceMBean overrides ------------------------------------
public void postCreation() {
sendNotification(
new Notification(
sTypes[ 0 ],
getName(),
1,
System.currentTimeMillis(),
"JCA Resource created"
)
);
}
public void preDestruction() {
sendNotification(
new Notification(
sTypes[ 1 ],
getName(),
1,
System.currentTimeMillis(),
"JCA Resource deleted"
)
);
}
// javax.management.j2ee.JDBC implementation ---------------------
public ObjectName[] getConnectionFactories() {
return (ObjectName[]) mConnectionFactories.toArray( new ObjectName[
mConnectionFactories.size() ] );
}
public ObjectName getConnectionFactory( int pIndex ) {
if( pIndex >= 0 && pIndex < mConnectionFactories.size() ) {
return (ObjectName) mConnectionFactories.get( pIndex );
}
else {
return null;
}
}
// J2EEManagedObjectMBean implementation -------------------------
public void addChild( ObjectName pChild ) {
String lType = J2EEManagedObject.getType( pChild );
if( "JCAConnectionFactory".equals( lType ) ) {
mConnectionFactories.add( pChild );
}
}
public void removeChild( ObjectName pChild ) {
String lType = J2EEManagedObject.getType( pChild );
if( "JCAConnectionFactory".equals( lType ) ) {
mConnectionFactories.remove( pChild );
}
}
// java.lang.Object overrides ------------------------------------
public String toString() {
return "JCAResource { " + super.toString() + " } [ " +
"Datasources: " + mConnectionFactories +
" ]";
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
}
1.1 jboss/src/main/org/jboss/management/j2ee/JCAResourceMBean.java
Index: JCAResourceMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.ObjectName;
import javax.management.j2ee.StateManageable;
/**
* MBean Mangement Inteface for {@link org.jboss.management.j2ee.JCAResource
* JCAResource}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020303 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface JCAResourceMBean
extends StateManageable, J2EEManagedObjectMBean
{
public ObjectName[] getConnectionFactories();
public ObjectName getConnectionFactory( int pIndex );
}
1.1 jboss/src/main/org/jboss/management/j2ee/JMSResource.java
Index: JMSResource.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.AttributeChangeNotification;
import javax.management.JMException;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBean;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.JMS JMS}. *
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020301 Scott McLaughlin</b>
* <ul>
* <li> Creation
* </ul>
**/
public class JMSResource
extends J2EEResource
implements JMSResourceMBean
{
// Attributes ----------------------------------------------------
private long mStartTime = -1;
private int mState = ServiceMBean.STOPPED;
private ObjectName mService;
// Static --------------------------------------------------------
private static final String[] sTypes = new String[] {
"j2ee.object.created",
"j2ee.object.deleted",
"state.stopped",
"state.stopping",
"state.starting",
"state.running",
"state.failed"
};
public static ObjectName create( MBeanServer pServer, String pName, ObjectName
pService ) {
Logger lLog = Logger.getLogger( JMSResource.class );
ObjectName lServer = null;
try {
lServer = (ObjectName) pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=J2EEServer,*" ),
null
).iterator().next();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 Server", e );
return null;
}
try {
// Now create the JMS Representant
return pServer.createMBean(
"org.jboss.management.j2ee.JMSResource",
null,
new Object[] {
pName,
lServer,
pService
},
new String[] {
String.class.getName(),
ObjectName.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 JMS Resouce", e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pName ) {
Logger lLog = Logger.getLogger( JMSResource.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() + ":type=JMSResource,name=" + pName +
",*"
);
ObjectName lJMSResource = (ObjectName) pServer.queryNames(
lSearch,
null
).iterator().next();
// Now remove the J2EEApplication
pServer.unregisterMBean( lJMSResource );
}
catch( Exception e ) {
lLog.error( "Could not destroy JSR-77 JMSResource Resource", e );
}
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* @param pName Name of the JMSResource
*
* @throws InvalidParameterException If list of nodes or ports was null or empty
**/
public JMSResource( String pName, ObjectName pServer, ObjectName pService )
throws
MalformedObjectNameException,
InvalidParentException
{
super( "JMSResource", pName, pServer );
mService = pService;
}
// org.jboss.ServiceMBean overrides ------------------------------------
public void postCreation() {
// If set then register for its events
try {
getServer().addNotificationListener( mService, new Listener(), null, null );
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service is null or
//AS ToDo: not found.
jme.printStackTrace();
}
sendNotification(
new Notification(
sTypes[ 0 ],
getName(),
1,
System.currentTimeMillis(),
"JMSResource Resource created"
)
);
}
public void preDestruction() {
sendNotification(
new Notification(
sTypes[ 1 ],
getName(),
1,
System.currentTimeMillis(),
"JMSResource Resource deleted"
)
);
}
// javax.managment.j2ee.EventProvider implementation -------------
public String[] getTypes() {
return sTypes;
}
public String getType( int pIndex ) {
if( pIndex >= 0 && pIndex < sTypes.length ) {
return sTypes[ pIndex ];
} else {
return null;
}
}
// javax.management.j2ee.StateManageable implementation ----------
public long getStartTime() {
return mStartTime;
}
public int getState() {
return mState;
}
/**
* This method is only overwriten because to catch the exception
* which is not specified in {@link javax.management.j2ee.StateManageable
* StateManageable} interface.
**/
public void start()
{
try {
super.start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
public void startRecursive() {
// No recursive start here
try {
start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
// ServiceMBeanSupport overrides ---------------------------------
public void startService() {
try {
getServer().invoke(
mService,
"start",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service could not
be started
jme.printStackTrace();
}
}
public void stopService() {
try {
getServer().invoke(
mService,
"stop",
new Object[] {},
new String[] {}
);
}
catch( JMException jme ) {
//AS ToDo: later on we have to define what happens when service could not
be stopped
jme.printStackTrace();
}
}
// java.lang.Object overrides ------------------------------------
public String toString() {
return "JMSResource { " + super.toString() + " } [ " +
" ]";
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
private class Listener implements NotificationListener {
public void handleNotification( Notification pNotification, Object pHandback )
{
if( pNotification instanceof AttributeChangeNotification ) {
AttributeChangeNotification lChange = (AttributeChangeNotification)
pNotification;
if( "State".equals( lChange.getAttributeName() ) )
{
mState = ( (Integer) lChange.getNewValue() ).intValue();
if( mState == ServiceMBean.STARTED ) {
mStartTime = lChange.getTimeStamp();
} else {
mStartTime = -1;
}
// Now send the event to the JSR-77 listeners
sendNotification(
new Notification(
sTypes[ getState() + 2 ],
getName(),
1,
System.currentTimeMillis(),
"State changed"
)
);
}
}
}
}
}
1.1 jboss/src/main/org/jboss/management/j2ee/JMSResourceMBean.java
Index: JMSResourceMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.j2ee.JMS;
import javax.management.j2ee.StateManageable;
/**
* MBean Mangement Inteface for {@link org.jboss.management.j2ee.JMS
* JMS}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020301 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface JMSResourceMBean
extends JMS, StateManageable, J2EEManagedObjectMBean
{
}
1.1 jboss/src/main/org/jboss/management/j2ee/ResourceAdapter.java
Index: ResourceAdapter.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.jboss.logging.Logger;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.ResourceAdapter ResourceAdapter}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020301 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public class ResourceAdapter
extends J2EEManagedObject
implements ResourceAdapterMBean
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
public static ObjectName create( MBeanServer pServer, String
pResourceAdapterModule, String pResourceAdapterName ) {
Logger lLog = Logger.getLogger( ResourceAdapter.class );
try {
// Now create the ResourceAdapter
return pServer.createMBean(
"org.jboss.management.j2ee.ResourceAdapter",
null,
new Object[] {
pResourceAdapterName,
new ObjectName( pResourceAdapterModule )
},
new String[] {
String.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 ResourceAdapter: " +
pResourceAdapterName, e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pResourceAdapterName ) {
Logger lLog = Logger.getLogger( ResourceAdapter.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() + ":type=ResourceAdapter,name=" +
pResourceAdapterName + ",*"
);
ObjectName lResourceAdapter = (ObjectName) pServer.queryNames(
lSearch,
null
).iterator().next();
// Now remove the ResourceAdapter
pServer.unregisterMBean( lResourceAdapter );
}
catch( Exception e ) {
lLog.error( "Could not destory JSR-77 ResourceAdapter: " +
pResourceAdapterName, e );
}
}
// Constructors --------------------------------------------------
/**
* @param pName Name of the ResourceAdapter
*
* @throws InvalidParameterException
**/
public ResourceAdapter(String pName, ObjectName pResourceAdapterModule )
throws
MalformedObjectNameException,
InvalidParentException
{
super("ResourceAdapter", pName, pResourceAdapterModule );
}
// java.lang.Object overrides --------------------------------------
public String toString() {
return "ResourceAdapter { " + super.toString() + " } []";
}
}
1.1
jboss/src/main/org/jboss/management/j2ee/ResourceAdapterMBean.java
Index: ResourceAdapterMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import javax.management.j2ee.ResourceAdapter;
/**
* MBean Mangement Inteface for {@link org.jboss.management.j2ee.StatefulSessionBean
* StatefulSessionBean}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20011126 Andreas Schaefer:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface ResourceAdapterMBean
extends ResourceAdapter, J2EEManagedObjectMBean
{
}
1.1
jboss/src/main/org/jboss/management/j2ee/ResourceAdapterModule.java
Index: ResourceAdapterModule.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
import java.net.URL;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import javax.management.AttributeChangeNotification;
import javax.management.MalformedObjectNameException;
import javax.management.MBeanServer;
import javax.management.Notification;
import javax.management.NotificationListener;
import javax.management.ObjectName;
import javax.management.j2ee.ResourceAdapter;
import javax.management.j2ee.J2EEApplication;
import javax.management.j2ee.J2EEServer;
//import javax.management.j2ee.JVM;
import java.security.InvalidParameterException;
import org.jboss.logging.Logger;
import org.jboss.system.ServiceMBean;
/**
* Root class of the JBoss JSR-77 implementation of
* {@link javax.management.j2ee.ResourceAdapterModule ResourceAdapterModule}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020301 Scott McLaughlin:</b>
* <ul>
* <li>
* Creation
* </ul>
**/
public class ResourceAdapterModule
extends J2EEModule
implements ResourceAdapterModuleMBean
{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private List mResourceAdapters = new ArrayList();
private long mStartTime = -1;
private int mState = ServiceMBean.STOPPED;
private ObjectName mService;
// Static --------------------------------------------------------
private static final String[] sTypes = new String[] {
"j2ee.object.created",
"j2ee.object.deleted",
"state.stopped",
"state.stopping",
"state.starting",
"state.running",
"state.failed"
};
public static ObjectName create( MBeanServer pServer, String pApplicationName,
String pName, URL pURL, ObjectName pService) {
Logger lLog = Logger.getLogger( ResourceAdapterModule.class );
String lDD = null;
ObjectName lParent = null;
try {
ObjectName lServer = (ObjectName) pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=J2EEServer,*" ),
null
).iterator().next();
String lServerName = lServer.getKeyPropertyList().get( "type" ) + "=" +
lServer.getKeyPropertyList().get( "name" );
lLog.debug( "ResourceAdapterModule.create(), server name: " + lServerName );
if(pApplicationName != null)
{
lParent = (ObjectName) pServer.queryNames(
new ObjectName( J2EEManagedObject.getDomainName() +
":type=J2EEApplication" +
",name=" + pApplicationName + "," + lServerName + ",*"
),
null
).iterator().next();
}
else
{
lParent = lServer;
}
// First get the deployement descriptor
lDD = J2EEDeployedObject.getDeploymentDescriptor( pURL,
J2EEDeployedObject.RAR );
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 ResourceAdapterModule: " +
pApplicationName, e );
return null;
}
try {
// Now create the ResourceAdapterModule
lLog.debug(
"Create ResourceAdapterModule, name: " + pName +
", application: " + lParent +
", dd: " + lDD
);
return pServer.createMBean(
"org.jboss.management.j2ee.ResourceAdapterModule",
null,
new Object[] {
pName,
lParent,
lDD,
pService
},
new String[] {
String.class.getName(),
ObjectName.class.getName(),
String.class.getName(),
ObjectName.class.getName()
}
).getObjectName();
}
catch( Exception e ) {
lLog.error( "Could not create JSR-77 ResourceAdapterModule: " +
pApplicationName, e );
return null;
}
}
public static void destroy( MBeanServer pServer, String pModuleName ) {
Logger lLog = Logger.getLogger( EjbModule.class );
try {
// Find the Object to be destroyed
ObjectName lSearch = new ObjectName(
J2EEManagedObject.getDomainName() + ":type=ResourceAdapterModule,name="
+ pModuleName + ",*"
);
ObjectName lResourceAdapterModule = (ObjectName) pServer.queryNames(
lSearch,
null
).iterator().next();
// Now remove the ResourceAdapterModule
pServer.unregisterMBean( lResourceAdapterModule );
}
catch( Exception e ) {
lLog.error( "Could not destory JSR-77 ResourceAdapterModule: " +
pModuleName, e );
}
}
// Constructors --------------------------------------------------
/**
* Constructor taking the Name of this Object
*
* @param pName Name to be set which must not be null
* @param pDeploymentDescriptor
*
* @throws InvalidParameterException If the given Name is null
**/
public ResourceAdapterModule( String pName, ObjectName pApplication, String
pDeploymentDescriptor, ObjectName pService )
throws
MalformedObjectNameException,
InvalidParentException
{
super( "ResourceAdapterModule", pName, pApplication, pDeploymentDescriptor );
mService = pService;
}
// Public --------------------------------------------------------
// EjbModule implementation --------------------------------------
public ObjectName[] getResourceAdapters() {
return (ObjectName[]) mResourceAdapters.toArray( new ObjectName[ 0 ] );
}
public ObjectName getResourceAdapter( int pIndex ) {
if( pIndex >= 0 && pIndex < mResourceAdapters.size() )
{
return (ObjectName) mResourceAdapters.get( pIndex );
}
else
{
return null;
}
}
// J2EEManagedObjectMBean implementation -------------------------
public void addChild( ObjectName pChild ) {
String lType = J2EEManagedObject.getType( pChild );
if( "ResourceAdapter".equals( lType ))
{
mResourceAdapters.add( pChild );
}
}
public void removeChild( ObjectName pChild ) {
String lType = J2EEManagedObject.getType( pChild );
if( "ResourceAdapter".equals( lType ))
{
mResourceAdapters.remove( pChild );
}
}
// org.jboss.ServiceMBean overrides ------------------------------------
public void postCreation() {
sendNotification(
new Notification(
sTypes[ 0 ],
getName(),
1,
System.currentTimeMillis(),
"Resource Adapter Module created"
)
);
}
public void preDestruction() {
sendNotification(
new Notification(
sTypes[ 1 ],
getName(),
1,
System.currentTimeMillis(),
"Resource Adapter Module deleted"
)
);
}
// javax.managment.j2ee.EventProvider implementation -------------
public String[] getTypes() {
return sTypes;
}
public String getType( int pIndex ) {
if( pIndex >= 0 && pIndex < sTypes.length ) {
return sTypes[ pIndex ];
} else {
return null;
}
}
// javax.management.j2ee.StateManageable implementation ----------
public long getStartTime() {
return mStartTime;
}
public int getState() {
return mState;
}
/**
* This method is only overwriten because to catch the exception
* which is not specified in {@link javax.management.j2ee.StateManageable
* StateManageable} interface.
**/
public void start()
{
try {
super.start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
public void startRecursive() {
// No recursive start here
try {
start();
}
catch( Exception e ) {
getLog().error( "start failed", e );
}
}
// Object overrides ---------------------------------------------------
public String toString() {
return "ResourceAdapterModule[ " + super.toString() +
"ResourceAdapters: " + mResourceAdapters +
" ]";
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
// Inner classes -------------------------------------------------
private class Listener implements NotificationListener {
public void handleNotification( Notification pNotification, Object pHandback )
{
if( pNotification instanceof AttributeChangeNotification ) {
AttributeChangeNotification lChange = (AttributeChangeNotification)
pNotification;
if( "State".equals( lChange.getAttributeName() ) )
{
mState = ( (Integer) lChange.getNewValue() ).intValue();
if( mState == ServiceMBean.STARTED ) {
mStartTime = lChange.getTimeStamp();
} else {
mStartTime = -1;
}
// Now send the event to the JSR-77 listeners
sendNotification(
new Notification(
sTypes[ getState() + 2 ],
getName(),
1,
System.currentTimeMillis(),
"State changed"
)
);
}
}
}
}
}
1.1
jboss/src/main/org/jboss/management/j2ee/ResourceAdapterModuleMBean.java
Index: ResourceAdapterModuleMBean.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.management.j2ee;
//import javax.management.j2ee.ResourceAdapterModule;
import javax.management.j2ee.StateManageable;
import javax.management.ObjectName;
/**
* MBean Mangement Inteface for {@link
org.jboss.management.j2ee.ResourceAdapterModule
* ResourceAdapterModule}.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Scott McLaughlin</a>.
* @version $Revision: 1.1 $
*
* <p><b>Revisions:</b>
*
* <p><b>20020301 Scott McLaughlin:</b>
* <ul>
* <li> Creation
* </ul>
**/
public interface ResourceAdapterModuleMBean
extends StateManageable,J2EEManagedObjectMBean
{
public ObjectName[] getResourceAdapters();
public ObjectName getResourceAdapter( int pIndex );
public String getDeploymentDescriptor();
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development