Jason, Is there a reason you are getting the serviceController in postRegister rather than start or create?
Also are you working on EJBDeployer/Application/Container today? Thanks david jencks On 2002.02.11 22:22:01 -0500 Jason Dillon wrote: > User: user57 > Date: 02/02/11 19:22:01 > > Modified: src/main/org/jboss/resource RARDeployer.java > Log: > o Adding SafeObjectFactory, which simply makes ObjectNames and > turns ant malformed exceptions into Errors. This is used to > create ObjectName OBJECT_NAME fields, so we don't have to keep > creating new ObjectNames all the time. > o MainDeployer & ServiceController use new ObjectName OBJECT_NAME > o Updated refering classes to not wrap OBJECT_NAME with new ObjectName > o Using MBeanProxy to talk to ServiceController (and MainDeployer > in some areas). MBeanProxy is a central location to put in that > pesky JMX exception handling + is tidies up the code base. Can > evevntually optimize this to make it veru efficient too. > o Putting org.jboss.util classes into lib/ext/jboss-util.jar and > adding > it to the bootlibraries, so that the core system components have > access > to these when loading (not just when running, aka after > jboss-service.xml loads). > * Need to clean up jboss-util, move deployable stuff out of it and > such > (they don't really belong there). > o updated modules that needed util, to include jboss-util.jar in there > external module config > > Revision Changes Path > 1.19 +109 -115 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.18 > retrieving revision 1.19 > diff -u -r1.18 -r1.19 > --- RARDeployer.java 29 Jan 2002 21:12:22 -0000 1.18 > +++ RARDeployer.java 12 Feb 2002 03:22:01 -0000 1.19 > @@ -1,9 +1,9 @@ > /* > -* JBoss, the OpenSource J2EE webOS > -* > -* Distributable under LGPL license. > -* See terms of license at gnu.org. > -*/ > + * JBoss, the OpenSource J2EE webOS > + * > + * Distributable under LGPL license. > + * See terms of license at gnu.org. > + */ > > package org.jboss.resource; > > @@ -26,8 +26,10 @@ > 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.DeploymentInfo; > import org.jboss.deployment.DeploymentException; > import org.jboss.logging.Logger; > @@ -36,59 +38,64 @@ > import org.jboss.system.ServiceMBeanSupport; > import org.jboss.system.ServiceControllerMBean; > import org.jboss.system.UnifiedClassLoader; > +import org.jboss.util.MBeanProxy; > + > import org.w3c.dom.Document; > import org.w3c.dom.Element; > > /** > -* Service that deploys ".rar" files containing resource adapters. > Deploying > -* the RAR file is the first step in making the resource adapter > available to > -* application components; once it is deployed, one or more connection > -* factories must be configured and bound into JNDI, a task performed > by the > -* <code>ConnectionFactoryLoader</code> service. > -* > -* @author Toby Allsopp ([EMAIL PROTECTED]) > -* @author <a href="mailto:[EMAIL PROTECTED]">David > Jencks</a> > -* @version $Revision: 1.18 $ > -* @see org.jboss.resource.ConnectionFactoryLoader <p> > -* > -* <b>Revisions:</b> <p> > -* > -* <b>20010725 Toby Allsopp (patch from David Jencks)</b> > -* <ul> > -* <li> Implemented <code>getMetaData</code> so that connection > factories > -* can be loaded after RAR deployment</li> > -* </ul> > -* <b>20011219 Marc Fleury</b> > -* <ul> > -* <li> Make the deployer call create and start on the service > it deploys</li> > -* </ul> > -* <b>20011227 Marc Fleury</b> > -* <ul> > -* <li> Unification of deployers</li> > -* </ul> > -* > -*/ > + * Service that deploys ".rar" files containing resource adapters. > Deploying > + * the RAR file is the first step in making the resource adapter > available to > + * application components; once it is deployed, one or more > connection > + * factories must be configured and bound into JNDI, a task performed > by the > + * <code>ConnectionFactoryLoader</code> service. > + * > + * @author Toby Allsopp ([EMAIL PROTECTED]) > + * @author <a href="mailto:[EMAIL PROTECTED]">David > Jencks</a> > + * @version $Revision: 1.19 $ > + * @see org.jboss.resource.ConnectionFactoryLoader <p> > + * > + * <b>Revisions:</b> <p> > + * > + * <b>20010725 Toby Allsopp (patch from David Jencks)</b> > + * <ul> > + * <li> Implemented <code>getMetaData</code> so that connection > factories > + * can be loaded after RAR deployment</li> > + * </ul> > + * > + * <b>20011219 Marc Fleury</b> > + * <ul> > + * <li> Make the deployer call create and start on the service it > deploys</li> > + * </ul> > + * > + * <b>20011227 Marc Fleury</b> > + * <ul> > + * <li> Unification of deployers</li> > + * </ul> > + */ > public class RARDeployer > -extends ServiceMBeanSupport > -implements RARDeployerMBean > + extends ServiceMBeanSupport > + implements RARDeployerMBean > { > private static int nextNum = 0; > - > + > + /** A proxy to the ServiceController. */ > + private ServiceControllerMBean serviceController; > + > // Constants ----------------------------------------------------- > > // Attributes ---------------------------------------------------- > > - > /** > - * The next sequence number to be used in notifications about > (un)deployment > - */ > + * The next sequence number to be used in notifications about > (un)deployment > + */ > private int nextMessageNum = 0; > > /** > - * Gets the DeployableFilter attribute of the RARDeployer object > - * > - * @return The DeployableFilter value > - */ > + * Gets the DeployableFilter attribute of the RARDeployer object > + * > + * @return The DeployableFilter value > + */ > public boolean accepts(DeploymentInfo sdi) > { > // To be accepted the deployment's root name must end in rar > @@ -97,23 +104,33 @@ > else return false; > } > > + /** > + * Once registration has finished, create a proxy to the > ServiceController > + * for later use. > + */ > + public void postRegister(Boolean done) { > + super.postRegister(done); > + > + serviceController = (ServiceControllerMBean) > + MBeanProxy.create(ServiceControllerMBean.class, > + ServiceControllerMBean.OBJECT_NAME, > + server); > + } > > // RARDeployerMBean implementation ------------------------------- > > - // DeployerMBean overrides --------------------------------- > - > /** > - * Gets the Name attribute of the RARDeployer object > - * > - * @return The Name value > - */ > + * Gets the Name attribute of the RARDeployer object > + * > + * @return The Name value > + */ > public String getName() > { > return "RARDeployer"; > } > > public void init(DeploymentInfo rdi) > - throws DeploymentException > + throws DeploymentException > { > try > { > @@ -148,88 +165,72 @@ > else rdi.watch = new URL(rdi.url, > "META-INF/application.xml"); > } > } > - catch (Exception e) {throw new DeploymentException("problem with > init in RARDeployer ", e);} > + catch (Exception e) { > + throw new DeploymentException("problem with init in > RARDeployer ", e); > + } > > } > > - /** > - * The <code>deploy</code> method deploys a rar at the given url. > - * > - * @param url The <code>URL</code> location of the rar to deploy. > - * @return an <code>Object</code> to identify this deployment. > - * @exception IOException if an error occurs > - * @exception DeploymentException if an error occurs > - */ > + /** > + * The <code>deploy</code> method deploys a rar at the given url. > + * > + * @param url The <code>URL</code> location of the rar to deploy. > + * @return an <code>Object</code> to identify this deployment. > + * @exception IOException if an error occurs > + * @exception DeploymentException if an error occurs > + */ > public void deploy(DeploymentInfo rdi) > - throws DeploymentException > + throws DeploymentException > { > - getLog().info("Attempting to deploy RAR at '" + rdi.url + "'"); > + if (log.isDebugEnabled()) { > + log.debug("Attempting to deploy RAR at '" + rdi.url + "'"); > + } > > try { > RARMetaData metaData = (RARMetaData) rdi.metaData; > > //set up the RARDeployment mbean for dependency management. > - ObjectName deploymentName = new > ObjectName("jboss.jca:service=RARDeployment,name=" + > metaData.getDisplayName()); > + ObjectName deploymentName = > + new ObjectName("jboss.jca:service=RARDeployment,name=" + > metaData.getDisplayName()); > + > server.createMBean("org.jboss.resource.RARDeployment", > deploymentName, > new Object[] {metaData}, > new String[] {"org.jboss.resource.RARMetaData"}); > > - > - server.invoke( > - getServiceControllerName(), > - "create", > - new Object[] {deploymentName}, > - new String[] {"javax.management.ObjectName"}); > - > - server.invoke( > - getServiceControllerName(), > - "start", > - new Object[] {deploymentName}, > - new String[] {"javax.management.ObjectName"}); > - > + serviceController.create(deploymentName); > + serviceController.start(deploymentName); > } > catch (Exception e) > { > - e.printStackTrace(); > - log.error(e); > + log.error("Problem deploying RARDeployment MBean", e); > throw new DeploymentException("Problem making RARDeployment > MBean", e); > - } // end of try-catch > - > + } > } > > public void undeploy(DeploymentInfo rdi) > - throws DeploymentException > + throws DeploymentException > { > - log.info("Undeploying RAR at '" + rdi.url + "'"); > + if (log.isDebugEnabled()) { > + log.debug("Undeploying RAR at '" + rdi.url + "'"); > + } > > RARMetaData metadata = (RARMetaData) rdi.metaData; > > try > { > - ObjectName deploymentName = new > ObjectName("jboss.jca:service=RARDeployment,name=" + > metadata.getDisplayName()); > + ObjectName deploymentName = > + new ObjectName("jboss.jca:service=RARDeployment,name=" + > metadata.getDisplayName()); > log.info("About to undeploy RARDeploymentMBean, objectname: " > + deploymentName); > > - getServer().invoke(getServiceControllerName(), > - "stop", > - new Object[] {deploymentName}, > - new String[] {"javax.management.ObjectName"}); > - > - getServer().invoke(getServiceControllerName(), > - "destroy", > - new Object[] {deploymentName}, > - new String[] {"javax.management.ObjectName"}); > - > - getServer().invoke(getServiceControllerName(), > - "remove", > - new Object[] {deploymentName}, > - new String[] {"javax.management.ObjectName"}); > - > - } catch (Exception e) > - { > + serviceController.stop(deploymentName); > + serviceController.destroy(deploymentName); > + serviceController.remove(deploymentName); > + } > + catch (Exception e) { > log.error("Problem undeploying RARDeployment MBean", e); > throw new DeploymentException("Problem undeploying > RARDeployment MBean", e); > - } // end of try-catch > + } > > metadata.setClassLoader(null); > } > @@ -240,36 +241,29 @@ > { > // Register with the main deployer > server.invoke( > - new ObjectName(org.jboss.deployment.MainDeployerMBean.OBJECT_NAME), > + org.jboss.deployment.MainDeployerMBean.OBJECT_NAME, > "addDeployer", > new Object[] {this}, > new String[] {"org.jboss.deployment.DeployerMBean"}); > } > - catch (Exception e) {log.error("Could not register with > MainDeployer", e);} > + catch (Exception e) { > + log.error("Could not register with MainDeployer", e); > + } > } > > - > public void stopService() > { > try > { > // Register with the main deployer > server.invoke( > - new ObjectName(org.jboss.deployment.MainDeployerMBean.OBJECT_NAME), > + org.jboss.deployment.MainDeployerMBean.OBJECT_NAME, > "removeDeployer", > new Object[] {this}, > new String[] {"org.jboss.deployment.DeployerMBean"}); > } > - catch (Exception e) {log.error("Could not register with > MainDeployer", e);} > - } > - > - > - private ObjectName getServiceControllerName() > - throws DeploymentException > - { > - try { return new ObjectName(ServiceControllerMBean.OBJECT_NAME);} > - > - catch (Exception e) {throw new DeploymentException ("Couldn't > get the ObjectName for the ServiceControllerMBean");} > + catch (Exception e) { > + log.error("Could not register with MainDeployer", e); > + } > } > - // Inner classes ------------------------------------------------- > } > > > > > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development