All Packages Class Hierarchy This Package Previous Next Index
Class com.sgi.sysadm.manager.RApp
java.lang.Object
|
+----com.sgi.sysadm.manager.RApp
- public abstract class RApp
- extends Object
RApp is an abstract base class for sysadm-based applications.
It provides login services at startup.
Subclasses of RApp need to provide a main() method as
well as the abstract createFrame(), setArgs(), and launchApp()
methods.
For example:
public class RunTask extends RApp {
UIContext _uic;
ResourceStack_rs;
RFrame _frame;
static public void main(String[] args) {
new RunTask(args).loginAndRun(args);
}
public RunTask(String[] args) {
super(RunTask.class.getName(), null, args);
_uic = getUIContext();
_rs = _uic.getResourceStack();
}
public RFrame createFrame() {
_frame = new TaskFrame();
return _frame;
}
// setArgs() and launchApp() are left as an exercise to the reader
}
Subclasses of RApp should override run() if they wish
to implement run-once behavior.
Subclasses should also define the
following properties in the {app name}P.properties file:
To launch a sysadm application from the command line:
Usage: java {appClass} [-L ll[_CC[_variant]]] [-p product name] \
[-s server name] [-l login name] [-n] \
[application options and operands]
-L ll[_CC[_variant]]
Set the locale.
-p product name
The CLASSPATH relative name of the package containing
PackageP.properties for this application.
-s server name
The name of the server on which to run the Task.
-l login name
Login name to use when logging into the server.
-n Don't display the RemoteHostPanel; use values from -s
and -l.
all other arguments are passed to the application.
If the application should display a splash screen, create a file
SplashP.properties
under the package directory passed to
the productName argument of the constructor. In that file,
put three resources: SPLASH_IMAGE, SPLASH_MESSAGE, and SPLASH_FONT.
- See Also:
- SPLASH_IMAGE, SPLASH_MESSAGE, SPLASH_FONT
-
DIALOG_TITLE
- The property RApp.dialogTitle is a String that is
used as the title on all dialogs displayed by this application.
-
SPLASH_FONT
- The resource SplashFont in the file
<package
name>/SplashP.properties is the name of the font used for
the text displayed on the splash screen.
-
SPLASH_IMAGE
- The resource SplashImage in the file
<package
name>/SplashP.properties is the name of an image that
should be displayed on the splash screen.
-
SPLASH_MESSAGE
- The resource SplashMessage in the file
<package
name>/SplashP.properties is the text that
should be displayed on the splash screen.
-
TOO_MANY_ARGS
- The resource RApp.Error.tooManyArgs is a String that is
displayed by tooManyArgsMsg() to indicate to the User that too
many arguments were specified on the command line.
-
UIDEFS
- The property set RApp.uidefs[n] is a array of strings
that control the UIDefaults for the RApp.
-
UNKNOWN_OPTION
- The resource RApp.Error.unknownOption is a format String that
is displayed by unknownOptionMsg() to indicate to the user that
a specific option was not found.
-
RApp(String, String, String[])
- Constructor.
-
createFrame()
- Called by initApp() to initiate creation of the
application frame.
-
getFrame()
- Get the RFrame in which this application is displayed.
-
getProductName()
- Get the product name that was specified on the command line, if
any.
-
getUIContext()
- Get the UIContext associated with this application.
-
initApp()
- Initialize the application frame by calling createFrame() and
register the frame with HostContext.
-
installRhinoLook(ResourceStack, boolean)
- Install the Rhino colors and fonts.
-
launchApp(HostContext, RApp. RAppLaunchListener)
- Called by run() to launch the application.
-
loginAndRun(String[])
- Login and run the sysadm application.
-
registerClient(HostContext, ResultListener)
- Called by run() to register the application's RFrame
with the HostContext before calling launchApp().
-
run(HostContext, RApp. RAppLaunchListener)
- Run a sysadm application.
-
setArgs(Vector, ResultListener)
- Called by the base class to forward command-line arguments to
the subclass.
-
setProductName(String)
- Set the product name when running the RApp from another RApp.
-
tooManyArgsMsg()
- Generate a localized error message using the resource
TOO_MANY_ARGS stating that there were too
many arguments specified on the command line.
-
unknownOptionMsg(String)
- Generate a localized error message using the resource
UNKNOWN_OPTION stating that option
is not recognized by the application
DIALOG_TITLE
public static final String DIALOG_TITLE
- The property RApp.dialogTitle is a String that is
used as the title on all dialogs displayed by this application.
UIDEFS
public static final String UIDEFS
- The property set RApp.uidefs[n] is a array of strings
that control the UIDefaults for the RApp. The value of each
of the Strings should be then name of a UIDefault to set. For
each value, there should be two additional properties:
RApp.uidefs[n].type and RApp.uidefs[n].value
These three keys make up a set:
RApp.uidefs0 = Button.font
RApp.uidefs0.type=FONT
RApp.uidefs0.value= SansSerif-12
The type can be either the String "FONT", or the String
"COLOR". If the type is FONT, a
javax.swing.plaf.FontUIResource will be added to the UI
Defaults, with the font as specified by the value key.
If the type is COLOR, a javax.swing.plaf.ColorUIResource
will be added to the UI Defaults, with the color as specified by
the value key.
Defaults are set in com.sgi.sysadm.ui.SysadmUIP.properties, and
the values can be overridden in the products's PackageP file,
where the product given by the -p flag in the args to the app.
- See Also:
- UIDefaults
UNKNOWN_OPTION
public static final String UNKNOWN_OPTION
- The resource RApp.Error.unknownOption is a format String that
is displayed by unknownOptionMsg() to indicate to the user that
a specific option was not found. Argument {0} is the option
that was not recognized.
TOO_MANY_ARGS
public static final String TOO_MANY_ARGS
- The resource RApp.Error.tooManyArgs is a String that is
displayed by tooManyArgsMsg() to indicate to the User that too
many arguments were specified on the command line.
SPLASH_IMAGE
public static final String SPLASH_IMAGE
- The resource SplashImage in the file
<package
name>/SplashP.properties is the name of an image that
should be displayed on the splash screen. eg:
com/sgi/my-package/splash.gif
SPLASH_MESSAGE
public static final String SPLASH_MESSAGE
- The resource SplashMessage in the file
<package
name>/SplashP.properties is the text that
should be displayed on the splash screen. eg:
Now loading ...
SPLASH_FONT
public static final String SPLASH_FONT
- The resource SplashFont in the file
<package
name>/SplashP.properties is the name of the font used for
the text displayed on the splash screen. eg:
SansSerif-Bold-14
RApp
public RApp(String appClassName,
String productName,
String args[])
- Constructor.
Sets up the UIContext and ResourceStack for the application,
sets the application dialog title.
- Parameters:
- appClassName - The package-qualified name of the
application class.
ResourceStack.BUNDLE_SUFFIX will be
appended to this name to generate the
application ResourceBundle name.
- productName - A String containing the
CLASSPATH relative name of the product
containing the package properties file.
May be null. The value of this
parameter will be overridden if the -p
option is specified on the command line.
- args - The commandLine args that RApp should parse to get
the arguments it needs.
installRhinoLook
public static void installRhinoLook(ResourceStack rs,
boolean addEntries)
- Install the Rhino colors and fonts.
- Parameters:
- rs - The ResourceStack that contains the fonts and colors
to use in the Rhino look.
- addEntries - A flag that controls whether this method
makes an explicit call to addCustomEntriesToTable.
When launched as an application, this call is not necessary, as
the call to setCurrentTheme automatically calls
addCustomEntriesToTable. But when launched as an
Applet, the call is necessary, as
addCustomEntriesToTable is not automatically called.
initApp
public final void initApp()
- Initialize the application frame by calling createFrame() and
register the frame with HostContext. RApp clients that use
run() or launchApp() to launch another RApp must first call initApp().
initApp() will be called automatically when the RApp is run
from the command-line via loginAndRun().
loginAndRun
public final void loginAndRun(String args[])
- Login and run the sysadm application. This method should only
be called if the application is being run from the command
line. Clients that have already logged in that want to run the
application should call the appropriate constructor for that
application and then call run().
- Parameters:
- args - The command-line arguments received by the
application's main() method.
run
public void run(HostContext hc,
RApp. RAppLaunchListener listener)
- Run a sysadm application. This method should be used when one
RApp runs another RApp. Since the first RApp
already has a HostContext, there is no need to log in again.
RApp clients that call run() must first call initApp() to make
sure that the application frame is created and registered with
the HostContext. Failure to call initApp() will result in a
call to Log.fatal().
This method registers the application frame with the host
context, sets up a window listener that unregisters the frame
when the window is closed, and then calls launchApp().
Applications that wish to implement run-once behavior should
override this method. Be sure to check the return value of
getFrame() in run() before dereferencing it; it will be
null if the caller neglected to call initApp().
- Parameters:
- hc - HostContext
- listener - Notified of the result of calling launchApp().
getFrame
public RFrame getFrame()
- Get the RFrame in which this application is displayed. The
RFrame will only be available after initApp() has been called.
- Returns:
- the RFrame in which this application is displayed;
null if initApp() has not yet been called.
getUIContext
public UIContext getUIContext()
- Get the UIContext associated with this application.
- Returns:
- the UIContext associated with this application.
getProductName
public String getProductName()
- Get the product name that was specified on the command line, if
any.
- Returns:
- A String representing the product name specified on the
command line with the -p option or null if no -p option
was specified.
setProductName
public void setProductName(String productName)
- Set the product name when running the RApp from another RApp.
- Parameters:
- productName - A String containing the
CLASSPATH relative name of the product
containing the package properties file.
createFrame
public abstract RFrame createFrame()
- Called by initApp() to initiate creation of the
application frame. This frame is used as the parent of the
login dialog. The subclass can access the returned RFrame
using the getFrame() method.
- Returns:
- the application RFrame.
setArgs
public abstract void setArgs(Vector appArgs,
ResultListener listener)
- Called by the base class to forward command-line arguments to
the subclass. The subclass should parse appArgs and
notify listener of success or failure. On failure,
the subclass should pass a localized error message to
listener via ResultEvent.setReason().
- Parameters:
- appArgs - A Vector of command-line arguments that were not
consumed during command-line parsing by the RApp class.
- listener - The listener to call upon success or failure.
launchApp
protected abstract void launchApp(HostContext hc,
RApp. RAppLaunchListener listener)
- Called by run() to launch the application. The
subclass should start the application and make it
visible. Clients that call launchApp() directly must first call
initApp() to ensure that the application frame has been created.
- Parameters:
- hc - HostContext The HostContext generated at login.
- listener - A listener to notify when the launch succeeds
or fails. On success, the subclass should put
a JComponent into the ResultEvent result that
can be used as the dialog parent for the login
panel, in case the connection needs to be
restarted.
registerClient
protected void registerClient(HostContext hc,
ResultListener listener)
- Called by run() to register the application's RFrame
with the HostContext before calling launchApp().
Subclasses should override this method if they want to
implement run-once behavior.
The base class will automatically unregister the application's
RFrame when the frame is closed.
- Parameters:
- hc - The HostContext to register the RFrame with.
- listener - The listener to notify when registration has
completed.
unknownOptionMsg
public String unknownOptionMsg(String option)
- Generate a localized error message using the resource
UNKNOWN_OPTION stating that option
is not recognized by the application
- Parameters:
- option - The option from the command line that is not
recognized.
- Returns:
- A localized error message.
tooManyArgsMsg
public String tooManyArgsMsg()
- Generate a localized error message using the resource
TOO_MANY_ARGS stating that there were too
many arguments specified on the command line.
- Returns:
- A localized error message.
All Packages Class Hierarchy This Package Previous Next Index