com.j_spaces.core
Class LeaseProxy

java.lang.Object
  extended by com.j_spaces.core.LeaseProxy
All Implemented Interfaces:
LeaseContext, Externalizable, Serializable, Lease

public class LeaseProxy
extends Object
implements LeaseContext, Externalizable

An instance of this class represents an entry/template lease or a lease of an event registration results from a notify.
You can get entry UID from the entry Lease object. e.g.


 Message o = new Message ("A");
 Lease lease = space.write(o, null, Lease.FOREVER);
 LeaseProxy lp = (LeaseProxy) lease;
 String uid = lp.getUID();
  

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.jini.core.lease.Lease
ABSOLUTE, ANY, DURATION, FOREVER
 
Constructor Summary
LeaseProxy()
          default constructor for Externalizable.
LeaseProxy(LeaseProxy lease)
          Copy constractor to create the super Classes
LeaseProxy(long absExprTime, String uid, com.j_spaces.core.JSpaceImpl spaceImpl)
          Construct a relative-format lease for Transient space.
LeaseProxy(long absExprTime, String uid, com.j_spaces.core.JSpaceImpl spaceImpl, String classname, int objectType)
          Construct a relative-format lease for Persistent space.
 
Method Summary
 boolean canBatch(Lease lease)
          
 void cancel()
          
 LeaseMap createLeaseMap(long duration)
          
 String getClassname()
          Returns a class name of lease resource( Entry/Notify Template ).
 EntryInfo getEntryInfo()
          Returns EntryInfo of written Entry.
 long getExpiration()
          
 Object getObject()
          returns the previous value associated with this update-or-write operation.
 int getObjectType()
          Returns type of Lease resource.
 int getSerialFormat()
          
 String getUID()
          Returns UID of written Entry.
 boolean isTimeout()
           
 void readExternal(ObjectInput in)
          
 void renew(long duration)
          
 void setSerialFormat(int format)
          
 void setUID(String uid)
          Sets UID of written Entry.
 void writeExternal(ObjectOutput out)
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LeaseProxy

public LeaseProxy()
default constructor for Externalizable. for internal use only


LeaseProxy

public LeaseProxy(long absExprTime,
                  String uid,
                  com.j_spaces.core.JSpaceImpl spaceImpl)
Construct a relative-format lease for Transient space. for internal use only


LeaseProxy

public LeaseProxy(long absExprTime,
                  String uid,
                  com.j_spaces.core.JSpaceImpl spaceImpl,
                  String classname,
                  int objectType)
Construct a relative-format lease for Persistent space. for internal use only


LeaseProxy

public LeaseProxy(LeaseProxy lease)
Copy constractor to create the super Classes

Parameters:
lease -
Method Detail

canBatch

public boolean canBatch(Lease lease)

Specified by:
canBatch in interface Lease

cancel

public void cancel()
            throws UnknownLeaseException,
                   RemoteException

Specified by:
cancel in interface Lease
Throws:
UnknownLeaseException
RemoteException

createLeaseMap

public LeaseMap createLeaseMap(long duration)

Specified by:
createLeaseMap in interface Lease

getExpiration

public long getExpiration()

Specified by:
getExpiration in interface Lease

getSerialFormat

public int getSerialFormat()

Specified by:
getSerialFormat in interface Lease

setSerialFormat

public void setSerialFormat(int format)

Specified by:
setSerialFormat in interface Lease

renew

public void renew(long duration)
           throws LeaseDeniedException,
                  UnknownLeaseException,
                  RemoteException

Specified by:
renew in interface Lease
Throws:
LeaseDeniedException
UnknownLeaseException
RemoteException

getClassname

public String getClassname()
Returns a class name of lease resource( Entry/Notify Template ). Only if and only if the space is persistent.

Returns:
Returns class name of lease resource( Entry/Notify Template ).

getObjectType

public int getObjectType()
Returns type of Lease resource.

Returns:
Returns type of Lease resource.

getUID

public String getUID()
Returns UID of written Entry.

Specified by:
getUID in interface LeaseContext
Returns:
UID of written Entry.

setUID

public void setUID(String uid)
Sets UID of written Entry.

Parameters:
UID - of written Entry.

getEntryInfo

public EntryInfo getEntryInfo()
Returns EntryInfo of written Entry.

Returns:
EntryInfo of written Entry.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException

Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException

Specified by:
writeExternal in interface Externalizable
Throws:
IOException

getObject

public Object getObject()
returns the previous value associated with this update-or-write operation. Note: Always null unless overridden.

Specified by:
getObject in interface LeaseContext
Returns:
null indicating a successful write.

isTimeout

public boolean isTimeout()