User: schaefera
  Date: 02/02/12 13:04:49

  Modified:    src/main/org/jboss/jmx/service Deployer.java
  Log:
  Fixed bugs in the Deployer and adjusted the Deployer name to MainDeployer.
  
  Revision  Changes    Path
  1.5       +27 -14    jboss/src/main/org/jboss/jmx/service/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/jmx/service/Deployer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Deployer.java     3 Jan 2002 04:00:58 -0000       1.4
  +++ Deployer.java     12 Feb 2002 21:04:38 -0000      1.5
  @@ -23,6 +23,8 @@
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
   
  +import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
  +import org.jboss.jmx.connector.rmi.RMIConnectorImpl;
   import org.jboss.jmx.connector.RemoteMBeanServer;
   
   /**
  @@ -32,7 +34,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christoph G. Jung</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Andreas Schaefer</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class Deployer
   {
  @@ -54,17 +56,21 @@
         }
         
         for (int count=0;count<args.length;count++) {            
  -         if (!args[count].equalsIgnoreCase("-undeploy")) { 
  -            System.out.println("Deploying " + args[count]);
  -            new Deployer( lServer ).deploy(args[count]);
  -            System.out.println(args[count] +
  -                               " has been deployed successfully");
  -         }
  -         else {
  -            System.out.println("Undeploying " + args[++count]);
  -            new Deployer( lServer ).undeploy(args[count]);
  -            System.out.println(args[count] +
  -                               " has been successfully undeployed");
  +         if( !( args[ count ].equals( "-server" ) ||
  +            ( count > 0 && args[ count - 1 ].equals( "-server" ) ) ) )
  +         {
  +            if (!args[count].equalsIgnoreCase("-undeploy")) { 
  +               System.out.println("Deploying " + args[count]);
  +               new Deployer( lServer ).deploy(args[count]);
  +               System.out.println(args[count] +
  +                                  " has been deployed successfully");
  +            }
  +            else {
  +               System.out.println("Undeploying " + args[++count]);
  +               new Deployer( lServer ).undeploy(args[count]);
  +               System.out.println(args[count] +
  +                                  " has been successfully undeployed");
  +            }
            }
         }
      }
  @@ -113,7 +119,7 @@
      protected ObjectName getFactoryName()
         throws MalformedObjectNameException
      {
  -      return new ObjectName("jboss.j2ee:service=J2eeDeployer");
  +      return new ObjectName("jboss.system:service=MainDeployer");
      }
      
      /**
  @@ -136,7 +142,14 @@
         RemoteMBeanServer connector = null;
         InitialContext ctx = new InitialContext();
         try {
  -         connector = (RemoteMBeanServer) ctx.lookup( "jmx:" + mServerName + ":rmi" 
);
  +         Object lObject = ctx.lookup( "jmx:" + mServerName + ":rmi" );
  +         if( !( lObject instanceof RMIAdaptor ) ) {
  +            throw new RuntimeException( "Object not of type: RMIAdaptorImpl, but: " 
+
  +               ( lObject == null ? "not found" : lObject.getClass().getName() ) );
  +         }
  +         connector = new RMIConnectorImpl(
  +            (RMIAdaptor) lObject
  +         );
         }
         finally {
            ctx.close();
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to