Module eclipselink
Class ValuePartitioningPolicy
- java.lang.Object
-
- org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
-
- org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
-
- org.eclipse.persistence.descriptors.partitioning.ValuePartitioningPolicy
-
- All Implemented Interfaces:
Serializable
public class ValuePartitioningPolicy extends FieldPartitioningPolicy
PUBLIC: ValuePartitioningPolicy partitions access to a database cluster by a field value from the object, such as the object's location, or tenant. Each value is assigned a specific server. All write or read request for object's with that value are sent to the server. If a query does not include the field as a parameter, then it can either be sent to all server's and unioned, or left to the sesion's default behavior.- See Also:
- Serialized Form
- Author:
- James Sutherland
- Since:
- EclipseLink 2.2
-
-
Field Summary
Fields Modifier and Type Field Description protected StringdefaultConnectionPoolThe default connection pool is used for any unmapped values.protected List<String>orderedPartitionsUse to track order for compute UCP index.protected Map<String,String>partitionNamesStore the value partitions by name.protected Map<Object,String>partitionsStore the value partitions.protected Class<?>partitionValueTypeThe type of the partition values.protected StringpartitionValueTypeNameThe type name of the partition value names.-
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
partitionField, unionUnpartitionableQueries
-
Fields inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
name
-
-
Constructor Summary
Constructors Constructor Description ValuePartitioningPolicy()ValuePartitioningPolicy(String partitionField)ValuePartitioningPolicy(String partitionField, boolean unionUnpartitionableQueries)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPartition(Object value, String connectionPool)PUBLIC: Add the value partition.voidaddPartitionName(String valueName, String connectionPool)INTERNAL: Add partition values by name (will be initialized at runtime with the real class loader).voidconvertClassNamesToClasses(ClassLoader classLoader)INTERNAL: Convert all the class-name-based settings to actual class-based settings.List<org.eclipse.persistence.internal.databaseaccess.Accessor>getConnectionsForQuery(org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord arguments)INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.StringgetDefaultConnectionPool()PUBLIC: Return the default connection pool used for any unmapped values.List<String>getOrderedPartitions()Map<Object,String>getPartitions()PUBLIC: Return the value partitions.voidpartitionPersist(org.eclipse.persistence.internal.sessions.AbstractSession session, Object object, ClassDescriptor descriptor)INTERNAL: Allow for the persist call to assign the partition.voidsetDefaultConnectionPool(String defaultConnectionPool)PUBLIC: Set the default connection pool used for any unmapped values.voidsetOrderedPartitions(List<String> orderedPartitions)voidsetPartitions(Map<Object,String> partitions)PUBLIC: Set the value partitions.voidsetPartitionValueTypeName(String partitionValueTypeName)INTERNAL:-
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy
extractPartitionValueForPersist, getPartitionField, getPartitionFieldName, getUnionUnpartitionableQueries, setPartitionField, setPartitionField, setUnionUnpartitionableQueries
-
Methods inherited from class org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy
acquireAccessor, getAccessor, getName, initialize, setName
-
-
-
-
Field Detail
-
partitions
protected Map<Object,String> partitions
Store the value partitions. Each partition maps a value to a connectionPool.
-
partitionNames
protected Map<String,String> partitionNames
Store the value partitions by name. Initialized at runtime.
-
partitionValueTypeName
protected String partitionValueTypeName
The type name of the partition value names. Initialized at runtime
-
partitionValueType
protected Class<?> partitionValueType
The type of the partition values. Initialized from the type name at runtime.
-
orderedPartitions
protected List<String> orderedPartitions
Use to track order for compute UCP index.
-
defaultConnectionPool
protected String defaultConnectionPool
The default connection pool is used for any unmapped values.
-
-
Method Detail
-
convertClassNamesToClasses
public void convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.- Overrides:
convertClassNamesToClassesin classPartitioningPolicy
-
setPartitionValueTypeName
public void setPartitionValueTypeName(String partitionValueTypeName)
INTERNAL:
-
getDefaultConnectionPool
public String getDefaultConnectionPool()
PUBLIC: Return the default connection pool used for any unmapped values.
-
setDefaultConnectionPool
public void setDefaultConnectionPool(String defaultConnectionPool)
PUBLIC: Set the default connection pool used for any unmapped values.
-
getPartitions
public Map<Object,String> getPartitions()
PUBLIC: Return the value partitions. Each partition maps a value to a connectionPool.
-
setPartitions
public void setPartitions(Map<Object,String> partitions)
PUBLIC: Set the value partitions. Each partition maps a value to a connectionPool.
-
addPartition
public void addPartition(Object value, String connectionPool)
PUBLIC: Add the value partition.
-
addPartitionName
public void addPartitionName(String valueName, String connectionPool)
INTERNAL: Add partition values by name (will be initialized at runtime with the real class loader).
-
getConnectionsForQuery
public List<org.eclipse.persistence.internal.databaseaccess.Accessor> getConnectionsForQuery(org.eclipse.persistence.internal.sessions.AbstractSession session, DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord arguments)
INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.- Specified by:
getConnectionsForQueryin classPartitioningPolicy
-
partitionPersist
public void partitionPersist(org.eclipse.persistence.internal.sessions.AbstractSession session, Object object, ClassDescriptor descriptor)INTERNAL: Allow for the persist call to assign the partition.- Overrides:
partitionPersistin classPartitioningPolicy
-
-