|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.neodatis.odb.impl.core.layers.layer3.engine.ObjectReader
public class ObjectReader
Manage all IO Reading
Field Summary | |
---|---|
protected IByteArrayConverter |
byteArrayConverter
|
static long |
calls
|
static java.lang.String |
LOG_ID
|
IStorageEngine |
storageEngine
The storage engine |
static long |
timeToGetObjectFromId
|
protected ITriggerManager |
triggerManager
|
Constructor Summary | |
---|---|
ObjectReader(IStorageEngine engine)
The constructor |
Method Summary | ||
---|---|---|
protected IInstanceBuilder |
buildInstanceBuilder()
|
|
java.lang.Object |
buildOneInstance(NonNativeObjectInfo objectInfo)
|
|
void |
close()
|
|
java.lang.String |
depthToSpaces()
A small method for indentation |
|
java.util.List<FullIDInfo> |
getAllIdInfos(java.lang.String objectTypeToDisplay,
byte idType,
boolean displayObject)
|
|
java.util.List<java.lang.Long> |
getAllIds(byte idType)
Returns information about all OIDs of the database |
|
java.lang.String |
getBaseIdentification()
|
|
OID |
getIdOfObjectAt(long position,
boolean includeDeleted)
Returns the id of an object by reading the object header |
|
IInstanceBuilder |
getInstanceBuilder()
|
|
OID |
getNextObjectOID(OID oid)
Gets the next object oid of the object with the specific oid |
|
java.lang.Object |
getObjectFromOid(OID oid,
boolean returnInstance,
boolean useCache)
|
|
ObjectInfoHeader |
getObjectInfoHeader(OID oid,
long position,
boolean useCache,
ICache cache)
|
|
IOdbList<ObjectInfoHeader> |
getObjectInfoHeaderList(ClassInfo classInfo)
This is an utility method to get the linked list of All Object Info Header. |
|
|
getObjectInfos(IQuery query,
boolean inMemory,
int startIndex,
int endIndex,
boolean returnObjects,
IMatchingObjectAction queryResultAction)
Return Objects. |
|
|
getObjectInfos(java.lang.String fullClassName,
boolean inMemory,
int startIndex,
int endIndex,
boolean returnOjects)
|
|
long |
getObjectPositionFromItsOid(OID oid,
boolean useCache,
boolean throwException)
Gets the real object position from its OID |
|
|
getObjects(java.lang.Class clazz,
boolean inMemory,
int startIndex,
int endIndex)
|
|
|
getObjects(IQuery query,
boolean inMemory,
int startIndex,
int endIndex)
Get a list of object matching the query |
|
|
getObjects(java.lang.String fullClassName,
boolean inMemory,
int startIndex,
int endIndex)
|
|
java.lang.String |
getObjectTypeFromPosition(long objectPosition)
Returns the name of the class of an object from its position |
|
ISession |
getSession()
|
|
Values |
getValues(IValuesQuery valuesQuery,
int startIndex,
int endIndex)
Get a list of values matching the query |
|
AtomicNativeObjectInfo |
readAtomicNativeObjectInfo(long position,
int odbTypeId)
Reads an atomic object |
|
java.lang.Object |
readAtomicNativeObjectInfoAsObject(long position,
int odbTypeId)
|
|
protected ClassInfo |
readClassInfoBody(ClassInfo classInfo)
Reads the body of a class info |
|
protected ClassInfo |
readClassInfoHeader(OID classInfoOid)
Read the class info header with the specific oid |
|
IOdbList<ClassInfoIndex> |
readClassInfoIndexesAt(long position,
ClassInfo classInfo)
|
|
protected java.lang.String |
readDatabaseCharacterEncoding()
Reads the database character encoding |
|
void |
readDatabaseHeader(java.lang.String user,
java.lang.String password)
see http://wiki.neodatis.org/odb-file-format |
|
protected boolean |
readEncryptionFlag()
Read the encryption flag of the database file |
|
EnumNativeObjectInfo |
readEnumObjectInfo(long position,
int odbTypeId)
Reads an enum object |
|
protected long |
readFirstClassOid()
Reads the first class OID |
|
protected boolean |
readLastODBCloseStatus()
Reads the status of the last odb close |
|
protected TransactionId |
readLastTransactionId(DatabaseId databaseId)
Read the last transaction id |
|
MetaModel |
readMetaModel(MetaModel metaModel,
boolean full)
Reads the database meta model |
|
protected NativeAttributeHeader |
readNativeAttributeHeader()
Read the header of a native attribute |
|
java.lang.Object |
readNonNativeObjectAtPosition(long position,
boolean useCache,
boolean returnInstance)
Reads an object at the specific position |
|
NonNativeObjectInfo |
readNonNativeObjectInfoFromOid(ClassInfo classInfo,
OID oid,
boolean useCache,
boolean returnObjects)
|
|
NonNativeObjectInfo |
readNonNativeObjectInfoFromPosition(ClassInfo classInfo,
OID oid,
long position,
boolean useCache,
boolean returnInstance)
Reads a non non native Object Info (Layer2) from its position |
|
protected long |
readNumberOfClasses()
Reads the number of classes in database file |
|
AbstractObjectInfo |
readObjectInfo(long objectIdentification,
boolean useCache,
boolean returnObjects)
|
|
AbstractObjectInfo |
readObjectInfoFromPosition(ClassInfo classInfo,
long objectPosition,
boolean useCache,
boolean returnObjects)
Reads an object info(Object meta information like its type and its values) from the database file |
|
ObjectInfoHeader |
readObjectInfoHeaderFromOid(OID oid,
boolean useCache)
Reads the pointers(ids or positions) of an object that has the specific oid |
|
ObjectInfoHeader |
readObjectInfoHeaderFromPosition(OID oid,
long position,
boolean useCache)
|
|
AttributeValuesMap |
readObjectInfoValuesFromOID(ClassInfo classInfo,
OID oid,
boolean useCache,
IOdbList<java.lang.String> attributeNames,
IOdbList<java.lang.String> relationAttributeNames,
int recursionLevel,
java.lang.String[] orderByFields,
boolean useOidForObject)
reads some attributes of an object. |
|
protected AttributeValuesMap |
readObjectInfoValuesFromPosition(ClassInfo classInfo,
OID oid,
long position,
boolean useCache,
IOdbList<java.lang.String> attributeNames,
IOdbList<java.lang.String> relationAttributeNames,
int recursionLevel,
java.lang.String[] orderByFields,
boolean useOidForObject)
|
|
long |
readOidPosition(OID oid)
|
|
protected boolean |
readReplicationFlag()
Read the replication flag of the database file |
|
protected int |
readVersion()
Read the version of the database file |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static long timeToGetObjectFromId
public static long calls
public static final java.lang.String LOG_ID
public IStorageEngine storageEngine
protected IByteArrayConverter byteArrayConverter
protected ITriggerManager triggerManager
Constructor Detail |
---|
public ObjectReader(IStorageEngine engine)
engine
- triggerManager
- Method Detail |
---|
public java.lang.String depthToSpaces()
protected IInstanceBuilder buildInstanceBuilder()
protected int readVersion()
protected boolean readEncryptionFlag()
protected boolean readReplicationFlag()
protected TransactionId readLastTransactionId(DatabaseId databaseId)
protected long readNumberOfClasses()
protected long readFirstClassOid()
protected boolean readLastODBCloseStatus()
protected java.lang.String readDatabaseCharacterEncoding()
public void readDatabaseHeader(java.lang.String user, java.lang.String password)
readDatabaseHeader
in interface IObjectReader
public MetaModel readMetaModel(MetaModel metaModel, boolean full)
IObjectReader
readMetaModel
in interface IObjectReader
metaModel
- An empty meta modelfull
- To indicate if a full read must be done
protected ClassInfo readClassInfoHeader(OID classInfoOid)
startPosition
-
protected ClassInfo readClassInfoBody(ClassInfo classInfo)
classInfo
- The class info to be read with already read header
public IOdbList<ClassInfoIndex> readClassInfoIndexesAt(long position, ClassInfo classInfo)
readClassInfoIndexesAt
in interface IObjectReader
public java.lang.Object readNonNativeObjectAtPosition(long position, boolean useCache, boolean returnInstance)
position
- The position to readuseCache
- To indicate if cache must be usedTo
- indicate if an instance must be return of just the meta info
public AbstractObjectInfo readObjectInfo(long objectIdentification, boolean useCache, boolean returnObjects)
public ObjectInfoHeader readObjectInfoHeaderFromOid(OID oid, boolean useCache)
readObjectInfoHeaderFromOid
in interface IObjectReader
oid
- The oid of the object we want to read the pointers
public ObjectInfoHeader readObjectInfoHeaderFromPosition(OID oid, long position, boolean useCache)
public AbstractObjectInfo readObjectInfoFromPosition(ClassInfo classInfo, long objectPosition, boolean useCache, boolean returnObjects)
reads its type and then read all its attributes. If one attribute is a non native object, it will be read (recursivly). <p/>
classInfo
- If null, we are probably reading a native instance : String
for exampleposition
- useCache
- To indicate if cache must be used. If not, the old version of
the object will read
public NonNativeObjectInfo readNonNativeObjectInfoFromOid(ClassInfo classInfo, OID oid, boolean useCache, boolean returnObjects)
readNonNativeObjectInfoFromOid
in interface IObjectReader
public NonNativeObjectInfo readNonNativeObjectInfoFromPosition(ClassInfo classInfo, OID oid, long position, boolean useCache, boolean returnInstance)
readNonNativeObjectInfoFromPosition
in interface IObjectReader
classInfo
- oid
- can be nullposition
- useCache
- returnInstance
-
public AttributeValuesMap readObjectInfoValuesFromOID(ClassInfo classInfo, OID oid, boolean useCache, IOdbList<java.lang.String> attributeNames, IOdbList<java.lang.String> relationAttributeNames, int recursionLevel, java.lang.String[] orderByFields, boolean useOidForObject)
IObjectReader
example of method call readObjectInfoValues(classinfo,18000,true,["profile.name","profile.email"],["profile.name","profile.email"],0) readObjectInfoValues(classinfo,21789,true,["name"],["profile.name"],1)
readObjectInfoValuesFromOID
in interface IObjectReader
classInfo
- If null, we are probably reading a native instance : String
for exampleoid
- The oid of the object to read. if -1,the read will be done by
positionuseCache
- To indicate if cache must be used. If not, the old version of
the object will readattributeNames
- The names of attributes to read the values, an attributename
can contain relation like profile.namerelationAttributeNames
- The original names of attributes to read the values, an
attributename can contain relation like profile.namerecursionLevel
- The recursion level of this method calluseOidForObject
- To indicate that if the object being read has an attribute that is not native, we will put the oid of the attribute (object) instead of reading the whole object
protected AttributeValuesMap readObjectInfoValuesFromPosition(ClassInfo classInfo, OID oid, long position, boolean useCache, IOdbList<java.lang.String> attributeNames, IOdbList<java.lang.String> relationAttributeNames, int recursionLevel, java.lang.String[] orderByFields, boolean useOidForObject)
classInfo
- The class info of the objects to be returnedoid
- The Object id of the object to return dataposition
- The position of the object to readuseCache
- To indicate if cache must be usedattributeNames
- The list of the attribute name for which we need to return a
value, an attributename can contain relation like profile.namerelationAttributeNames
- The original names of attributes to read the values, an
attributename can contain relation like profile.namerecursionLevel
- The recursion level of this callorderByFields
- ?useOidForObject
- To indicate that if the object being read has an attribute that is not native, we will put the oid of the attribute (object) instead of reading the whole object
public ObjectInfoHeader getObjectInfoHeader(OID oid, long position, boolean useCache, ICache cache)
protected NativeAttributeHeader readNativeAttributeHeader()
The header contains - The block size = int - The block type = byte - The OdbType ID = int - A boolean to indicate if object is nulls. This method reads all the bytes and then convert the byte array to the values
odbTypeId
- isNull
- writeDataInTransaction
- public java.lang.Object readAtomicNativeObjectInfoAsObject(long position, int odbTypeId)
readAtomicNativeObjectInfoAsObject
in interface IObjectReader
public AtomicNativeObjectInfo readAtomicNativeObjectInfo(long position, int odbTypeId)
readAtomicNativeObjectInfo
in interface IObjectReader
public EnumNativeObjectInfo readEnumObjectInfo(long position, int odbTypeId)
public OID getNextObjectOID(OID oid)
getNextObjectOID
in interface IObjectReader
position
-
public long readOidPosition(OID oid)
readOidPosition
in interface IObjectReader
public java.lang.Object getObjectFromOid(OID oid, boolean returnInstance, boolean useCache)
getObjectFromOid
in interface IObjectReader
public java.lang.String getObjectTypeFromPosition(long objectPosition)
objectPosition
-
public long getObjectPositionFromItsOid(OID oid, boolean useCache, boolean throwException)
getObjectPositionFromItsOid
in interface IObjectReader
oid
- The oid of the object to get the positionthrowException
- To indicate if an exception must be thrown if object is not
found
public java.util.List<java.lang.Long> getAllIds(byte idType)
getAllIds
in interface IObjectReader
idType
-
public java.util.List<FullIDInfo> getAllIdInfos(java.lang.String objectTypeToDisplay, byte idType, boolean displayObject)
getAllIdInfos
in interface IObjectReader
public OID getIdOfObjectAt(long position, boolean includeDeleted)
IObjectReader
getIdOfObjectAt
in interface IObjectReader
public void close()
close
in interface IObjectReader
public java.lang.Object buildOneInstance(NonNativeObjectInfo objectInfo)
buildOneInstance
in interface IObjectReader
public <T> Objects<T> getObjects(java.lang.Class clazz, boolean inMemory, int startIndex, int endIndex)
public <T> Objects<T> getObjects(java.lang.String fullClassName, boolean inMemory, int startIndex, int endIndex)
public <T> Objects<T> getObjects(IQuery query, boolean inMemory, int startIndex, int endIndex)
IObjectReader
getObjects
in interface IObjectReader
public Values getValues(IValuesQuery valuesQuery, int startIndex, int endIndex)
IObjectReader
getValues
in interface IObjectReader
public ISession getSession()
public <T> Objects<T> getObjectInfos(IQuery query, boolean inMemory, int startIndex, int endIndex, boolean returnObjects, IMatchingObjectAction queryResultAction)
IObjectReader
getObjectInfos
in interface IObjectReader
query
- The query to select objectsinMemory
- To indicate if object must be all loaded in memorystartIndex
- First object indexendIndex
- Last object indexreturnObjects
- To indicate if object instances must be created
public <T> Objects<T> getObjectInfos(java.lang.String fullClassName, boolean inMemory, int startIndex, int endIndex, boolean returnOjects)
public java.lang.String getBaseIdentification()
getBaseIdentification
in interface IObjectReader
public IOdbList<ObjectInfoHeader> getObjectInfoHeaderList(ClassInfo classInfo)
classInfo
- public IInstanceBuilder getInstanceBuilder()
getInstanceBuilder
in interface IObjectReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |