public class RemoteIdentityManager extends java.lang.Object implements IdentityManager
IdentityManager
which
delegates requests for database record identity services to the remote P2J
server which is authoritative for the target database. This is necessary
in cases where business logic dynamically connects to a remote database
which is not managed by the current P2J server instance, since unique
primary key generation action must be serialized through a identity manager
which is authoritative for the target database.
An instance of this class works with a local proxy for a remote instance of
IdentityManagerMultiplexer
residing at the target server. The
remote object may manage multiple databases, each of which is assigned a
unique database identifier. When the database is set
into a RemoteIdentityManager
instance, the associated identifier is requested from the remote
multiplexer. The ID returned by the multiplexer is used on all subsequent
service requests sent by the IdentityManager
instance.
RemotePersistence
Modifier and Type | Field and Description |
---|---|
private int |
mpID
Multiplex ID for the remote database associated with this object
|
private IdentityManagerMultiplexer |
multiplexer
Identity manager multiplexer which will service remote requests
|
Constructor and Description |
---|
RemoteIdentityManager(IdentityManagerMultiplexer multiplexer)
Constructor which stores a proxy to the remote object which will
service identity manager requests for the remote database.
|
Modifier and Type | Method and Description |
---|---|
java.io.Serializable |
nextPrimaryKey(java.lang.String table)
Return the next primary key for the specified table.
|
void |
reclaimKeys(java.io.Serializable[] keys)
Inform the identity manager that the given primary keys can be reused.
|
void |
setPersistence(Persistence persistence)
Set the name of the physical database with which this identity manager
is associated.
|
private final IdentityManagerMultiplexer multiplexer
private int mpID
public RemoteIdentityManager(IdentityManagerMultiplexer multiplexer)
multiplexer
- Identity manager multiplexer which will service remote
requests.public void setPersistence(Persistence persistence)
setPersistence
in interface IdentityManager
persistence
- Persistence service object.public java.io.Serializable nextPrimaryKey(java.lang.String table) throws PersistenceException
nextPrimaryKey
in interface IdentityManager
table
- Table for which the next primary key will be returned.PersistenceException
- if there is an error determining the next primary key ID.public void reclaimKeys(java.io.Serializable[] keys)
reclaimKeys
in interface IdentityManager
keys
- Keys for reuse.