The PART Object Browser Tool
Starting from release 1.2, PART
distributions comes with a tool called the Object Browser.
The browser is a standalone PART application that can display
information about distributed objects held by other PART
applications.
The PART binary release includes a pre-compiled browser jar file for J2SE. If you have downloaded a source code release, the browser tool is compiled using the j2se_tools Ant target. For instructions on how to compile PART Ant targets for J2SE, look here.
The following sections describes how the browser is used.- Starting the browser tool
- Connecting the browser to another process
- Searching for session processes
- Retrieving and browsing process objects
- Changing property values
- Object replication issues
Starting the browser tool
The browser can be started via the StartBrowser.bat (Win32) or StartBrowser.sh (Unix) file, located in the part1.2/java/dist/j2se/tools/run_win32 and part1.2/java/dist/j2se/tools/run_unix directories respectively (assuming the release version is 1.2). For instance:
>cd
part1.2/java/dist/j2se/tools/run_win32
>StartBrowser.bat
When started, the browser will build a GUI which looks like this:
Connecting the browser to another process
In order for the browser to be able to display information about objects held by other processes, it needs to be connected to the PART session in which these processes participate. The upper left section of the browser GUI contains field where a host name and a port number can be entered. Once this information has been entered, the 'Connect' button should be pressed to initiate the connect.The host name should be the name of a host where the PART process to which the browser is trying to connect runs (could by any process in the session). The port number should be any TCP port listened to by this process. Note that the browser needs to connect to a port listened to by the application code in the remote process, PART has no "internal" port which it listens to for browser connections. This means that if the application code in a particular process hasn't told PART to listen to any port , the browser can't connect to that process.
Whether the connection fails or succeeds, information is printed in the status window of the browser GUI.
Searching for session processes
Once connected to another process, the browser can display the identifiers of all processes participating in the same session. This is done by pressing the "Search for processes" button at the bottom of the leftmost column.The effect of the search is that the leftmost (process) column is populated with the identifiers of the session processes. Not that it might take a couple of seconds before all identifiers are in place, especially if mobile phones connected via GPRS connections participate in the session.
NOTE the column information isn't automatically updated as processes join or leave the session. This has to be done manually by pressing the "Search for processes" button.
Retrieving and browsing process objects
By selecting (clicking on) a process identifier and then pressing the "Retrieve objects" button at the bottom of the middle (object) column, the browser will fetch and display information about all PART objects held by that process. The information consists of the class name of each object (IpProcess in the figure below), the memory size in bytes of the object, and whether the object is a master (M) or replica (R) copy.NOTE the column information isn't automatically updated as the remote process adds or removes objects. This has to be done manually by pressing the "Retrieve objects" button.
Selecting (clicking on) a line in the object column will display information about the corresponding object's properties. This information will be presented in the rightmost (property) column. The information include the group and name attributes (displayed as group.name) as well as the value. For convenience, the browser associates each property with a number (#) to ease counting.
NOTE if properties are removed or added to the object, or if their values change, the property column isn't automatically refreshed. This has to be done manually by pressing the "Synchronise object" button at the bottom of the column.
Changing property values
The browser allows the user to modify the value of any property displayed in the property column. If a property is selected (clicked on), the property value is displayed in the "set field" below the property column (the value is j2se in the figure below).By modifying the displayed value in the "set field" and then pressing the "Set Value" button, the property is given the new value. This value is set remotely in the property in the processes which is currently being displayed, and also in the copy held by the browser.
Object replication issues
One of the trickiest thing about using the browser is making sure that it has access to class files of all objects it needs to replicate and display. Since the browser is just an ordinary PART process, it uses the PART replication mechanism to copy objects from remote processes. Since replication involves creating local instances of such objects, the corresponding class files must be available in the class path of the browser application, otherwise replication won't work.If the browser tries to copy objects and fails due to unknown class files, an error is printed in the status window (in the figure below, the browser can't instantiate the class TestObject).
Thus, when using the browser, make sure that its class path includes all classes that it might have to replicate and display. For instance, by editing the bat or shell script file used to start the browser, it's possible to add additional class files to the class path. For instance, to add an additional jar file (SomeApplication.jar) containing a set of application classes, located in SOME_PATH directory, the browser startup line in the bat or shell script file should be changed from
java -classpath
"../../dist/j2se/tools/Browser.jar" org.iperg.part.tools.Browser
to
java -classpath
"../../dist/j2se/tools/Browser.jar;SOME_PATH/SomeApplication.jar"
org.iperg.part.tools.Browser