File Explorer Sample Overview
The file explorer sample is an extension written by a fictitious company
called Bob's Company, or BobCo for short.
This sample extension adds
a task to the Director console that allows the user to display a simplistic
file explorer view of the local drives on a client with the appropriate
extension installed.
This sample illustrates a server extension which runs in the same JVM
as the Director server, thereby reducing the memory footprint.
Most applications should use this technique.
Applications which briefly use large amounts of resources should use the
technique illustrated in the File Explorer JVM sample.
Details of the File Explorer Sample
This sample demonstrates all three types of task extensions:
console, server, and agent, as described in
Creating Director Tasks.
More detail on extending agents is described in Creating
and Registering a Windows Agent Service.
More detail on extending the console task is described in
Creating Console Task Extensions.
When this extension is installed
on the console, server, and one or more agents, you can activate the task
through console actions by either dragging and dropping an agent on the task
icon or by using the agent's pop-up menu.
When the task is activated,
the console sends a request to the server portion indicating which managed
system it wants to explore.
The initial request causes the file explorer
task server to send a service node command to the specified agent to retrieve
a list of local disk drives.
The results are forwarded back to
the console where they are displayed in a tree view in the file explorer's
GUI.
Each branch represents the root directory of each local drive.
Each time one of the tree view's branches is expanded, a new request is
sent to the server and then forwarded to the agent to retrieve a list of
files from the directory being expanded.
When the results are returned
back to the console, the branch in the tree view is expanded with the contents
of the directory.
The sample code consists of Java source for the console and server portions
and C++ code for the agent service extension.
Defined Interfaces
-
BobCoFileExplorerConstants
-
Defines the constants that need to be shared among the BobCo file explorer classes.
Defined Classes
-
BobCoFileExplorerExtension
-
Extension class for the file explorer
-
BobCoFileExplorerGUI
-
Extends
TWGTaskFrame
to provide the GUI for BobCo's file explorer.
It gets instantiated and launched as appropriate by Director's console.
-
BobCoFileExplorerServer
-
Main class for the BobCo file explorer task server.
It is launched by the Director server as appropriate and receives task
activations through
TWGRemoteTaskManager.
-
BobCoFileExplorerTree
-
Simple extension of JTree that sets up the basic
display properties of the file explorer tree.
It also contains an inner class that provides the tree cell renderer.
-
BobCoFileExplorerTreeNode
-
Extends DefaultMutableTreeNode
and provides the dynamic updating of the tree by issuing commands to the client
as branches are expanded.
-
BobCoResources
-
Resource bundle of translatable strings used by the file explorer.
-
BobCoTaskActivation
-
Utility class that maintains the
additional information needed for task activation processing beyond what is
provided in
TWGRemoteTaskActivation.
-
ConsoleRequestDirectoryContentsCommand
-
Command subclass containing fields used for correlation so the command can be sent
asynchronously and the results can be handled properly when returned.
It also implements the Runnable and
CommandCompleteListener
interfaces so command completion processing can be handled asynchronously under Swing's dispatch thread.
-
ConsoleRequestLocalFixedDrivesCommand
-
Command subclass containing fields used for correlation so the command can be sent
asynchronously and the results can be handled properly when returned.
It also implements the Runnable and
CommandCompleteListener interfaces so command completion processing
can be handled asynchronously under Swing's dispatch thread.
-
GetClientDirectoryContentsCommand
-
Command subclass containing fields used for correlation so
the command can be sent asynchronously and the results can be handled
properly when returned.
It also implements the CommandCompleteListener
interface so it can handle its own command complete processing.
-
GetClientLocalFixedDrivesCommand
-
Command subclass containing fields used for correlation so
the command can be sent asynchronously and the results can be handled
properly when returned.
It also implements the CommandCompleteListener
interface so it can handle its own command complete processing.
Source Files of the Sample
Java Files for the Server
Java Files for the Console
Java Files for the Server and Console
C++ Files for the Windows Agent
To build this sample, see Sample Code Overview.
After building the code for the server, console and Windows agent, install them as follows.
- On the Windows Director server, stop Director by entering:
net stop twgipc
- On the Windows Director server, make a sub-directory classes\com\BobCo\FileExplorer
in the directory in which the Director server is installed. Note: The
installation on the Director server can also be completed using "nmake install" from the
samples\javasrc\com\BobCo\FileExplorer directory.
- Copy the following files to it from samples\classes\com\BobCo\FileExplorer.
BobCoFileExplorerConstants.class
BobCoFileExplorerExtension.class
BobCoFileExplorerServer.class
BobCoFileExplorerTask.properties
BobCoResources.class
BobCoTaskActivation.class
FileExplorerHelp.properties
GetClientDirectoryContentsCommand.class
GetClientLocalFixedDrivesCommand.class
- Copy file BobCoFileExplorer.TWGExt from samples\classes\extensions to
the classes\extensions sub-directory
in the directory where the Director server is installed.
- If the Windows Director console is a separate computer (remote from the server),
also make a sub-directory classes\com\BobCo\FileExplorer
in the directory where the Director console is installed.
Otherwise, the Director console is installed on the same computer as the Director server.
- Copy the following files
from samples\classes\com\BobCo\FileExplorer
to the classes\com\BobCo\FileExplorer sub-directory
in the directory in which the Windows Director console is installed.
BobCoFileExplorerConstants.class
BobCoFileExplorerGUI.class
BobCoFileExplorerTree$BobCoTreeCellRenderer.class
BobCoFileExplorerTree.class
BobCoFileExplorerTreeNode.class
ConsoleRequestDirectoryContentsCommand.class
ConsoleRequestLocalFixedDrivesCommand.class
- On the Windows Director console, make sub-directory classes\com\BobCo\FileExplorer\images
in the directory in which the Windows Director console is installed.
- Copy the following files
from samples\classes\com\BobCo\FileExplorer\images
to the classes\com\BobCo\FileExplorer\images sub-directory
in the directory in which the Windows Director console is installed.
document.gif
drive.gif
find16.gif
find32.gif
folder.gif
openfolder.gif
- For a Windows agent, copy the following files
from the samples\FileExplorer\w32 directory
to the "bin" sub-directory
in the directory where the Director agent was installed.
BobCoRes.dll
BobCBase.exe
- On the computer and in the directory where this SDK is installed, <SdkInstallDir>
(for example c:\Program Files\IBM\Director SDK), begin the registration of the File Explorer agent, by entering.
cd <SdkInstallDir>\samples\FileExplorer\w32
dir svcmgr.ini
The file should NOT exist. If it does, rename it.
<SdkInstallDir>\bin\twgsvcee.exe
The Service Entry Editor opens. Enter the following.
- Service Connection Name: BobCoB
This must match Client.0.Tasks = NativeMO.BobCoB
in file BobCoFileExplorerTask.properties .
- Application Base Name: BobCBase.exe
- Application Base Parameters: (leave blank)
- Select Auto-start and stay loaded.
- Select Run base detached.
- Click Add. The message, "Add of service was successful." should appear.
- Click OK.
- Click Exit. The Service Entry Editor closes and new file svcmgr.ini should be created.
- Enter:
move svcmgr.ini newsvmgr.ini
- Copy file newsvmgr.ini to the Windows agent where File Explorer is being registered,
to the Director\bin sub-directory
in the directory where the Director agent is installed, <InstallDir>
(for example c:\Program Files\IBM\director).
- On this Windows agent, enter:
net stop twgipc
cd <InstallDir>\Director\bin
dir *mgr.ini*
This directory should now contain both files svcmgr.ini and newsvmgr.ini.
twgmrgsi merge newsvmgr.ini
The time stamp on file svcmgr.ini should be updated and the size should increase by almost 200 bytes.
- Start the Windows Director server on which the sample is installed by entering:
net start twgipc
In the Director\log sub-directory:
- there should be no *.err files;
- file com.tivoli.twg.engine.TWGServerMain.stdout
should have several lines containing "BobCoFileExplorer";
If there are no *.stdout files, you may have forgotten to
turn on logging of STDOUT and STDERR.
- Login to the Management Console.
In the Tasks pane, the Explore Files task should appear.
- If the sample is installed on a different agent computer than the server,
also start the Windows Director agent on this computer by entering:
net start twgipc
There should be no *.err files in the agent's log sub-directory.
- In the Management Console, Groups pane, select Director Systems.
If the agent on which File Explorer is installed does not appear, on the main menu,
select Tasks > Discover Systems > Director Systems.
In a less than a minute, the agent should appear.
- In the Management Console, from the Tasks pane,
drag the File Explorer task onto the agent node, in the Group Contents pane.
In the console's Director\log sub-directory,
file com.tivoli.console.ConsoleLauncher.stdout should exist and contain several
lines regarding BobCo.
If it doesn't exist, you may have forgotten to
turn on logging of STDOUT and STDERR
on the remote Director console machine.