admin@glassfish.java.net

[code review]

From: Mark Saunders <Mark.Saunders_at_Sun.COM>
Date: Fri, 25 Aug 2006 14:15:38 -0700

Non functional jbi command "start-jbi-component".

This command is currently non-functional and will print a success
message for any component name given. The actual implementation of the
command can not be integrated until after the JBI Runtime and Common
Client code has been integrated.

? admin-cli.log
? build
? diff.txt
? commands/build
?
commands/src/java/com/sun/enterprise/cli/commands/StartJBIComponentCommand.java
?
commands/tests/java/com/sun/enterprise/cli/commands/StartJBIComponentCommandTest.java
? commands/tests/java/com/sun/enterprise/cli/commands/TestLogger.java
? framework/${javadoc.dir}
? framework/build
Index: commands/commandsbuild.properties
===================================================================
RCS file: /cvs/glassfish/admin-cli/commands/commandsbuild.properties,v
retrieving revision 1.3
diff -u -r1.3 commandsbuild.properties
--- commands/commandsbuild.properties 14 Apr 2006 23:25:03 -0000 1.3
+++ commands/commandsbuild.properties 23 Aug 2006 22:22:23 -0000
@@ -38,13 +38,17 @@
 ########
 #on unix
 ########
-junit.jar=/net/koori.sfbay/onestop/sjsas_ee/8.2/nightly/binaries/solaris/latest/${java.obj.dir}/junit/junit.jar
-xercesImpl.jar=/net/koori.sfbay/onestop/sjsas_ee/8.2/nightly/binaries/solaris/latest/${java.obj.dir}/jaxrpc-sec/lib/xercesImpl.jar
+#junit.jar=/net/koori.sfbay/onestop/sjsas_ee/8.2/nightly/binaries/solaris/latest/${java.obj.dir}/junit/junit.jar
+#xercesImpl.jar=/net/koori.sfbay/onestop/sjsas_ee/8.2/nightly/binaries/solaris/latest/${java.obj.dir}/jaxrpc-sec/lib/xercesImpl.jar
+
 ######################################################################
 #on windows need to map the network drive Z: to \\koori.sfbay\onestop
 ######################################################################
 #junit.jar=Z:\\sjsas_ee\\8.1\\nightly\\binaries\\solaris\\latest\\JDK1.4_DBG.OBJ\\junit\\junit.jar
 #xercesImpl.jar=Z:\\sjsas_ee\\8.1\\nightly\\binaries\\solaris\\latest\\JDK1.4_DBG.OBJ\\jaxrpc-sec\\lib\\xercesImpl.jar
+
+junit.jar=c:/glassfish2/workspace/glassfish/appserv-tests/lib/junit.jar
+xercesImpl.jar=c:/glassfish2/workspace/glassfish/appserv-tests/lib/xercesImpl.jar
 
 ### Component Properties ###
 src.dir=src/java
Index: commands/project.properties
===================================================================
RCS file: /cvs/glassfish/admin-cli/commands/project.properties,v
retrieving revision 1.3
diff -u -r1.3 project.properties
--- commands/project.properties 25 Dec 2005 03:46:14 -0000 1.3
+++ commands/project.properties 23 Aug 2006 18:32:56 -0000
@@ -23,3 +23,4 @@
 
 glassfish.module.name=admin-cli
 maven.mode.online=false
+junit.jar=c:/glassfish2/workspace/glassfish/appserv-tests/lib/junit.jar
Index: commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml
===================================================================
RCS file:
/cvs/glassfish/admin-cli/commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml,v
retrieving revision 1.46
diff -u -r1.46 CLIDescriptor.xml
---
commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml 3
Aug 2006 00:29:07 -0000 1.46
+++
commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml
 25 Aug 2006 18:20:15 -0000
@@ -5544,5 +5544,17 @@
                         <ValidOption name="port"/>
             <ValidOption name="secure"/>
         </Command>
