ozone API

org.ozoneDB
Class OzoneProxy

java.lang.Object
  extended byorg.ozoneDB.OzoneProxy
All Implemented Interfaces:
java.io.Externalizable, OzoneCompatibleOrProxy, OzoneRemote, java.io.Serializable

public class OzoneProxy
extends java.lang.Object
implements OzoneRemote, java.io.Externalizable

Proxy of an OzoneRemote object.

Version:
$Revision: 1.5 $Date: 2003/09/24 12:42:23 $
Author:
SMB, Medium.net
See Also:
Serialized Form

Field Summary
 OzoneInterface link
           
static DxMap linkTable
          Table of stream to OzoneInterface pairs.
 org.ozoneDB.core.ObjectID remoteID
           
 
Constructor Summary
OzoneProxy()
          This constructor will only be called, when the object is constructed from a stream.
OzoneProxy(org.ozoneDB.core.ObjectID id, OzoneInterface link)
          This constructor is only be called, when this object is constructed inside the database.
OzoneProxy(OzoneProxy rhs)
           
 
Method Summary
 void createProxyLinkAttributes(org.xml.sax.helpers.AttributesImpl atts)
          Adds the required attributes for a simple XLink which points to this proxy to an attribute list.
 boolean equals(java.lang.Object obj)
          Base implementation of equals().
 void finalize()
          Notify the database link that this reference dies.
 java.lang.String getHandle()
          Retrieves a handle to a specific instance of an OzoneObject.
 org.ozoneDB.core.ObjectID getObjectID()
          Returns the ObjectID of the represented ozone object.
 java.lang.String handle()
          Deprecated. use getHandle()
 int hashCode()
          Base implementation of hashCode().
 java.lang.Object invoke(java.lang.String methodName, int lockLevel)
          Method to use the proxy without a generated stub.
 java.lang.Object invoke(java.lang.String methodName, java.lang.Object arg1, int lockLevel)
          Method to use the proxy without a generated stub.
 java.lang.Object invoke(java.lang.String methodName, java.lang.Object arg1, java.lang.Object arg2, int lockLevel)
          Method to use the proxy without a generated stub.
 java.lang.Object invoke(java.lang.String methodName, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, int lockLevel)
          Method to use the proxy without a generated stub.
 boolean isSame(OzoneProxy proxy)
           
 void readExternal(java.io.ObjectInput in)
           
 org.ozoneDB.core.ObjectID remoteID()
           
 java.lang.String toString()
          Base implementation of toString() that runs client side only.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

linkTable

public static DxMap linkTable
Table of stream to OzoneInterface pairs. The method readExternal(ObjectInput) checks this table to find corresponding database link.


link

public transient OzoneInterface link

remoteID

public org.ozoneDB.core.ObjectID remoteID
Constructor Detail

OzoneProxy

public OzoneProxy()
This constructor will only be called, when the object is constructed from a stream.


OzoneProxy

public OzoneProxy(org.ozoneDB.core.ObjectID id,
                  OzoneInterface link)
This constructor is only be called, when this object is constructed inside the database. However, it may be the result of a RMI call.


OzoneProxy

public OzoneProxy(OzoneProxy rhs)
Method Detail

isSame

public boolean isSame(OzoneProxy proxy)

equals

public boolean equals(java.lang.Object obj)
Base implementation of equals(). May be overwritten by an implementation of the actual database object. In that case the method is handled, as all remote methods, on the server side.


hashCode

public int hashCode()
Base implementation of hashCode(). May be overwritten by an implementation of the actual database object. In that case the method is handled, as all remote methods, on the server side.


toString

public java.lang.String toString()
Base implementation of toString() that runs client side only. When you want to override this method with one that runs on the server side, as all remote methods, you need to define public String toString() in your OzoneRemote extending interface so that OPP will generate a remote call. For instance: public interface Foo extends OzoneRemote { // ensure OPP will create a remote call public String toString(); // other methods } Providing an implementation for toString() in your OzoneObject extending class is optional; if you do not, then the implementation of toString() in OzoneObject will be used server-side conform normal java method override rules.

Returns:
String string representation of this proxy, containing a string representation of the ozone id of the object this proxy represents

remoteID

public org.ozoneDB.core.ObjectID remoteID()

getObjectID

public org.ozoneDB.core.ObjectID getObjectID()
Returns the ObjectID of the represented ozone object. ObjectIDs are equal for equal ozone objects and different for different ozone objects. They are comparable, so that ozone objects may use ObjectID.compareTo(Object) in comparison functions.

Currently, ObjectID exposes other methods than ObjectID.equals(Object) and ObjectID.compareTo(Object). However, they should not be used, as ObjectIDs should be, apart from this method, opaque.

Specified by:
getObjectID in interface OzoneCompatibleOrProxy
Returns:
the ObjectID of the represented ozone object

getHandle

public java.lang.String getHandle()
Retrieves a handle to a specific instance of an OzoneObject.
A handle is the externalizeable equivalent of OzoneProxy. The purpose of handles is to enable detached systems (such as web interfaces) that are not able to use OzoneProxy objects directly a means to access specific objects where object naming is not practical or convenient. A handle is valid for the lifetime of the OzoneObject it references. Unlike OzoneProxy, retrieving a handle on an object does nothing to guarantee its existence. While the handle is valid for the lifetime of the object it refers to, that object's lifetime may be shorter than the handle's.

The resultant string representation will be composed entirely of alphanumeric characters [A-Z], [a-z], and [0-9]; as such, it can safely and reliably be used in URLs without need for escaping.


handle

public java.lang.String handle()
Deprecated. use getHandle()


createProxyLinkAttributes

public void createProxyLinkAttributes(org.xml.sax.helpers.AttributesImpl atts)

Adds the required attributes for a simple XLink which points to this proxy to an attribute list.

Parameters:
atts - The SAX attribute list to which the attributes will be added.

invoke

public java.lang.Object invoke(java.lang.String methodName,
                               int lockLevel)
                        throws java.lang.Exception
Method to use the proxy without a generated stub. The method signature will be generated from the actual argument types. This may be in some cases!

Throws:
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.String methodName,
                               java.lang.Object arg1,
                               int lockLevel)
                        throws java.lang.Exception
Method to use the proxy without a generated stub.

Throws:
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.String methodName,
                               java.lang.Object arg1,
                               java.lang.Object arg2,
                               int lockLevel)
                        throws java.lang.Exception
Method to use the proxy without a generated stub.

Throws:
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.String methodName,
                               java.lang.Object arg1,
                               java.lang.Object arg2,
                               java.lang.Object arg3,
                               int lockLevel)
                        throws java.lang.Exception
Method to use the proxy without a generated stub.

Throws:
java.lang.Exception

finalize

public void finalize()
Notify the database link that this reference dies.


writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

ozone API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.