|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umich.eecs.tac.props.AbstractTransportable
public abstract class AbstractTransportable
This class provides a skeletal implementation of the Transportable
interface by providing a locking mechanism. Inheriting classes should issue
lockCheck()
when setting attributes.
readWithLock(se.sics.isl.transport.TransportReader)
and
writeWithLock(se.sics.isl.transport.TransportWriter)
methods.
Constructor Summary | |
---|---|
AbstractTransportable()
|
Method Summary | |
---|---|
java.lang.String |
getTransportName()
Returns the transport name for externalization of an implementing AbstractTransportable will return the simple name of the implementing class. |
protected boolean |
isLocked()
Returns whether the transportable is immutable. |
void |
lock()
Make the transportable immutable. |
protected void |
lockCheck()
Before writing an attribute value, lockCheck() should be called. |
void |
read(se.sics.isl.transport.TransportReader reader)
Reads the state for this transportable from the specified reader. |
protected abstract void |
readWithLock(se.sics.isl.transport.TransportReader reader)
Reads the state of the transportable . |
void |
write(se.sics.isl.transport.TransportWriter writer)
Writes the state for this transportable to the specified writer. |
protected abstract void |
writeWithLock(se.sics.isl.transport.TransportWriter writer)
Writes the state of the transportable . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTransportable()
Method Detail |
---|
public final void lock()
protected final boolean isLocked()
true
if the transportable is locked,
false
otherwise.protected final void lockCheck() throws java.lang.IllegalStateException
lockCheck()
should be called.
This method will throw an illegal state
exception
if a write is called on a locked object.
java.lang.IllegalStateException
- throws exception if object is locked.public final void read(se.sics.isl.transport.TransportReader reader) throws java.text.ParseException
read
in interface se.sics.isl.transport.Transportable
reader
- the reader to read data from
java.text.ParseException
- if a parse error occurspublic final void write(se.sics.isl.transport.TransportWriter writer)
write
in interface se.sics.isl.transport.Transportable
writer
- the writer to write data topublic final java.lang.String getTransportName()
AbstractTransportable
will return the simple name
of the implementing class.
getTransportName
in interface se.sics.isl.transport.Transportable
protected abstract void readWithLock(se.sics.isl.transport.TransportReader reader) throws java.text.ParseException
transportable
. Implementing
classes should read in attributes first and then any sub-nodes.
reader
- the reader to read data from.
java.text.ParseException
- if a parse error occursprotected abstract void writeWithLock(se.sics.isl.transport.TransportWriter writer)
transportable
. Implementing
classes should write out attributes first and then any sub-nodes.
writer
- the writer to write data to.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |