FileDocCategorySizeDatePackage
JBIDeployer.javaAPI DocGlassfish v2 API5130Fri May 04 22:34:30 BST 2007com.sun.enterprise.deployment.autodeploy

JBIDeployer

public class JBIDeployer extends Object
Handles all the mbean operations.
author
binod@dev.java.net

Fields Summary
private String
PREFIX
private String
DEPLOY_SUFFIX
private String
SHUTDOWN
private String
STARTED
private String
STOPPED
private String
NOTFOUND
Constructors Summary
Methods Summary
voiddeploy(javax.management.MBeanServer mbs, java.io.File sa, java.lang.String saName)
Get the status of the service assembly, if it is present undeploy it first. Later deploy ant start the new archive.


                              
             
        if (!getState(mbs, saName).equals(NOTFOUND) ) {
            undeploy(mbs, saName);
        }
        ObjectName deployMbean = getObjectName(mbs);
        mbs.invoke(deployMbean, "deploy", new Object[] {sa.getAbsolutePath()},
                   new String[] {"java.lang.String"});
        start(mbs, saName);
    
private javax.management.ObjectNamegetObjectName(javax.management.MBeanServer mbs)

        ObjectName deployMbean = new ObjectName(PREFIX + DEPLOY_SUFFIX);
        return mbs.getObjectInstance(deployMbean).getObjectName();
    
java.lang.StringgetState(javax.management.MBeanServer mbs, java.lang.String sa)
Return the state of the service assembly. If it is not found return NOTFOUND.

        String state = NOTFOUND;
        try {
            ObjectName deployMbean = getObjectName(mbs);
            state = (String) mbs.invoke(deployMbean, "getState", 
            new Object[] {sa}, new String[] {"java.lang.String"});
        } catch (Exception e) {
            //sLogger.log(Level.FINE, e.getMessage(), e);
        }
        return state;
    
private voidshutdown(javax.management.MBeanServer mbs, java.lang.String sa)

        ObjectName deployMbean = getObjectName(mbs);
        mbs.invoke(deployMbean, "shutDown", new Object[] {sa},
                   new String[] {"java.lang.String"});
    
private voidstart(javax.management.MBeanServer mbs, java.lang.String sa)

        ObjectName deployMbean = getObjectName(mbs);
        mbs.invoke(deployMbean, "start", new Object[] {sa},
                   new String[] {"java.lang.String"});
    
private voidstop(javax.management.MBeanServer mbs, java.lang.String sa)

        ObjectName deployMbean = getObjectName(mbs);
        mbs.invoke(deployMbean, "stop", new Object[] {sa},
                   new String[] {"java.lang.String"});
    
voidundeploy(javax.management.MBeanServer mbs, java.lang.String sa)
Undeploy the archive. Before doing that, if it is started, stop it. If it is stopped, shutdown it.

        if (STARTED.equals(getState(mbs, sa))) {
            stop(mbs, sa);
            shutdown(mbs, sa);
        }
        if (STOPPED.equals(getState(mbs, sa))) {
            shutdown(mbs, sa);
        }
        ObjectName deployMbean = getObjectName(mbs);
        mbs.invoke(deployMbean, "undeploy", new Object[] {sa},
                   new String[] {"java.lang.String"});