Package org.apache.openjpa.slice
Class SliceImplHelper
- java.lang.Object
-
- org.apache.openjpa.slice.SliceImplHelper
-
public class SliceImplHelper extends java.lang.Object
Utility methods to determine the target slices for a persistence capable instance by calling back to user-specified distribution policy.- Author:
- Pinaki Poddar
-
-
Constructor Summary
Constructors Constructor Description SliceImplHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SliceInfo
getSliceInfo(OpenJPAStateManager sm)
Gets the assigned slice information, if any, from the given StateManager.static SliceInfo
getSlicesByPolicy(java.lang.Object pc, DistributedConfiguration conf, java.lang.Object ctx)
Gets the target slices by calling user-specifiedDistributionPolicy
orReplicationPolicy
depending on whether the given instance isreplicated
.static SliceInfo
getSlicesByPolicy(OpenJPAStateManager sm, DistributedConfiguration conf, java.lang.Object ctx)
Gets the target slices for the given StateManager.static boolean
isReplicated(java.lang.Object pc, DistributedConfiguration conf)
Affirms if the given instance be replicated to multiple slices.static boolean
isSliceAssigned(OpenJPAStateManager sm)
Affirms if the given StateManager has an assigned slice.
-
-
-
Method Detail
-
getSlicesByPolicy
public static SliceInfo getSlicesByPolicy(java.lang.Object pc, DistributedConfiguration conf, java.lang.Object ctx)
Gets the target slices by calling user-specifiedDistributionPolicy
orReplicationPolicy
depending on whether the given instance isreplicated
. The policy is invoked when an instance enters the managed life cycle. However, if the instance being persisted is distributed to a target slice that is not determinable by its own basic attributes, but on its associated instance then those association may not have been initialized at the point of entry. In such case, the policy may return null. However, when a target slice may not be determinable at the entry to managed life cycle, a target slice must be determinable by the time an instance is flushed.- Parameters:
pc
- the managed instance whose target slice is to be determined.conf
- to supply the distribution policyctx
- the (opaque) context of invocation. No semantics is currently associated.- Returns:
- information about the target slice for the given instance. Can be null if the policy can not determine the target slice(s) based on the current state of the instance.
-
getSlicesByPolicy
public static SliceInfo getSlicesByPolicy(OpenJPAStateManager sm, DistributedConfiguration conf, java.lang.Object ctx)
Gets the target slices for the given StateManager.
-
isReplicated
public static boolean isReplicated(java.lang.Object pc, DistributedConfiguration conf)
Affirms if the given instance be replicated to multiple slices.
-
isSliceAssigned
public static boolean isSliceAssigned(OpenJPAStateManager sm)
Affirms if the given StateManager has an assigned slice.
-
getSliceInfo
public static SliceInfo getSliceInfo(OpenJPAStateManager sm)
Gets the assigned slice information, if any, from the given StateManager.
-
-