Servertec
Persistent Object Store
1.4.1 09/04/2005

stec.xpos
Class IndexedObjectStore

java.lang.Object
  extended by stec.xpos.IndexedObjectStore

public final class IndexedObjectStore
extends java.lang.Object

Contains static methods used to create, delete, open and pack indexed persistent object stores.

Indexed persistent object stores represent one or more indexes and associated persistent object store.

Operations performed on indexed persistent object stores are cascaded to associated indexes.

.ios Header

1 byte - type - the file type. Currently 0x10
2 bytes - version - the version number. Currently 0x0100 (1.0.0).
4 bytes - index_count - the number of indexes associated with the persistent object store. 1 or more.
n bytes - the utf-8 encoded filename the path and base file name of the object store.
n bytes - one or more utf-8 encoded index descriptors.

Index Descriptor

n bytes - index_name - the utf-8 encoded name of the index.
n bytes - filename - the utf-8 encoded filename the path and base file name of the index.
n bytes - indexer_class_name - the utf-8 encoded class name of the indexer.

UTF-8 Encoded String

2 byte - string_length - the length in bytes of the utf-8 encoded string.
n bytes - utf8_encoded_string - the utf-8 encoded string.

Since:
1.1.0 09/01/2002

Constructor Summary
IndexedObjectStore()
           
 
Method Summary
static void addIndex(java.lang.String filename, java.lang.String index_name, java.lang.String index_filename, java.lang.String indexer_classname)
          Adds the named Index to the specified indexed persistent object store.
static boolean containsIndex(java.lang.String filename, java.lang.String index_name)
          Returns whether the specified index is associated with the indexed object store.
static void copy(java.lang.String from_filename, java.lang.String to_filename, boolean overwrite)
          Copies the specified indexed object store
static void copy(java.lang.String from_filename, java.lang.String to_filename, boolean overwrite, boolean cascaded_copy)
          Copies the specified indexed object store.
static void create(java.lang.String filename, java.lang.String object_store_filename, IndexDescriptor[] index_descriptors, boolean overwrite)
          Used to create a new indexed persistent object store or to overwrite an existing indexed persistent object store.
static void delete(java.lang.String filename)
          Deletes the specified indexed persistent object store.
static void delete(java.lang.String filename, boolean cascaded_delete)
          Deletes the specified indexed persistent object store.
static boolean exists(java.lang.String filename)
          Returns whether the specified indexed persistent object store currently exists.
static IndexDescriptor[] getIndexDescriptors(java.lang.String filename)
          Returns an array of one or more IndexDescriptors for indexes associated with the specified indexed object store.
static java.lang.String getObjectStore(java.lang.String filename)
          Returns the path and base file name of the persistent object store associated with the specified indexed object store.
static boolean inUse(java.lang.String filename)
          Returns whether the specified indexed persistent object store is being used.
static void move(java.lang.String from_filename, java.lang.String to_filename, boolean overwrite)
          Moves the specified indexed object store.
static void move(java.lang.String from_filename, java.lang.String to_filename, boolean overwrite, boolean cascaded_move)
          Moves the specified indexed object store.
static IndexedObjectStoreReference open(java.lang.String filename, boolean exclusive)
          Opens the specified indexed persistent object store and returns a stec.xpos.IndexedObjectStoreReference to it.
static void pack(java.lang.String filename)
          Releases unused space at the end of the specified indexed persistent object store back to the operating system.
static void reindex(java.lang.String filename)
          Clears all the associated indexes and performs potentially lengthy reindex on each index for all key, value pairs in the object store associated with the specified indexed object store.
static void removeIndex(java.lang.String filename, java.lang.String index_name)
          Removes the named Index from the specified indexed persistent object store.
static void removeIndex(java.lang.String filename, java.lang.String index_name, boolean cascaded_delete)
          Removes the named Index from the specified indexed persistent object store.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexedObjectStore

public IndexedObjectStore()
Method Detail

create

public static final void create(java.lang.String filename,
                                java.lang.String object_store_filename,
                                IndexDescriptor[] index_descriptors,
                                boolean overwrite)
                         throws java.lang.IllegalArgumentException,
                                java.io.IOException
Used to create a new indexed persistent object store or to overwrite an existing indexed persistent object store.

The specified object store and indexes must already exist before this method is called.

After the .ios is created the specified indexes are cleared and a potentially lengthy reindex is performed on each index for all key, value pairs in the specified object store.

Each index specified degrades performance since update operations are cascaded to associated indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to create.
object_store_filename - the path and base file name of the persistent object store to use.
index_descriptors - an array of one or more stec.xpos.IndexDescriptors.
overwrite - whether to overwrite any existing indexed persistent object store.
Throws:
java.lang.IllegalArgumentException - if any of the parameters specified were not valid.
java.io.IOException - if the indexed object store is in use, already exists or cannot be created or if an I/O exception occurred.
See Also:
delete, delete

