User: d_jencks
Date: 01/11/10 13:38:03
Modified: src/main/org/jboss/resource ConnectionFactoryLoader.java
ConnectionFactoryLoaderMBean.java
ConnectionManagerFactoryLoader.java
ConnectionManagerFactoryLoaderMBean.java
RARDeployer.java RARDeployerMBean.java
RARMetaData.java
Added: src/main/org/jboss/resource RARDeployment.java
Log:
Changed mbean dependencies to work directly by mbean-references: eliminated depends
tag from *service.xml files
Revision Changes Path
1.12 +46 -121 jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoader.java
Index: ConnectionFactoryLoader.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoader.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ConnectionFactoryLoader.java 2001/09/11 18:38:57 1.11
+++ ConnectionFactoryLoader.java 2001/11/10 21:38:03 1.12
@@ -61,7 +61,7 @@
* @author <a href="[EMAIL PROTECTED]">Toby Allsopp</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
* @see RARDeployer
- * @version $Revision: 1.11 $ <p>
+ * @version $Revision: 1.12 $ <p>
*
* <b>Revisions:</b> <p>
*
@@ -79,7 +79,7 @@
*/
public class ConnectionFactoryLoader
extends ServiceMBeanSupport
- implements ConnectionFactoryLoaderMBean, NotificationListener, ObjectFactory
+ implements ConnectionFactoryLoaderMBean, ObjectFactory
{
/**
@@ -93,19 +93,17 @@
private MBeanServer server;
- private String resourceAdapterName;
+ private ObjectName resourceAdapterName;
private String jndiName;
private String mcfProperties = "";
- private String rarDeployerName;
private String tmName = "java:/TransactionManager";
- private String cmfName;
+ private ObjectName cmfLoaderName;
private String cmProps;
// Principal mapping parameters
private String princMapClass;
private String princMapProps = "";
- private ObjectName rarDeployerObjectName;
/**
* The JNDI name to which this connection factory is bound
@@ -128,9 +126,9 @@
*
* @param resourceAdapterName The new ResourceAdapterName value
*/
- public void setResourceAdapterName(String resourceAdapterName)
+ public void setResourceAdapterName(ObjectName resourceAdapterName)
{
- this.resourceAdapterName = resourceAdapterName.trim();
+ this.resourceAdapterName = resourceAdapterName;
}
/**
@@ -153,15 +151,6 @@
this.mcfProperties = p;
}
- /**
- * Sets the RARDeployerName attribute of the ConnectionFactoryLoader object
- *
- * @param rarDeployerName The new RARDeployerName value
- */
- public void setRARDeployerName(String rarDeployerName)
- {
- this.rarDeployerName = rarDeployerName.trim();
- }
/**
* Sets the TransactionManagerName attribute of the ConnectionFactoryLoader
@@ -180,9 +169,9 @@
*
* @param c The new ConnectionManagerFactoryName value
*/
- public void setConnectionManagerFactoryName(String c)
+ public void setConnectionManagerFactoryLoaderName(ObjectName c)
{
- cmfName = c.trim();
+ cmfLoaderName = c;
}
/**
@@ -232,7 +221,7 @@
*
* @return The ResourceAdapterName value
*/
- public String getResourceAdapterName()
+ public ObjectName getResourceAdapterName()
{
return resourceAdapterName;
}
@@ -258,16 +247,6 @@
}
/**
- * Gets the RARDeployerName attribute of the ConnectionFactoryLoader object
- *
- * @return The RARDeployerName value
- */
- public String getRARDeployerName()
- {
- return rarDeployerName;
- }
-
- /**
* Gets the TransactionManagerName attribute of the ConnectionFactoryLoader
* object
*
@@ -284,9 +263,9 @@
*
* @return The ConnectionManagerFactoryName value
*/
- public String getConnectionManagerFactoryName()
+ public ObjectName getConnectionManagerFactoryLoaderName()
{
- return cmfName;
+ return cmfLoaderName;
}
/**
@@ -389,41 +368,8 @@
super.postRegister(registrationDone);
}
- // NotificationListener implementation ---------------------------
- /**
- * #Description of the Method
- *
- * @param n Description of Parameter
- * @param handback Description of Parameter
- */
- public void handleNotification(Notification n, Object handback)
- {
- log.debug("Received notification '" + n + "'");
- // We know that this is relevent to us because of the filter
- String type = n.getType();
- try
- {
- if (type.endsWith(DEPLOY_NOTIFICATION))
- {
- loadConnectionFactory((RARMetaData)n.getUserData());
- }
- else if (type.endsWith(UNDEPLOY_NOTIFICATION))
- {
- unloadConnectionFactory((RARMetaData)n.getUserData());
- }
- else
- {
- log.error("Unknown notification type: " + type);
- }
- }
- catch (Exception e)
- {
- log.error("Problem loading or unloading connection factory", e);
- }
- }
-
protected ObjectName getObjectName(MBeanServer server, ObjectName name)
{
this.server = server;
@@ -448,9 +394,6 @@
//add the factory name to the log:
String name = getClass().getName() + "." + jndiName;
log = Logger.create(name);
- rarDeployerObjectName = new ObjectName(rarDeployerName);
- server.addNotificationListener(rarDeployerObjectName, this,
- new RAFilter(log), null);
}
protected void startService()
@@ -459,22 +402,13 @@
// If this factory has not already been loaded...
if (!cfs.containsKey(jndiName))
{
- // ... and the RAR deployer exists...
- if (server.isRegistered(rarDeployerObjectName))
- {
- Object[] args = new Object[]{resourceAdapterName};
- String[] sig = new String[]{"java.lang.String"};
- RARMetaData rmd = (RARMetaData)server.invoke(
- rarDeployerObjectName, "getMetaData", args, sig);
- // ... and the RAR has been deployed...
- if (rmd != null)
- {
- // ... then load the connection factory immediately
- // because we have missed notification of the RAR's
- // deployment
- loadConnectionFactory(rmd);
- }
- }
+ //if we got here, the rar should be loaded... we have a dependency.
+ //check anyway
+ if (!server.isRegistered(resourceAdapterName))
+ {
+ throw new Exception("Can't find allegedly deployed rar: " +
resourceAdapterName);
+ } // end of if ()
+ loadConnectionFactory();
}
}
@@ -485,19 +419,14 @@
{
try
{
- // ... and the RAR deployer exists...
- if (server.isRegistered(rarDeployerObjectName))
+ // ... and the RAR deployment exists...
+ if (server.isRegistered(resourceAdapterName))
{
- Object[] args = new Object[]{resourceAdapterName};
- String[] sig = new String[]{"java.lang.String"};
- RARMetaData rmd = (RARMetaData)server.invoke(
- rarDeployerObjectName, "getMetaData", args, sig);
+ RARMetaData rmd = (RARMetaData)server.getAttribute(
+ resourceAdapterName, "RARMetaData");
// ... and the RAR has been deployed...
if (rmd != null)
{
- // ... then unload the connection factory
- // immediately because we won't be around to receive
- // notification of the RAR's undeployment
unloadConnectionFactory(rmd);
}
}
@@ -523,7 +452,7 @@
*
* @param metaData Description of Parameter
*/
- private void loadConnectionFactory(RARMetaData metaData)
+ private void loadConnectionFactory()
{
// This context is used in a few places. There is no point
// continuing if JNDI isn't working.
@@ -538,6 +467,17 @@
log.error("Unable to obtain initial context", ne);
return;
}
+ RARMetaData metaData = null;
+ try
+ {
+ metaData = (RARMetaData)server.getAttribute(resourceAdapterName,
"RARMetaData");
+ }
+ catch (Exception e)
+ {
+ log.error("Unable to obtain RARMetaData", e);
+ return;
+ } // end of try-catch
+
// This is the class loader through which we should be able to
// load the resource adapter's classes
@@ -712,7 +652,7 @@
// Find the connection manager factory
ConnectionManagerFactory cmf;
- try
+ /*try
{
cmf = (ConnectionManagerFactory)ctx.lookup("java:/" + cmfName);
}
@@ -722,7 +662,17 @@
cmfName + "'", e);
return;
}
-
+ */
+ try
+ {
+ cmf = (ConnectionManagerFactory)server.getAttribute(cmfLoaderName,
"ConnectionManagerFactory");
+ } catch (Exception e)
+ {
+ log.error("Unable to find connection manager factory at from loader " +
cmfLoaderName);
+ return;
+
+ } // end of try-catch
+
// Configure the connection manager
ConnectorConfig cmConfig = new ConnectorConfig();
@@ -860,30 +810,5 @@
// Inner classes -------------------------------------------------
- /**
- */
- private class RAFilter implements NotificationFilter
- {
- private Logger log;
- private RAFilter(Logger log)
- {
- this.log = log;
- }
-
- /**
- * Gets the NotificationEnabled attribute of the RAFilter object
- *
- * @param n Description of Parameter
- * @return The NotificationEnabled value
- */
- public boolean isNotificationEnabled(Notification n)
- {
- log.debug("Evaluating notification type='" + n.getType() + "', " +
- "message='" + n.getMessage() + "'");
- return
- n.getType().startsWith(DEPLOYMENT_NOTIFICATION) &&
- n.getMessage().equals(resourceAdapterName);
- }
- }
}
1.6 +10 -20
jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoaderMBean.java
Index: ConnectionFactoryLoaderMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/ConnectionFactoryLoaderMBean.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConnectionFactoryLoaderMBean.java 2001/09/08 19:32:20 1.5
+++ ConnectionFactoryLoaderMBean.java 2001/11/10 21:38:03 1.6
@@ -6,6 +6,7 @@
*/
package org.jboss.resource;
+import javax.management.ObjectName;
import org.jboss.system.ServiceMBean;
/**
@@ -17,26 +18,25 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @see RARDeployer
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public interface ConnectionFactoryLoaderMBean
extends ServiceMBean
{
String OBJECT_NAME = ":service=ConnectionFactoryLoader";
- String DEPLOYMENT_NOTIFICATION = "org.jboss.resource.deployment";
- String DEPLOY_NOTIFICATION = ".deploy";
- String UNDEPLOY_NOTIFICATION = ".undeploy";
/**
- * The name of the resource adapter. This is the value from the <code>
+ * The name of the mbean representing the resource adapter deployment.
+ * This is the value from the <code>
* display-name</code> element in its deployment descriptor becase I can't
- * see a better name to use.
+ * see a better name to use, turned into an ObjectName of the form
+ * JCA:service=RARDeployment,name=(display-name).
*
* @return The ResourceAdapterName value
*/
- String getResourceAdapterName();
+ ObjectName getResourceAdapterName();
- void setResourceAdapterName(String resourceAdapterName);
+ void setResourceAdapterName(ObjectName resourceAdapterName);
/**
* The name under which to bind this connection factory in JNDI. The name
@@ -60,16 +60,6 @@
void setManagedConnectionFactoryProperties(String properties);
- /**
- * The name of the MBean responsible for deploying the resource adapter.
- * This is so we can listen for notification of the resource adapter being
- * deployed.
- *
- * @return The RARDeployerName value
- */
- String getRARDeployerName();
-
- void setRARDeployerName(String rarDeployerName);
/**
* The name under which the transaction manager is bound in JNDI. This has a
@@ -88,9 +78,9 @@
*
* @return The ConnectionManagerFactoryName value
*/
- String getConnectionManagerFactoryName();
+ ObjectName getConnectionManagerFactoryLoaderName();
- void setConnectionManagerFactoryName(String connectionManagerFactoryName);
+ void setConnectionManagerFactoryLoaderName(ObjectName
connectionManagerFactoryName);
/**
* The properties to set on the connection manager.
1.7 +14 -2
jbosscx/src/main/org/jboss/resource/ConnectionManagerFactoryLoader.java
Index: ConnectionManagerFactoryLoader.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/ConnectionManagerFactoryLoader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConnectionManagerFactoryLoader.java 2001/09/11 18:38:58 1.6
+++ ConnectionManagerFactoryLoader.java 2001/11/10 21:38:03 1.7
@@ -36,7 +36,7 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
*/
public class ConnectionManagerFactoryLoader
extends ServiceMBeanSupport
@@ -172,6 +172,18 @@
return "ConnectionManagerFactoryLoader";
}
+ /**
+ * The <code>getConnectionManagerFactory</code> method returns the
+ * ConnectionManagerFactory loaded by this loader. It is used instead
+ * of the jndi binding by the ConnectionFactoryLoader mbean dependency.
+ *
+ * @return a <code>ConnectionManagerFactory</code> value
+ */
+ public ConnectionManagerFactory getConnectionManagerFactory()
+ {
+ return cmf;
+ }
+
// ObjectFactory implementation ----------------------------------
/**
@@ -187,7 +199,7 @@
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable environment)
{
- // Return the connection factory with the requested name
+ // Return the connection manager factory with the requested name
log.debug("ConnectionManagerLoader.getObjectInstance, name = '" +
name + "'");
synchronized (cmfs)
1.5 +5 -1
jbosscx/src/main/org/jboss/resource/ConnectionManagerFactoryLoaderMBean.java
Index: ConnectionManagerFactoryLoaderMBean.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/ConnectionManagerFactoryLoaderMBean.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ConnectionManagerFactoryLoaderMBean.java 2001/08/30 02:19:22 1.4
+++ ConnectionManagerFactoryLoaderMBean.java 2001/11/10 21:38:03 1.5
@@ -14,7 +14,7 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @see
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public interface ConnectionManagerFactoryLoaderMBean
extends ServiceMBean
@@ -40,4 +40,8 @@
String getFactoryClass();
void setFactoryClass(String c);
+
+ //used instead of jndi binding
+ ConnectionManagerFactory getConnectionManagerFactory();
+
}
1.12 +45 -41 jbosscx/src/main/org/jboss/resource/RARDeployer.java
Index: RARDeployer.java
===================================================================
RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployer.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RARDeployer.java 2001/09/26 21:47:03 1.11
+++ RARDeployer.java 2001/11/10 21:38:03 1.12
@@ -6,6 +6,10 @@
*/
package org.jboss.resource;
+
+
+
+//import java.net.URLClassLoader;Replaced with org.jboss.system.URLClassLoader.
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
@@ -17,7 +21,6 @@
import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
-//import java.net.URLClassLoader;Replaced with org.jboss.system.URLClassLoader.
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
@@ -26,16 +29,14 @@
import java.util.Map;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-
import javax.management.Notification;
-
+import javax.management.ObjectName;
import org.jboss.deployment.DeployerMBeanSupport;
import org.jboss.deployment.DeploymentException;
import org.jboss.logging.Logger;
import org.jboss.metadata.XmlFileLoader;
import org.jboss.system.ServiceLibraries;
import org.jboss.system.URLClassLoader;
-
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -48,7 +49,7 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
-* @version $Revision: 1.11 $
+* @version $Revision: 1.12 $
* @see org.jboss.resource.ConnectionFactoryLoader <p>
*
* <b>Revisions:</b> <p>
@@ -126,26 +127,6 @@
return "RARDeployer";
}
- /**
- * Gets the MetaData attribute of the RARDeployer object
- *
- * @param resourceAdapterName Description of Parameter
- * @return The MetaData value
- */
- public RARMetaData getMetaData(String resourceAdapterName)
- {
- Collection dis = getDeployments().values();
- Iterator i = dis.iterator();
- while (i.hasNext())
- {
- DeploymentInfo di = (DeploymentInfo)i.next();
- if (di.metadata.getDisplayName().equals(resourceAdapterName))
- {
- return di.metadata;
- }
- }
- return null;
- }
/**
* The <code>deploy</code> method deploys a rar at the given url.
@@ -213,16 +194,29 @@
metadata.setClassLoader(cl);
- // Let's tell the waiting hordes (of connection factory loaders)
- // that this resource adapter is available
+ //set up the RARDeployment mbean for dependency management.
+ try
+ {
+ ObjectName deploymentName = new
ObjectName("JCA:service=RARDeployment,name=" + metadata.getDisplayName());
+ getServer().createMBean("org.jboss.resource.RARDeployment",
+ deploymentName,
+ new Object[] {metadata},
+ new String[] {"org.jboss.resource.RARMetaData"});
+
- Notification notification = new Notification(
- ConnectionFactoryLoaderMBean.DEPLOYMENT_NOTIFICATION +
- ConnectionFactoryLoaderMBean.DEPLOY_NOTIFICATION, this,
- nextMessageNum++, metadata.getDisplayName());
- notification.setUserData(metadata);
- sendNotification(notification);
+ getServer().invoke(getServiceControllerName(),
+ "registerAndStartService",
+ new Object[] {deploymentName, null},
+ new String[] {"javax.management.ObjectName",
"java.lang.String"});
+
+
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException("Problem making RARDeployment MBean", e);
+ } // end of try-catch
+
DeploymentInfo info = new DeploymentInfo();
info.metadata = metadata;
info.unpackedDir = unpackedDir;
@@ -242,15 +236,25 @@
"deployed at '" + url + "'");
}
- // Tell the waiting hordes (of connection factory loaders)
- // that this resource adapter is no longer available
-
RARMetaData metadata = info.metadata;
- Notification notification = new Notification(
- ConnectionFactoryLoaderMBean.DEPLOYMENT_NOTIFICATION +
- ConnectionFactoryLoaderMBean.UNDEPLOY_NOTIFICATION, this,
- nextMessageNum++, metadata.getDisplayName());
- sendNotification(notification);
+ try
+ {
+ ObjectName deploymentName = new
ObjectName("JCA:service=RARDeployment,name=" + metadata.getDisplayName());
+ log.info("About to undeploy RARDeploymentMBean, objectname: " +
deploymentName);
+
+ getServer().invoke(getServiceControllerName(),
+ "undeploy",
+ new Object[] {deploymentName},
+ new String[] {"javax.management.ObjectName"});
+
+
+ } catch (Exception e)
+ {
+ log.error("Problem undeploying RARDeployment MBean", e);
+ throw new DeploymentException("Problem undeploying RARDeployment MBean",
e);
+ } // end of try-catch
+
+
//unregister the classloader from the system libraries.
//this is the org.jboss.system.URLClassLoader.
URLClassLoader cl = (URLClassLoader)metadata.getClassLoader();
1.6 +1 -9 jbosscx/src/main/org/jboss/resource/RARDeployerMBean.java
Index: RARDeployerMBean.java
===================================================================
RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARDeployerMBean.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RARDeployerMBean.java 2001/08/21 03:27:20 1.5
+++ RARDeployerMBean.java 2001/11/10 21:38:03 1.6
@@ -12,7 +12,7 @@
* Exposed management interface for the <code>RARDeployer</code> service.
*
* @author Toby Allsopp ([EMAIL PROTECTED])
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public interface RARDeployerMBean
extends DeployerMBean
@@ -23,12 +23,4 @@
// Public --------------------------------------------------------
- /**
- * Returns metadata for a deployed resource adapter.
- *
- * @param resourceAdapterName the name of the resource adapter
- * @return the resource adapter's metadata or <code>null
- * </code>if no resource adapter by that name is deployed
- */
- public RARMetaData getMetaData(String resourceAdapterName);
}
1.11 +9 -1 jbosscx/src/main/org/jboss/resource/RARMetaData.java
Index: RARMetaData.java
===================================================================
RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/RARMetaData.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- RARMetaData.java 2001/11/01 20:56:27 1.10
+++ RARMetaData.java 2001/11/10 21:38:03 1.11
@@ -25,7 +25,7 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @see RARDeployer
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.11 $
*/
public class RARMetaData
// extends Y
@@ -286,6 +286,8 @@
"config-property-type");
Element valueE = MetaData.getOptionalChild(element,
"config-property-value");
+ Element descE = MetaData.getOptionalChild(element,
+ "description");
Property p = new Property();
p.name = getElementContent(nameE);
@@ -294,6 +296,11 @@
{
p.value = getElementContent(valueE);
}
+ if (descE != null)
+ {
+ p.desc = getElementContent(descE);
+ }
+
properties.put(p.name, p);
}
catch (org.jboss.ejb.DeploymentException de)
@@ -508,5 +515,6 @@
public String name;
public String type;
public String value;
+ public String desc;
}
}
1.1 jbosscx/src/main/org/jboss/resource/RARDeployment.java
Index: RARDeployment.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.resource;
import java.lang.reflect.Constructor;
import java.util.Iterator;
import java.util.Map;
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.DynamicMBean;
import javax.management.InvalidAttributeValueException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanConstructorInfo;
import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
import javax.management.ReflectionException;
/**
* RARDeployment.java
*
*
* Created: Fri Sep 28 11:59:19 2001
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
* @version
*/
public class RARDeployment implements DynamicMBean
{
private final RARMetaData rarMetaData;
private final MBeanInfo mbi;
/**
* Creates a new <code>RARDeployment</code> instance.
*
* @param rarMetaData a <code>RARMetaData</code> value
*/
public RARDeployment (RARMetaData rarMetaData)
{
this.rarMetaData = rarMetaData;
mbi = setupMBeanInfo();
}
// implementation of javax.management.DynamicMBean interface
/**
* The <code>invoke</code> method throws an MBeanException for RARDeployement
* because the mbean is read-only.
*
* @param operation a <code>String</code> value
* @param params an <code>Object[]</code> value
* @param sig a <code>String[]</code> value
* @return <description>
* @exception MBeanException always thrown
* @exception ReflectionException if an error occurs
*/
public Object invoke(String operation, Object[] params, String[] sig)
throws MBeanException
{
throw new MBeanException(null, "No operations exposed for RARDeployment");
}
/**
* Describe <code>getAttributes</code> method here.
*
* @param AttributeNames a <code>String[]</code> value
* @return an <code>AttributeList</code> value
*/
public AttributeList getAttributes(String[] attributeNames)
{
AttributeList atts = new AttributeList();
for (int i = 0; i < attributeNames.length; i++)
{
try
{
Object value = getAttribute(attributeNames[i]);
atts.add(new Attribute(attributeNames[i], value));
}
catch (Exception e)
{
}
}
return atts;
}
public Object getAttribute(String attributeName) throws
AttributeNotFoundException, MBeanException, ReflectionException
{
if (attributeName == null)
{
throw new MBeanException(new AttributeNotFoundException("Null is not an
attribute name"), "No attribute name given to getAttribute");
}
else if (attributeName.equals("DisplayName"))
{
return rarMetaData.getDisplayName();
}
else if (attributeName.equals("ManagedConnectionFactoryClass"))
{
return rarMetaData.getManagedConnectionFactoryClass();
}
else if (attributeName.equals("TransactionSupport"))
{
return new Integer(rarMetaData.getTransactionSupport());
}
else if (attributeName.equals("AuthMechType"))
{
return rarMetaData.getAuthMechType();
}
else if (attributeName.equals("ReauthenticationSupport"))
{
return new Boolean(rarMetaData.getReauthenticationSupport());
}
else if (attributeName.equals("RARMetaData"))
{
return rarMetaData;
}
else
{
RARMetaData.Property prop =
(RARMetaData.Property)rarMetaData.getProperties().get(attributeName);
if (prop != null)
{
return prop.value;
}
}
throw new AttributeNotFoundException("No such attribute: " + attributeName);
}
public MBeanInfo getMBeanInfo()
{
return mbi;
}
public void setAttribute(Attribute param1) throws AttributeNotFoundException
{
throw new AttributeNotFoundException("No settable attributes in
RARDeployment");
}
public AttributeList setAttributes(AttributeList param1)
{
return null;
}
private MBeanInfo setupMBeanInfo()
{
Map rarProps = rarMetaData.getProperties();
int attributeCount = 5 + rarProps.size();
MBeanAttributeInfo[] attributeInfos = new MBeanAttributeInfo[attributeCount];
MBeanConstructorInfo[] constructorInfos = new MBeanConstructorInfo[1];
int i = 0;
attributeInfos[i++] = new MBeanAttributeInfo("DisplayName",
"java.lang.String",
"Display name of the Resource Adapter",
true,
false,
false);
attributeInfos[i++] = new MBeanAttributeInfo("ManagedConnectionFactoryClass",
"java.lang.String",
"Class name of the
ManagedConnectionFactory for this Resource Adapter",
true,
false,
false);
attributeInfos[i++] = new MBeanAttributeInfo("TransactionSupport",
"java.lang.Integer",
"Transaction support of the Resource
Adapter, expressed as a TX_SUPPORT_* constant",
true,
false,
false);
attributeInfos[i++] = new MBeanAttributeInfo("AuthMechType",
"java.lang.String",
"Authorization mechanism type of the
Resource Adapter",
true,
false,
false);
attributeInfos[i++] = new MBeanAttributeInfo("ReauthenticationSupport",
"java.lang.boolean",
"Whether this Resource Adapter
supports reauthentication of existing connections.",
true,
false,
false);
Iterator propIterator = rarProps.values().iterator();
while (propIterator.hasNext())
{
RARMetaData.Property prop = (RARMetaData.Property)propIterator.next();
attributeInfos[i++] = new MBeanAttributeInfo(prop.name,
prop.type,
prop.desc,
true,
false,
false);
}
Constructor[] constructors = getClass().getConstructors();
constructorInfos[0] = new MBeanConstructorInfo("Constructor for the
RARDeployment",
constructors[0]);
MBeanInfo mbi = new MBeanInfo(getClass().getName(),
"Description of a deployed Resource Adapter",
attributeInfos,
constructorInfos,
new MBeanOperationInfo[0],
new MBeanNotificationInfo[0]);
return mbi;
}
}// Rardeployment
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development