Class JDOAdapter

  • All Implemented Interfaces:
    Serializable, org.datanucleus.api.ApiAdapter

    public class JDOAdapter
    extends Object
    implements org.datanucleus.api.ApiAdapter
    Adapter for the JDO API, to allow the DataNucleus core runtime to expose multiple APIs to clients.
    See Also:
    Serialized Form
    • Field Detail

      • defaultPersistentTypeNames

        protected static final Set<String> defaultPersistentTypeNames
    • Constructor Detail

      • JDOAdapter

        public JDOAdapter()
    • Method Detail

      • getName

        public String getName()
        Accessor for the name of the API.
        Specified by:
        getName in interface org.datanucleus.api.ApiAdapter
        Returns:
        Name of the API
      • isMemberDefaultPersistent

        public boolean isMemberDefaultPersistent​(Class type)
        Specified by:
        isMemberDefaultPersistent in interface org.datanucleus.api.ApiAdapter
      • getExecutionContext

        public org.datanucleus.ExecutionContext getExecutionContext​(Object obj)
        Method to return the ExecutionContext (if any) associated with the passed object. Supports persistable objects, and PersistenceManager.
        Specified by:
        getExecutionContext in interface org.datanucleus.api.ApiAdapter
        Parameters:
        obj - The object
        Returns:
        The ExecutionContext
      • getLifeCycleState

        public org.datanucleus.state.LifeCycleState getLifeCycleState​(int stateType)
        Returns the LifeCycleState for the state constant.
        Specified by:
        getLifeCycleState in interface org.datanucleus.api.ApiAdapter
        Parameters:
        stateType - the type as integer
        Returns:
        the type as LifeCycleState object
      • getObjectState

        public String getObjectState​(Object obj)
        Accessor for the object state.
        Specified by:
        getObjectState in interface org.datanucleus.api.ApiAdapter
        Parameters:
        obj - Object
        Returns:
        The state ("persistent-clean", "detached-dirty" etc)
      • isValidPrimaryKeyClass

        public 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. Will throw a InvalidPrimaryKeyException if it is invalid, otherwise returning true.
        Specified by:
        isValidPrimaryKeyClass in interface org.datanucleus.api.ApiAdapter
        Parameters:
        pkClass - The Primary Key class
        cmd - AbstractClassMetaData for the persistable class
        clr - the ClassLoaderResolver
        noOfPkFields - Number of primary key fields
        mmgr - MetaData manager
        Returns:
        Whether it is valid
      • allowPersistOfDeletedObject

        public boolean allowPersistOfDeletedObject()
        Whether the API allows (re-)persistence of a deleted object.
        Specified by:
        allowPersistOfDeletedObject in interface org.datanucleus.api.ApiAdapter
        Returns:
        Whether you can call persist on a deleted object
      • allowDeleteOfNonPersistentObject

        public boolean allowDeleteOfNonPersistentObject()
        Whether the API allows deletion of a non-persistent object.
        Specified by:
        allowDeleteOfNonPersistentObject in interface org.datanucleus.api.ApiAdapter
        Returns:
        Whether you can call delete on an object not yet persisted
      • allowReadFieldOfDeletedObject

        public boolean allowReadFieldOfDeletedObject()
        Whether the API allows reading a field of a deleted object.
        Specified by:
        allowReadFieldOfDeletedObject in interface org.datanucleus.api.ApiAdapter
        Returns:
        Whether you can read after deleting
      • clearLoadedFlagsOnDeleteObject

        public boolean clearLoadedFlagsOnDeleteObject()
        Whether the API requires clearing of the fields of an object when it is deleted.
        Specified by:
        clearLoadedFlagsOnDeleteObject in interface org.datanucleus.api.ApiAdapter
        Returns:
        Whether to clear loaded fields at delete
      • getDefaultCascadePersistForField

        public boolean getDefaultCascadePersistForField()
        Specified by:
        getDefaultCascadePersistForField in interface org.datanucleus.api.ApiAdapter
      • getDefaultCascadeUpdateForField

        public boolean getDefaultCascadeUpdateForField()
        Specified by:
        getDefaultCascadeUpdateForField in interface org.datanucleus.api.ApiAdapter
      • getDefaultCascadeDeleteForField

        public boolean getDefaultCascadeDeleteForField()
        Specified by:
        getDefaultCascadeDeleteForField in interface org.datanucleus.api.ApiAdapter
      • getDefaultCascadeDetachForField

        public boolean getDefaultCascadeDetachForField()
        Specified by:
        getDefaultCascadeDetachForField in interface org.datanucleus.api.ApiAdapter
      • getDefaultCascadeRefreshForField

        public boolean getDefaultCascadeRefreshForField()
        Specified by:
        getDefaultCascadeRefreshForField in interface org.datanucleus.api.ApiAdapter
      • getDefaultDFGForPersistableField

        public boolean getDefaultDFGForPersistableField()
        Specified by:
        getDefaultDFGForPersistableField in interface org.datanucleus.api.ApiAdapter
      • getDefaultFactoryProperties

        public Map getDefaultFactoryProperties()
        Method to return the default factory properties for this API.
        Specified by:
        getDefaultFactoryProperties in interface org.datanucleus.api.ApiAdapter
        Returns:
        The default props
      • getUserExceptionForException

        public RuntimeException getUserExceptionForException​(String msg,
                                                             Exception e)
        Convenience method to return a user exception appropriate for this API.
        Specified by:
        getUserExceptionForException in interface org.datanucleus.api.ApiAdapter
        Parameters:
        msg - The message
        e - The cause
        Returns:
        The JDO exception
      • getDataStoreExceptionForException

        public RuntimeException getDataStoreExceptionForException​(String msg,
                                                                  Exception e)
        Convenience method to return a datastore exception appropriate for this API.
        Specified by:
        getDataStoreExceptionForException in interface org.datanucleus.api.ApiAdapter
        Parameters:
        msg - The message
        e - Any root cause exception
        Returns:
        The exception
      • getApiExceptionForNucleusException

        public RuntimeException getApiExceptionForNucleusException​(org.datanucleus.exceptions.NucleusException ne)
        Specified by:
        getApiExceptionForNucleusException in interface org.datanucleus.api.ApiAdapter