exists

public static final boolean exists(java.lang.String filename)
                            throws java.io.IOException
Returns whether the specified indexed persistent object store currently exists.

Also checks whether the associated object store and indexes exist.

Parameters:
filename - the path and base file name of the indexed persistent object store to test.
Returns:
whether the specified indexed persistent object store currently exists.
Throws:
java.io.IOException - if an I/O exception occurred.

delete

public static final void delete(java.lang.String filename,
                                boolean cascaded_delete)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Deletes the specified indexed persistent object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to delete.
cascaded_delete - whether to delete the associated object store and indexes.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be deleted or if an I/O exception occurred.
See Also:
create

delete

public static final void delete(java.lang.String filename)
                         throws java.io.FileNotFoundException,
                                java.io.IOException
Deletes the specified indexed persistent object store.

Also deletes the associated object store and indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to delete.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be deleted or if an I/O exception occurred.
See Also:
create

open

public static final IndexedObjectStoreReference open(java.lang.String filename,
                                                     boolean exclusive)
                                              throws java.io.FileNotFoundException,
                                                     java.io.IOException
Opens the specified indexed persistent object store and returns a stec.xpos.IndexedObjectStoreReference to it.

Also opens the associated object store and indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to open.
exclusive - whether to open the indexed persistent object store reference for exlusive use.
Returns:
the stec.xpos.IndexedObjectStoreReference to the indexed persistent object store.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is exclusively opened or cannot be opened or if an I/O exception occurred.
See Also:
IndexedObjectStoreReference, close

pack

public static final void pack(java.lang.String filename)
                       throws java.io.FileNotFoundException,
                              java.io.IOException
Releases unused space at the end of the specified indexed persistent object store back to the operating system.

Packing a large indexed persistent object store may take a long time.

Also packs the associated object store and indexes.

Java 1.2.0 or later is required to change the physical size of the object store and associated indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to pack.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be packed or if an I/O exception occurred.

inUse

public static final boolean inUse(java.lang.String filename)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException
Returns whether the specified indexed persistent object store is being used.

Also checks the associated object store and indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to test.
Returns:
whether the specified indexed persistent object store is being used.
Throws:
java.io.FileNotFoundException - if the specified indexed object store does not exist.
java.io.IOException - if an I/O exception occurred.

addIndex

public static final void addIndex(java.lang.String filename,
                                  java.lang.String index_name,
                                  java.lang.String index_filename,
                                  java.lang.String indexer_classname)
                           throws java.io.FileNotFoundException,
                                  java.io.IOException
Adds the named Index to the specified indexed persistent object store.

The specified index must already exist before this method is called.

Before the .ios is updated the specified index is cleared and a potentially lengthy reindex is performed on the index for all key, value pairs in the specified object store.

Each index added has a negative impact on performance since update operations are cascaded to associated indexes.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
index_name - the name of the index.
index_filename - the path and base file name of the index.
indexer_classname - the name of the Indexer.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be updated or if an I/O exception occurred.

removeIndex

public static final void removeIndex(java.lang.String filename,
                                     java.lang.String index_name,
                                     boolean cascaded_delete)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
Removes the named Index from the specified indexed persistent object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
index_name - the name of the index to remove.
cascaded_delete - whether to delete the index file being removed.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be updated or if an I/O exception occurred.

removeIndex

public static final void removeIndex(java.lang.String filename,
                                     java.lang.String index_name)
                              throws java.io.FileNotFoundException,
                                     java.io.IOException
Removes the named Index from the specified indexed persistent object store.

Deletes the index file being removed.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
index_name - the name of the index to remove.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be updated or if an I/O exception occurred.

containsIndex

public static final boolean containsIndex(java.lang.String filename,
                                          java.lang.String index_name)
                                   throws java.io.FileNotFoundException,
                                          java.io.IOException
Returns whether the specified index is associated with the indexed object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
index_name - the name of the index to check.
Returns:
whether the specified index is associated with the indexed object store.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if an I/O exception occurred.

reindex

public static final void reindex(java.lang.String filename)
                          throws java.io.FileNotFoundException,
                                 java.io.IOException
Clears all the associated indexes and performs potentially lengthy reindex on each index for all key, value pairs in the object store associated with the specified indexed object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if the indexed object store is in use or cannot be reindexed or if an I/O exception occurred.

getIndexDescriptors

public static final IndexDescriptor[] getIndexDescriptors(java.lang.String filename)
                                                   throws java.io.FileNotFoundException,
                                                          java.io.IOException
Returns an array of one or more IndexDescriptors for indexes associated with the specified indexed object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
Returns:
an array of IndexDescriptors.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if an I/O exception occurred.

