admin@glassfish.java.net

Re: [code review]

From: Jane Young-Lau <Jane.Young_at_Sun.COM>
Date: Tue, 12 Sep 2006 00:58:14 -0700

I will review this.

Thanks,
Jane


Mark Saunders wrote:
> Implementation of the JBI command set. The commands are still
> non-functional, but all commands have been placed into the xml
> description file.
>
> The code that is being integrated use the methods in the
> jbi-admin-common.jar file.
>
> Attached are the new files that will be added to the command directory.
>
> The file StartJBIComponentCommand.java will be removed from the cvs
> repository. The new method JBILifecycleCommand.java will take the
> place of this file.
>
> CVS changes are listed below:
>
> Index: admin-cli/commands/build.xml
> ===================================================================
> RCS file: /cvs/glassfish/admin-cli/commands/build.xml,v
> retrieving revision 1.10
> diff -u -r1.10 build.xml
> --- admin-cli/commands/build.xml 16 Mar 2006 03:26:20 -0000 1.10
> +++ admin-cli/commands/build.xml 11 Sep 2006 16:43:37 -0000
> @@ -66,6 +66,7 @@
> <pathelement location="${javaee.jar}"/>
> <!-- jaxb-libs.jar now jarred in jaxr-impl.jar -->
> <pathelement location="${jaxr-impl.jar}"/>
> + <pathelement location="${jbi-admin-common.jar}"/>
> </classpath>
> <include name="**/*.java"/> </javac>
> Index:
> admin-cli/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.47
> diff -u -r1.47 CLIDescriptor.xml
> ---
> admin-cli/commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml
> 28 Aug 2006 17:58:18 -0000 1.47
> +++
> admin-cli/commands/src/java/com/sun/enterprise/cli/commands/CLIDescriptor.xml
> 11 Sep 2006 19:42:16 -0000
> @@ -283,7 +283,13 @@
> <Option name="serviceproperties" type="string"
> value-required="true"/> <Option name="categories"
> type="string" value-required="true"/>
> <Option name="organization" type="string" value-required="true"/>
> - <Option name="savelogin" type="boolean"
> value-required="false" default="false"/> + <Option
> name="savelogin" type="boolean" value-required="false"
> default="false"/> + <Option name="assemblyname" type="string"
> value-required="false"/>
> + <Option name="targetname" type="string" value-required="false"/>
> + <Option name="componentname" type="string"
> value-required="false"/>
> + <Option name="libraryname" type="string"
> value-required="false"/>
> + <Option name="lifecyclestate" type="string"
> value-required="false"/>
> + <Option name="forceshutdown" type="boolean"
> value-required="false" default="false"/>
> </Options>
> <Commands>
> <Command name="backup-domain"
> classname="com.sun.enterprise.cli.commands.BackupCommands"
> numberofoperands="?" usage-text="backup-domain [--domaindir
> domain_directory] [--description description] [--echo=false]
> [--terse=false] [--verbose=false] [domain_name]">
> @@ -5543,16 +5549,211 @@
> <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)] component_name">
> + <Command name="start-jbi-component"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> 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)] component_name">
> <ValidOption name="user"/>
> - <ValidOption name="password"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="stop-jbi-component"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> 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)] component_name">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="shut-down-jbi-component"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> numberofoperands="1" usage-text="asadmin start-jbi-component
> [--terse=false] [--verbose=false] [--forceshutdown=false]
> [--echo=false] [--interactive=true] [--host localhost] [--port
> 4848|4849] [--secure | -s] [--user admin_user] [--passwordfile
> file_name] [--target target(Default server)] component_name">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="forceshutdown"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="install-jbi-component"
> classname="com.sun.enterprise.cli.commands.InstallJBIComponentCommand"
> numberofoperands="1" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--enabled=true] [--upload=true] [--host localhost] [--port 4848|4849]
> [--secure | -s] [--user admin_user] [--passwordfile file_name]
> [--target target(Default server)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="enabled"/>
> + <ValidOption name="upload"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="install-jbi-shared-library"
> classname="com.sun.enterprise.cli.commands.InstallJBISharedLibraryCommand"
> numberofoperands="1" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--upload=true] [--host localhost] [--port 4848|4849] [--secure | -s]
> [--user admin_user] [--passwordfile file_name] [--target
> target(Default server)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="upload"/>
> <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="list-jbi-shared-libraries"
> classname="com.sun.enterprise.cli.commands.ListJBISharedLibrariesCommand"
> numberofoperands="0" usage-text="asadmin install-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)] [--componentname component_name] filepath">
> + <ValidOption name="user"/>
> <ValidOption name="host"/>
> <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> <ValidOption name="interactive"/>
> <ValidOption name="terse"/>
> <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="componentname"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="list-jbi-service-engines"
> classname="com.sun.enterprise.cli.commands.ListJBIServiceEnginesCommand"
> numberofoperands="0" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--upload=true] [--host localhost] [--port 4848|4849] [--secure | -s]
> [--user admin_user] [--passwordfile file_name] [--lifecyclestate
> started|stopped|installed] [--target target(Default server)]
> [--libraryname shared_library_name] [--assemblyname
> service_assembly_name] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="lifecyclestate"/>
> + <ValidOption name="libraryname"/>
> + <ValidOption name="assemblyname"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="list-jbi-binding-components"
> classname="com.sun.enterprise.cli.commands.ListJBIBindingComponentsCommand"
> numberofoperands="0" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--upload=true] [--host localhost] [--port 4848|4849] [--secure | -s]
> [--user admin_user] [--passwordfile file_name] [--lifecyclestate
> started|stopped|installed] [--target target(Default server)]
> [--libraryname shared_library_name] [--assemblyname
> service_assembly_name] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="lifecyclestate"/>
> + <ValidOption name="libraryname"/>
> + <ValidOption name="assemblyname"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="list-jbi-service-assemblies"
> classname="com.sun.enterprise.cli.commands.ListJBIServiceAssembliesCommand"
> numberofoperands="0" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--upload=true] [--host localhost] [--port 4848|4849] [--secure | -s]
> [--user admin_user] [--passwordfile file_name] [--lifecyclestate
> started|stopped|installed] [--target target(Default server)]
> [--componentname component_name] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="lifecyclestate"/>
> + <ValidOption name="componentname"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="deploy-jbi-service-assembly"
> classname="com.sun.enterprise.cli.commands.DeployJBIServiceAssemblyCommand"
> numberofoperands="1" usage-text="asadmin install-jbi-component
> [--terse=false] [--verbose=false] [--echo=false] [--interactive=true]
> [--enabled=true] [--upload=true] [--host localhost] [--port 4848|4849]
> [--secure | -s] [--user admin_user] [--passwordfile file_name]
> [--target target(Default server)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="enabled"/>
> + <ValidOption name="upload"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="undeploy-jbi-service-assembly"
> classname="com.sun.enterprise.cli.commands.UndeployJBIServiceAssemblyCommand"
> numberofoperands="1" usage-text="asadmin install-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)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="uninstall-jbi-component"
> classname="com.sun.enterprise.cli.commands.UninstallJBIComponentCommand"
> numberofoperands="1" usage-text="asadmin install-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)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="uninstall-jbi-shared-library"
> classname="com.sun.enterprise.cli.commands.UninstallJBISharedLibraryCommand"
> numberofoperands="1" usage-text="asadmin install-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)] filepath">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="start-jbi-service-assembly"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> 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)] component_name">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="stop-jbi-service-assembly"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> 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)] component_name">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> + <ValidOption name="echo"/>
> + </Command>
> + <Command name="shut-down-jbi-service-assembly"
> classname="com.sun.enterprise.cli.commands.JBILifecycleCommand"
> 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)] component_name">
> + <ValidOption name="user"/>
> + <ValidOption name="host"/>
> + <ValidOption name="port"/>
> + <ValidOption name="passwordfile"/>
> + <ValidOption name="interactive"/>
> + <ValidOption name="terse"/>
> + <ValidOption name="verbose"/>
> + <ValidOption name="secure"/>
> + <ValidOption name="target"/>
> <ValidOption name="echo"/>
> </Command>
> </Commands>
> Index:
> admin-cli/commands/src/java/com/sun/enterprise/cli/commands/LocalStrings.properties
>
> ===================================================================
> RCS file:
> /cvs/glassfish/admin-cli/commands/src/java/com/sun/enterprise/cli/commands/LocalStrings.properties,v
>
> retrieving revision 1.36
> diff -u -r1.36 LocalStrings.properties
> ---
> admin-cli/commands/src/java/com/sun/enterprise/cli/commands/LocalStrings.properties
> 3 Aug 2006 00:29:07 -0000 1.36
> +++
> admin-cli/commands/src/java/com/sun/enterprise/cli/commands/LocalStrings.properties
> 12 Sep 2006 03:22:15 -0000
> @@ -211,4 +211,4 @@
> FileNotReadable=CLI197 The file, {0}, is not readable.
> TargetNotAnInstance=CLI198 Specified target {0} is not an instance.
> InstanceNotRunning=CLI199 Instance {0} is not running. Please start
> the instance first.
> -
> +JBIRuntimeNotAvailable=CLI200 The JBI Runtime is not avaliable,
> Unable to execute the command {0}.
>
> Index: bootstrap/project.properties
> ===================================================================
> RCS file: /cvs/glassfish/bootstrap/project.properties,v
> retrieving revision 1.192
> diff -u -r1.192 project.properties
> --- bootstrap/project.properties 9 Sep 2006 16:37:57 -0000 1.192
> +++ bootstrap/project.properties 11 Sep 2006 15:33:12 -0000
> @@ -183,6 +183,7 @@
> ant.jar=${glassfish.home}/lib/ant/lib/ant.jar
> activation.jar=${glassfish.home}/lib/activation.jar
> admin-cli.jar=${glassfish.home}/lib/admin-cli.jar
> +jbi-admin-common.jar=${glassfish.home}/lib/jbi-admin-common.jar
> appserv-admin.jar=${glassfish.home}/lib/appserv-admin.jar
> appserv-deployment-client.jar=${glassfish.home}/lib/appserv-deployment-client.jar
>
> appserv-cmp.jar=${glassfish.home}/lib/appserv-cmp.jar
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class DeployJBIServiceAssemblyCommand extends JBICommand
> {
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
>
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
> String componentName = getOption(COMPONENT_NAME_OPTION);
> boolean isUpload = getBooleanOption(UPLOAD_OPTION,false);
> boolean isEnabled = getBooleanOption(ENABLED_OPTION,false);
>
> // Retrieve the operand
> String filePath = (String) getOperands().get(0);
>
> String result = ((JBIAdminCommands) mJbiAdminCommands).deployServiceAssembly(
> filePath,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class InstallJBIComponentCommand extends JBICommand
> {
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
> String componentName = getOption(COMPONENT_NAME_OPTION);
> boolean isUpload = getBooleanOption(UPLOAD_OPTION,false);
> boolean isEnabled = getBooleanOption(ENABLED_OPTION,false);
>
> // Retrieve the operand
> String filePath = (String) getOperands().get(0);
>
> String result = ((JBIAdminCommands) mJbiAdminCommands).installComponent(
> filePath,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class InstallJBISharedLibraryCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
> boolean isUpload = getBooleanOption(UPLOAD_OPTION,false);
>
> // Retrieve the operand
> String filePath = (String) getOperands().get(0);
>
> String result = ((JBIAdminCommands) mJbiAdminCommands).installComponent(
> filePath,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.client.JBIAdminCommandsClientFactory;
> import com.sun.jbi.ui.common.JBIAdminCommands;
> import com.sun.jbi.ui.common.JBIRemoteException;
> import javax.management.MBeanServerConnection;
> import java.util.ArrayList;
> import java.util.HashMap;
> import java.util.Iterator;
> import java.util.Map;
>
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public abstract class JBICommand extends S1ASCommand
> {
> protected static final String VERBOSE = "verbose";
> protected static final String TERSE = "terse";
> protected static final String TARGET_OPTION = "target";
> protected static final String LIBRARY_NAME_OPTION = "libraryname";
> protected static final String ASSEMBLY_NAME_OPTION = "assemblyname";
> protected static final String COMPONENT_NAME_OPTION = "componentname";
> protected static final String UPLOAD_OPTION = "upload";
> protected static final String ENABLED_OPTION = "enabled";
> protected static final String LIFECYCLE_STATE_OPTION = "lifecyclestate";
> protected static final String FORCE_OPTION = "force";
>
> protected static String[] validStates = {"started","stopped","installed"};
>
> protected JBIAdminCommands mJbiAdminCommands = null;
> protected MBeanServerConnection mbsc = null;
>
> /**
> * 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();
> }
>
> /**
> * Method that will return the option value or if no option value
> * was specified, the default value will be returned.
> * @param optionName The option name use to retrieve the value
> * @param defaultValue The default value returned if no option value exists
> * @return The option value
> */
> protected String getOption(String optionName, String defaultValue)
> {
> return super.getOption(optionName)==null?defaultValue:getOption(optionName);
> }
>
> /**
> * Method that will return the option value or if no option value
> * was specified, the default value will be returned.
> * @param optionName The option name use to retrieve the value
> * @param defaultValue The default value returned if no option value exists
> * @return The option value
> */
> protected String getOption(String optionName, String[] validOptions) throws CommandValidationException
> {
> boolean found = false;
> String option = getOption(optionName);
> for (int i=0; i<validOptions.length; i++)
> {
> if (option.equals(validOptions[i]))
> {
> found = true;
> break;
> }
> }
> if (found) {
> return option;
> }
> else {
> throw new CommandValidationException(getLocalizedString("InvalidValueInOption",
> new Object[]{optionName}));
> }
> }
>
> /**
> * Method that will return the option value or if no option value
> * was specified, the default value will be returned.
> * @param optionName The option name use to retrieve the value
> * @param defaultValue The default value returned if no option value exists
> * @return The option value
> */
> protected boolean getBooleanOption(String optionName, boolean defaultValue)
> {
> return super.getOption(optionName)==null?defaultValue:getBooleanOption(optionName);
> }
>
> /**
> * Debug Method - For testing only
> * Method that will return the usage values that are specified in the
> * usage text string.
> * @return An ArrayList containing the usage options
> */
> public ArrayList getUsageValues ()
> {
> String usageText = getUsageText();
> ArrayList list = new ArrayList();
> int indexStart = usageText.indexOf("--",0);
> while (indexStart != -1)
> {
> int indexEnd = usageText.indexOf(" ",indexStart);
> int indexEnd2 = usageText.indexOf("=",indexStart);
> if (indexEnd2 != -1)
> {
> indexEnd = indexEnd2;
> }
> list.add(usageText.substring(indexStart+2,indexEnd));
> indexStart = usageText.indexOf("--",indexEnd+1);
> }
> return list;
> }
>
> /**
> * Debug Method - For testing only
> * Method that will validate the usage text in the xml file
> */
> public void validateUsageText() throws CommandValidationException
> {
> ArrayList excludedOptions = new ArrayList();
> excludedOptions.add("user");
> excludedOptions.add("passwordfile");
> excludedOptions.add("password");
> validateUsageText(excludedOptions);
> }
>
> /**
> * Debug Method - For testing only
> * Method that will validate the usage text in the xml file
> */
> public void validateUsageText(ArrayList excludedOptions) throws CommandValidationException
> {
> HashMap options = getOptions();
> ArrayList list = getUsageValues();
> if ((list != null) && (options != null))
> {
> // Make sure each option is also documented in the usage text
> for (Iterator iter = options.entrySet().iterator(); iter.hasNext();)
> {
> Map.Entry entry = (Map.Entry)iter.next();
> String key = (String)entry.getKey();
> String value = (String)entry.getValue();
> if (!(list.contains(key)))
> {
> // Throw Exception for jUnit Tests
> System.out.println ("Usage is missing the option: " + key);
> throw new CommandValidationException("Usage is missing the option: " + key);
> }
> }
>
> // Make sure each option in the usage state is a valid option
> // HashMap options = getOptions();
> for (Iterator iter = list.iterator(); iter.hasNext();)
> {
> String value = (String)iter.next();
> if (!excludedOptions.contains(value))
> {
> if (!(options.containsKey(value)))
> {
> // Throw Exception for jUnit Tests
> System.out.println ("Option specified in the usage statement is not a valid option: " + value);
> throw new CommandValidationException("Option specified in the usage statement is not a valid option: " + value);
> }
> }
> }
> }
> }
>
> /**
> * Perform the pre run initialization. This will validate the options as
> * well as retrieve the MBean Server Connection.
> */
> protected boolean preRunInit() throws CommandValidationException,
> CommandException,
> JBIRemoteException
> {
> // Validate the options and opeands
> validateOptions();
>
> // For Testing only -- Will remove later --
> // validateUsageText();
>
> // Retrieve the MBean Server Connection and the JBIAdminCommands object.
> mbsc = getMBeanServerConnection(getHost(),
> getPort(),
> getUser(),
> getPassword());
>
> // Retrieve the JBI Admin Command object
> try {
> mJbiAdminCommands = JBIAdminCommandsClientFactory.getInstance(mbsc);
> }
> catch (Exception e) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
>
> // Make sure we have a valid command object
> if (mJbiAdminCommands == null)
> {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
>
> // Throw an exception if the JBI Runtime is not available.
> if (!(mJbiAdminCommands.isJBIRuntimeEnabled()))
> {
> throw new CommandException(getLocalizedString("JBIRuntimeNotAvailable",
> new Object[]{name}));
> }
>
> return true;
> }
>
>
> // This method is still under development. It currently only
> // dumps the result string passed in to the screen.
> // Note: Still need to I18N all messages.
> protected void processJBIAdminResult (String result)
> {
> if (result == null) {
> CLILogger.getInstance().printDetailMessage ("No Result Found!");
> }
>
> // For now we'll just print the xml result string
> CLILogger.getInstance().printDetailMessage (result);
> }
>
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class JBILifecycleCommand extends JBICommand
> {
> private static final String START_COMPONENT = "start-jbi-component";
> private static final String STOP_COMPONENT = "stop-jbi-component";
> private static final String SHUT_DOWN_COMPONENT = "shut-down-jbi-component";
> private static final String START_SERVICE_ASSEMBLY = "start-jbi-service-assembly";
> private static final String STOP_SERVICE_ASSEMBLY = "stop-jbi-service-assembly";
> private static final String SHUT_DOWN_SERVICE_ASSEMBLY = "shut-down-jbi-service-assembly";
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
>
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
> 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)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).startComponent(
> componentName,
> targetName);
> }
>
> else if (name.equals(STOP_COMPONENT)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).stopComponent(
> componentName,
> targetName);
> }
>
> else if (name.equals(SHUT_DOWN_COMPONENT)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).shutdownComponent(
> componentName,
> force,
> targetName);
> }
> else if (name.equals(START_SERVICE_ASSEMBLY)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).startServiceAssembly(
> componentName,
> targetName);
> }
>
> else if (name.equals(STOP_SERVICE_ASSEMBLY)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).stopServiceAssembly(
> componentName,
> targetName);
> }
>
> else if (name.equals(SHUT_DOWN_SERVICE_ASSEMBLY)) {
> String result = ((JBIAdminCommands) mJbiAdminCommands).shutdownServiceAssembly(
> componentName,
> targetName);
> }
>
> //processJBIAdminResult(result);
>
> }
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
>
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class ListJBIBindingComponentsCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options used for this command
> String targetName = getOption(TARGET_OPTION,"server");
> String libraryName = getOption(LIBRARY_NAME_OPTION);
> String assemblyName = getOption(ASSEMBLY_NAME_OPTION);
> String lifecycleState = getOption(LIFECYCLE_STATE_OPTION,validStates);
>
> if ((libraryName == null) && (assemblyName == null)) {
> result = ((JBIAdminCommands) mJbiAdminCommands).listBindingComponents(
> targetName);
> }
> else {
> result = ((JBIAdminCommands) mJbiAdminCommands).listBindingComponents(
> lifecycleState,
> libraryName,
> assemblyName,
> targetName);
> }
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class ListJBIServiceAssembliesCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options used for this command
> String targetName = getOption(TARGET_OPTION,"server");
> String componentName = getOption(COMPONENT_NAME_OPTION);
> String lifecycleState = getOption(LIFECYCLE_STATE_OPTION,validStates);
>
> if (componentName == null) {
> result = ((JBIAdminCommands) mJbiAdminCommands).listServiceAssemblies(
> targetName);
> }
> else {
> result = ((JBIAdminCommands) mJbiAdminCommands).listServiceAssemblies(
> lifecycleState,
> componentName,
> targetName);
> }
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class ListJBIServiceEnginesCommand extends JBICommand
> {
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options used for this command
> String targetName = getOption(TARGET_OPTION,"server");
> String libraryName = getOption(LIBRARY_NAME_OPTION);
> String assemblyName = getOption(ASSEMBLY_NAME_OPTION);
> String lifecycleState = getOption(LIFECYCLE_STATE_OPTION,validStates);
>
> if ((libraryName == null) && (assemblyName == null)) {
> result = ((JBIAdminCommands) mJbiAdminCommands).listServiceEngines(
> targetName);
> }
> else {
> result = ((JBIAdminCommands) mJbiAdminCommands).listServiceEngines(
> lifecycleState,
> libraryName,
> assemblyName,
> targetName);
> }
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class ListJBISharedLibrariesCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
> String componentName = getOption(COMPONENT_NAME_OPTION);
>
> if (componentName == null) {
> result = ((JBIAdminCommands) mJbiAdminCommands).listSharedLibraries(
> targetName);
> }
> else {
> result = ((JBIAdminCommands) mJbiAdminCommands).listSharedLibraries(
> componentName,
> targetName);
> }
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
>
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class UndeployJBIServiceAssemblyCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
>
> // Retrieve the operand
> String assemblyName = (String) getOperands().get(0);
>
> // Call the Common Client to process the start component command
> result = ((JBIAdminCommands) mJbiAdminCommands).undeployServiceAssembly(
> assemblyName,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
>
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class UninstallJBIComponentCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
>
> // Retrieve the operand
> String componentName = (String) getOperands().get(0);
>
> result = ((JBIAdminCommands) mJbiAdminCommands).uninstallComponent(
> componentName,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
>
> ------------------------------------------------------------------------
>
> /*
> * 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 com.sun.jbi.ui.common.JBIRemoteException;
> import com.sun.jbi.ui.common.JBIAdminCommands;
>
> /**
> * Will start the JBI component on the specified target.
> * @version $Revision: 1.1 $
> */
> public class UninstallJBISharedLibraryCommand extends JBICommand
> {
>
> /**
> * A method that Executes the command
> * @throws CommandException
> */
>
> public void runCommand() throws CommandException, CommandValidationException
> {
> String result = "";
> try {
>
> // Perform the pre run initialization
> if (preRunInit())
> {
> // Retrieve the options
> String targetName = getOption(TARGET_OPTION,"server");
>
> // Retrieve the operand
> String libraryName = (String) getOperands().get(0);
>
> result = ((JBIAdminCommands) mJbiAdminCommands).uninstallSharedLibrary(
> libraryName,
> targetName);
>
> //processJBIAdminResult(result);
>
> // Display the default success message
> CLILogger.getInstance().printDetailMessage (
> getLocalizedString ("CommandSuccessful",new Object[] {name} ) );
> }
> }
>
> // ** ToDo -- Need to create the JBI Remote exception message
> catch (JBIRemoteException jre) {
> throw new CommandException(getLocalizedString("CouldNotInvokeCommand",
> new Object[]{name}));
> }
> }
> }
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>