Package net.ontopia.infoset.content
Class FileContentStore
java.lang.Object
net.ontopia.infoset.content.FileContentStore
- All Implemented Interfaces:
ContentStoreIF
INTERNAL: A content store implementation based on the file system.
It uses a two-level structure where inside the root directory is a
set of directories, each of which contains a fixed number of files
(N). A key is mapped to a file name (key modulo N) and a directory
name (key divided by N). The next free key is stored in a file in
the top directory, and keys are allocated in blocks.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintadd(InputStream data, int length) INTERNAL: Creates an entry for the specified data value.intadd(ContentInputStream data) INTERNAL: Creates an entry for the specified data value.voidclose()INTERNAL: Closes the content store.booleancontainsKey(int key) INTERNAL: Returns true if the content store contains an entry with the specified key.get(int key) INTERNAL: Gets the data value associated with the specified key.booleanremove(int key) INTERNAL: Removes the entry associated with the key.
-
Field Details
-
FILES_PER_DIRECTORY
public static final int FILES_PER_DIRECTORY- See Also:
-
KEY_BLOCK_SIZE
public static final int KEY_BLOCK_SIZE- See Also:
-
MAX_SPINS
public static final int MAX_SPINS- See Also:
-
SPIN_TIMEOUT
public static final int SPIN_TIMEOUT- See Also:
-
-
Constructor Details
-
FileContentStore
- Throws:
ContentStoreException
-
-
Method Details
-
containsKey
Description copied from interface:ContentStoreIFINTERNAL: Returns true if the content store contains an entry with the specified key.- Specified by:
containsKeyin interfaceContentStoreIF- Throws:
ContentStoreException
-
get
Description copied from interface:ContentStoreIFINTERNAL: Gets the data value associated with the specified key.- Specified by:
getin interfaceContentStoreIF- Throws:
ContentStoreException
-
add
Description copied from interface:ContentStoreIFINTERNAL: Creates an entry for the specified data value.- Specified by:
addin interfaceContentStoreIF- Throws:
ContentStoreException
-
add
Description copied from interface:ContentStoreIFINTERNAL: Creates an entry for the specified data value.- Specified by:
addin interfaceContentStoreIF- Throws:
ContentStoreException
-
remove
Description copied from interface:ContentStoreIFINTERNAL: Removes the entry associated with the key. If the key is not present the call has no effect.- Specified by:
removein interfaceContentStoreIF- Returns:
- true if the key was present; false otherwise
- Throws:
ContentStoreException
-
close
Description copied from interface:ContentStoreIFINTERNAL: Closes the content store. This allows all internal resources to be released.- Specified by:
closein interfaceContentStoreIF- Throws:
ContentStoreException
-