getObjectStore

public static final java.lang.String getObjectStore(java.lang.String filename)
                                             throws java.io.FileNotFoundException,
                                                    java.io.IOException
Returns the path and base file name of the persistent object store associated with the specified indexed object store.

Parameters:
filename - the path and base file name of the indexed persistent object store to use.
Returns:
the path and base file name of the persistent object store associated with the specified indexed object store.
Throws:
java.io.FileNotFoundException - if the indexed object store does not exist.
java.io.IOException - if an I/O exception occurred.

copy

public static final void copy(java.lang.String from_filename,
                              java.lang.String to_filename,
                              boolean overwrite,
                              boolean cascaded_copy)
                       throws java.lang.IllegalArgumentException,
                              java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Copies the specified indexed object store.

Parameters:
from_filename - the path and base file name of the indexed object store to copy.
to_filename - the path and base file name of the indexed object store to copy to.
overwrite - whether to overwrite any existing indexed object store.
cascaded_copy - whether to also copy associated object store and indexes.
Throws:
java.lang.IllegalArgumentException - if any of the parameters specified were not valid.
java.io.FileNotFoundException - if the indexed object store does not exist.
java.lang.ClassNotFoundException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be found.
java.lang.IllegalAccessException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be loaded because the class is not public or is in another package.
java.lang.InstantiationException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be instantiated because it is an interface or an abstract class.
java.io.IOException - if the indexed object store is in use or cannot be copied or if an I/O exception occurred.
Since:
1.2.2 03/03/2003

copy

public static final void copy(java.lang.String from_filename,
                              java.lang.String to_filename,
                              boolean overwrite)
                       throws java.lang.IllegalArgumentException,
                              java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Copies the specified indexed object store

Does not copy associated object store and indexes.

Parameters:
from_filename - the path and base file name of the indexed object store to copy.
to_filename - the path and base file name of the indexed object store to copy to.
overwrite - whether to overwrite any existing indexed object store.
Throws:
java.lang.IllegalArgumentException - if any of the parameters specified were not valid.
java.io.FileNotFoundException - if the indexed object store does not exist.
java.lang.ClassNotFoundException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be found.
java.lang.IllegalAccessException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be loaded because the class is not public or is in another package.
java.lang.InstantiationException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be instantiated because it is an interface or an abstract class.
java.io.IOException - if the indexed object store is in use or cannot be copied or if an I/O exception occurred.
Since:
1.2.2 03/03/2003

move

public static final void move(java.lang.String from_filename,
                              java.lang.String to_filename,
                              boolean overwrite,
                              boolean cascaded_move)
                       throws java.lang.IllegalArgumentException,
                              java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Moves the specified indexed object store.

Parameters:
from_filename - the path and base file name of the indexed object store to move.
to_filename - the path and base file name of the indexed object store to move to.
overwrite - whether to overwrite any existing indexed object store.
cascaded_move - whether to also move associated obj store and indexes.
Throws:
java.lang.IllegalArgumentException - if any of the parameters specified were not valid.
java.io.FileNotFoundException - if the indexed object store does not exist.
java.lang.ClassNotFoundException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be found.
java.lang.IllegalAccessException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be loaded because the class is not public or is in another package.
java.lang.InstantiationException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be instantiated because it is an interface or an abstract class.
java.io.IOException - if the indexed object store is in use or cannot be moved or if an I/O exception occurred.
Since:
1.2.2 03/03/2003

move

public static final void move(java.lang.String from_filename,
                              java.lang.String to_filename,
                              boolean overwrite)
                       throws java.lang.IllegalArgumentException,
                              java.io.FileNotFoundException,
                              java.io.IOException,
                              java.lang.ClassNotFoundException,
                              java.lang.IllegalAccessException,
                              java.lang.InstantiationException
Moves the specified indexed object store.

Does not move associated object store and indexes.

Parameters:
from_filename - the path and base file name of the indexed object store to move.
to_filename - the path and base file name of the indexed object store to move to.
overwrite - whether to overwrite any existing indexed object store.
Throws:
java.lang.IllegalArgumentException - if any of the parameters specified were not valid.
java.io.FileNotFoundException - if the indexed object store does not exist.
java.lang.ClassNotFoundException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be found.
java.lang.IllegalAccessException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be loaded because the class is not public or is in another package.
java.lang.InstantiationException - if the key_class_name, the value_class_name, the collator_class_name or the values_collator_class_name cannot be instantiated because it is an interface or an abstract class.
java.io.IOException - if the indexed object store is in use or cannot be moved or if an I/O exception occurred.
Since:
1.2.2 03/03/2003

Servertec
Persistent Object Store
1.4.1 09/04/2005

Copyright © 2001-2005 Servertec. All rights reserved.