org.apache.ojb.broker.core.proxy
Class VirtualProxy

java.lang.Object
  extended by org.apache.ojb.broker.core.proxy.VirtualProxy
All Implemented Interfaces:
java.io.Serializable, OJBProxy

public abstract class VirtualProxy
extends java.lang.Object
implements OJBProxy, java.io.Serializable

Proxy base class. can be used to implement lazy materialization techniques.

Version:
$Id: VirtualProxy.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Thomas Mahler
See Also:
Serialized Form

Constructor Summary
VirtualProxy()
          Creates a new, uninitialized proxy.
VirtualProxy(IndirectionHandler handler)
          Create a VirtualProxy that uses the given invocation handler.
VirtualProxy(PBKey key, Identity oid)
          Creates a VirtualProxy for the subject with the given identity.
 
Method Summary
 boolean alreadyMaterialized()
          Determines whether this proxy already has been materialized.
 IndirectionHandler getIndirectionHandler()
          Returns the IndirectionHandler
static IndirectionHandler getIndirectionHandler(VirtualProxy proxy)
          Returns the indirection handler of the given proxy.
 java.lang.Object getRealSubject()
          Returns the proxies real subject.
 java.lang.Object writeReplace()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualProxy

public VirtualProxy()
Creates a new, uninitialized proxy.


VirtualProxy

public VirtualProxy(PBKey key,
                    Identity oid)
Creates a VirtualProxy for the subject with the given identity.

Parameters:
key - The key of the PersistenceBroker
oid - The identity of the subject

VirtualProxy

public VirtualProxy(IndirectionHandler handler)
Create a VirtualProxy that uses the given invocation handler. [tomdz] Why here the use of InvocationHandler ?

Parameters:
handler - The indirection handler of the proxy
Method Detail

getIndirectionHandler

public static IndirectionHandler getIndirectionHandler(VirtualProxy proxy)
Returns the indirection handler of the given proxy.

Parameters:
proxy - The proxy
Returns:
The indirection handler

alreadyMaterialized

public boolean alreadyMaterialized()
Determines whether this proxy already has been materialized.

Returns:
true if the real subject already been loaded

getRealSubject

public java.lang.Object getRealSubject()
                                throws PersistenceBrokerException
Returns the proxies real subject. The subject will be materialized if necessary.

Returns:
The subject
Throws:
PersistenceBrokerException

getIndirectionHandler

public IndirectionHandler getIndirectionHandler()
Returns the IndirectionHandler

Specified by:
getIndirectionHandler in interface OJBProxy
Returns:
The indirectionHandler

writeReplace

public java.lang.Object writeReplace()
Specified by:
writeReplace in interface OJBProxy


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30