com.tivoli.twg.inventory
Class TWGInvCollector

java.lang.Object
  extended bycom.tivoli.twg.inventory.TWGInvCollector
All Implemented Interfaces:
java.lang.Runnable

public abstract class TWGInvCollector
extends java.lang.Object
implements java.lang.Runnable

The TWGInvCollector is an abstract base class for deriving Inventory collectors. Each collector will be notified when Inventory events occur for the specified managed object so that they may take any necessary actions.

You must call one of the registerCollector() methods in this class during the InitClassRegistration() section of your TWGExtension subclass.


Field Summary
static int INV_COLLECTION_AUTH_FAILURE
          Authorization Failure
static int INV_COLLECTION_COMM_ERROR
          Communication Error
static int INV_COLLECTION_GENERAL_FAILURE
          General Failure
static int INV_COLLECTION_HARDWARE_FAILURE
          Hardware Inventory Error
static int INV_COLLECTION_NO_DATA
          No Inventory Data Returned
static int INV_COLLECTION_SOFTWARE_FAILURE
          Software Inventory Error
static int INV_COLLECTION_SUCCESS
          Collection completed successfully
static int INV_COLLECTION_TIMEOUT
          Timeout
static int INV_COLLECTION_UNKNOWN_SYSTEM
          System Unknown to Inventory
 
Constructor Summary
TWGInvCollector()
          Default constructor
 
Method Summary
abstract  java.lang.String getCollectorThreadName()
          The name of the Inventory Collector.
static TWGDatabaseQuery GetCreateDefaultQuery(TWGDatabaseTable Table)
          Get/create default query for specified table
abstract  java.lang.String[] getDatabaseTableClassNames()
          Subclasses must override this method to specify what inventory tables are populated by the collector
 void internalStartInventory(long moid, java.lang.String className, byte[] addrInfo, int reason)
          Called by main inventory Server to put a StartInventory job on the queue.
 void internalStopInventory(long moid)
          Called by the main Inventory server to put a Stop Inventory job on the queue.
 void inventoryComplete(long moid, int returnCode, long updateTime)
          Inventory Collectors call this method when they have finished processing for a requested inventory on a selected managed object.
static void registerCollector(TWGExtension ext, java.lang.String collectorClassName, java.lang.String moClassName)
          Register inventory collector.
static void registerCollector(TWGExtension ext, java.lang.String collectorClassName, java.lang.String moClassName, java.lang.String overrideCollectorName)
          Register overriding inventory collector The collector will REPLACE the specified collector already designated to be notified when managed objects of this class require inventory operations.
static void registerCollectorForService(TWGExtension ext, java.lang.String collectorClassName, java.lang.String moClassName, java.lang.String serviceName)
          Register inventory collector for a required client service The collector will be ADDED to the list of collectors already designated to be notified when managed objects of this class require inventory operations.
static void registerCollectorForServiceOCN(TWGExtension ext, java.lang.String collectorClassName, java.lang.String moClassName, java.lang.String ovClassName, java.lang.String serviceName)
          Same as registerCollectorForService but allow overrideClassName
 void run()
          Worker thread for queueing up inventory items for the collector
 void sendToDb(int cmdCode, java.lang.Object cmdObj)
          Used by the collector to send information to the database.
abstract  void shutdown()
          Called when the Inventory Server is stopping and the Collector needs to shutdown.
 void start()
          Start collector service node and thread.
abstract  void startInventory(long moid, java.lang.String className, byte[] addrInfo)
          An Inventory collection should be performed on the indicated managed object.
abstract  void stopInventory(long objId)
          A previously requested Inventory scan should be stopped on the indicated managed object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INV_COLLECTION_SUCCESS

public static final int INV_COLLECTION_SUCCESS
Collection completed successfully

See Also:
Constant Field Values

INV_COLLECTION_GENERAL_FAILURE

public static final int INV_COLLECTION_GENERAL_FAILURE
General Failure

See Also:
Constant Field Values

INV_COLLECTION_AUTH_FAILURE

public static final int INV_COLLECTION_AUTH_FAILURE
Authorization Failure

See Also:
Constant Field Values

INV_COLLECTION_COMM_ERROR

public static final int INV_COLLECTION_COMM_ERROR
Communication Error

See Also:
Constant Field Values

INV_COLLECTION_HARDWARE_FAILURE

public static final int INV_COLLECTION_HARDWARE_FAILURE
Hardware Inventory Error

See Also:
Constant Field Values

INV_COLLECTION_SOFTWARE_FAILURE

public static final int INV_COLLECTION_SOFTWARE_FAILURE
Software Inventory Error

See Also:
Constant Field Values

INV_COLLECTION_UNKNOWN_SYSTEM

public static final int INV_COLLECTION_UNKNOWN_SYSTEM
System Unknown to Inventory

See Also:
Constant Field Values

INV_COLLECTION_TIMEOUT

public static final int INV_COLLECTION_TIMEOUT
Timeout

See Also:
Constant Field Values

INV_COLLECTION_NO_DATA

public static final int INV_COLLECTION_NO_DATA
No Inventory Data Returned

See Also:
Constant Field Values
Constructor Detail

TWGInvCollector

public TWGInvCollector()
Default constructor

Method Detail

getDatabaseTableClassNames

public abstract java.lang.String[] getDatabaseTableClassNames()
Subclasses must override this method to specify what inventory tables are populated by the collector


registerCollector

public static final void registerCollector(TWGExtension ext,
                                           java.lang.String collectorClassName,
                                           java.lang.String moClassName)
                                    throws java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException,
                                           java.lang.IllegalAccessException
Register inventory collector. The collector will be ADDED to the list of collectors already designated to be notified when managed objects of this class require inventory operations. This list will call the collectors sequentially. This method must be called by extensions in phase 1 extension initialization.

Parameters:
ext - TWGExtension instance to register database table classes under
collectorClassName - class name of TWGInvCollector subclass to register
moClassName - managed object class name to associate collector with
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

registerCollector

public static final void registerCollector(TWGExtension ext,
                                           java.lang.String collectorClassName,
                                           java.lang.String moClassName,
                                           java.lang.String overrideCollectorName)
                                    throws java.lang.ClassNotFoundException,
                                           java.lang.InstantiationException,
                                           java.lang.IllegalAccessException
Register overriding inventory collector The collector will REPLACE the specified collector already designated to be notified when managed objects of this class require inventory operations. This method must be called by extensions in phase 1 initialization.

Parameters:
ext - TWGExtension instance to register database table classes under
collectorClassName - class name of TWGInvCollector subclass to register
moClassName - managed object class name to associate collector with
overrideCollectorName - collector class to override in the MO class' inheritance list
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

registerCollectorForService

public static final void registerCollectorForService(TWGExtension ext,
                                                     java.lang.String collectorClassName,
                                                     java.lang.String moClassName,
                                                     java.lang.String serviceName)
                                              throws java.lang.ClassNotFoundException,
                                                     java.lang.InstantiationException,
                                                     java.lang.IllegalAccessException
Register inventory collector for a required client service The collector will be ADDED to the list of collectors already designated to be notified when managed objects of this class require inventory operations. The collector is only called for managed objects that support the specified service. This method must be called by extensions in phase 1 extension initialization.

Parameters:
ext - TWGExtension instance to register database table classes under
collectorClassName - class name of TWGInvCollector subclass to register
moClassName - managed object class name to associate collector with
serviceName - service name required on managed object for collector to be called (collector is not called if service is not supported on MO)
Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

registerCollectorForServiceOCN

public static final void registerCollectorForServiceOCN(TWGExtension ext,
                                                        java.lang.String collectorClassName,
                                                        java.lang.String moClassName,
                                                        java.lang.String ovClassName,
                                                        java.lang.String serviceName)
                                                 throws java.lang.ClassNotFoundException,
                                                        java.lang.InstantiationException,
                                                        java.lang.IllegalAccessException
Same as registerCollectorForService but allow overrideClassName

Throws:
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException

start

public void start()
Start collector service node and thread.


getCollectorThreadName

public abstract java.lang.String getCollectorThreadName()
The name of the Inventory Collector. This should be a SHORT name of less than 10 characters. The name will be used as the Thread Name.

Returns:
String identifier the collector is known as

startInventory

public abstract void startInventory(long moid,
                                    java.lang.String className,
                                    byte[] addrInfo)
An Inventory collection should be performed on the indicated managed object.

Parameters:
moid - managed object ID
className - class name of Managed Object
addrInfo - specific addressing info required for this type of managed object

stopInventory

public abstract void stopInventory(long objId)
A previously requested Inventory scan should be stopped on the indicated managed object

Parameters:
objId - managed object id

shutdown

public abstract void shutdown()
Called when the Inventory Server is stopping and the Collector needs to shutdown.


inventoryComplete

public final void inventoryComplete(long moid,
                                    int returnCode,
                                    long updateTime)
Inventory Collectors call this method when they have finished processing for a requested inventory on a selected managed object.

Parameters:
moid - managed object id
returnCode - inventory collection status
updateTime - time update was completed, milliseconds since January 1, 1970 GMT

sendToDb

public final void sendToDb(int cmdCode,
                           java.lang.Object cmdObj)
Used by the collector to send information to the database. Typically this is called as follows:

 TWGDbStoreRow row;
 TWGDbReplaceManagedObjCmd dbCmd = new TWGDbReplaceManagedObjCmd(managedObjectId);
 row = new TWGDbStoreRow(***TABLE_NAME***);
 row.addColumnValue(***COLUMN NAME***, ***COLUMN VALUE***);
 .
 .
 .
 dbCmd.addRow(row);
 sendToDb(TWGDbReplaceManagedObjCmd.TWG_DB_REPLACE_MANAGEDOBJ_CMD, dbCmd);

 

Parameters:
cmdCode - command identifier for command we are sending
cmdObj - Serializable object for sending to the Database

internalStartInventory

public final void internalStartInventory(long moid,
                                         java.lang.String className,
                                         byte[] addrInfo,
                                         int reason)
Called by main inventory Server to put a StartInventory job on the queue. When this job is processed, the startInventory() method of this class will be called

Parameters:
moid - managed object id
className - java class name of object
addrInfo - required addressing info from object that can be used to communicate with object

internalStopInventory

public final void internalStopInventory(long moid)
Called by the main Inventory server to put a Stop Inventory job on the queue. When this job is processed, the stop inventory method of this class will be called.

Parameters:
moid - managed object id

run

public void run()
Worker thread for queueing up inventory items for the collector

Specified by:
run in interface java.lang.Runnable

GetCreateDefaultQuery

public static TWGDatabaseQuery GetCreateDefaultQuery(TWGDatabaseTable Table)
                                              throws TWGDbException
Get/create default query for specified table

Parameters:
Table - database table to get/create default query for
Throws:
TWGDbException - if failed to create default query