Methods Summary |
---|
private java.lang.String | getAppName()
String name = getOption(APP_NAME);
return name;
|
private java.lang.String | getClientStub(javax.management.MBeanServerConnection mbsc)retrieve client stub from server
try
{
final String fileName = new JMXFileTransfer(mbsc).downloadClientStubs(
appName,
downloadDir);
CLILogger.getInstance().printDebugMessage("Downloaded client stubs to: " + fileName);
return fileName;
}
catch (Exception e)
{
Throwable t = e.getCause();
while(t!=null && t.getCause()!=null)
t=t.getCause();
if(t==null)
t=e;
throw new CommandException(t.getLocalizedMessage(),t);
}
|
public void | runCommand()An abstract method that Executes the command
validateOptions();
//use http connector
final MBeanServerConnection mbsc = getMBeanServerConnection(getHost(),
getPort(),
getUser(),
getPassword());
String path = getClientStub(mbsc);
// getClientStub(mbsc,retrievePath, type);
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name} ) );
|
private void | validateDirectory()check if file path exist on the local file system
File dlDir = new File(downloadDir);
if (!dlDir.exists() )
{
dlDir.mkdirs();
}
if(!dlDir.exists() || !dlDir.canWrite() || !dlDir.isDirectory() ) {
throw new CommandValidationException(getLocalizedString(
"InvalidDirectory",new Object [] {downloadDir}));
}
|
public boolean | validateOptions()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.
super.validateOptions();
downloadDir = (String) getOperands().get(0);
validateDirectory();
appName = getAppName();
return true;
|