org.planx.xmlstore.koala.io
Class CacheNodeFileSystem<R extends Locatable>

java.lang.Object
  extended by org.planx.xmlstore.koala.io.NodeFileSystemImpl<R>
      extended by org.planx.xmlstore.koala.io.CacheNodeFileSystem<R>
All Implemented Interfaces:
FileSystem, Loader<R,SystemNode>, NodeFileSystem<R>

public class CacheNodeFileSystem<R extends Locatable>
extends NodeFileSystemImpl<R>

A NodeFileSystem that caches shared nodes (nodes that have the isShared flag set to true). This enables efficient loading and traversal of nodes.

Author:
Thomas Ambus

Constructor Summary
CacheNodeFileSystem(FileSystem fs, IOPolicy<R> policy, boolean useSoft)
          The NodeFileSystem will use a NodeConverter for converting nodes to and from byte representation.
 
Method Summary
 void clear()
          Frees all data in this FileSystem.
 void free(Bound l)
          Frees the space occupied by the specified Bound.
 SystemNode load(Locator loc, RelativeDualReference<Locator,R> ref)
          Loads a node from the file system.
 SystemNode load(R ref)
          Loads a node from the file system.
 Locator save(SystemNode node)
          Saves at end of the file system by appending (i.e. allocating using NodeFileSystemImpl.allocate()).
 
Methods inherited from class org.planx.xmlstore.koala.io.NodeFileSystemImpl
all, allocate, allocate, clearModified, close, getData, getMeta, getPolicy, id, isContained, isModified, isReadOnly, setMeta, setReadOnly, size, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CacheNodeFileSystem

public CacheNodeFileSystem(FileSystem fs,
                           IOPolicy<R> policy,
                           boolean useSoft)
The NodeFileSystem will use a NodeConverter for converting nodes to and from byte representation.

Method Detail

load

public SystemNode load(R ref)
                throws IOException
Description copied from interface: NodeFileSystem
Loads a node from the file system.

Specified by:
load in interface Loader<R extends Locatable,SystemNode>
Specified by:
load in interface NodeFileSystem<R extends Locatable>
Overrides:
load in class NodeFileSystemImpl<R extends Locatable>
Throws:
IOException

load

public SystemNode load(Locator loc,
                       RelativeDualReference<Locator,R> ref)
                throws IOException
Description copied from interface: NodeFileSystem
Loads a node from the file system.

Specified by:
load in interface NodeFileSystem<R extends Locatable>
Overrides:
load in class NodeFileSystemImpl<R extends Locatable>
Throws:
IOException

save

public Locator save(SystemNode node)
             throws IOException
Description copied from class: NodeFileSystemImpl
Saves at end of the file system by appending (i.e. allocating using NodeFileSystemImpl.allocate()).

Specified by:
save in interface NodeFileSystem<R extends Locatable>
Overrides:
save in class NodeFileSystemImpl<R extends Locatable>
Throws:
IOException

free

public void free(Bound l)
          throws IOException
Description copied from interface: FileSystem
Frees the space occupied by the specified Bound.

Specified by:
free in interface FileSystem
Overrides:
free in class NodeFileSystemImpl<R extends Locatable>
Throws:
IOException - if an I/O error occurred.
InvalidSourceIdException - if the file system identifier of the locator is invalid.
OutOfBoundsException - if the locator is out of bounds.

clear

public void clear()
           throws IOException
Description copied from interface: FileSystem
Frees all data in this FileSystem.

Specified by:
clear in interface FileSystem
Overrides:
clear in class NodeFileSystemImpl<R extends Locatable>
Throws:
IOException


Copyright © 2004-2005 Plan-X. All Rights Reserved.