Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.jigsaw.resources
Class 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 java.lang.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.

Field Summary
`protected boolean` | `alive` Is our attached thread still alive ?
`protected static int` | `ATTR_FLUSHCONFIG` Attribute index - Should we save the configuration ?
`protected static int` | `ATTR_FLUSHLOG` Attribute index - Should we flush the logs too ?
`protected static int` | `ATTR_FLUSHPROPS` Attrbute index - Should we save the properties too ?
`protected static int` | `ATTR_INTERVAL` Attribute index - Backup interval, in seconds.
`protected static int` | `ATTR_PRIORITY` Attribute index - The priority of the flusher thread.
`protected static int` | `ATTR_TRACE_CHECK` Attribute index - should we display a trace when we perform checkpoint
`protected java.util.Date` | `checkpoint` Last date at which we checkpointed the configuration
`protected java.lang.Thread` | `thread` Our thread, if one is currently attached.

Fields inherited from class org.w3c.tools.resources.FramedResource
`ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener`

Fields inherited from class org.w3c.tools.resources.Resource
`ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL`

Fields inherited from class org.w3c.tools.resources.AttributeHolder
`attributes, values`

Constructor Summary
`CheckpointResource()`

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

Methods inherited from class org.w3c.tools.resources.FramedResource
`addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, eventDisabled, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameModified, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, lookup, markModified, perform, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, processEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, setValue, unregisterFrame`

Methods inherited from class org.w3c.tools.resources.Resource
`checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, updateAttributes`

Methods inherited from class org.w3c.tools.resources.AttributeHolder
`definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, initialize, lookupAttribute, pickleValues, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ATTR_INTERVAL

    protected static int ATTR_INTERVAL

  Attribute index - Backup interval, in seconds.

### ATTR_PRIORITY

    protected static int ATTR_PRIORITY

  Attribute index - The priority of the flusher thread.

### ATTR_FLUSHLOG

    protected static int ATTR_FLUSHLOG

  Attribute index - Should we flush the logs too ?

### ATTR_FLUSHPROPS

    protected static int ATTR_FLUSHPROPS

  Attrbute index - Should we save the properties too ?

### ATTR_FLUSHCONFIG

    protected static int ATTR_FLUSHCONFIG

  Attribute index - Should we save the configuration ?

### ATTR_TRACE_CHECK

    protected static int ATTR_TRACE_CHECK

  Attribute index - should we display a trace when we perform checkpoint

### thread

    protected java.lang.Thread thread

  Our thread, if one is currently attached.

### checkpoint

    protected java.util.Date checkpoint

  Last date at which we checkpointed the configuration

### alive

    protected boolean alive

  Is our attached thread still alive ?

Constructor Detail

### CheckpointResource

    public CheckpointResource()

Method Detail

### activate

    public void activate()

  Start the thread for this object, only if needed.

### stop

    protected void stop()

  Force our attached thread to stop.

### getInterval

    public int getInterval()

  Get the sync interval.
  Returns:
    An integer number of seconds, or -1 if undefined.

### getPriority

    public int getPriority()

  Get the priority for our attached thread.
  Returns:
    An integer priority for the thread, which defaults to 2 if undefined.

### 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.

### getTraceFlag

    public boolean getTraceFlag()

### getFlushProperties

    public boolean getFlushProperties()

  Get the flush properties flag.
  Returns:
    A boolean, true if the properties are to be flushed, false otherwise.

### 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.

### acceptUnload

    public boolean acceptUnload()

  This is the only resource that will refuse to be unloaded !
  Overrides:
    acceptUnload in class Resource
  Returns:
    Always false.

### 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

### run

    public void run()

  We are attached a thread, now it's time to performt the job.
  Specified by:
    run in interface java.lang.Runnable

### initialize

    public void initialize(java.lang.Object[] values)

  Activate the checkpointer at initialization time.
  Overrides:
    initialize in class FramedResource
  Tags copied from class: FramedResource
  Parameters:
    `values` - Default attribute values.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD