|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gov.nist.nlpir.irf.proxy.VirtualProxy
This is an abstract class which represents what's common to all
proxies for support of on-demand (de)materialization of the real objects
for which they stand.
Inner Class Summary | |
private class |
VirtualProxy.IMP_Entry
|
Field Summary | |
protected PersistenceBroker |
broker
The persistence broker for this proxy's real object |
protected static HandlesByOid |
handles
The table of handles by Oid. |
private static java.util.Vector |
inMemoryProxiesByOid
Tracks in-memory proxies for persistent objects to prevent duplication. |
protected static InfoServer |
iS
The info server - here to save getting it every time its needed. |
protected Oid |
objectIdentifier
Unique identifier for persistent object |
private java.lang.Object |
realObject
The real object for which this object is a proxy, a handle, a smart reference |
(package private) static long |
serialVersionUID
serial version universal id - put here so Java does not insert one which may change due to revisions and make it impossible to deserialize earlier versions of serialized objects |
Constructor Summary | |
VirtualProxy()
|
Method Summary | |
VirtualProxy |
addRefToInMemoryProxiesByOid()
Adds to the table of in-memory proxies a reference to the specified proxy returning any existing one if one exists |
abstract PersistenceBroker |
createBroker()
The concrete virtual proxy will create a broker for this proxy object |
void |
deleteRefFromInMemoryProxiesByOid()
Deletes from the table of in-memory proxies a reference to the specified proxy |
private Handle |
dematerializeRealObject(Handle oldHandle,
java.lang.Object obj)
Dematerializes the updated real object for which this proxy object stands |
private Handle |
dematerializeRealObject(java.lang.Object obj)
Dematerializes the real object for which this proxy object stands |
protected PersistenceBroker |
getBroker()
Returns the broker for this proxy |
VirtualProxy |
getFirstInstance()
Enforce uniqueness of proxies by checking to see if a proxy for this IR document already exists and returning that reference if it exists. |
static int |
getInMemoryProxiesByOidBinCount()
Gets the number of bins in the subject table |
static int |
getInMemoryProxiesByOidSize()
Gets the number of keys in the subject table |
static java.lang.String |
getInMemoryProxyCounts()
Returns information on the number of in-memory proxies for persistent objects - lightweight versus heavyweight |
Oid |
getObjectIdentifier()
Gets this proxy's Oid |
protected PersistenceBroker |
getPersistenceBroker()
Get the broker for this proxy object |
static VirtualProxy |
getProxyFor(java.lang.Class proxyClass,
Oid objectIdentifier)
If there is already a proxy with the specified Oid, then return it after recording another reference to said proxy. |
java.lang.Object |
getRealObject()
Returns the real object for which this proxy object stands |
protected boolean |
isLightweight()
Tests whether this proxy is lightweight or not. |
void |
makeLightweight()
Make this proxy object lightweight - cut the link to its real object |
void |
makePersistent()
Makes the object persistent IFF not already persistent Assign it an oid if it has none; save its handle by Oid; and save the Oid in the proxie |
private java.lang.Object |
materializeRealObject()
Materializes the real object for which this proxy object stands |
static void |
presentInMemoryProxies()
Writes the contents of the inMemoryProxiesByOid table to standard out |
void |
readExternal(BufferedRandomAccessFile in)
Reads external representation of this object |
void |
replaceRealObject()
Replaces the realobject associated with this proxy. |
protected void |
setBroker(PersistenceBroker b)
Sets the broker field |
static void |
setIS(InfoServer pIS)
Sets the info server reference |
(package private) void |
setObjectIdentifier(Oid objectIdentifier)
|
protected void |
setRealObject(java.lang.Object o)
Sets the real object field |
private static void |
testInMemoryProxiesByOidTable(long oid)
Tests whether the InMemoryProxiesByOid table is large enough to accept this oid. |
java.lang.String |
toString()
Returns the class instance as string. |
void |
writeExternal(BufferedRandomAccessFile out)
Writes external representation of this object |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static transient java.util.Vector inMemoryProxiesByOid
protected transient PersistenceBroker broker
private transient java.lang.Object realObject
static final long serialVersionUID
protected Oid objectIdentifier
protected static InfoServer iS
protected static HandlesByOid handles
Constructor Detail |
public VirtualProxy()
Method Detail |
public Oid getObjectIdentifier()
public static void setIS(InfoServer pIS)
public void makePersistent()
public void replaceRealObject()
public final java.lang.Object getRealObject()
public void makeLightweight()
protected final void setBroker(PersistenceBroker b)
the
- broker for this proxyprotected final PersistenceBroker getBroker()
protected final void setRealObject(java.lang.Object o)
o
- the real object for this proxyprotected final boolean isLightweight()
final void setObjectIdentifier(Oid objectIdentifier)
protected final PersistenceBroker getPersistenceBroker()
private final java.lang.Object materializeRealObject()
private final Handle dematerializeRealObject(java.lang.Object obj)
obj
- the object to be dematerialized/deserializedprivate final Handle dematerializeRealObject(Handle oldHandle, java.lang.Object obj)
oldHandle
- The handle the object used to have.public VirtualProxy getFirstInstance()
Proxy1 myProxy = readProxy1FromDisk(); myProxy = myProxy.getFirstInstance();Of course, if at one point it is sure this instance of the proxy is the first one to be materialized, then the call to this function can be avoided.
void
getFirstInstances()
method, and an overriding of the current
method in the proxy X must apply it to Y. If an object is a container
of container of Proxies, it must define a void getFirstInstances()
that recursively calls the same method on the contained
container, and so on.public static final VirtualProxy getProxyFor(java.lang.Class proxyClass, Oid objectIdentifier)
proxyClass
- Class of the proxy to be gottenobjectIdentifier
- Oid of the proxy to tobe gottenpublic abstract PersistenceBroker createBroker()
public java.lang.String toString()
public final void readExternal(BufferedRandomAccessFile in)
in
- random access file handlepublic final void writeExternal(BufferedRandomAccessFile out)
out
- random access file handlepublic final VirtualProxy addRefToInMemoryProxiesByOid()
Oid
- the object identifier of the proxy to be addedpublic final void deleteRefFromInMemoryProxiesByOid()
public static final int getInMemoryProxiesByOidSize()
public static final int getInMemoryProxiesByOidBinCount()
public static java.lang.String getInMemoryProxyCounts()
public static void presentInMemoryProxies()
private static void testInMemoryProxiesByOidTable(long oid)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |