ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.platform
Class RmiPlatformPersistenceSystem

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--org.jagent.service.util.RMIBasicService
              |
              +--com.ibm.able.platform.AbleBasicService
                    |
                    +--com.ibm.able.platform.RmiPlatformPersistenceSystem
All Implemented Interfaces:
org.jagent.service.IPService, java.rmi.Remote, RmiAblePlatformService, RmiAblePlatformServiceEventGenerator, RmiPlatformPersistenceService, org.jagent.service.RMIService, java.io.Serializable, javax.agent.service.Service

public final class RmiPlatformPersistenceSystem
extends AbleBasicService
implements RmiPlatformPersistenceService

Whee! After all those interfaces and proxies, here is the real, nitty-gritty implementation of an RMI-based Platform Persistence Service.

See Also:
Serialized Form

Fields inherited from class com.ibm.able.platform.AbleBasicService
ANS_PRINCIPAL, LOCAL_PRINCIPAL, myAnsPrincipal, myKeyPair, myMsgLog, myPrincipal, mySecSppt, myServiceEventListeners, myServiceProperties, myTrcLog, myTrustLevel, myVerifiableAgentName, myVerifiableNamingService, REQUESTORS_PORT, SOCKET_FACTORY
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface org.jagent.service.RMIService
RMI, SERVICE_PROTOCOL
 
Fields inherited from interface org.jagent.service.IPService
SERVICE_HOST, SERVICE_PORT
 
Constructor Summary
RmiPlatformPersistenceSystem()
          Create an instance of an RMI-based Platform Persistence Service.
RmiPlatformPersistenceSystem(javax.agent.service.ServiceProperties theServiceProperties)
          Create an instance of an RMI-based Platform Persistence Service, using the specified service properties.
 
Method Summary
 void close(java.lang.String databaseName, java.lang.String tableName, AbleSecureKey key)
          Closes all connections, both the AbleDBImport and AbleDBExport beans for this database table.
 void createTableConnection(java.lang.String databaseName, java.lang.String tableName, java.lang.String[] columnNames, java.lang.String[] columnTypes, AbleSecureKey key)
          This creates both an AbleDBImport and AbleDBExport bean and the table these beans will be dealing with if the table does not already exist.
 void delete(java.lang.String databaseName, java.lang.String tableName, java.lang.Object whereObject, AbleSecureKey key)
          Deletes rows from a table.
 java.lang.String getBindingName()
           
 void insert(java.lang.String databaseName, java.lang.String tableName, java.lang.Object[] insertData, AbleSecureKey key)
          Insert a record into a table.
 java.lang.Object[] select(java.lang.String databaseName, java.lang.String tableName, java.lang.String columnString, java.lang.String whereString, AbleSecureKey key)
          Selects data from a table.
 void terminateService(AbleSecureKey key)
          Secure method that will take down the PPS nicely.
 void update(java.lang.String databaseName, java.lang.String tableName, java.lang.Object updateObject, java.lang.Object whereObject, AbleSecureKey key)
          Updates a row in a table.
 
Methods inherited from class com.ibm.able.platform.AbleBasicService
addAblePlatformServiceEventListener, getAblePlatformServiceEventListeners, notifyAblePlatformServiceEventListeners, removeAblePlatformServiceEventListener, thenNotifyAblePlatformServiceEventListeners
 
Methods inherited from class org.jagent.service.util.RMIBasicService
bindServiceToRegistry, getServiceProperties, setServiceProperties, shutdown
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RmiPlatformPersistenceSystem

public RmiPlatformPersistenceSystem()
                             throws java.lang.Exception
Create an instance of an RMI-based Platform Persistence Service.

RmiPlatformPersistenceSystem

public RmiPlatformPersistenceSystem(javax.agent.service.ServiceProperties theServiceProperties)
                             throws java.lang.Exception
Create an instance of an RMI-based Platform Persistence Service, using the specified service properties.
Parameters:
theServiceProperties - Service properties on which the service is based.

Method Detail

terminateService

public void terminateService(AbleSecureKey key)
                      throws AbleException,
                             javax.agent.service.naming.NamingException
Secure method that will take down the PPS nicely. It will call quitAll() on all of the AbleDBExport and AbleDBImport beans.

Overrides:
terminateService in class AbleBasicService
Parameters:
key - The key that is used to secure this communication

Throws:
AbleException -

On errors verifying the key when the platform is secure.

If the caller is not authorized to make this call.

On any errors calling quitAll on the AbleDBExport and AbleDBImport beans.

On errors terminating the PlatformPersistenceService.

javax.agent.service.naming.NamingException - On errors generating a secureKey used to terminate the PlatformPersistenceService.

getBindingName

public java.lang.String getBindingName()
Overrides:
getBindingName in class org.jagent.service.util.RMIBasicService

createTableConnection

public void createTableConnection(java.lang.String databaseName,
                                  java.lang.String tableName,
                                  java.lang.String[] columnNames,
                                  java.lang.String[] columnTypes,
                                  AbleSecureKey key)
                           throws AbleException,
                                  java.rmi.RemoteException,
                                  PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
This creates both an AbleDBImport and AbleDBExport bean and the table these beans will be dealing with if the table does not already exist. The Export bean will be used in the future to alter the table in any way, and the Import bean will be used to read info from the table.

Specified by:
createTableConnection in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the Database that the table will exist in.

tableName - The name of the table.

columnNames - String[] containing the name of each column for this table.

columnTypes - String[] containing the type of each column for this table.

key - AbleSecureKey used to secure communication.

Throws:
AbleException - On all errors creating and initializing the AbleDBExport or AbleDBImport beans.

PlatformPersistenceException -

If unable to verify the key when the platform is secure.

On errors creating the table.

java.rmi.RemoteException - On all remote errors.

insert

public void insert(java.lang.String databaseName,
                   java.lang.String tableName,
                   java.lang.Object[] insertData,
                   AbleSecureKey key)
            throws java.rmi.RemoteException,
                   PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
Insert a record into a table.

Specified by:
insert in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the Database that the table will exist in.

tableName - The name of the table to insert into.

insertData - Object[] containing the data that is to be inserted into the table.

key - AbleSecureKey used to secure communication.

Throws:
PlatformPersistenceException -

If unable to verify the key when the platform is secure.

If secure and the caller is not the one who originally set up the connection to this table.

java.rmi.RemoteException - On all remote errors.

update

public void update(java.lang.String databaseName,
                   java.lang.String tableName,
                   java.lang.Object updateObject,
                   java.lang.Object whereObject,
                   AbleSecureKey key)
            throws java.rmi.RemoteException,
                   PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
Updates a row in a table.

Specified by:
update in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the Database that the table will exist in.

tableName - The name of the table.

updateObject - This is the new data for the record that is to be updated. This should either be a Map or an Object[]. If it is an Object[], it will contain the data for the record to be updated. Each element represents a column. Every column must be represented, even if a column is not changing. If it is a Map, then keys are the column names and the values are the column values. Unlike an Object[], when using a Map the columns that are not changing do not have to be present. If the updateObject is an Object[], the whereObject must be a String. If the updateObject is a Map, the whereObject must be a Map too.

whereObject - This determines the where clause for the update statement. The whereObject is either a String or a Map. If it is a String, it will be appended to the end of the update statement. If it is a Map, it will be used to build the where clause. The keys will be the column names, and the values will be the Object to match to for their respective column. If left null, or empty, everything will be deleted. If the whereObject is a String, the updateObject must be an Object[]. If the whereObject is a Map, the updateObject must be a Map too.

key - AbleSecureKey used to secure communication

Throws:
PlatformPersistenceException -

If unable to verify the key when the platform is secure.

If secure and the caller is not the one who originally set up the connection to this table.

If updateObject is an Object[], but whereObject is not a String

If updateObject is a Map, but whereObject is not a Map

If updateObject is neither an Object[] or a Map.

java.rmi.RemoteException - On all remote errors.

delete

public void delete(java.lang.String databaseName,
                   java.lang.String tableName,
                   java.lang.Object whereObject,
                   AbleSecureKey key)
            throws java.rmi.RemoteException,
                   PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
Deletes rows from a table.

Specified by:
delete in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the database that the table will exist in.

tableName - The name of the table.

whereObject - This can either be a simple String that states the where clause of the delete, or a Map that will be used to build the where clause. The keys will be the column names, and the values will be the Object to match to for their respective column. If left null, or not a String or Map, everything will be deleted.

key - AbleSecureKey used to secure communication

Throws:
PlatformPersistenceException -

If unable to verify the key when the platform is secure.

If secure and the caller is not the one who originally set up the connection to this table.

java.rmi.RemoteException - On all remote errors.

select

public java.lang.Object[] select(java.lang.String databaseName,
                                 java.lang.String tableName,
                                 java.lang.String columnString,
                                 java.lang.String whereString,
                                 AbleSecureKey key)
                          throws AbleException,
                                 java.rmi.RemoteException,
                                 PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
Selects data from a table.

Specified by:
select in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the database that the table will exist in.

tableName - The name of the table.

columnString - The columns that are to be returned in a select statement. If left blank or null, all columns will be returned.

whereString - The where string of the select statement. If left blank or null, everything will be returned.

key - AbleSecureKey used to secure communication.

Returns:
An Object[] of Object[]s, each containing a returned row from the select statement.

Throws:
AbleException - On AbleDBImport bean errors opening or processing the select query.

PlatformPersistenceException -

If unable to verify the key when the platform is secure.

If secure and the caller is not the one who originally set up the connection to this table.

java.rmi.RemoteException - On all remote errors.

close

public void close(java.lang.String databaseName,
                  java.lang.String tableName,
                  AbleSecureKey key)
           throws AbleException,
                  java.rmi.RemoteException,
                  PlatformPersistenceException
Description copied from interface: RmiPlatformPersistenceService
Closes all connections, both the AbleDBImport and AbleDBExport beans for this database table.

Specified by:
close in interface RmiPlatformPersistenceService
Following copied from interface: com.ibm.able.platform.RmiPlatformPersistenceService
Parameters:
databaseName - The name of the DB that the table will exist in.

tableName - The name of the table.

key - AbleSecureKey used to secure communication.

Throws:
AbleException - On any errors calling quitAll on the AbleDBImport or AbleDBExport beans.

PlatformPersistenceException -

If unable to verify the key when the platform is secure.

If secure and the caller is not the one who originally set up the connection to this table.

java.rmi.RemoteException - On all remote errors.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003