public class JDOAdapter extends Object implements org.datanucleus.api.ApiAdapter
Modifier and Type | Field and Description |
---|---|
protected static Set<String> |
defaultPersistentTypeNames |
protected static org.datanucleus.util.Localiser |
LOCALISER |
Constructor and Description |
---|
JDOAdapter() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowDeleteOfNonPersistentObject()
Whether the API allows deletion of a non-persistent object.
|
boolean |
allowPersistOfDeletedObject()
Whether the API allows (re-)persistence of a deleted object.
|
boolean |
allowReadFieldOfDeletedObject()
Whether the API allows reading a field of a deleted object.
|
boolean |
clearLoadedFlagsOnDeleteObject()
Whether the API requires clearing of the fields of an object when it is deleted.
|
void |
copyFieldsFromPersistableObject(Object pc,
int[] fieldNumbers,
Object pc2) |
void |
copyPkFieldsToPersistableObjectFromId(Object pc,
Object id,
org.datanucleus.store.fieldmanager.FieldManager fm) |
RuntimeException |
getApiExceptionForNucleusException(org.datanucleus.exceptions.NucleusException ne) |
Object |
getCopyOfPersistableObject(Object obj,
org.datanucleus.state.ObjectProvider op,
int[] fieldNumbers) |
RuntimeException |
getDataStoreExceptionForException(String msg,
Exception e)
Convenience method to return a datastore exception appropriate for this API.
|
boolean |
getDefaultCascadeDeleteForField()
Returns the default cascade-delete setting.
|
boolean |
getDefaultCascadePersistForField()
Returns the default cascade-persist.
|
boolean |
getDefaultCascadeRefreshForField()
Returns the default cascade-refresh setting.
|
boolean |
getDefaultCascadeUpdateForField()
Returns the default cascade-update setting.
|
boolean |
getDefaultDFGForPersistableField() |
Map |
getDefaultFactoryProperties()
Method to return the default factory properties for this API.
|
org.datanucleus.ExecutionContext |
getExecutionContext(Object obj)
Method to return the ExecutionContext (if any) associated with the passed object.
|
Object |
getIdForObject(Object obj)
Method to return the object identity for the passed persistable object.
|
Class |
getKeyTypeForSingleFieldIdentityType(Class idType)
Accessor for the type of the single field application-identity key given the single field identity type.
|
org.datanucleus.state.LifeCycleState |
getLifeCycleState(int stateType)
Returns the LifeCycleState for the state constant.
|
String |
getName()
Accessor for the name of the API.
|
Object |
getNewApplicationIdentityObjectId(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.metadata.AbstractClassMetaData acmd,
String value)
Utility to create a new application identity when you know the metadata for the target class,
and the toString() output of the identity.
|
Object |
getNewApplicationIdentityObjectId(Class cls,
Object key)
Method to return a new object identity for the specified class, and key (possibly toString() output).
|
Object |
getNewApplicationIdentityObjectId(Object pc,
org.datanucleus.metadata.AbstractClassMetaData cmd)
Method to create a new object identity for the passed object with the supplied MetaData.
|
Object |
getNewSingleFieldIdentity(Class idType,
Class pcType,
Object value)
Utility to create a new SingleFieldIdentity using reflection when you know the
type of the PersistenceCapable, and also which SingleFieldIdentity, and the value of the key.
|
String |
getObjectState(Object obj)
Accessor for the object state.
|
String |
getSingleFieldIdentityClassNameForByte()
Accessor for the class name to use for identities when there is a single Byte/byte field.
|
String |
getSingleFieldIdentityClassNameForChar()
Accessor for the class name to use for identities when there is a single Character/char field.
|
String |
getSingleFieldIdentityClassNameForInt()
Accessor for the class name to use for identities when there is a single Integer/int field.
|
String |
getSingleFieldIdentityClassNameForLong()
Accessor for the class name to use for identities when there is a single Long/long field.
|
String |
getSingleFieldIdentityClassNameForObject()
Accessor for the class name to use for identities when there is a single Object field.
|
String |
getSingleFieldIdentityClassNameForShort()
Accessor for the class name to use for identities when there is a single Short/short field.
|
String |
getSingleFieldIdentityClassNameForString()
Accessor for the class name to use for identities when there is a single String field.
|
Class |
getTargetClassForSingleFieldIdentity(Object id)
Accessor for the target class for the specified single field application-identity.
|
String |
getTargetClassNameForSingleFieldIdentity(Object id)
Accessor for the target class name for the specified single field identity.
|
Object |
getTargetKeyForSingleFieldIdentity(Object id)
Accessor for the key object for the specified single field application-identity.
|
RuntimeException |
getUserExceptionForException(String msg,
Exception e)
Convenience method to return a user exception appropriate for this API.
|
Object |
getVersionForObject(Object obj)
Method to return the object version for the passed persistable object.
|
boolean |
isDatastoreIdentity(Object id) |
boolean |
isDeleted(Object obj)
Accessor for whether the passed object is deleted.
|
boolean |
isDetachable(Object obj)
Method to return if the passed object is detachable using this API.
|
boolean |
isDetached(Object obj)
Accessor for whether the passed object is detached.
|
boolean |
isDirty(Object obj)
Accessor for whether the passed object is dirty.
|
boolean |
isManaged(Object pc)
Whether the provided object is currently managed (has an ExecutionContext).
|
boolean |
isMemberDefaultPersistent(Class type) |
boolean |
isNew(Object obj)
Accessor for whether the passed object is new.
|
boolean |
isPersistable(Class cls)
Utility method to check if the specified class is of a type that can be persisted for this API.
|
boolean |
isPersistable(Object obj)
Method to return if the passed object is persistable using this API.
|
boolean |
isPersistent(Object obj)
Accessor for whether the passed object is persistent.
|
boolean |
isSingleFieldIdentity(Object id)
Accessor for whether the passed identity is a valid single-field application-identity for this API.
|
boolean |
isSingleFieldIdentityClass(String className)
Checks whether the passed class name is valid for a single field application-identity for this API.
|
boolean |
isTransactional(Object obj)
Accessor for whether the passed object is transactional.
|
boolean |
isValidPrimaryKeyClass(Class pkClass,
org.datanucleus.metadata.AbstractClassMetaData cmd,
org.datanucleus.ClassLoaderResolver clr,
int noOfPkFields,
org.datanucleus.metadata.MetaDataManager mmgr)
Utility to check if a primary-key class is valid.
|
void |
makeDirty(Object obj,
String member) |
public String getName()
getName
in interface org.datanucleus.api.ApiAdapter
public boolean isMemberDefaultPersistent(Class type)
isMemberDefaultPersistent
in interface org.datanucleus.api.ApiAdapter
public boolean isManaged(Object pc)
isManaged
in interface org.datanucleus.api.ApiAdapter
public org.datanucleus.ExecutionContext getExecutionContext(Object obj)
getExecutionContext
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic org.datanucleus.state.LifeCycleState getLifeCycleState(int stateType)
getLifeCycleState
in interface org.datanucleus.api.ApiAdapter
stateType
- the type as integerpublic boolean isPersistent(Object obj)
isPersistent
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isNew(Object obj)
isNew
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isDirty(Object obj)
isDirty
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isDeleted(Object obj)
isDeleted
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isDetached(Object obj)
isDetached
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isTransactional(Object obj)
isTransactional
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isPersistable(Object obj)
isPersistable
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isPersistable(Class cls)
isPersistable
in interface org.datanucleus.api.ApiAdapter
cls
- The class to checkpublic boolean isDetachable(Object obj)
isDetachable
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic String getObjectState(Object obj)
getObjectState
in interface org.datanucleus.api.ApiAdapter
obj
- Objectpublic void makeDirty(Object obj, String member)
makeDirty
in interface org.datanucleus.api.ApiAdapter
public Object getIdForObject(Object obj)
getIdForObject
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic Object getVersionForObject(Object obj)
getVersionForObject
in interface org.datanucleus.api.ApiAdapter
obj
- The objectpublic boolean isValidPrimaryKeyClass(Class pkClass, org.datanucleus.metadata.AbstractClassMetaData cmd, org.datanucleus.ClassLoaderResolver clr, int noOfPkFields, org.datanucleus.metadata.MetaDataManager mmgr)
isValidPrimaryKeyClass
in interface org.datanucleus.api.ApiAdapter
pkClass
- The Primary Key classcmd
- AbstractClassMetaData for the PersistenceCapable classclr
- the ClassLoaderResolvernoOfPkFields
- Number of primary key fieldsmmgr
- MetaData managerpublic boolean isSingleFieldIdentity(Object id)
isSingleFieldIdentity
in interface org.datanucleus.api.ApiAdapter
public boolean isDatastoreIdentity(Object id)
isDatastoreIdentity
in interface org.datanucleus.api.ApiAdapter
public boolean isSingleFieldIdentityClass(String className)
isSingleFieldIdentityClass
in interface org.datanucleus.api.ApiAdapter
className
- the full class namepublic String getSingleFieldIdentityClassNameForLong()
getSingleFieldIdentityClassNameForLong
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForInt()
getSingleFieldIdentityClassNameForInt
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForShort()
getSingleFieldIdentityClassNameForShort
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForByte()
getSingleFieldIdentityClassNameForByte
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForChar()
getSingleFieldIdentityClassNameForChar
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForString()
getSingleFieldIdentityClassNameForString
in interface org.datanucleus.api.ApiAdapter
public String getSingleFieldIdentityClassNameForObject()
getSingleFieldIdentityClassNameForObject
in interface org.datanucleus.api.ApiAdapter
public Class getTargetClassForSingleFieldIdentity(Object id)
getTargetClassForSingleFieldIdentity
in interface org.datanucleus.api.ApiAdapter
id
- The identitypublic String getTargetClassNameForSingleFieldIdentity(Object id)
getTargetClassNameForSingleFieldIdentity
in interface org.datanucleus.api.ApiAdapter
id
- The identitypublic Object getTargetKeyForSingleFieldIdentity(Object id)
getTargetKeyForSingleFieldIdentity
in interface org.datanucleus.api.ApiAdapter
id
- The identitypublic Class getKeyTypeForSingleFieldIdentityType(Class idType)
getKeyTypeForSingleFieldIdentityType
in interface org.datanucleus.api.ApiAdapter
idType
- Single field identity typepublic Object getNewSingleFieldIdentity(Class idType, Class pcType, Object value)
getNewSingleFieldIdentity
in interface org.datanucleus.api.ApiAdapter
idType
- Type of SingleFieldIdentitypcType
- Type of the PersistenceCapablevalue
- The value for the identity (the Long, or Int, or ... etc).org.datanucleus.exceptions.NucleusException
- if invalid input is receivedpublic Object getNewApplicationIdentityObjectId(org.datanucleus.ClassLoaderResolver clr, org.datanucleus.metadata.AbstractClassMetaData acmd, String value)
getNewApplicationIdentityObjectId
in interface org.datanucleus.api.ApiAdapter
clr
- ClassLoader resolveracmd
- MetaData for the target classvalue
- String form of the keyorg.datanucleus.exceptions.NucleusException
- if invalid input is receivedpublic Object getNewApplicationIdentityObjectId(Object pc, org.datanucleus.metadata.AbstractClassMetaData cmd)
getNewApplicationIdentityObjectId
in interface org.datanucleus.api.ApiAdapter
pc
- The persistable objectcmd
- Its metadatapublic Object getNewApplicationIdentityObjectId(Class cls, Object key)
getNewApplicationIdentityObjectId
in interface org.datanucleus.api.ApiAdapter
cls
- Persistable classkey
- form of the object idpublic boolean allowPersistOfDeletedObject()
allowPersistOfDeletedObject
in interface org.datanucleus.api.ApiAdapter
public boolean allowDeleteOfNonPersistentObject()
allowDeleteOfNonPersistentObject
in interface org.datanucleus.api.ApiAdapter
public boolean allowReadFieldOfDeletedObject()
allowReadFieldOfDeletedObject
in interface org.datanucleus.api.ApiAdapter
public boolean clearLoadedFlagsOnDeleteObject()
clearLoadedFlagsOnDeleteObject
in interface org.datanucleus.api.ApiAdapter
public boolean getDefaultCascadePersistForField()
getDefaultCascadePersistForField
in interface org.datanucleus.api.ApiAdapter
public boolean getDefaultCascadeUpdateForField()
getDefaultCascadeUpdateForField
in interface org.datanucleus.api.ApiAdapter
public boolean getDefaultCascadeDeleteForField()
getDefaultCascadeDeleteForField
in interface org.datanucleus.api.ApiAdapter
public boolean getDefaultCascadeRefreshForField()
getDefaultCascadeRefreshForField
in interface org.datanucleus.api.ApiAdapter
public boolean getDefaultDFGForPersistableField()
getDefaultDFGForPersistableField
in interface org.datanucleus.api.ApiAdapter
public Map getDefaultFactoryProperties()
getDefaultFactoryProperties
in interface org.datanucleus.api.ApiAdapter
public RuntimeException getUserExceptionForException(String msg, Exception e)
getUserExceptionForException
in interface org.datanucleus.api.ApiAdapter
msg
- The messagee
- The causepublic RuntimeException getDataStoreExceptionForException(String msg, Exception e)
getDataStoreExceptionForException
in interface org.datanucleus.api.ApiAdapter
msg
- The messagee
- Any root cause exceptionpublic RuntimeException getApiExceptionForNucleusException(org.datanucleus.exceptions.NucleusException ne)
getApiExceptionForNucleusException
in interface org.datanucleus.api.ApiAdapter
public Object getCopyOfPersistableObject(Object obj, org.datanucleus.state.ObjectProvider op, int[] fieldNumbers)
getCopyOfPersistableObject
in interface org.datanucleus.api.ApiAdapter
public void copyFieldsFromPersistableObject(Object pc, int[] fieldNumbers, Object pc2)
copyFieldsFromPersistableObject
in interface org.datanucleus.api.ApiAdapter
Copyright © 2018. All rights reserved.