|
IBM WebSphere Extended Deployment (XD)TM, Release 6.1 ObjectGrid API Specification |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ObjectGrid
This object is used for creating sessions to the ObjectGrid. It is the
central core of the ObjectGrid framework. Besides creating
Sessions, it is also responsible for defining BackingMaps,
setting a TransactionCallback, managing keywords,
adding event listeners, and managing the security settings.
| Field Summary | |
|---|---|
static int |
CLIENT
Indicates the ObjectGrid is a client-side distributed ObjectGrid. |
static int |
LOCAL
Indicates the ObjectGrid is a local ObjectGrid. |
static int |
SERVER
Indicates the ObjectGrid is a server-side distributed ObjectGrid. |
| Method Summary | |
|---|---|
void |
addEventListener(ObjectGridEventListener listener)
Adds an ObjectGridEventListener. |
void |
associateKeyword(java.io.Serializable parent,
java.io.Serializable child)
Deprecated. Use Index or query function to get Objects with specific attributes |
BackingMap |
createMap(java.lang.String name)
Creates a BackingMap, but does not associate it with this ObjectGrid. |
BackingMap |
defineMap(java.lang.String name)
Defines a BackingMap that will be used by the application. |
void |
destroy()
Destroys this instance. |
java.util.List |
getEventListeners()
Returns the current list of ObjectGridEventListeners. |
java.util.List |
getListOfMapNames()
Gets the list of map names currently defined for this ObjectGrid instance. |
BackingMap |
getMap(java.lang.String name)
Returns a BackingMap previously configured by calling the defineMap(String) or setMaps(List) method. |
java.lang.String |
getName()
Gets the name of this ObjectGrid. |
int |
getObjectGridType()
Returns the type of ObjectGrid. |
Session |
getSession()
Gets a Session object that can be used by a single thread at a time. |
Session |
getSession(CredentialGenerator credGen)
Get a session using a CredentialGenerator. |
Session |
getSession(javax.security.auth.Subject subject)
Allows the use of a specific Subject rather than use the
SubjectSource configured on the ObjectGrid to get a Session. |
TransactionCallback |
getTransactionCallback()
Retrieves the TransactionCallback object. |
int |
getTxTimeout()
Gets transaction timeout setting for this ObjectGrid instance. |
void |
initialize()
Begins the bootstrapping of the ObjectGrid and Session instances. |
boolean |
isSecurityEnabled()
Checks whether security is enabled on this ObjectGrid or not. |
void |
registerEntities(java.lang.Class[] entities)
Register one or more entities based on the class metadata. |
void |
registerEntities(java.net.URL entityXML)
Registers one ore more entities from an entity XML file. |
void |
removeEventListener(ObjectGridEventListener listener)
Removes an ObjectGridEventListener. |
int |
reserveSlot(java.lang.String containerName)
Allows plugins on this ObjectGrid to reserve slots for use in to store transaction context data using TxID. |
void |
setAuthorizationMechanism(int authMechanism)
Sets the authorization mechanism. |
void |
setEventListeners(java.util.List listeners)
This overwrites the current list of ObjectGridEventListeners
and replaces it with the supplied List of ObjectGridEventListeners. |
void |
setMapAuthorization(MapAuthorization mapAuthorization)
Deprecated. in WAS XD 6.1. Use setObjectGridAuthorization(ObjectGridAuthoirzation) instead
to plug in custom authorizations.
If both setMapAuthorization(MapAuthorization) and setObjectGridAuthorization(ObjectGridAuthoirzation)
are used, ObjectGrid will use the provided MapAuthorization to authorize map accesses,
even though this method is deprecated. |
void |
setMaps(java.util.List mapList)
Clears any BackingMaps that have been previously defined
on this ObjectGrid and replaces them with the List of BackingMaps provided. |
void |
setName(java.lang.String gridName)
Sets the name of this ObjectGrid. |
void |
setObjectGridAuthorization(ObjectGridAuthorization ogAuthorization)
Sets the ObjectGridAuthorization for this ObjectGrid instance. |
void |
setPermissionCheckPeriod(int period)
Sets the permission check period. |
void |
setQueryConfig(QueryConfig queryConfig)
Set the QueryConfig object for this ObjectGrid. |
void |
setSecurityEnabled()
Enables the ObjectGrid security. |
void |
setSubjectSource(SubjectSource source)
Sets the SubjectSource plugin. |
void |
setSubjectValidation(SubjectValidation subjectValidation)
Sets the SubjectValidation for this ObjectGrid instance. |
void |
setTransactionCallback(TransactionCallback callback)
Sets the TransactionCallback object. |
void |
setTxTimeout(int timeout)
Sets the transaction timeout value to a specified number of seconds. |
| Methods inherited from interface com.ibm.websphere.objectgrid.streamquery.StreamQueryManager |
|---|
addStreamQuerySet, createStreamQuerySet, getStreamQuerySets, removeStreamQuerySet, setStreamQuerySets |
| Field Detail |
|---|
static final int LOCAL
static final int SERVER
static final int CLIENT
| Method Detail |
|---|
Session getSession()
throws ObjectGridException,
TransactionCallbackException
Gets a Session object that can be used by a single thread at a time.
It is not allowed to share this Session object between
threads without placing a critical section around it. While the core
framework allows the object to move between threads, the
TransactionCallback and Loader may prevent this
usage, especially in J2EE environments.
When the ObjectGrid is a local ObjectGrid, and its security is enabled, this
method will use the SubjectSource to get a Subject
object and then associate the Subject object with this session .
When the ObjectGrid is a distributed ObjectGrid (client server mode), and its security is enabled, this method will utilize the client server security infrastructure to get a secure session.
If the initialize() method has not been invoked prior to
the first getSession invocation, an implicit initialization
will occur. This ensures that all of the configuration is complete
before any runtime usage is required.
Session
ObjectGridException - if an error occurs during processing
TransactionCallbackException - if the TransactionCallback
throws an exception
java.lang.IllegalStateException - if this method is called after the
destroy() method is called.destroy(),
initialize(),
Session,
SubjectSource
Session getSession(javax.security.auth.Subject subject)
throws ObjectGridException,
TransactionCallbackException,
InvalidSubjectException
Subject rather than use the
SubjectSource configured on the ObjectGrid to get a Session.
This method should only be used when ObjectGrid security is enabled. If
the ObjectGrid security is disabled, the provided Subject object will not be
used.
If the initialize() method has not been invoked prior to
the first getSession invocation, an implicit initialization
will occur. This ensures that all of the configuration is complete
before any runtime usage is required.
subject - Subject to associate with the returned Session
Session
ObjectGridException - if an error occurs during processing
TransactionCallbackException - if the TransactionCallback
throws an exception
InvalidSubjectException - the subject passed in is invalid based
on the SubjectValidation mechanism.
java.lang.IllegalStateException - if this method is called after the
destroy() method is called.destroy(),
initialize(),
Session,
SubjectValidationvoid setTransactionCallback(TransactionCallback callback)
A single cache is a single domain. All Loaders defined for
BackingMaps in an ObjectGrid will normally cooperate, thus
a corresponding TransactionCallback object needs to be set
on the ObjectGrid.
callback - An instance of a TransactionCallback
java.lang.IllegalArgumentException - if callback is null
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
TransactionCallbackTransactionCallback getTransactionCallback()
The TransactionCallback can be used in conjunction with the
TxID to house transaction-specific context data,
such as the connection to the database.
setTransactionCallback(TransactionCallback) method of
this interface or a default TransactionCallback object
if setTransactionCallback was not previously called for this ObjectGrid.setTransactionCallback(TransactionCallback),
TransactionCallbackBackingMap defineMap(java.lang.String name)
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
name - the name of the map being defined.
java.lang.IllegalArgumentException - if name is null
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
BackingMapBackingMap createMap(java.lang.String name)
This method is to be used in tandem with the
Note, to avoid an
setMaps(List)
method, which will associate BackingMaps with this ObjectGrid.
These methods are for use when configuring an ObjectGrid with the Spring Framework.
IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
name - the name of the map being defined.
java.lang.IllegalArgumentException - if name is null
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
setMaps(List)
void setMaps(java.util.List mapList)
BackingMaps that have been previously defined
on this ObjectGrid and replaces them with the List of BackingMaps provided.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
mapList - a list of BackingMaps to set on this ObjectGrid.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.createMap(String),
initialize()java.util.List getListOfMapNames()
Note, once the initialize() method is called, the
List returned will not change. However, it could
change if called prior to initialization. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
defineMap(String) or
setMaps(List) method. An empty List is returned
if no maps are currently defined.defineMap(String),
initialize(),
setMaps(List)BackingMap getMap(java.lang.String name)
defineMap(String) or setMaps(List) method.
name - the same name that was used as an argument to the
defineMap(String) or createMap(String) method.
A null reference is returned if a map is not associated with this
ObjectGrid for the specified map name.
- Returns:
- the BackingMap instance
- See Also:
createMap(String),
defineMap(String),
setMaps(List)
void initialize()
throws ObjectGridException
After this method has been invoked, the configuration of the ObjectGrid is
considered complete and is ready for runtime usage. Any additional
configuration method invocations, such as defineMap(String),
will result in an exception.
This method is considered optional since the first call to one of the
getSession methods will perform an implicit initialization.
ObjectGridException - if an error occurs during processingvoid addEventListener(ObjectGridEventListener listener)
ObjectGridEventListener.
Significant events will be communicated to interested listeners through
the
Note, this method is allowed to be invoked before and after the
ObjectGridEventListener callback interface. Multiple
event listeners are allowed to be registered, with no implied ordering of
event notifications.
initialize() method.
listener - An instance of ObjectGridEventListener
java.lang.IllegalArgumentException - if listener is null
java.lang.IllegalStateException - if this method is called during
initialization by one of the configured plugins and the
ObjectGrid runtime is not in a usable state to initialize
the ObjectGridEventListener.ObjectGridEventListener
void removeEventListener(ObjectGridEventListener listener)
ObjectGridEventListener.
This method removes an ObjectGridEventListener that was
previously added to this object using the
addEventListener(ObjectGridEventListener) or
setEventListeners(List) method. If the desired
ObjectGridEventListener is not found, no error will be
returned.
Note, this method is allowed to be invoked before and after the
initialize() method.
listener - An instance of ObjectGridEventListener
java.lang.IllegalArgumentException - if listener is nulladdEventListener(ObjectGridEventListener),
setEventListeners(List),
ObjectGridEventListenervoid setEventListeners(java.util.List listeners)
ObjectGridEventListeners
and replaces it with the supplied List of ObjectGridEventListeners.
Note, this method is allowed to be invoked before and after the
initialize() method.
listeners - List of ObjectGridEventListeners
java.lang.ClassCastException - if one of the elements in the provided list
is not an instance of ObjectGridEventListener
java.lang.IllegalArgumentException - if listeners is null or
contains a null reference.
java.lang.IllegalStateException - if this method is called during
initialization by one of the configured plugins and the
ObjectGrid runtime is not in a usable state to initialize
the ObjectGridEventListener objects.ObjectGridEventListenerjava.util.List getEventListeners()
ObjectGridEventListeners.
ObjectGridEventListeners.addEventListener(ObjectGridEventListener),
setEventListeners(List),
ObjectGridEventListener
void associateKeyword(java.io.Serializable parent,
java.io.Serializable child)
If map entries are invalidated using the parent keyword, map entries associated with the child keyword are also invalidated. Invalidating a child keyword has no impact on entries associated with the parent keyword. For example, this method can be used to add the keyword "New York" as a child of the keyword "USA" so that if "USA" is invalidated, all of the entries associated with the "New York" keyword will also be invalidated.
Note, this method is allowed to be invoked before and after the
initialize() method.
parent - keyword to associate with the child parameter in a
parent-child relationshipchild - All entries associated with this keyword will also be
associated with the parent keywordObjectMap.invalidateUsingKeyword(Serializable, boolean)java.lang.String getName()
This method is useful for authorization as all Maps are prefixed with the ObjectGrid name.
setName(String)void setName(java.lang.String gridName)
IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
gridName - The ObjectGrid name to use.
java.lang.IllegalArgumentException - if gridName is null
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.int reserveSlot(java.lang.String containerName)
TxID.
Once a slot is reserved, the slot assignment is permanent and cannot be given back.
Note, this method is allowed to be invoked before and after the
initialize() method.
containerName - The name of the Object with the slots.
TxID.SLOT_NAME,
TxID.getSlot(int),
TxID.putSlot(int, Object)void setSubjectValidation(SubjectValidation subjectValidation)
SubjectValidation for this ObjectGrid instance.
Passing null to this method removes a previously set
SubjectValidation object from an earlier invocation of this method
and indicates that this ObjectGrid is not associated with a
SubjectValidation object.
This method should only be used when ObjectGrid security is enabled. If
the ObjectGrid security is disabled, the provided SubjectValidation object
will not be used.
A SubjectValidation plugin can be used to validate the
Subject object passed in is a valid Subject.
Please refer to SubjectValidation for more details.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
subjectValidation - the SubjectValidation plugin
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.getSession(Subject),
initialize(),
SubjectValidationvoid setMapAuthorization(MapAuthorization mapAuthorization)
setObjectGridAuthorization(ObjectGridAuthoirzation) instead
to plug in custom authorizations.
If both setMapAuthorization(MapAuthorization) and setObjectGridAuthorization(ObjectGridAuthoirzation)
are used, ObjectGrid will use the provided MapAuthorization to authorize map accesses,
even though this method is deprecated.
MapAuthorization for this ObjectGrid instance.
Passing null to this method removes a previously set
MapAuthorization object from an earlier invocation of this method
and indicates that this ObjectGrid is not associated with a
MapAuthorization object.
This method should only be used when ObjectGrid security is enabled. If
the ObjectGrid security is disabled, the provided MapAuthorization object
will not be used.
A MapAuthorization plugin can be used to authorize
access to the maps. Please refer to MapAuthorization for more details.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
mapAuthorization - the MapAuthorization plugin
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
MapAuthorizationvoid setAuthorizationMechanism(int authMechanism)
If this method is not invoked, the default authorization mechanism is
SecurityConstants.AUTHORIZATION_MECHANISM_JAAS.
This method should only be used when ObjectGrid security is enabled. If the ObjectGrid security is disabled, the provide authorization mechanism will not be used.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
authMechanism - the authorization mechanism, must be one of the
final static variable on the SecurityConstants class.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
SecurityConstants.AUTHORIZATION_MECHANISM_CUSTOM,
SecurityConstants.AUTHORIZATION_MECHANISM_JAASvoid setSecurityEnabled()
Security on the ObjectGrid level refers to ObjectGrid authorizations.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize()boolean isSecurityEnabled()
Security on the ObjectGrid level refers to ObjectGrid authorizations. Security is disabled by default.
setSecurityEnabled()void setPermissionCheckPeriod(int period)
This method takes a single parameter indicating how often the customer wants to check the permission used to allow a client access. If the parameter is 0 then every single authorized operation call will ask the authorization mechanism, either JAAS authorization or custom authorization to check if the current Subject has permission. This approach may be prohibitively expensive from a performance point of view depending on the authorization implementation, but if it is required then you can do it. Alternatively, if the parameter is > 0 then it indicates the number of seconds to cache a set of permissions before returning to the authorization mechanism to refresh them. This mechanism provides much better performance, but you run the risk that if the back-end permissions are changed during this time, the ObjectGrid will possibly allow or prevent access even though the back-end security provider has been modified.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
period - the permission check period in seconds.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize()void setSubjectSource(SubjectSource source)
SubjectSource plugin.
Passing null to this method removes a previously set
SubjectSource object from an earlier invocation of this method
and indicates that this ObjectGrid is not associated with a
SubjectSource object.
A SubjectSource plugin can be used to get a Subject
object from the environment to represent the ObjectGrid client.
This method should only be used when ObjectGrid security is enabled. If
the ObjectGrid security is disabled, the provided SubjectSource object
will not be used.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
source - the SubjectSource plugin
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
SubjectSourcevoid setTxTimeout(int timeout)
Any transaction that is started by use of a Session returned by one of
the
Note, to avoid an
The transaction timeout is used by any transaction started by a Session
that is returned by the getSession methods of this interface. Since this
method must be called prior to getSession method to avoid IllegalStateException,
this method only affects transactions that are started after this method is called.
If this method is never called, the transaction is allowed unlimited amount of
time to complete.
getSession methods on this interface must complete
within the number of seconds specified by the transaction timeout
parameter of this method. The timeout value is the maximum number of
seconds the transaction is allowed to execute. If a transaction
executes longer than this amount, a TransactionTimeoutException
is thrown and the transaction is rolled back even if commit is requested.
IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
timeout - is the transaction timeout value in seconds. Use a value of 0
to indicate a transaction is allowed unlimited amount
of time so that no TransactionTimeoutException ever occurs.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
Session.TRANSACTION_NO_TIMEOUT,
Session.setTransactionTimeout(int),
TransactionTimeoutException
int getTxTimeout()
setTxTimeout(int) method or 0
if setTxTimeout was never called.setTxTimeout(int)void destroy()
This method should be invoked when the ObjectGrid is no longer being
used. When this method is called, the ObjectGrid can free up any
resources it is using. No new Sessions can be created or used after
the destroy() has been invoked. Any in-flight Sessions
will be allowed to continue, if the resources are still available to
complete processing.
Session getSession(CredentialGenerator credGen)
throws ObjectGridException,
TransactionCallbackException
CredentialGenerator.
This method can only be called by the ObjectGrid client in an ObjectGrid
client server environment. If ObjectGrid is used in a local model, that is,
within the same JVM with no client or server existing, getSession(Subject)
or the SubjectSource plugin should be used to secure the ObjectGrid.
If the initialize() method has not been invoked prior to
the first getSession invocation, an implicit initialization
will occur. This ensures that all of the configuration is complete
before any runtime usage is required.
credGen - A CredentialGenerator for generating a credential
for the session returned.
Session
ObjectGridException - if an error occurs during processing
TransactionCallbackException - if the TransactionCallback
throws an exception
java.lang.IllegalStateException - if this method is called after the
destroy() method is called.destroy(),
initialize(),
CredentialGenerator,
Sessionvoid setQueryConfig(QueryConfig queryConfig)
queryConfig - The QueryConfig to associate with this ObjectGrid instance.QueryConfigvoid registerEntities(java.net.URL entityXML)
Entity registration is required prior to ObjectGrid initialization to bind an Entity with a BackingMap and any defined indices.
This method may be called multiple times.
entityXML - the URL of the entity XML that defines the entities.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.void registerEntities(java.lang.Class[] entities)
Entity registration is required prior to ObjectGrid initialization to bind an Entity with a BackingMap and any defined indices.
This method may be called multiple times.
entities - one or more annotated entity classes to register as entities.
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.int getObjectGridType()
The return value is equivalent to one of the constants declared on this interface,
LOCAL, SERVER, or CLIENT.
void setObjectGridAuthorization(ObjectGridAuthorization ogAuthorization)
ObjectGridAuthorization for this ObjectGrid instance.
Passing null to this method removes a previously set
ObjectGridAuthorization object from an earlier invocation of this method
and indicates that this ObjectGrid is not associated with a
ObjectGridAuthorization object.
This method should only be used when ObjectGrid security is enabled. If
the ObjectGrid security is disabled, the provided ObjectGridAuthorization object
will not be used.
A ObjectGridAuthorization plugin can be used to authorize
access to the ObjectGrid and maps. Please refer to ObjectGridAuthorization for more details.
As of XD 6.1, the setMapAuthorization is deprecated and
setObjectGridAuthorization is recommended for use. However,
if both MapAuthorization plugin and ObjectGridAuthorization plugin
are used, ObjectGrid will use the provided MapAuthorization to authorize map accesses,
even though it is deprecated.
Note, to avoid an IllegalStateException, this method must be
called prior to the initialize() method. Also, keep in mind
that the getSession methods implicitly call the
initialize() method if it has yet to be called by the
application.
ogAuthorization - the ObjectGridAuthorization plugin
java.lang.IllegalStateException - if this method is called after the
initialize() method is called.initialize(),
ObjectGridAuthorization
|
IBM WebSphere Extended Deployment (XD)TM, Release 6.1 ObjectGrid API Specification |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||