+ <Command name="start-jbi-component"
classname="com.sun.enterprise.cli.commands.StartJBIComponentCommand"
numberofoperands="1" usage-text="asadmin start-jbi-component
[--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
[--host localhost] [--port 4848|4849] [--secure | -s] [--user
admin_user] [--passwordfile file_name] [--target target(Default server)]">
+ <ValidOption name="user"/>
+ <ValidOption name="password"/>
+ <ValidOption name="passwordfile"/>
+ <ValidOption name="target"/>
+ <ValidOption name="host"/>
+ <ValidOption name="port"/>
+ <ValidOption name="interactive"/>
+ <ValidOption name="terse"/>
+ <ValidOption name="verbose"/>
+ <ValidOption name="echo"/>
+ </Command>
     </Commands>
 </CommandsAndOptions>



Output from: ant -f commandsbuild.xml -Dcut=AllTest test

[C:/glassfish2/workspace/glassfish/admin-cli/commands] testcommands
Buildfile: commandsbuild.xml

init:

compile:
     [echo] xercesImpl =
c:/glassfish2/workspace/glassfish/appserv-tests/lib/xercesImpl.jar

compile-tests:
    [javac] Compiling 1 source file to
C:\glassfish2\workspace\glassfish\admin-cli\commands\build
    [javac]
C:\glassfish2\workspace\glassfish\admin-cli\commands\tests\java\com\sun\enterprise\cli\commands\AllTest.java


test:
     [java] .........................................
     [java] ............message = CLI186 Invalid format entered for the
webservice name. Valid format for an endpoint in
 an application is <app-name>#<module-name>#<endpoint-name>. Valid
format for an endpoint in a deployed standalone modul
e is <module-name>#<endpoint-name>.
     [java] ..............Value specified for interval 0 is not valid.
Please specify a value greater than 0.
     [java] Command Not Yet Implemented
     [java] ...............
     [java] Command sampleCommand is deprecated.
     [java] .Command sampleCommand is deprecated.
     [java] .Starting Domain UndefinedDomain, please wait.
     [java] Log redirected to test_domain\UndefinedDomain\logs\server.log.
     [java]
C:\glassfish2\workspace\glassfish\admin-cli\commands\test_domain is not
a directory
     [java] .Domain directory
C:\glassfish2\workspace\glassfish\admin-cli\commands\test_domain is not
a directory or doe
s not exist.
     [java] ........
     [java] Time: 15.582

     [java] OK (93 tests)


BUILD SUCCESSFUL
Total time: 17 seconds
[C:/glassfish2/workspace/glassfish/admin-cli/commands]




/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the License). You may not use this file except in
 * compliance with the License.
 *
 * You can obtain a copy of the license at
 * https://glassfish.dev.java.net/public/CDDLv1.0.html or
 * glassfish/bootstrap/legal/CDDLv1.0.txt.
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL
 * Header Notice in each file and include the License file
 * at glassfish/bootstrap/legal/CDDLv1.0.txt.
 * If applicable, add the following below the CDDL Header,
 * with the fields enclosed by brackets [] replaced by
 * you own identifying information:
 * "Portions Copyrighted [year] [name of copyright owner]"
 *
 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
 */

package com.sun.enterprise.cli.commands;

import com.sun.enterprise.cli.framework.CommandValidationException;
import com.sun.enterprise.cli.framework.CommandException;
import com.sun.enterprise.cli.framework.CLILogger;
import javax.management.MBeanServerConnection;

/**
 * Will start the JBI component on the specified target.
 * @version $Revision: 1.0 $
 */
public class StartJBIComponentCommand extends BaseLifeCycleCommand
{
    private static final String VERBOSE = "verbose";
    private static final String TERSE = "terse";
    private static final String TARGET_OPTION = "target";

    /**
     * An abstract method that validates the options
     * on the specification in the xml properties file
     * This method verifies for the correctness of number of
     * operands and if all the required options are supplied by the client.
     * @return boolean returns true if success else returns false
     */
    public boolean validateOptions() throws CommandValidationException
    {
            return super.validateOptions();
    }

    /**
     * A method that Executes the command
     * @throws CommandException
     */
    public void runCommand() throws CommandException, CommandValidationException
    {

        validateOptions();

        // Retrieve the MBean Server Connection
        MBeanServerConnection mbsc = getMBeanServerConnection(getHost(),
                                                              getPort(),
                                                              getUser(),
                                                              getPassword());
        String targetName = getOption(TARGET_OPTION);
        String componentName = (String) getOperands().get(0);

        // Call the Common Client to process the start component command
  // try {
  // String result = ((JBIAdminCommands) mCommonClient).startComponent(
  // componentName,
  // targetName,
  // mbsc);
  // }
  // catch (JBIRemoteException jre) {
  // // - Process CommonClientException
  // // - throw new CommandException(getLocalizedString("abc");
  // }

        // Display the default success message
        CLILogger.getInstance().printDetailMessage (
                getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
    }

}