Sun N1 Service Provisioning System 5.1 Plug-in Development Guide

Browsing Function

The com.sun.n1.sps.plugin.browse package contains five interfaces and four classes that specify browse functionality:

Browser API Implementation

The Browser implementation includes the following key API segments:

BrowserFilter[] getAvailableFilters()

Returns the different filters this browser supports. Use the BrowserFilter interface to filter BrowserNodes based on particular criteria, for example, filter all files to show just *.tmp files.

BrowserDisplay getDisplay()

Gets the display properties object to be used with this browser.

BrowserNode getNode(java.lang.String location)

Returns a node in the hierarchy this browser represents.

void setFilterName(java.lang.String name)

Specifies the filter to be used while browsing.

BrowserNode Class

The BrowserNode class implements the entire hierarchy tree functionality. This functionality is segmented into four key areas:

BrowserFactory Interface

The BrowserFactory interface provides the interface for the HierarchyBrowserLoader to obtain an actual instance of the appropriate HierarchyBrowser.

To define a class which implements the BrowserFactory interface, use an API call similar to the following example:

Browser getBrowser(BrowserContext bContext,AgentContext aContext)

where:

The BrowserFactory implementation defines a getBrowser method with the system-supplied BrowserContext object and AgentContext objects as parameters.

In the backing component of the component type, declare the fully qualified class name of the browser factory in the browserClass variable. The following code fragment defines two browser factories for a backing component:

<var 
 access="PRIVATE" 
 name="EJBFileSystemBrowser" 
 default="com.raplix.rolloutexpress.plugins.weblogic.hierarchies.ejb.EJBFileBrowserFactory"
/> 
<var 
 access="PRIVATE" 
 name="EJBDomainBrowser" 
 default="com.raplix.rolloutexpress.plugins.weblogic.hierarchies.ejb.EJBDomainBrowserFactory"
/>

Sample Code for Browsing Function


Example 3–1 Browser Filter

The following example filters all files of the name *.tmp:

public class TmpFilter implements BrowserFilter, ExampleFilter {

    public String getName() {
        return "tmpFilter";
    }
    public String getDescription() {
        return "show only *.tmp files";
    }
    public boolean filter(ExampleBrowserNode node) {
        return node.getLocalName().endsWith(".tmp");
    }

}