org.norther.tammi.acorn.trace
Class TraceableSupport

java.lang.Object
  extended by org.norther.tammi.acorn.trace.TraceableSupport
All Implemented Interfaces:
Serializable, Traceable

public class TraceableSupport
extends Object
implements Traceable, Serializable

A support class for traceable objects implementing default methods.

Note that this implementation doesn't maintain traces at resource level.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
TraceableSupport()
          Constructs a new traceable.
TraceableSupport(Traceable adaptee)
          Constructs a new traceable adapter.
 
Method Summary
 void addTraceListener(TraceListener listener)
          Adds a listener if not already present.
 void clearTraceListeners()
          Clears all listeners from this traceable.
 long getLastInitialized()
          Gets the timestamp of the last initialization of the traced object.
 long getLastModified()
          Gets the timestamp of the last modification of the traced object.
 long getLastModified(Object key)
          Gets the timestamp of the last modification of the specified resource.
 void notifyTraceListeners()
          Notifies listeners if this trace has been modified.
 void notifyTraceListeners(Object key)
          Notifies listeners with the specified resource if this trace has been modified.
 void notifyTraceListeners(TraceEvent event)
          Notifies listeners with the specified event when this trace has been modified.
 void removeTraceListener(TraceListener listener)
          Removes a listener.
 void setLastModified(Object key, long timestamp)
          Sets the timestamp of the last modification of the specified resource.
 int traceListenerCount()
          Returns the number of listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraceableSupport

public TraceableSupport()
Constructs a new traceable.


TraceableSupport

public TraceableSupport(Traceable adaptee)
Constructs a new traceable adapter.

Parameters:
adaptee - the adaptee.
Method Detail

getLastInitialized

public long getLastInitialized()
Description copied from interface: Traceable
Gets the timestamp of the last initialization of the traced object.

Specified by:
getLastInitialized in interface Traceable
Returns:
the initialization timestamp.

getLastModified

public long getLastModified()
Description copied from interface: Traceable
Gets the timestamp of the last modification of the traced object.

Specified by:
getLastModified in interface Traceable
Returns:
the modification timestamp.

getLastModified

public long getLastModified(Object key)
Description copied from interface: Traceable
Gets the timestamp of the last modification of the specified resource.

Specified by:
getLastModified in interface Traceable
Parameters:
key - the key of the resource.
Returns:
the modification timestamp.

setLastModified

public void setLastModified(Object key,
                            long timestamp)
Description copied from interface: Traceable
Sets the timestamp of the last modification of the specified resource. This is a clumsy way to maintain original timestamps of resources copied between objects, so implementors are encouraged to provide timestamped setters to be applied instead of this method.

Specified by:
setLastModified in interface Traceable
Parameters:
key - the key of the resource.
timestamp - the modification timestamp.

addTraceListener

public void addTraceListener(TraceListener listener)
Description copied from interface: Traceable
Adds a listener if not already present.

Specified by:
addTraceListener in interface Traceable
Parameters:
listener - a listener to add.

removeTraceListener

public void removeTraceListener(TraceListener listener)
Description copied from interface: Traceable
Removes a listener.

Specified by:
removeTraceListener in interface Traceable
Parameters:
listener - the listener to remove.

clearTraceListeners

public void clearTraceListeners()
Description copied from interface: Traceable
Clears all listeners from this traceable.

Specified by:
clearTraceListeners in interface Traceable

traceListenerCount

public int traceListenerCount()
Returns the number of listeners.

Returns:
the number of listeners.

notifyTraceListeners

public void notifyTraceListeners()
Notifies listeners if this trace has been modified.


notifyTraceListeners

public void notifyTraceListeners(Object key)
Notifies listeners with the specified resource if this trace has been modified.

Parameters:
key - the resource key.

notifyTraceListeners

public void notifyTraceListeners(TraceEvent event)
Notifies listeners with the specified event when this trace has been modified.

Parameters:
event - the trace event.


Copyright © 2004 The Norther Organization. All rights reserved.