com.partnersoft.io.store
Interface CogStore

All Known Implementing Classes:
PreferencesCogStore, XMLCogStore

public interface CogStore

A place to store your Cogs. More precisely, a hierarchical storage database for Cog objects. This is an abstract interface that may map to a file-based, sql-based, or some other implementation. A CogStore may be read-only or editable. It supports basic loading and saving and simple queries similar to a directory listing or "find" function. In general, though, it is expected that you will be loading and saving to a known path.

For our own amusement, we have labeled the directory-like object a "bin" (like a bucket for parts).

Author:
Paul Reavis Copyright 2003 Partner Software, Inc.

Field Summary
static int BIN
           
static int COG
           
static int NOT_FOUND
           
 
Method Summary
 int examine(java.lang.String path)
          Returns type of node for path - either NOT_FOUND, COG, or BIN.
 boolean isWritable()
          Returns true if you can write to this store.
 java.lang.String[] listContents(java.lang.String binPath)
          Lists the contents for the given bin node.
 Cog retrieveCog(java.lang.String path)
          Retreives a cog from storage.
 Cog retrieveCogOrNull(java.lang.String path)
          Retreives a cog from storage.
 void storeCog(java.lang.String path, Cog cog)
          Stores a cog, replacing the current one at that location and creating any missing bins needed.
 

Field Detail

NOT_FOUND

static final int NOT_FOUND
See Also:
Constant Field Values

COG

static final int COG
See Also:
Constant Field Values

BIN

static final int BIN
See Also:
Constant Field Values
Method Detail

isWritable

boolean isWritable()
Returns true if you can write to this store.


retrieveCog

Cog retrieveCog(java.lang.String path)
                throws java.io.IOException
Retreives a cog from storage.

Throws:
java.io.IOException

retrieveCogOrNull

Cog retrieveCogOrNull(java.lang.String path)
                      throws java.io.IOException
Retreives a cog from storage. Returns null (rather than FileNotFound) if it's not there.

Throws:
java.io.IOException

storeCog

void storeCog(java.lang.String path,
              Cog cog)
              throws java.io.IOException
Stores a cog, replacing the current one at that location and creating any missing bins needed.

Throws:
java.io.IOException

examine

int examine(java.lang.String path)
            throws java.io.IOException
Returns type of node for path - either NOT_FOUND, COG, or BIN.

Throws:
java.io.IOException

listContents

java.lang.String[] listContents(java.lang.String binPath)
                                throws java.io.IOException
Lists the contents for the given bin node. Throws IllegalArgumentException if it's not a bin.

Throws:
java.io.IOException