org.geotools.caching.grid.spatialindex.store
Class DiskStorage

java.lang.Object
  extended by org.geotools.caching.grid.spatialindex.store.DiskStorage
All Implemented Interfaces:
Storage

public class DiskStorage
extends java.lang.Object
implements Storage

A storage that stores data in a file on disk. Create new instances with static factory method DiskStorage.createInstance() or DiskStorage.createInstance(PropertySet)

Author:
Christophe Rousson , Google SoC 2007

Field Summary
static java.lang.String DATA_FILE_PROPERTY
           
static java.lang.String INDEX_FILE_PROPERTY
           
protected static java.util.logging.Logger logger
           
static java.lang.String PAGE_SIZE_PROPERTY
           
 
Fields inherited from interface org.geotools.caching.spatialindex.Storage
STORAGE_TYPE_PROPERTY
 
Method Summary
 void addFeatureType(org.opengis.feature.type.FeatureType ft)
          Adds a feature type to the store.
 void clear()
          Removes all entries from the disk store and clears the associated feature types.
 void clearFeatureTypes()
          Clears all feature types associated with store
static Storage createInstance()
          Default factory method : create a new Storage of type DiskStorage, with page size set to default 1000 bytes, and data file is a new temporary file.
static Storage createInstance(java.util.Properties pset)
          Factory method : create a new Storage of type DiskStorage.
 void dispose()
          Disposes of the store.
 NodeIdentifier findUniqueInstance(NodeIdentifier id)
           
 void flush()
          Writes the index file.
 Node get(NodeIdentifier id)
          Gets a particular node
 ReferencedEnvelope getBounds()
          Get the bounds of data in the store.
 java.util.Collection<org.opengis.feature.type.FeatureType> getFeatureTypes()
          Gets the feature types supported by the store.
 java.util.Properties getPropertySet()
          Get properties about the given storage.
protected  void initializeFromIndex()
          Initializes the store from the index file.
 void put(Node n)
          Adds a node to the store.
 void remove(NodeIdentifier id)
          Removes a node from the store.
 void setBounds(ReferencedEnvelope bounds)
          Sets the bounds of the store
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATA_FILE_PROPERTY

public static final java.lang.String DATA_FILE_PROPERTY
See Also:
Constant Field Values

INDEX_FILE_PROPERTY

public static final java.lang.String INDEX_FILE_PROPERTY
See Also:
Constant Field Values

PAGE_SIZE_PROPERTY

public static final java.lang.String PAGE_SIZE_PROPERTY
See Also:
Constant Field Values

logger

protected static java.util.logging.Logger logger
Method Detail

createInstance

public static Storage createInstance(java.util.Properties pset)
Factory method : create a new Storage of type DiskStorage. Valid properties are :

Parameters:
property - set
Returns:
new instance of DiskStorage

createInstance

public static Storage createInstance()
Default factory method : create a new Storage of type DiskStorage, with page size set to default 1000 bytes, and data file is a new temporary file.

Returns:
new instance of DiskStorage with default parameters.

clear

public void clear()
Removes all entries from the disk store and clears the associated feature types.

Specified by:
clear in interface Storage

get

public Node get(NodeIdentifier id)
Gets a particular node

Specified by:
get in interface Storage
Parameters:
id - identifier of the node to read
Returns:

put

public void put(Node n)
Adds a node to the store.

Specified by:
put in interface Storage

remove

public void remove(NodeIdentifier id)
Removes a node from the store.

Specified by:
remove in interface Storage
Parameters:
id - identifier of the node to remove

dispose

public void dispose()
Disposes of the store.

This flushes all data and closes file handles

Specified by:
dispose in interface Storage

flush

public void flush()
Writes the index file.

This does not close the data files.

Specified by:
flush in interface Storage

initializeFromIndex

protected void initializeFromIndex()
                            throws java.io.IOException
Initializes the store from the index file.

Throws:
java.io.IOException

getPropertySet

public java.util.Properties getPropertySet()
Description copied from interface: Storage
Get properties about the given storage. The actual properties returned depend on the type of storage.

Specified by:
getPropertySet in interface Storage
Returns:

findUniqueInstance

public NodeIdentifier findUniqueInstance(NodeIdentifier id)
Specified by:
findUniqueInstance in interface Storage

addFeatureType

public void addFeatureType(org.opengis.feature.type.FeatureType ft)
Adds a feature type to the store.

Specified by:
addFeatureType in interface Storage
Parameters:
ft - feature type to add

getFeatureTypes

public java.util.Collection<org.opengis.feature.type.FeatureType> getFeatureTypes()
Gets the feature types supported by the store.

Specified by:
getFeatureTypes in interface Storage

clearFeatureTypes

public void clearFeatureTypes()
Clears all feature types associated with store

Specified by:
clearFeatureTypes in interface Storage

setBounds

public void setBounds(ReferencedEnvelope bounds)
Sets the bounds of the store

Specified by:
setBounds in interface Storage

getBounds

public ReferencedEnvelope getBounds()
Get the bounds of data in the store.

Specified by:
getBounds in interface Storage
Returns:


Copyright © 1996-2010 Geotools. All Rights Reserved.