com.sun.n1.sps.client
Class CommandManagerBuilder

java.lang.Object
  extended by com.sun.n1.sps.client.CommandManagerBuilder

public final class CommandManagerBuilder
extends java.lang.Object

The CommandManagerBuilder builds and returns the reference to the CommandManager given the File path to the SPS CLI Installation directory. Once the reference to the CommandManger is obtained, the SPS CLUI commands can be invoked via the CommandManager.

Example usage:
CommandManagerBuilder cmb = new CommandManagerBuilder();
// for a default CLI installation location on Unix.
cmb.setCLIInstallationDir(new File("/opt/SUNWn1sps/N1_Service_Provisioning_System_6.0/cli/"));
CommandManager cm = cmb.build();
// Now, CommandManager can be used to invoke the API.

See Also:
CommandManager

Field Summary
static java.lang.String API_VERSION
          This string represents SPS API version.
static java.lang.String MSG_CMD_MGR_REF_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_ERROR_CREATING_TMP_FILES
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_INCOMPATIBLE_VERSION_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_INVALID_BS_JAR_FILE_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_INVALID_CLI_DIR_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_INVALID_CLI_LIB_DIR_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_SET_CLI_MSG
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_SYNCHRONIZATION_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_TEST_CONNECTION_FAILURE_ERROR
          This string is implementational and is not intended for use by clients
static java.lang.String MSG_UNABLE_VERSION_ERROR
          This string is implementational and is not intended for use by clients
 
Constructor Summary
CommandManagerBuilder()
          Constructs the CommandMgrBuilder.
 
Method Summary
 CommandManager build()
          Loads and builds the CommandManager on which the various CLI commands can be executed.
 java.net.URLClassLoader getClassLoader()
          Returns the class loader used to load the CommandManager.
 java.io.File getCLIInstallationDir()
          Returns the SPS CLI Installation directory.
 boolean getTestConnection()
          Gets the flag to validate the Master Server connection.
static java.lang.String getVersion()
          Returns the version of the N1 SPS Public API.
static void main(java.lang.String[] args)
           
 void setCLIInstallationDir(java.io.File inCLIInstDir)
          Sets the SPS CLI Installation directory.
 void setTestConnection(boolean inTestConnection)
          Sets the flag to validate the Master Server connection when the the build method is invoked.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MSG_SET_CLI_MSG

public static final java.lang.String MSG_SET_CLI_MSG
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_CMD_MGR_REF_ERROR

public static final java.lang.String MSG_CMD_MGR_REF_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_SYNCHRONIZATION_ERROR

public static final java.lang.String MSG_SYNCHRONIZATION_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_INVALID_CLI_DIR_ERROR

public static final java.lang.String MSG_INVALID_CLI_DIR_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_INVALID_CLI_LIB_DIR_ERROR

public static final java.lang.String MSG_INVALID_CLI_LIB_DIR_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_ERROR_CREATING_TMP_FILES

public static final java.lang.String MSG_ERROR_CREATING_TMP_FILES
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_INVALID_BS_JAR_FILE_ERROR

public static final java.lang.String MSG_INVALID_BS_JAR_FILE_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_INCOMPATIBLE_VERSION_ERROR

public static final java.lang.String MSG_INCOMPATIBLE_VERSION_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_UNABLE_VERSION_ERROR

public static final java.lang.String MSG_UNABLE_VERSION_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

MSG_TEST_CONNECTION_FAILURE_ERROR

public static final java.lang.String MSG_TEST_CONNECTION_FAILURE_ERROR
This string is implementational and is not intended for use by clients

See Also:
Constant Field Values

API_VERSION

public static java.lang.String API_VERSION
This string represents SPS API version.

Constructor Detail

CommandManagerBuilder

public CommandManagerBuilder()
Constructs the CommandMgrBuilder.

Method Detail

setCLIInstallationDir

public void setCLIInstallationDir(java.io.File inCLIInstDir)
                           throws ConfigurationException
Sets the SPS CLI Installation directory. The SPS CLI Installation directory must be a valid installation directory and must be configured to point to a valid MS installation. Both the CLI and MS must have the same versions.

The MS connection settings are read from the CLI Installation directory.

Parameters:
inCLIInstDir - a valid CLI Installation directory.
Throws:
ConfigurationException - unable to configure setup.

getCLIInstallationDir

public java.io.File getCLIInstallationDir()
Returns the SPS CLI Installation directory.

Returns:
the SPS CLI Installtion directory.

setTestConnection

public void setTestConnection(boolean inTestConnection)
Sets the flag to validate the Master Server connection when the the build method is invoked. By default this flag is false.

Note : If the connection test is to be conducted, always invoke this method with true before invoking the build() method.

Parameters:
inTestConnection - true if the connection test is to be conducted, else false.
See Also:
build()

getTestConnection

public boolean getTestConnection()
Gets the flag to validate the Master Server connection. By default this flag is false.

Returns:
true if this flag has been set to true, else false.

build

public CommandManager build()
                     throws ConfigurationException,
                            ClientException
Loads and builds the CommandManager on which the various CLI commands can be executed. Invoking the build method is an expensive operation and it is recommended that the user create only one CommandManager when connecting to one Master Server instance.

Note: Always call the setCLIInstallationDir(File) before calling this method.

Returns:
The reference to the CommandManager.
Throws:
ConfigurationException - if unable to load the CommandManager.
ClientException - if there was a failure to verify the connection to the CommandManager.
See Also:
setCLIInstallationDir(java.io.File)

getClassLoader

public java.net.URLClassLoader getClassLoader()
Returns the class loader used to load the CommandManager.

Returns:
the class loader used to load the CommandManager.

getVersion

public static java.lang.String getVersion()
Returns the version of the N1 SPS Public API. This version has to be compatible with the version of the CLI installation that is being set by the setCLIInstallationDir(java.io.File).

For example, the version number (6.0) returned by the cli by executing:
[CLI installation path]/cli/bin/$ cr_cli -verion
should be the same (for example 6.0) as returned by this method.
This value can also be obtained on the command line by executing:
[CLI installaion path]/cli/lib/$ java -jar sps-api.jar -path cli_path -version

Returns:
the version of the N1 SPS Public API.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception