org.neodatis.odb.impl.core.server.layers.layer1
Class ClientObjectIntrospector

java.lang.Object
  extended by org.neodatis.odb.impl.core.layers.layer1.introspector.LocalObjectIntrospector
      extended by org.neodatis.odb.impl.core.server.layers.layer1.ClientObjectIntrospector
All Implemented Interfaces:
IObjectIntrospector, IClientObjectIntrospector

public class ClientObjectIntrospector
extends LocalObjectIntrospector
implements IClientObjectIntrospector

Not thread safe

Author:
osmadja

Field Summary
protected  java.util.Map<OID,ClientNonNativeObjectInfo> aois
          A map of abstract object info, keys are local ids
protected  IOdbList<OID> clientOids
          client oids are sequential ids created by the client side engine.
protected  java.lang.String connectionId
          This represents the connection to the server
protected  java.util.Map<OID,java.lang.Object> objects
           
protected  ISession session
           
 
Fields inherited from class org.neodatis.odb.impl.core.layers.layer1.introspector.LocalObjectIntrospector
classIntrospector, storageEngine
 
Constructor Summary
ClientObjectIntrospector(IStorageEngine storageEngine, java.lang.String connectionId)
           
 
Method Summary
 NonNativeObjectInfo buildNnoi(java.lang.Object o, ClassInfo info, AbstractObjectInfo[] values, long[] attributesIdentification, int[] attributeIds, java.util.Map<java.lang.Object,NonNativeObjectInfo> alreadyReadObjects)
           
 IOdbList<OID> getClientOids()
           
 AbstractObjectInfo getMetaRepresentation(java.lang.Object object, ClassInfo ci, boolean recursive, java.util.Map<java.lang.Object,NonNativeObjectInfo> alreadyReadObjects, IIntrospectionCallback callback)
          retrieve object data
 ISession getSession()
           
 void synchronizeIds(OID[] clientIds, OID[] serverIds)
          This method is used to make sure that client oids and server oids are equal.
 
Methods inherited from class org.neodatis.odb.impl.core.layers.layer1.introspector.LocalObjectIntrospector
clear, getClassIntrospector, getNativeObjectInfoInternal, getObjectInfo, getObjectInfoInternal, objectHasChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.neodatis.odb.core.layers.layer1.introspector.IObjectIntrospector
clear, getClassIntrospector
 

Field Detail

clientOids

protected IOdbList<OID> clientOids
client oids are sequential ids created by the client side engine. When an object is sent to server, server ids are sent back from server and client engine replace all local(client) oids by the server oids.


aois

protected java.util.Map<OID,ClientNonNativeObjectInfo> aois
A map of abstract object info, keys are local ids


objects

protected java.util.Map<OID,java.lang.Object> objects

session

protected ISession session

connectionId

protected java.lang.String connectionId
This represents the connection to the server

Constructor Detail

ClientObjectIntrospector

public ClientObjectIntrospector(IStorageEngine storageEngine,
                                java.lang.String connectionId)
Method Detail

getSession

public ISession getSession()

buildNnoi

public NonNativeObjectInfo buildNnoi(java.lang.Object o,
                                     ClassInfo info,
                                     AbstractObjectInfo[] values,
                                     long[] attributesIdentification,
                                     int[] attributeIds,
                                     java.util.Map<java.lang.Object,NonNativeObjectInfo> alreadyReadObjects)
Specified by:
buildNnoi in interface IObjectIntrospector
Overrides:
buildNnoi in class LocalObjectIntrospector

getClientOids

public IOdbList<OID> getClientOids()
Specified by:
getClientOids in interface IClientObjectIntrospector

getMetaRepresentation

public AbstractObjectInfo getMetaRepresentation(java.lang.Object object,
                                                ClassInfo ci,
                                                boolean recursive,
                                                java.util.Map<java.lang.Object,NonNativeObjectInfo> alreadyReadObjects,
                                                IIntrospectionCallback callback)
Description copied from interface: IObjectIntrospector
retrieve object data

Specified by:
getMetaRepresentation in interface IObjectIntrospector
Overrides:
getMetaRepresentation in class LocalObjectIntrospector
Parameters:
object - The object to get meta representation
ci - The ClassInfo
recursive - To indicate that introspection must be recursive
alreadyReadObjects - A map with already read object, to avoid cyclic reference problem
Returns:
The object info

synchronizeIds

public void synchronizeIds(OID[] clientIds,
                           OID[] serverIds)
This method is used to make sure that client oids and server oids are equal.
 When storing an object, the client side does not know the oid that each object will receive. So the client create
 temporary (sequential) oids. These oids are sent to the server in the object meta-representations. On the server side,
 real OIDs are created and associated to the objects and to the client side ids. After calling the store on the server side
 The client use the the synchronizeIds method to replace client ids by the correct server side ids. 
 
 

Specified by:
synchronizeIds in interface IClientObjectIntrospector