All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.jigsaw.resources.CheckpointResource

java.lang.Object
   |
   +----org.w3c.tools.resources.AttributeHolder
           |
           +----org.w3c.tools.resources.Resource
                   |
                   +----org.w3c.tools.resources.FramedResource
                           |
                           +----org.w3c.jigsaw.resources.CheckpointResource

public class CheckpointResource
extends FramedResource
implements Runnable
A resource that will checkpoint the configuration at regular intervals. This resource will make sure that current configuration is backed up to disk at regular (configurable) intervals.

The webmaster can customize what part of the configuration is to be backed up through boolean attributes.


Variable Index

 o alive
Is our attached thread still alive ?
 o ATTR_FLUSHCONFIG
Attribute index - Should we save the configuration ?
 o ATTR_FLUSHLOG
Attribute index - Should we flush the logs too ?
 o ATTR_FLUSHPROPS
Attrbute index - Should we save the properties too ?
 o ATTR_INTERVAL
Attribute index - Backup interval, in seconds.
 o ATTR_PRIORITY
Attribute index - The priority of the flusher thread.
 o ATTR_TRACE_CHECK
Attribute index - should we display a trace when we perform checkpoint
 o checkpoint
Last date at which we checkpointed the configuration
 o thread
Our thread, if one is currently attached.

Constructor Index

 o CheckpointResource()

Method Index

 o acceptUnload()
This is the only resource that will refuse to be unloaded !
 o activate()
Start the thread for this object, only if needed.
 o getFlushConfiguration()
Get the flush configuration flag.
 o getFlushLog()
Get the flush log flag.
 o getFlushProperties()
Get the flush properties flag.
 o getInterval()
Get the sync interval.
 o getPriority()
Get the priority for our attached thread.
 o getTraceFlag()
 o initialize(Object[])
Activate the checkpointer at initialization time.
 o notifyUnload()
This resource is being unloaded.
 o run()
We are attached a thread, now it's time to performt the job.
 o stop()
Force our attached thread to stop.

Variables

 o ATTR_INTERVAL
 protected static int ATTR_INTERVAL
Attribute index - Backup interval, in seconds.

 o ATTR_PRIORITY
 protected static int ATTR_PRIORITY
Attribute index - The priority of the flusher thread.

 o ATTR_FLUSHLOG
 protected static int ATTR_FLUSHLOG
Attribute index - Should we flush the logs too ?

 o ATTR_FLUSHPROPS
 protected static int ATTR_FLUSHPROPS
Attrbute index - Should we save the properties too ?

 o ATTR_FLUSHCONFIG
 protected static int ATTR_FLUSHCONFIG
Attribute index - Should we save the configuration ?

 o ATTR_TRACE_CHECK
 protected static int ATTR_TRACE_CHECK
Attribute index - should we display a trace when we perform checkpoint

 o thread
 protected Thread thread
Our thread, if one is currently attached.

 o checkpoint
 protected Date checkpoint
Last date at which we checkpointed the configuration

 o alive
 protected boolean alive
Is our attached thread still alive ?

Constructors

 o CheckpointResource
 public CheckpointResource()

Methods

 o activate
 public synchronized void activate()
Start the thread for this object, only if needed.

 o stop
 protected synchronized void stop()
Force our attached thread to stop.

 o getInterval
 public int getInterval()
Get the sync interval.

Returns:
An integer number of seconds, or -1 if undefined.
 o getPriority
 public int getPriority()
Get the priority for our attached thread.

Returns:
An integer priority for the thread, which defaults to 2 if undefined.
 o getFlushLog
 public boolean getFlushLog()
Get the flush log flag.

Returns:
A boolean, true if the log is to be flushed at each refresh interval, false otherwise.
 o getTraceFlag
 public boolean getTraceFlag()
 o getFlushProperties
 public boolean getFlushProperties()
Get the flush properties flag.

Returns:
A boolean, true if the properties are to be flushed, false otherwise.
 o getFlushConfiguration
 public boolean getFlushConfiguration()
Get the flush configuration flag.

Returns:
A boolean, true oif the configuration is to be flushed at each interval, false otherwise.
 o acceptUnload
 public boolean acceptUnload()
This is the only resource that will refuse to be unloaded !

Returns:
Always false.
Overrides:
acceptUnload in class Resource
 o notifyUnload
 public void notifyUnload()
This resource is being unloaded. Unloading that object will also stop the thread. However, there is a bug here, since if the resource gets unloaded for some reason, it will not be able to wakeup itself at next checkpoint time.

Overrides:
notifyUnload in class FramedResource
 o run
 public void run()
We are attached a thread, now it's time to performt the job.

 o initialize
 public void initialize(Object values[])
Activate the checkpointer at initialization time.

Overrides:
initialize in class FramedResource

All Packages  Class Hierarchy  This Package  Previous  Next  Index