Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

novaworx.resource
Class Resource  view Resource download Resource.java

java.lang.Object
  extended bycosmoworx.data.DataNode
      extended bynovaworx.resource.Resource
All Implemented Interfaces:
cosmoworx.data.Node, cosmoworx.data.RealNode

public final class Resource
extends cosmoworx.data.DataNode

Represents a resource.


Nested Class Summary
private  class Resource.ResourceMonitor
          A class to monitor the modified date of the resource and cause reload requests when the resource was modified by an outside process.
 
Field Summary
private  boolean mbActive
          The active flag.
private  boolean mbLoaded
          The loaded flag.
private  boolean mbOpen
          The open flag.
private  ResourceDelegate moDelegate
          The delegate that handles special implementation needs.
private  Resource.ResourceMonitor moMonitor
          The ResourceMonitor for this resource.
private static java.util.Timer moMonitorTimer
          The Timer for the ResourceMonitor objects.
private  java.util.Vector mvResourceListeners
          The ResourceListener list.
 
Fields inherited from class cosmoworx.data.DataNode
 
Constructor Summary
Resource(java.net.URI aoURI)
          Construct a Resource.
 
Method Summary
 void addResourceListener(ResourceListener aoListener)
          Add a ResourceListener.
 void close()
          Close the resource.
 boolean equals(java.lang.Object aoObject)
          Check for equality.
 boolean exists()
          Does the resource exist.
 void finalize()
          Finalize the object.
(package private)  void fireResourceActivated()
          Send an event that the resource is available.
(package private)  void fireResourceDeactivated()
          Send an event that the resource is available.
(package private)  void fireResourceLoaded()
          Send an event that the resource has been loaded.
(package private)  void fireResourceSaved()
          Send an event that the resource has been saved.
 ResourceDelegate getDelegate()
          Get the delegate that handles specific tasks.
 long getLastModified()
          Get the last date the resource was modified.
 java.net.URI getURI()
          Get the URI for this resource.
 boolean isActive()
          Is the resource available after being opened or closed.
 boolean isContainer()
          Is the resource a container for other resources.
 boolean isLoaded()
          Ts the resource loaded.
 boolean isOpen()
          Is the resource open.
 boolean isReadable()
          Is the resource readable.
 boolean isWritable()
          Is the resource writable.
 void load()
          Load the resource.
 void open()
          Open the resource.
 void removeResourceListener(ResourceListener aoListener)
          Remove a ResourceListener.
 void save()
          Save the resource.
(package private)  void setActive(boolean abActive)
          Set the active flag.
 void setDelegate(ResourceDelegate aoDelegate)
          Set the delegate that handles specific tasks.
 java.lang.String toString()
          The string representation of the resource.
 
Methods inherited from class cosmoworx.data.DataNode
add, addNodeListener, clear, contains, copyFrom, get, get, getAttributeKeys, getBoolean, getBoolean, getChild, getChildCount, getDouble, getDouble, getFloat, getFloat, getIndex, getInt, getInt, getLong, getLong, getModifiedChildCount, getParent, getRealNode, getResource, getResourceKeys, insert, insertAfter, insertBefore, isModified, remove, removeNodeListener, set, setBoolean, setDouble, setFloat, setInt, setLong, setModified, setModifyForChildren, setResource
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mbOpen

private boolean mbOpen
The open flag.


mbLoaded

private boolean mbLoaded
The loaded flag.


mbActive

private boolean mbActive
The active flag.


moDelegate

private ResourceDelegate moDelegate
The delegate that handles special implementation needs.


mvResourceListeners

private java.util.Vector mvResourceListeners
The ResourceListener list.


moMonitor

private Resource.ResourceMonitor moMonitor
The ResourceMonitor for this resource.


moMonitorTimer

private static java.util.Timer moMonitorTimer
The Timer for the ResourceMonitor objects.

Constructor Detail

Resource

public Resource(java.net.URI aoURI)
Construct a Resource.

Method Detail

getURI

public java.net.URI getURI()
Get the URI for this resource.


setDelegate

public void setDelegate(ResourceDelegate aoDelegate)
Set the delegate that handles specific tasks.


getDelegate

public ResourceDelegate getDelegate()
Get the delegate that handles specific tasks.


setActive

void setActive(boolean abActive)
Set the active flag.


isActive

public boolean isActive()
Is the resource available after being opened or closed.


open

public void open()
          throws ResourceException
Open the resource.


load

public void load()
          throws ResourceException
Load the resource.


save

public void save()
          throws ResourceException
Save the resource.


close

public void close()
           throws ResourceException
Close the resource.


isOpen

public boolean isOpen()
Is the resource open.


isLoaded

public boolean isLoaded()
Ts the resource loaded.


exists

public boolean exists()
               throws ResourceException
Does the resource exist.


isReadable

public boolean isReadable()
                   throws ResourceException
Is the resource readable. Returns false until the resource is opened.


isWritable

public boolean isWritable()
                   throws ResourceException
Is the resource writable. Returns false until the resource is opened.


isContainer

public boolean isContainer()
                    throws ResourceException
Is the resource a container for other resources.


getLastModified

public long getLastModified()
                     throws ResourceException
Get the last date the resource was modified.


addResourceListener

public void addResourceListener(ResourceListener aoListener)
Add a ResourceListener.


removeResourceListener

public void removeResourceListener(ResourceListener aoListener)
Remove a ResourceListener.


toString

public java.lang.String toString()
The string representation of the resource. This returns URI.toString().


equals

public boolean equals(java.lang.Object aoObject)
Check for equality.


finalize

public void finalize()
Finalize the object.


fireResourceLoaded

void fireResourceLoaded()
Send an event that the resource has been loaded.


fireResourceSaved

void fireResourceSaved()
Send an event that the resource has been saved.


fireResourceActivated

void fireResourceActivated()
Send an event that the resource is available.


fireResourceDeactivated

void fireResourceDeactivated()
Send an event that the resource is available.