IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid
Class TimeBasedDBUpdateConfig

java.lang.Object
  extended by com.ibm.websphere.objectgrid.TimeBasedDBUpdateConfig
All Implemented Interfaces:
Externalizable, Serializable

public class TimeBasedDBUpdateConfig
extends Object
implements Externalizable

This TimeBasedDBUpdateConfig represents a configuration for a time-based database updater. A TimeBasedDBUpdateConfig object contains information on how to get the newly inserted and updated records from the database and how to update the data in the correspondent ObjectGrid maps.

Users use BackingMap.setTimeBasedDBUpdateConfig(TimeBasedDBUpdateConfig) method to set a TimeBasedDBUpdateConfig in the backing map configuration.

A time-based database updater periodically interacts with Java Persistence API (JPA) to get the latest changes (inserts and updates) from the database using a specific timestamp field. Therefore, a JPA provider is required to use this feature. The database here can be any backend supported by the chosen JPA provider.

The time-based database updater periodically query the database using JPA interfaces to get the JPA entities which represent the newly inserted and updated records in the database. In order to do that, every record in the database should have a "timestamp" to identify the time or sequence when the record was last updated or inserted. The "timestamp" here does not have to be in a timestamp format. It can be in an integer or long format, as long as it generates a unique increasing value.

If a TimeBasedDBUpdateConfig is defined in the BackingMap or a "timeBasedDBUpdate" element is configured for a backing map in the XML configuration, a time-based database updater is automatically launched. For the distributed ObjectGrid, it will only be launched in the partition 0.

Since:
WAS XD 6.1.0.3
See Also:
BackingMap.setTimeBasedDBUpdateConfig(TimeBasedDBUpdateConfig), Serialized Form

Nested Class Summary
static class TimeBasedDBUpdateConfig.DBUpdateMode
          An type of DBUpdateMode specifies how the database changes should be pushed to the ObjectGrid maps.
 
Constructor Summary
TimeBasedDBUpdateConfig()
           
 
Method Summary
 TimeBasedDBUpdateConfig.DBUpdateMode getDBUpdateMode()
           
 String getEntityClassName()
           
 JPAPropertyFactory getJpaPropertyFactory()
           
 String getPersistenceUnitName()
           
 String getTimestampField()
           
 void readExternal(ObjectInput in)
           
 void setDBUpdateMode(TimeBasedDBUpdateConfig.DBUpdateMode mode)
          Set the time-based database update mode.
 void setEntityClassName(String entityClassName)
          Set the entity class name used to interact with the Java Persistence API (JPA) provider.
 void setJpaPropertyFactory(JPAPropertyFactory map)
          Set the JPA property factory to override the default persistence properties.
 void setPersistenceUnitName(String persistenceUnitName)
          Set the JPA persistence unit name.
 void setTimestampField(String timestampField)
          The timestamp field is a field of the entity class.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeBasedDBUpdateConfig

public TimeBasedDBUpdateConfig()
Method Detail

setEntityClassName

public void setEntityClassName(String entityClassName)
Set the entity class name used to interact with the Java Persistence API (JPA) provider. The entity class name is used to get JPA entities which represent database records.

Parameters:
entityClassName - The entityClassName to set.

setDBUpdateMode

public void setDBUpdateMode(TimeBasedDBUpdateConfig.DBUpdateMode mode)
Set the time-based database update mode.

By default, the time-based database update mode is set to TimeBasedDBUpdateConfig.DBUpdateMode.INVALIDATE_ONLY.

Parameters:
mode - the time-based database update mode
See Also:
TimeBasedDBUpdateConfig.DBUpdateMode

setPersistenceUnitName

public void setPersistenceUnitName(String persistenceUnitName)
Set the JPA persistence unit name.

By default, the persistence unit name is the name of the first persistence unit defined in your persistence.xml file.

Parameters:
persistenceUnitName - the JPA persitence unit name to set.

setTimestampField

public void setTimestampField(String timestampField)
The timestamp field is a field of the entity class. A timestamp field is used to identify the time or sequence when a database backend record was last updated or inserted.

If a timestamp field is not set, then ObjectGrid will try to get the annotated Timestamp from the entity class. If the annotation cannot be found, an IllegalArgumentException will be thrown.

Parameters:
timestampField - the timestamp field to set.

getEntityClassName

public String getEntityClassName()
Returns:
the entity class name used for interacting with JPA.

getDBUpdateMode

public TimeBasedDBUpdateConfig.DBUpdateMode getDBUpdateMode()
Returns:
the time-based database update mode.

getPersistenceUnitName

public String getPersistenceUnitName()
Returns:
the persistence unit name set on this object.

getTimestampField

public String getTimestampField()
Returns:
the timestamp field set on this object.

setJpaPropertyFactory

public void setJpaPropertyFactory(JPAPropertyFactory map)
Set the JPA property factory to override the default persistence properties.

Parameters:
map - the overriding JPA property factory

getJpaPropertyFactory

public JPAPropertyFactory getJpaPropertyFactory()
Returns:
the JPA property factory used to override the default persistence properties.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.