Top Description Fields Constructors Methods
org.eclipse.persistence.descriptors.partitioning

public Class ValuePartitioningPolicy

extends FieldPartitioningPolicy
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .List, .Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.ValidationException, org.eclipse.persistence.internal.databaseaccess.Accessor, org.eclipse.persistence.internal.helper.ConversionManager, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.queries.DatabaseQuery

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.
Author
James Sutherland
Since
EclipseLink 2.2

Field Summary

Modifier and TypeField and Description
protected String
defaultConnectionPool

The default connection pool is used for any unmapped values.

protected List<String>
orderedPartitions

Use to track order for compute UCP index.

protected Map<String, String>
partitionNames

Store the value partitions by name.

protected Map<Object, String>
partitions

Store the value partitions.

protected Class<?>
partitionValueType

The type of the partition values.

protected String
partitionValueTypeName

The type name of the partition value names.

Inherited from org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy:
partitionFieldunionUnpartitionableQueries

Constructor Summary

AccessConstructor and Description
public
public
public
ValuePartitioningPolicy(String partitionField, boolean unionUnpartitionableQueries)

Method Summary

Modifier and TypeMethod and Description
public void
addPartition(Object value, String connectionPool)

PUBLIC: Add the value partition.

public void
addPartitionName(String valueName, String connectionPool)

INTERNAL: Add partition values by name (will be initialized at runtime with the real class loader).

public void
convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings to actual class-based settings.
public List<Accessor>
getConnectionsForQuery(AbstractSession session, DatabaseQuery query, AbstractRecord arguments)

Implements abstract org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.getConnectionsForQuery.

INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.
public String
getDefaultConnectionPool()

PUBLIC: Return the default connection pool used for any unmapped values.

public List<String>
public Map<Object, String>
getPartitions()

PUBLIC: Return the value partitions.

private <T> T
initObject(Class<T> type, String value)

Convert the string value to the class type.

public void
partitionPersist(AbstractSession session, Object object, ClassDescriptor descriptor)

Overrides org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.partitionPersist.

INTERNAL: Allow for the persist call to assign the partition.
public void
setDefaultConnectionPool(String defaultConnectionPool)

PUBLIC: Set the default connection pool used for any unmapped values.

public void
setOrderedPartitions(List<String> orderedPartitions)

public void
setPartitions(Map<Object, String> partitions)

PUBLIC: Set the value partitions.

public void
setPartitionValueTypeName(String partitionValueTypeName)

INTERNAL:

Inherited from org.eclipse.persistence.descriptors.partitioning.FieldPartitioningPolicy:
extractPartitionValueForPersistgetPartitionFieldgetPartitionFieldNamegetUnionUnpartitionableQueriessetPartitionFieldsetPartitionFieldsetUnionUnpartitionableQueries

Field Detail

defaultConnectionPoolback to summary
protected String defaultConnectionPool

The default connection pool is used for any unmapped values.

orderedPartitionsback to summary
protected List<String> orderedPartitions

Use to track order for compute UCP index.

partitionNamesback to summary
protected Map<String, String> partitionNames

Store the value partitions by name. Initialized at runtime.

partitionsback to summary
protected Map<Object, String> partitions

Store the value partitions. Each partition maps a value to a connectionPool.

partitionValueTypeback to summary
protected Class<?> partitionValueType

The type of the partition values. Initialized from the type name at runtime.

partitionValueTypeNameback to summary
protected String partitionValueTypeName

The type name of the partition value names. Initialized at runtime

Constructor Detail

ValuePartitioningPolicyback to summary
public ValuePartitioningPolicy()
ValuePartitioningPolicyback to summary
public ValuePartitioningPolicy(String partitionField)
ValuePartitioningPolicyback to summary
public ValuePartitioningPolicy(String partitionField, boolean unionUnpartitionableQueries)

Method Detail

addPartitionback to summary
public void addPartition(Object value, String connectionPool)

PUBLIC: Add the value partition.

addPartitionNameback to summary
public void addPartitionName(String valueName, String connectionPool)

INTERNAL: Add partition values by name (will be initialized at runtime with the real class loader).

convertClassNamesToClassesback to summary
public void convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.convertClassNamesToClasses.

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.

Annotations
@Override
getConnectionsForQueryback to summary
public List<Accessor> getConnectionsForQuery(AbstractSession session, DatabaseQuery query, AbstractRecord arguments)

Implements abstract org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.getConnectionsForQuery.

INTERNAL: Get a connection from one of the pools in a round robin rotation fashion.

Annotations
@Override
getDefaultConnectionPoolback to summary
public String getDefaultConnectionPool()

PUBLIC: Return the default connection pool used for any unmapped values.

getOrderedPartitionsback to summary
public List<String> getOrderedPartitions()
getPartitionsback to summary
public Map<Object, String> getPartitions()

PUBLIC: Return the value partitions. Each partition maps a value to a connectionPool.

initObjectback to summary
private <T> T initObject(Class<T> type, String value)

Convert the string value to the class type. This will handle numbers, string, dates, and most other classes.

partitionPersistback to summary
public void partitionPersist(AbstractSession session, Object object, ClassDescriptor descriptor)

Overrides org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy.partitionPersist.

INTERNAL: Allow for the persist call to assign the partition.

Annotations
@Override
setDefaultConnectionPoolback to summary
public void setDefaultConnectionPool(String defaultConnectionPool)

PUBLIC: Set the default connection pool used for any unmapped values.

setOrderedPartitionsback to summary
public void setOrderedPartitions(List<String> orderedPartitions)
setPartitionsback to summary
public void setPartitions(Map<Object, String> partitions)

PUBLIC: Set the value partitions. Each partition maps a value to a connectionPool.

setPartitionValueTypeNameback to summary
public void setPartitionValueTypeName(String partitionValueTypeName)

INTERNAL: