The com.sun.n1.sps.plugin.export package contains seven interfaces and one exception class for specifying component definition and creation functionality:
ComponentExporter – All plug-ins must implement this base interface to construct a component from a browse process.
ComponentMonitor – Monitor created by the system that manages the component creation process for a given component.
ComponentToken – The token to represent a component for purposes of adding a contained component to a CompositeComponentMonitor interface.
CompositeComponentMonitor – The monitor for a component that contains other components.
ResourceProcessor – Allows for introspection of a resource.
SimpleComponentMonitor – Component monitor for components that contain a resource.
SystemData – Gives access to variables defined by various persistent system objects related to the current export and browse operations.
ComponentExportException – Strongly typed exception for use with errors related to component export.
To enable an export function, use a process similar to the following sequence:
In the backing component of the component type, declare the fully qualified class name of the componentExporter in the exporterClass variable.
<varList> <var name="exporterClassName" default="com.sun.n1.sps.pluginimpl.sample.export.StaticCompExporter"/> </varList>
Define a class which implements the ComponentExporter interface.
ComponentExporter calls the various methods on the ComponentMonitor input argument to build the component. These methods might include addComponentVar, addSourceInfoParam, setComponentDescription, and setComponentLabel.
ComponentExporter can also call get routines to obtain information from the ComponentMonitor. These get routines might include getPluginComponentVars, getPluginHostVars, getActiveBrowser, getSourceInfoParam, and getLocation.
ComponentExporter can also call exportResource to call into control blocks to execute component type-specific functionality for exporting the component.
After constructing the component, the ComponentExporter can call setResource to set a physical resource to be bundled in the component, completing the export process.
public class implements ComponentExporter { public ExampleExporter() { } public BrowserContext getBrowserContext() { return new BrowserContext(); } public BrowserInfo[] getAvailableBrowsers() { return new BrowserInfo[] { new BrowserInfo("example", //relevant comp type "Example Browser", //browser ui display name "example ss", //relevant ss null, //valid for all platforms null, //no host set restriction new PromptParamList()) //no checkin params }; } public String getBrowserClassPath(BrowserInfo browser) { return null; } public void constructComponent(ComponentMonitor mon) throws ComponentExportException { //It's the responsibility of the infrastructure to identify the type //of component and construct the component with the appropriate monitor SimpleComponentMonitor sMon = (SimpleComponentMonitor)mon; sMon.setComponentDescription("This is an example component"); sMon.setComponentLabel("What the hell is a label for?"); sMon.setResource(ResourceType.FILE, //our sample type is a file sMon.getLocation(), //get the location specified false, //do not use differential checkin false, //not a config template false, //file->symlinks meaningless true, //capture permissions null, //file->checkinmode meaningless null); //no special processing of rsrc } }