FileDocCategorySizeDatePackage
JBILifecycleCommands.javaAPI DocGlassfish v2 API5842Fri May 04 22:25:12 BST 2007com.sun.enterprise.cli.commands

JBILifecycleCommands

public class JBILifecycleCommands extends JBICommand
Will perform a lifecycle operation (stop, stop or shutdown) on a component (service engine, binding component) or a service assembly.
version
$Revision: 1.4 $

Fields Summary
private static final String
START_COMPONENT
private static final String
STOP_COMPONENT
private static final String
SHUT_DOWN_COMPONENT
private static final String
START_SERVICE_ASSEMBLY
private static final String
STOP_SERVICE_ASSEMBLY
private static final String
SHUT_DOWN_SERVICE_ASSEMBLY
Constructors Summary
Methods Summary
public voidrunCommand()
A method that Executes the command

throws
CommandException


                   
         
    
        String result = "";
        String successKey = "";
        try {

            // Perform the pre run initialization
            if (preRunInit())
            {        
                // Retrieve the options
                String  targetName  = getOption(TARGET_OPTION);
                boolean force       = getBooleanOption(FORCE_OPTION);

                // Retrieve the operand "componentName"
                String  componentName = (String) getOperands().get(0);

                // Using the command name, we'll determine how to process the command
                if (name.equals(START_COMPONENT)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).startComponent(
                        componentName,
                        targetName);
                    successKey = "JBISuccessStartedComponent";
                }

                else if (name.equals(STOP_COMPONENT)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).stopComponent(
                        componentName,
                        targetName);
                    successKey = "JBISuccessStoppedComponent";
                }

                else if (name.equals(SHUT_DOWN_COMPONENT)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).shutdownComponent(
                        componentName,
                        force,
                        targetName);
                    successKey = "JBISuccessShutDownComponent";
                }
                else if (name.equals(START_SERVICE_ASSEMBLY)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).startServiceAssembly(
                        componentName,
                        targetName);
                    successKey = "JBISuccessStartAssemblyComponent";
                }

                else if (name.equals(STOP_SERVICE_ASSEMBLY)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).stopServiceAssembly(
                        componentName,
                        targetName);
                    successKey = "JBISuccessStoppedAssembly";
                }

                else if (name.equals(SHUT_DOWN_SERVICE_ASSEMBLY)) {
                    result = ((JBIAdminCommands) mJbiAdminCommands).shutdownServiceAssembly(
                        componentName,
                        force,
                        targetName);
                    successKey = "JBISuccessShutDownAssembly";
                }

            }
            processJBIAdminResult (result, successKey);
        }

        catch (Exception e) {
            processTaskException(e);
        }