com.vmware.apputils
Class AppUtil

java.lang.Object
  extended by com.vmware.apputils.AppUtil
Direct Known Subclasses:
ExtendedAppUtil

public class AppUtil
extends java.lang.Object

The AppUtil class handles basic setup needed to create a connection to a VMware Infrastructure server, such as ESX, ESXi, or VirtualCenter server. This class validates user input (in terms of correct datatypes) and creates instances of the built-in options (command-line arguments) for servername, username, password, and so on.

This class also creates an instance of the Logger for outputting messages to the console, and parses and validates any additional command-line options (creating by using the OptionSpec class) that might be passed to it from a sample application.


Field Summary
 Log log
           
 
Constructor Summary
AppUtil(java.lang.String name)
           
 
Method Summary
 void addOptions(OptionSpec[] userOptions)
           
static void ALog(Log glog)
           
 void connect()
           
 void disConnect()
           
 void displayUsage()
           
 java.lang.String get_option(java.lang.String key)
           
 java.lang.String getAppName()
           
 ServiceConnection getConnection()
           
 Log getLog()
           
 java.lang.String getPassword()
           
 java.lang.String getServiceUrl()
           
 ServiceUtil getServiceUtil()
           
 java.lang.String getUsername()
           
 ClientUtil getUtil()
           
 void init(java.lang.String name)
           
 void initConnection()
           
static AppUtil initialize(java.lang.String name, OptionSpec[] userOptions, java.lang.String[] args)
           
static AppUtil initialize(java.lang.String name, java.lang.String[] args)
           
 void loadSession()
           
 boolean option_is_set(java.lang.String option)
           
 void parseInput(java.lang.String[] args)
           
 void saveSession(java.lang.String fileName)
           
 void setup()
           
 void validate()
           
 void validate(java.lang.Object className, java.lang.String functionName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public Log log
Constructor Detail

AppUtil

public AppUtil(java.lang.String name)
Method Detail

initialize

public static AppUtil initialize(java.lang.String name,
                                 OptionSpec[] userOptions,
                                 java.lang.String[] args)
                          throws java.lang.Exception
Throws:
java.lang.Exception

initialize

public static AppUtil initialize(java.lang.String name,
                                 java.lang.String[] args)
                          throws java.lang.Exception
Throws:
java.lang.Exception

ALog

public static void ALog(Log glog)

setup

public void setup()

init

public void init(java.lang.String name)

initConnection

public void initConnection()
                    throws java.lang.Exception
Throws:
java.lang.Exception

addOptions

public void addOptions(OptionSpec[] userOptions)
                throws java.lang.Exception
Throws:
java.lang.Exception

parseInput

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

validate

public void validate()
              throws java.lang.Exception
Throws:
java.lang.Exception

validate

public void validate(java.lang.Object className,
                     java.lang.String functionName)
              throws java.lang.Exception
Throws:
java.lang.Exception

displayUsage

public void displayUsage()

option_is_set

public boolean option_is_set(java.lang.String option)

get_option

public java.lang.String get_option(java.lang.String key)

connect

public void connect()
             throws java.lang.Exception
Throws:
java.lang.Exception

loadSession

public void loadSession()
                 throws java.lang.Exception
Throws:
java.lang.Exception

saveSession

public void saveSession(java.lang.String fileName)
                 throws java.lang.Exception
Throws:
java.lang.Exception

disConnect

public void disConnect()
                throws java.lang.Exception
Throws:
java.lang.Exception

getAppName

public java.lang.String getAppName()
Returns:
name of the client application

getLog

public Log getLog()
Returns:
current log

getConnection

public ServiceConnection getConnection()
Returns:
the service connection object

getUtil

public ClientUtil getUtil()
Returns:
Client Util object

getServiceUtil

public ServiceUtil getServiceUtil()
Returns:
Service Util object

getServiceUrl

public java.lang.String getServiceUrl()
                               throws java.lang.Exception
Returns:
web service url
Throws:
java.lang.Exception

getUsername

public java.lang.String getUsername()
                             throws java.lang.Exception
Returns:
web service username
Throws:
java.lang.Exception

getPassword

public java.lang.String getPassword()
                             throws java.lang.Exception
Returns:
web service password
Throws:
java.lang.Exception