Object Store Browser Plug-in Source Code Example
When this abstract record is viewed in the object store browser, showing the current value is simple. You can read the state into an instance of the abstract record and call getValue(). The following is the object store browser plug-in source code: public class SimpleRecordOSVPlugin implements StateViewerInterface { /** * A uid node of the type this viewer is registered against has been expanded. * @param os * @param type * @param manipulator * @param node * @throws ObjectStoreException */ public void uidNodeExpanded(ObjectStore os, String type, ObjectStoreBrowserTreeManipulationInterface manipulator, UidNode node, StatePanel infoPanel) throws ObjectStoreException { // Do nothing } /** * An entry has been selected of the type this viewer is registered against. * * @param os * @param type * @param uid * @param entry * @param statePanel * @throws ObjectStoreException */ public void entrySelected(ObjectStore os, String type, Uid uid, ObjectStoreViewEntry entry, StatePanel statePanel) throws ObjectStoreException { SimpleRecord rec = new SimpleRecord(); if ( rec.restore_state( os.read_committed(uid, type), ObjectType.ANDPERSISTENT ) ) { statePanel.setData( “Value�, rec.getValue() ); } } /** * Get the type this state viewer is intended to be registered against. * @return */ public String getType() { return “/StateManager/AbstractRecord/SimpleRecord�; } } The method uidNodeExpanded is invoked when a Uid representing the given type is expanded in the object store hierarchy tree. This is not required by this plug-in as this abstract record is not visible in the object store directly, but only via one of the lists in an atomic action. The method entrySelected is invoked when an entry is selected from the object view which represents an object with the given type. In both methods the State Panel is used to display information regarding the state of the object. The State Panel has the following methods that assist in display this information: Methods of StatePanel setInfo(String info) Shows general information. setData(String name, String value) Puts information into the table which is displayed by the object store browser tool. enableDetailsButton(DetailsButtonListener listener) Enables the Details button. The listener interface allows a plug-in to be informed when the button is pressed. It is up to the plug-in developer to decide how to display this further information. This example reads the state from the object store and uses the value returned by getValue() to put an entry into the state panel table. The getType() method returns the type this plug-in is to be registered against.