org.apache.ojb.broker
Class VirtualProxy

java.lang.Object
  extended byorg.apache.ojb.broker.VirtualProxy
All Implemented Interfaces:
java.io.Serializable

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

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

Version:
$Id: VirtualProxy.java,v 1.10 2004/01/07 11:41:20 thma Exp $
Author:
Thomas Mahler
See Also:
as a sample application., Serialized Form

Constructor Summary
VirtualProxy()
           
VirtualProxy(java.lang.reflect.InvocationHandler handler)
          create a VirtualProxy from an identity
VirtualProxy(PBKey key, Identity oid)
          create a VirtualProxy from an identity
 
Method Summary
 boolean alreadyMaterialized()
          returns true if the real subject already been loaded
static java.lang.Object createProxy(PBKey key, java.lang.Class proxyClass, Identity realSubjectsIdentity)
          static factory method creates VirtualProxy instances of a given subclass and an real subjects identity.
static org.apache.ojb.broker.accesslayer.IndirectionHandler getIndirectionHandler(VirtualProxy proxy)
           
 java.lang.Object getRealSubject()
          returns the proxies real subject.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualProxy

public VirtualProxy()

VirtualProxy

public VirtualProxy(PBKey key,
                    Identity oid)
create a VirtualProxy from an identity

Parameters:
oid - org.apache.ojb.broker.Identity
key - the PersistenceBroker Key

VirtualProxy

public VirtualProxy(java.lang.reflect.InvocationHandler handler)
create a VirtualProxy from an identity

Method Detail

getIndirectionHandler

public static org.apache.ojb.broker.accesslayer.IndirectionHandler getIndirectionHandler(VirtualProxy proxy)

alreadyMaterialized

public boolean alreadyMaterialized()
returns true if the real subject already been loaded


createProxy

public static java.lang.Object createProxy(PBKey key,
                                           java.lang.Class proxyClass,
                                           Identity realSubjectsIdentity)
static factory method creates VirtualProxy instances of a given subclass and an real subjects identity.

Parameters:
proxyClass - java.lang.Class
realSubjectsIdentity - org.apache.ojb.broker.Identity
key - the PersistenceBroker Key
Returns:
org.apache.ojb.app.VirtualProxy
Throws:
PersistenceBrokerException - if there is an error creating the proxy object

getRealSubject

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

Throws:
PersistenceBrokerException


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14