Remote Systems
v6.4.1

com.ibm.etools.systems.dstore.core.miners.miner
Class Miner

java.lang.Object
  extended bycom.ibm.etools.systems.dstore.core.miners.miner.Miner
All Implemented Interfaces:
ISchemaExtender
Direct Known Subclasses:
CommandMiner, EnvironmentMiner, UniversalFileSystemMiner

public abstract class Miner
extends Object
implements ISchemaExtender

Miner is the abstact base class of all DataStore extensions). The DataStore framework knows how to load and route commands to miners because it interfaces miners through the restricted set of interfaces declared here. To add a new miner, developers must extend this class and implement the abstract methods declared here.


Field Summary
 DataStore _dataStore
           
protected  ArrayList _dependencies
           
 DataElement _minerData
           
 DataElement _minerElement
           
 DataElement _minerTransient
           
protected  String _name
           
protected  ResourceBundle _resourceBundle
           
protected  String _value
           
static String Copyright
           
 
Constructor Summary
protected Miner()
          Creates a new Miner
 
Method Summary
 DataElement command(DataElement command)
          Issues a specified command on this miner from the DataStore framework.
 DataElement createAbstractCommandDescriptor(DataElement descriptor, String name, String value)
          Creates an abstract command descriptor.
 DataElement createAbstractObjectDescriptor(DataElement descriptor, String name)
          Creates an abstract object descriptor.
 DataElement createAbstractObjectDescriptor(DataElement descriptor, String name, String source)
          Creates an abstract object descriptor.
 DataElement createAbstractRelationship(DataElement from, DataElement to)
          Creates an abstract relationship between two descriptors.
 DataElement createCommandDescriptor(DataElement descriptor, String name, String value)
          Creates a command descriptor.
 DataElement createCommandDescriptor(DataElement descriptor, String name, String value, boolean visible)
          Creates a command descriptor.
 DataElement createObjectDescriptor(DataElement descriptor, String name)
          Creates a object descriptor.
 DataElement createObjectDescriptor(DataElement descriptor, String name, String source)
          Creates a object descriptor.
 DataElement createReference(DataElement from, DataElement to)
          Creates a contents relationship between any two elements.
 DataElement createRelationDescriptor(DataElement descriptor, String name)
          Creates a new type of relationship descriptor.
 void finish()
          Shuts down the miner and cleans up it's meta-information.
 DataElement getCommandArgument(DataElement command, int arg)
          Returns the argument of a command specified at a given index.
 String getCommandName(DataElement command)
          Returns the name of a command.
 DataElement getCommandStatus(DataElement command)
          Returns the status of a command.
protected  ArrayList getDependencies()
           
 ExternalLoader getExternalLoader()
          Implement this to returns the external class loader for this extender implementation.
 String getLocalizedString(String key)
          Deprecated. use DataStoreResources. instead. This will be removed next major release
 DataElement getMinerData()
          Returns the element that contains this miners meta-information.
 ArrayList getMinerDependencies()
          Returns the qualified names of all miners that this miner depends on.
 DataElement getMinerElement()
          Returns the element that represents this miner.
 DataElement getMinerTransient()
          Returns the transient object container for this element.
 String getName()
          Returns the qualified name of this miner
 int getNumberOfCommandArguments(DataElement command)
          Returns the number of arguments for this command.
 ResourceBundle getResourceBundle()
          Interface to retrieve an NL enabled resource bundle.
 DataElement getSchemaRoot()
          Returns the descriptor root for the DataStore schema
 String getValue()
          Returns the name of this miner
 String getVersion()
          Returns the version of this miner The expected format for this is ".
abstract  DataElement handleCommand(DataElement theCommand)
          Handle commands that are routed to this miner.
 boolean isConnected()
          Indicates whether the miner has been connected to the DataStore yet.
 boolean isInitialized()
          Indicates whether the miner has been initialized yet
protected  void load()
          Default method that gets called on a Miner when it is loaded.
protected  void load(DataElement status)
          Default method that gets called on a Miner when it is loaded.
 void makeTransient(DataElement objectDescriptor)
          Identifies a give object descriptor type to be transient in this miner.
 void setDataStore(DataStore dataStore)
          Sets the DataStore and performs some fundamental initialization for this miner.
 void setExternalLoader(ExternalLoader loader)
           
protected  void updateMinerInfo()
          This gets called after a miner is initialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.etools.systems.dstore.core.model.ISchemaExtender
extendSchema
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

_dataStore

public DataStore _dataStore

_minerElement

public DataElement _minerElement

_minerData

public DataElement _minerData

_minerTransient

public DataElement _minerTransient

_name

protected String _name

_value

protected String _value

_dependencies

protected ArrayList _dependencies

_resourceBundle

protected ResourceBundle _resourceBundle
Constructor Detail

Miner

protected Miner()
Creates a new Miner

Method Detail

getMinerDependencies

public final ArrayList getMinerDependencies()
Returns the qualified names of all miners that this miner depends on. A miner depends on another miner if it's schema extends or uses another's schema. By default it returns an empty list.

Returns:
a list of miner dependencies, each represented as a qualified name

getDependencies

protected ArrayList getDependencies()

isInitialized

public final boolean isInitialized()
Indicates whether the miner has been initialized yet

Returns:
whether the miner has been initialized

isConnected

public final boolean isConnected()
Indicates whether the miner has been connected to the DataStore yet.

Returns:
whether the miner has been connected to the DataStore

finish

public void finish()
Shuts down the miner and cleans up it's meta-information. Override this function to do your own cleanup.


getResourceBundle

public ResourceBundle getResourceBundle()
Interface to retrieve an NL enabled resource bundle. Override this function to get access to a real resource bundle.


load

protected void load()
Default method that gets called on a Miner when it is loaded. Override this function to perform some initialization at miner loading time.


load

protected void load(DataElement status)
Default method that gets called on a Miner when it is loaded. Override this function to perform some initialization at miner loading time. If loading the miner can result in some failure, set that status to incomplete

Parameters:
status - the status of the initialize miner command

updateMinerInfo

protected void updateMinerInfo()
This gets called after a miner is initialized. If you need to update element information at that time, override this method.


getName

public final String getName()
Returns the qualified name of this miner

Returns:
the qualified name of this miner

getValue

public final String getValue()
Returns the name of this miner

Returns:
the name of this miner

command

public final DataElement command(DataElement command)
Issues a specified command on this miner from the DataStore framework. The base class handles "C_INIT_MINERS" but other commands are delegated to the concrete miner implementations through handleCommand()

Parameters:
command - the command that has been sent to this miner
Returns:
the status of the command

setDataStore

public final void setDataStore(DataStore dataStore)
Sets the DataStore and performs some fundamental initialization for this miner. The framework calls this method on a miner before any commands are issued. The extendSchema() is called on the miner.

Parameters:
dataStore - the DataStore that owns this miner

createAbstractCommandDescriptor

public final DataElement createAbstractCommandDescriptor(DataElement descriptor,
                                                         String name,
                                                         String value)
Creates an abstract command descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the command
value - the identifier for this command
Returns:
the new command descriptor

createCommandDescriptor

public final DataElement createCommandDescriptor(DataElement descriptor,
                                                 String name,
                                                 String value)
Creates a command descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the command
value - the identifier for this command
Returns:
the new command descriptor

createCommandDescriptor

public final DataElement createCommandDescriptor(DataElement descriptor,
                                                 String name,
                                                 String value,
                                                 boolean visible)
Creates a command descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the command
value - the identifier for this command
visible - an indication whether this command descriptor should be visible to an end-user
Returns:
the new command descriptor

createAbstractObjectDescriptor

public final DataElement createAbstractObjectDescriptor(DataElement descriptor,
                                                        String name)
Creates an abstract object descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the object type
Returns:
the new object descriptor

createAbstractObjectDescriptor

public final DataElement createAbstractObjectDescriptor(DataElement descriptor,
                                                        String name,
                                                        String source)
Creates an abstract object descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the object type
source - the plugin location of the miner that owns this object type
Returns:
the new object descriptor

createObjectDescriptor

public final DataElement createObjectDescriptor(DataElement descriptor,
                                                String name)
Creates a object descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the object type
Returns:
the new object descriptor

createObjectDescriptor

public final DataElement createObjectDescriptor(DataElement descriptor,
                                                String name,
                                                String source)
Creates a object descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the object type
source - the plugin location of the miner that owns this object type
Returns:
the new object descriptor

createRelationDescriptor

public final DataElement createRelationDescriptor(DataElement descriptor,
                                                  String name)
Creates a new type of relationship descriptor. This is a helper method that miner may call when it creates or updates the schema for it's tool domain

Parameters:
descriptor - the parent descriptor for the new descriptor
name - the name of the relationship type
Returns:
the new relationship descriptor

createAbstractRelationship

public final DataElement createAbstractRelationship(DataElement from,
                                                    DataElement to)
Creates an abstract relationship between two descriptors. An abstract relationship between two descriptors indicates that the first descriptor abstracts the second, while the second inherits the properties of the first. This is a helper method that miner may call when it creates or updates the schema for it's tool domain.

Parameters:
from - the abstacting descriptor
to - the descriptor that is abstracted
Returns:
the new relationship descriptor

createReference

public final DataElement createReference(DataElement from,
                                         DataElement to)
Creates a contents relationship between any two elements.

Parameters:
from - the containing element
to - the element that is contained
Returns:
the new relationship

getMinerElement

public final DataElement getMinerElement()
Returns the element that represents this miner.

Returns:
the miner element

getMinerData

public final DataElement getMinerData()
Returns the element that contains this miners meta-information.

Returns:
the miner data element

getMinerTransient

public final DataElement getMinerTransient()
Returns the transient object container for this element.

Returns:
the transient element

makeTransient

public final void makeTransient(DataElement objectDescriptor)
Identifies a give object descriptor type to be transient in this miner.

Parameters:
objectDescriptor - the object descriptor type that is transient

getCommandName

public final String getCommandName(DataElement command)
Returns the name of a command. This is a helper method to be used inside handleCommand().

Parameters:
command - a tree of elements representing a command
Returns:
the name of the command

getCommandStatus

public final DataElement getCommandStatus(DataElement command)
Returns the status of a command. This is a helper method to be used inside handleCommand().

Parameters:
command - a tree of elements representing a command
Returns:
the status element for the command

getNumberOfCommandArguments

public final int getNumberOfCommandArguments(DataElement command)
Returns the number of arguments for this command. This is a helper method to be used inside handleCommand().

Parameters:
command - a tree of elements representing a command
Returns:
the number of arguments for this command

getCommandArgument

public final DataElement getCommandArgument(DataElement command,
                                            int arg)
Returns the argument of a command specified at a given index. This is a helper method to be used inside handleCommand().

Parameters:
command - a tree of elements representing a command
arg - the index into the commands children
Returns:
the argument of the command

getSchemaRoot

public final DataElement getSchemaRoot()
Returns the descriptor root for the DataStore schema

Returns:
the descriptor root

setExternalLoader

public void setExternalLoader(ExternalLoader loader)

getExternalLoader

public ExternalLoader getExternalLoader()
Description copied from interface: ISchemaExtender
Implement this to returns the external class loader for this extender implementation. In order for a tool extension to be loaded by the DataStore, it's class loader needs to be supplied.

Specified by:
getExternalLoader in interface ISchemaExtender
Returns:
the external loader

handleCommand

public abstract DataElement handleCommand(DataElement theCommand)
Handle commands that are routed to this miner. This interface must be implemented by each miner in order to perform tool actions driven from user interface interaction.

Parameters:
theCommand - an instance of a command containing a tree of arguments

getVersion

public String getVersion()
Returns the version of this miner The expected format for this is ".." This MUST be overridden if version support is required FIXME make this abstract next release


getLocalizedString

public final String getLocalizedString(String key)
Deprecated. use DataStoreResources. instead. This will be removed next major release

If a resource bundle is supplied (ie. getResourceBundle() is overridden), then this is a convenience metho for getting at an NL enabled string

Parameters:
key - the key identifying the string
Returns:
the NL enabled string

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.