Methods Summary |
---|
public static java.lang.String | getFrameworkString(java.lang.String key)
return getString(key, FRAMEWORK_BASE_PACKAGE,
FRAMEWORK_PROPERTY_FILE_NAME);
|
public static java.lang.String | getFrameworkString(java.lang.String key, java.lang.Object[] toInsert)
return getString(key, toInsert, FRAMEWORK_BASE_PACKAGE,
FRAMEWORK_PROPERTY_FILE_NAME);
|
public ICommandEnvironment | getGlobalsEnv()Returns the command environment that is set in in GlobalsManager.
return mGlobalCommandEnvironment;
|
public static synchronized com.sun.enterprise.cli.framework.GlobalsManager | getInstance()Returns the instance of the GlobalsManager through this object,
the caller can access all the methods in this class.
if( sGlobalsMgr == null )
{
sGlobalsMgr = new GlobalsManager();
}
return sGlobalsMgr;
|
public java.lang.String | getOption(java.lang.String optionName)Returns the option value that is set in GlobalsManager.
String optionValue = (String)mGlobalCommandEnvironment.getEnvironmentValue(optionName );
return optionValue;
|
private static java.util.ResourceBundle | getResourceBundle(java.lang.String packageName, java.lang.String propertyFile)
ResourceBundle resBundle = (ResourceBundle) resourceBundles.get(packageName);
if (resBundle == null)
{
try
{
resBundle = ResourceBundle.getBundle(
packageName + "." + propertyFile);
resourceBundles.put(packageName, resBundle);
}
catch(java.util.MissingResourceException mre)
{
throw new CommandException(mre.getLocalizedMessage());
}
}
return resBundle;
|
public static java.lang.String | getString(java.lang.String key)
return getString(key, COMMANDS_BASE_PACKAGE,
COMMANDS_PROPERTY_FILE_NAME);
|
public static java.lang.String | getString(java.lang.String key, java.lang.Object[] toInsert)
return getString(key, toInsert, COMMANDS_BASE_PACKAGE,
COMMANDS_PROPERTY_FILE_NAME);
|
private static java.lang.String | getString(java.lang.String key, java.lang.String basePkg, java.lang.String propertyFile)
return getResourceBundle(basePkg, propertyFile).getString(key);
|
private static java.lang.String | getString(java.lang.String key, java.lang.Object[] toInsert, java.lang.String basePkg, java.lang.String propertyFile)
String fmtStr = null;
try
{
ResourceBundle resBundle = getResourceBundle(basePkg, propertyFile);
MessageFormat msgFormat =
new MessageFormat(resBundle.getString(key));
fmtStr = msgFormat.format(toInsert);
}
catch(Exception e)
{
throw new CommandException(e.getLocalizedMessage());
}
return fmtStr;
|
public static void | main(java.lang.String[] args)
try
{
GlobalsManager globalsMgr = GlobalsManager.getInstance();
System.out.println(globalsMgr.getFrameworkString("junk", new Object[]{"junk", "prashanth"}));
globalsMgr.setBasePackage("com.sun.enterprise.cli.commands");
System.out.println(globalsMgr.getString("junk", new Object[]{"junk", "prashanth"}));
}
catch(CommandException ce)
{
ce.printStackTrace();
}
|
public void | removeOption(java.lang.String optionName)Removes the option from the options list
mGlobalCommandEnvironment.removeEnvironment(optionName);
|
public static void | setBasePackage(java.lang.String basePkg)
COMMANDS_BASE_PACKAGE = basePkg;
|
public void | setGlobalsEnv(ICommandEnvironment env)Sets the global command environment. (global means the set of options
which are base/common options to all the subcommands).
mGlobalCommandEnvironment = env;
|
public static synchronized void | setInstance(com.sun.enterprise.cli.framework.GlobalsManager globalsMgr)Sets the GlobalsManager object.
if ( sGlobalsMgr != globalsMgr )
{
sGlobalsMgr = globalsMgr;
}
|
public void | setOption(java.lang.String name, java.lang.String value)Sets the Option object in the GlobalsManager.
mGlobalCommandEnvironment.setEnvironment(name, value);
|
public static void | setPropertyFile(java.lang.String fileName)
COMMANDS_PROPERTY_FILE_NAME = fileName;
|