All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sgi.sysadm.ui.TaskLoader

java.lang.Object
   |
   +----com.sgi.sysadm.ui.TaskLoader

public class TaskLoader
extends Object
TaskLoader is intended to be the primary mechanism for clients to query and load Tasks.

Tasks are loaded in a two-step process to allow the Task to be queried for static information, such as its privileges, without having to instantiate the Task.

To support the two-step loading mechanism, Tasks need to define a ResourceBundle named "{taskname}P.properties" and place it in the same package that contains "{taskname}.class".

See Also:
Task

Constructor Index

 o TaskLoader(HostContext, String)
Constructor.

Method Index

 o acceptsOperandType(String)
Determine if the Task accepts the given operand type.
 o equals(TaskLoader)
Test if this TaskLoader is equivalent to other.
 o getFullTaskName()
Get the CLASSPATH relative name of the task associated with this loader.
 o getHostContext()
Get the HostContext associated with this TaskLoader.
 o getItemTester()
Get an ItemTester for the task to be loaded.
 o getLongTaskName()
Gets the long name (Task.LONG_NAME) of the task.
 o getResourceStack()
Get the ResourceStack associated with this task.
 o loadTask(ResultListener)
Load the Task class, instantiate it, set the product attributes (if any) and verify prerequisites.
 o loadTask(TaskData, Vector, ResultListener)
Load the Task class, instantiate it, set TaskData attributes, pass operands, set the product attributes (if any) and verify prerequisites.
 o setDialogParent(JComponent)
Set the dialog parent for the next call to loadTask.

Constructors

 o TaskLoader
 public TaskLoader(HostContext hostContext,
                   String taskName) throws MissingResourceException
Constructor. Load the task properties.

Parameters:
hostContext - The HostContext representing the server to load the task from.
taskName - The CLASSPATH relative name of the task to load.
Throws: MissingResourceException
Thrown if the task ResourceBundle is not found.

Methods

 o getHostContext
 public HostContext getHostContext()
Get the HostContext associated with this TaskLoader.

Returns:
The HostContext associated with this TaskLoader.
 o getFullTaskName
 public String getFullTaskName()
Get the CLASSPATH relative name of the task associated with this loader.

Returns:
the CLASSPATH relative name of the task associated with this loader.
 o getLongTaskName
 public String getLongTaskName()
Gets the long name (Task.LONG_NAME) of the task.

Returns:
A String containing the long name of the task.
 o getResourceStack
 public ResourceStack getResourceStack()
Get the ResourceStack associated with this task.

Returns:
the ResourceStack associated with this task.
 o getItemTester
 public ItemTester getItemTester() throws TaskLoaderException
Get an ItemTester for the task to be loaded. This method first searches for the property Task.ITEM_TESTER that describes the ItemTester class to load. If that property is not found, we look for an ItemTester class called {taskname}Tester.class. If that class is not found, we return an ItemTester that always returns true.

Returns:
An ItemTester for the task to be loaded.
Throws: TaskLoaderException
if the Task.ITEM_TESTER property is defined and specifies a non-existent class or if the tester class cannot be loaded or instantiated for some reason.
 o acceptsOperandType
 public boolean acceptsOperandType(String operandType)
Determine if the Task accepts the given operand type.

Parameters:
operandType - An Item selector representing the operand type to check.
Returns:
true if operandType is accepted, false otherwise.
 o setDialogParent
 public void setDialogParent(JComponent dialogParent)
Set the dialog parent for the next call to loadTask. The privilege dialog will be posted over the dialog parent. Error dialogs will be posted over the dialog parent if the Task has not yet been displayed.

Parameters:
dialogParent - Dialog parent for next call to loadTask.
 o loadTask
 public void loadTask(ResultListener listener)
Load the Task class, instantiate it, set the product attributes (if any) and verify prerequisites. Use this method if no operands will be passed to the Task and no TaskData attributes will be set on the Task.

listener.succeeded() will be called if the Task loading process is successful. The listener may use ResultEvent.getResult() to get a reference to the Task class that was loaded.

listener.failed() will be called if there is an error at any stage of the Task loading process. The listener may use ResultEvent.getReason() to get a localized error message String suitable for display to the user.

Parameters:
listener - The ResultListener that will be notified when the loading, instantiation, and prerequisite verification of the Task has succeeded or failed.
 o loadTask
 public void loadTask(TaskData taskData,
                      Vector operands,
                      ResultListener listener)
Load the Task class, instantiate it, set TaskData attributes, pass operands, set the product attributes (if any) and verify prerequisites.

listener.succeeded() will be called if the Task loading process is successful. The listener may use ResultEvent.getResult() to get a reference to the Task class that was loaded.

listener.failed() will be called if there is an error at any stage of the Task loading process. The listener may use ResultEvent.getReason() to get a localized error message String suitable for display to the user.

Parameters:
taskData - The set of TaskData attributes to set on the Task. May be empty or null if there are no attributes to set.
operands - A Vector of Object to pass to the Task as operands. May be empty or null if there are no operands to pass.
listener - The ResultListener that will be notified when the loading, instantiation, and prerequisite verification of the Task has succeeded or failed.
 o equals
 public boolean equals(TaskLoader other)
Test if this TaskLoader is equivalent to other.

Parameters:
other - A TaskLoader to compare with this one for equality.

All Packages  Class Hierarchy  This Package  Previous  Next  Index