|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A Database represents a single relational database table along with associated indexes and other meta data. Note that a full application database will usually consist of a number of individual Database objects, since each one represents a single data table.
The interface specifies the functions a Database provides, not how it is implemented. However the Ewe library provides a Database implementation that can be implemented on any object that provides RandomAccessStream functionality (such as a RandomAccessFile). This allows a Database to be setup in memory as easily as on disk.
Databases can be fully secure using Ewe encryption or any other type of encryption.
| Field Summary | |
static String |
CreatedSortName
|
static int |
FIELD_MODIFIER_INTEGER_AUTO_INCREMENT
Used by modifyField() - this modifies and INTEGER field to be auto-incremental. |
static String |
ModifiedBySortName
|
static String |
ModifiedSortName
|
static String |
OidSortName
|
static int |
SYNC_SLOW
This is a sync option that suggests that the database use a sync model that uses less memory but may be slower. |
static int |
SYNC_STORE_CREATION_DATE
This is a sync option that tells the database to store the creation date along with every record. |
static int |
SYNC_STORE_MODIFICATION_DATE
This is a sync option that tells the database to store the modification date along with every record. |
static int |
SYNC_STORE_MODIFIED_BY
This is a sync option that tells the database to save the MODIFIED_BY data with each record. |
static String |
SyncSortName
|
| Fields inherited from interface ewe.database.DatabaseTypes |
BOOLEAN, BYTE_ARRAY, CREATED_FIELD, DATE, DATE_TIME, DECIMAL, DOUBLE, FIRST_SPECIAL_FIELD, FLAG_SYNCHRONIZED, FLAGS_FIELD, INTEGER, JAVA_OBJECT, LONG, MAX_ID, MODIFIED_BY_FIELD, MODIFIED_FIELD, NAME_FIELD, OBJECT_BYTES_FIELD, OBJECT_TEXT_FIELD, OID_FIELD, reservedFieldHeaders, reservedFieldIDs, reservedFieldNames, reservedFieldTypes, SORT_DATE_ONLY, SORT_IGNORE_CASE, SORT_TIME_ONLY, SORT_UNKNOWN_IS_GREATER_THAN_KNOWN, SORT_UNKNOWN_IS_LESS_THAN_KNOWN, STRING, TIME, TIMESTAMP |
| Method Summary | |
int |
addField(String fieldName,
int fieldType)
Add a new field. |
int |
addSort(String sortName,
int options,
int field)
Create a new sort criteria that sorts using one field only. |
int |
addSort(String sortName,
int options,
int field1,
int field2,
int field3,
int field4)
Create a new sort criteria allowing you to specify up to four fields. |
int |
addSort(String sortName,
int options,
String fieldList)
Create a new sort criteria allowing you to specify up to four fields. |
void |
addSpecialField(int fieldCode)
Use this to add one of the reserved fields (the XXXX_FIELD) values. |
void |
append(DatabaseEntry de)
Use this method in "Append" mode to add a data item to the Databse. |
void |
change()
Mark the Database as having been changed in some way. |
void |
close()
Close the database. |
void |
closeLookup()
This is used with enableLookupMode() - it tells the database that data reading is complete and the underlying file may be closed. |
int |
countDeletedEntries()
Returns the number of entries marked as deleted. |
Handle |
countEntries()
If getEntriesCount() returns -1, indicating that the number of entries is unknown, then this method will count the entries by counting each one if necessary. |
void |
delete()
Delete the database. |
boolean |
deleteMetaData(String name)
|
boolean |
deleteStream(String name)
Delete a Stream from the Database. |
boolean |
enableLookupMode()
This method tells the database that it will be used for read-only lookups and that it can close its underlying file if it wishes - and later re-open it when lookups are done without re-reading the database info. |
boolean |
enableSynchronization(Handle h,
int syncOptions)
This tells the database to include the OID_FIELD, FLAGS_FIELD, CREATED_FIELD and MODIFIED_FIELD information with each record so that it can be synchronized with a other databases. |
void |
enableSynchronization(int syncOptions)
This tells the database to include the OID_FIELD, FLAGS_FIELD, CREATED_FIELD and MODIFIED_FIELD information with each record so that it can be synchronized with a other databases. |
int[] |
ensureFields(Object objectOrClass,
String fields,
String headers)
Similar to setFields() except that no error is thrown if any fields of the same name and type already exist. |
int[] |
ensureSorts(Object objectOrClass,
String sorts)
This works the same as setSorts() except that no error is thrown if any of the sorts already exists and has the same criteria of the already declared sort. |
Iterator |
entries()
This returns an Iterator that you can use to go through the entries in the database. |
Iterator |
entries(Object searchData,
Comparer comparer)
This returns an Iterator that you can use to go through the entries in the database. |
Iterator |
entries(ObjectFinder entry)
This returns an Iterator that you can use to go through the entries in the database. |
void |
eraseDeletedEntries()
Erase all the entries marked as deleted. |
boolean |
eraseDeletedEntry(long OID)
Erase the deleted entry for the specified OID. |
long |
estimateEntriesCount()
If getEntriesCount() returns -1, indicating that the number of entries is unknown, then this method will attempt to estimate the entries count via a quick non-blocking method without resorting to counting each entry. |
int |
findField(String fieldName)
Find the FieldID of a named field. |
int[] |
findFields(String fieldNames)
Get an array of fieldIds for a comma separated list of field names. |
int[] |
findFields(String[] fieldNames)
Get an array of fieldIds for an array of field names. |
int |
findSort(String sortName)
Get the ID of a named sort criteria. |
long |
getCurrentState()
Get the current changed state of the Database. |
long[] |
getDeletedEntries()
Get an array of object IDs representing all the deleted entries. |
DatabaseEntry |
getDeletedEntry(long OID,
DatabaseEntry dest)
Get the DatabaseEntry of the deleted OID. |
long[] |
getDeletedSince(Time t)
Get all OIDs of all entries deleted since the Time t. |
FoundEntries |
getEmptyEntries()
This returns an empty FoundEntries object for this Database |
FoundEntries |
getEntries()
Deprecated. use getFoundEntries(Handle h,int sortID) with a zero sortID instead. |
FoundEntries |
getEntries(int sortID)
Deprecated. use getFoundEntries(Handle h,int sortID) instead. |
long |
getEntriesCount()
This will return the number of entries in the database if known. |
EventDispatcher |
getEventDispatcher()
Get an EventDispatcher which you can use to attach EventListeners to, for listening to the events being generated by the Database. |
String |
getFieldHeader(int fieldID)
Get the header for a specified field ID. |
String |
getFieldName(int fieldID)
Get the name for a specified field ID. |
int[] |
getFields()
Get the IDs of all the fields. |
int |
getFieldType(int fieldID)
Get the type of a field. |
Handle |
getFoundEntries(Comparer comparer)
Get all the entries in the Database sorted by the specified Comparer in a new thread. |
FoundEntries |
getFoundEntries(Handle h,
Comparer comparer)
Get all the entries in the Database sorted by the specific comparer. |
FoundEntries |
getFoundEntries(Handle h,
int sortID)
Get all the entries in the Database sorted by the specified sort ID. |
FoundEntries |
getFoundEntries(Handle h,
int sortID,
EntrySelector selector)
Get a subset of the entries in the Database sorted by the specific sort ID and which the EntrySelector considers to be equal to the searchData. |
FoundEntries |
getFoundEntries(Handle h,
int sortID,
Object primarySearchFields)
Get a subset of the entries in the Database sorted by the specific sort ID and which match the primarySearchFields data. |
FoundEntries |
getFoundEntries(Handle h,
int sortID,
ObjectFinder finder)
Get a subset of the entries in the Database sorted by the specific sort ID and which the ObjectFinder considers to be what is being looked for. |
FoundEntries |
getFoundEntries(Handle h,
String indexName)
Get all the entries in the database sorted according to the specified index. |
Handle |
getFoundEntries(int sortID)
Get all the entries in the Database sorted by the specified sort ID in a new thread. |
Handle |
getFoundEntries(int sortID,
EntrySelector selector)
Get a subset the entries in the Database sorted by the specified sort ID in a new thread. |
Handle |
getFoundEntries(int sortID,
Object primarySearchFields)
Get a subset of the entries in the Database sorted by the specific sort ID and which match the primarySearchFields data in a new thread. |
Handle |
getFoundEntries(int sortID,
ObjectFinder finder)
Get a subset of the entries in the Database sorted by the specific sort ID and which the ObjectFinder considers to be what is being looked for in a new thread. |
Handle |
getFoundEntries(String indexName)
Get all the entries in the Database sorted by the specified index in a new thread. |
int |
getIdentifier()
Get a unique identifier for this database - used for synchronizing. |
IndexEntry[] |
getIndexes()
This returns all the indexes used by the Database. |
Locale |
getLocale()
Set the locale being used with the Database. |
Object |
getMetaData(String name,
int length,
boolean mustExist)
|
Time |
getModifiedTime()
Get the time of the last modification made to the database. |
DatabaseEntry |
getNewData()
Return an empty DatabaseEntry to be used with this database. |
Object |
getNewDataObject()
Create and return a new instance of the object class assigned to the database. |
Reflect |
getObjectClass()
If setObjectClass() was used on the database to specify a Java class to be used as a data interface, then this will return a Reflect object representing that class. |
int[] |
getSortFields(int sortID)
Get the fields by which the Sort will sort. |
String |
getSortName(int sortID)
Get the name of a Sort. |
int |
getSortOptions(int sortID)
Get the options associated with the sortID. |
int[] |
getSorts()
Get the IDs of all the sorts. |
long |
getStreamLength(String name)
Returns the length of a meta-data Stream stored in the Database, or -1 if the named Stream does not exist. |
Time |
getSynchronizedTime(int remoteDatabaseID)
|
Time |
getTimeOfDeletion(long OID,
Time destination)
Return the time of deletion of the specified OID. |
boolean |
hasChangedSince(long previousState)
Return if the Database has changed since the previous state. |
boolean |
indexBy(Handle h,
Class databaseEntryComparer,
String name)
This tells the Database to keep an index using a particular Comparer class and distinct name. |
boolean |
indexBy(Handle h,
int sortID,
String name)
This tells the Database to keep an index for a particular sort ID and optional distinct name. |
void |
indexBy(int sortID)
This is a convenience method for the other indexBy method. |
boolean |
isIndexedBy(int sortID)
This returns if the Database has at least one index that uses the specified sort ID. |
boolean |
isInstanceOfDataObject(Object data)
Return if the specified object is an instance of the data transfer object assigned in setObjectClass(); |
boolean |
isOpenForReadWrite()
This should return true if the Database is open in read/write mode, or false if it is open in read-only mode. |
int |
metaDataLength(String name)
|
void |
modifyField(int fieldID,
int modifier,
Object modifierData)
Modify a field in some way. |
void |
openLookup()
This is used with enableLookupMode() - it tells the database that data is about to be read in and if the underlying file is closed - then it should be re-opened and kept open until closeLookup() is called. |
Stream |
openStreamForReading(String name)
Open a Stream into the database to read some sort of meta-data. |
Stream |
openStreamForReplacing(String name)
Open a Stream into the database to save some sort of meta-data. |
Stream |
openStreamForWriting(String name,
boolean append)
Open a Stream into the database to save some sort of meta-data. |
int[] |
overrideFields(Object objectOrClass,
String fields,
String headers)
Similar to setFields() except that no error is thrown if any fields of the same name and type already exist. |
int[] |
overrideSorts(Object objectOrClass,
String sorts)
This works the same as setSorts() except that no error is thrown if any of the sorts already exists and has the same criteria of the already declared sort, and also any old sorts of the same name will be replaced by the new sort. |
void |
readMetaData(Object metaLocation,
int metaOffset,
byte[] data,
int offset,
int length)
|
int |
readMetaDataInt(Object metaLocation,
int offset)
|
boolean |
reIndex(Handle h)
In "Append" mode, after all the data has been added, call this method to re-index the database. |
void |
removeField(int fieldID)
Remove a field. |
void |
removeSort(int sortID)
Remove a Sort. |
void |
rename(String newName)
Rename the database. |
void |
save()
Save the Database specs to permanent storage. |
void |
setDataValidator(DataValidator validator)
Set a DataValidator to validate data before it is saved in the Database. |
void |
setEncryption(DataProcessor decryptor,
DataProcessor encryptor)
Use this when the Database is initialized to set the decryptor and encryptor for the data. |
boolean |
setFieldHeader(int fieldID,
String newHeader)
Set the header for a specified field ID. |
int[] |
setFields(Object objectOrClass)
Set the fields for the Database, which must match fields in the objectOrClass transfer object. |
int[] |
setFields(Object objectOrClass,
String fields)
Set the fields for the Database, which must match fields in the objectOrClass transfer object. |
int[] |
setFields(Object objectOrClass,
String fields,
String headers)
Set the fields for the Database, which must match fields in the objectOrClassOrReflect transfer object. |
void |
setLocale(Locale locale)
Set the locale to be used with the Database. |
boolean |
setModifiedTime(Time t)
Set the time of the last modification made to the database. |
void |
setObjectClass(Object objectOrClass)
This is used to set the class of the object used for data transfer to and from the table. |
void |
setPassword(String password)
Use this when the Database is initialized to set the encryption key for the database. |
int[] |
setSorts(Object objectOrClass)
Set the sorts of the Database as specified by the object provided. |
int[] |
setSorts(Object objectOrClass,
String sorts)
Set the sorts of the Database as specified by the object provided. |
void |
setSynchronizedTime(int remoteDatabaseID,
Time syncTime)
|
int[] |
toCriteria(int sortID)
Convert the sortID to a Criteria array, used by a number of Database functions. |
boolean |
useEncryption(DataProcessor decryptor,
DataProcessor encryptor)
Use this when opening the database and accessing the data. |
boolean |
usePassword(Object key)
Use this when opening the database and accessing the data. |
void |
writeMetaData(Object metaLocation,
int metaOffset,
byte[] data,
int offset,
int length)
|
void |
writeMetaDataInt(Object metaLocation,
int offset,
int value)
|
| Methods inherited from interface ewe.data.HasProperties |
getProperties |
| Field Detail |
public static final int FIELD_MODIFIER_INTEGER_AUTO_INCREMENT
public static final int SYNC_SLOW
public static final int SYNC_STORE_CREATION_DATE
public static final int SYNC_STORE_MODIFICATION_DATE
public static final int SYNC_STORE_MODIFIED_BY
public static final String OidSortName
public static final String SyncSortName
public static final String ModifiedSortName
public static final String ModifiedBySortName
public static final String CreatedSortName
| Method Detail |
public void setEncryption(DataProcessor decryptor,
DataProcessor encryptor)
throws IOException
IOException
public void setPassword(String password)
throws IllegalArgumentException,
IOException
password - a string to be used as the password. Choose a mix of numeric and letters
for better security.
IllegalArgumentException
IOException
public boolean useEncryption(DataProcessor decryptor,
DataProcessor encryptor)
throws IOException
decryptor - The decryptor. Necessary for reading and writing if the Database is encrypted.encryptor - The encryptor. Necessary for writing only if the Database is encrypted.
IOException
public boolean usePassword(Object key)
throws IOException
IOExceptionpublic Locale getLocale()
public void setLocale(Locale locale)
public int countDeletedEntries()
throws IOException
IOException - on error.
public long[] getDeletedEntries()
throws IOException
IOException
public void eraseDeletedEntries()
throws IOException
IOException
public DatabaseEntry getDeletedEntry(long OID,
DatabaseEntry dest)
throws IOException
OID - The OID to look for.
IOException
public Time getTimeOfDeletion(long OID,
Time destination)
throws IOException
OID - The OID of the deleted entry.destination - an optional destination time. If this is null the a new Time will
be created.
IOException
public boolean eraseDeletedEntry(long OID)
throws IOException
OID - the OID of the deleted entry.
IOException
public long[] getDeletedSince(Time t)
throws IOException
IOException
public void setObjectClass(Object objectOrClass)
throws IllegalArgumentException
objectOrClass -
IllegalArgumentExceptionpublic Reflect getObjectClass()
public Object getNewDataObject()
throws IllegalStateException
IllegalStateException - if no object class is specified or the
object could not be instantiated.public boolean isInstanceOfDataObject(Object data)
data - the object to check.
public boolean isOpenForReadWrite()
public int[] setSorts(Object objectOrClass)
throws IllegalArgumentException
objectOrClass - the Class of the object or an instance of the object.
IllegalArgumentException - if a sort conflicts with an already saved sort.
public int[] setSorts(Object objectOrClass,
String sorts)
throws IllegalArgumentException
objectOrClass - the Class of the object or an instance of the object.sorts - a String specifying the sort criteria to use.
IllegalArgumentException - if a sort conflicts with an already saved sort.
public int[] ensureSorts(Object objectOrClass,
String sorts)
throws IllegalArgumentException
objectOrClass - the Class of the object or an instance of the object.sorts - a String specifying the sort criteria to use.
IllegalArgumentException
public int[] overrideSorts(Object objectOrClass,
String sorts)
throws IllegalArgumentException
objectOrClass - the Class of the object or an instance of the object.sorts - a String specifying the sort criteria to use.
IllegalArgumentException
public int[] ensureFields(Object objectOrClass,
String fields,
String headers)
throws IllegalArgumentException
objectOrClass - The object or class of the object to be used for data transfer.fields - A comma separated list of fields.headers - An optional comma separated list of headers.
IllegalArgumentException
public int[] overrideFields(Object objectOrClass,
String fields,
String headers)
throws IllegalArgumentException
objectOrClass - The object or class of the object to be used for data transfer.fields - A comma separated list of fields.headers - An optional comma separated list of headers.
IllegalArgumentException
public int[] setFields(Object objectOrClass)
throws IllegalArgumentException
objectOrClass - The object or class of the object to be used for data transfer.
IllegalArgumentException
public int[] setFields(Object objectOrClass,
String fields)
throws IllegalArgumentException
objectOrClass - The object or class of the object to be used for data transfer.fields - A comma separated list of fields.
IllegalArgumentException
public int[] setFields(Object objectOrClass,
String fields,
String headers)
throws IllegalArgumentException
objectOrClass - The object or class of the object to be used for data transfer.fields - A comma separated list of fields.headers - An optional comma separated list of headers.
IllegalArgumentExceptionpublic int findField(String fieldName)
fieldName - The name of the field.
public int[] findFields(String[] fieldNames)
public int[] findFields(String fieldNames)
public String getFieldName(int fieldID)
public String getFieldHeader(int fieldID)
public boolean setFieldHeader(int fieldID,
String newHeader)
public String getSortName(int sortID)
public int[] getSortFields(int sortID)
public int getSortOptions(int sortID)
public int[] toCriteria(int sortID)
throws IllegalArgumentException
IllegalArgumentExceptionpublic int getFieldType(int fieldID)
public int[] getFields()
public int[] getSorts()
public int addField(String fieldName,
int fieldType)
throws IllegalArgumentException
fieldName - The name of the new field.fieldType - The type of the new field.
IllegalArgumentException
public void modifyField(int fieldID,
int modifier,
Object modifierData)
throws IllegalArgumentException,
IOException
fieldID - The id of the field to modify.modifier - one of the FIELD_MODIFIER_XXX values appropriate for the field type.modifierData - Some data dependant on the field modifier used.
IllegalArgumentException - if the modifier is not appropriate for the field or
if the data is not the correct type for the modifier.
IOExceptionpublic int findSort(String sortName)
sortName - The name of the sort criteria.
public int addSort(String sortName,
int options,
int field)
throws IllegalArgumentException
IllegalArgumentException
public int addSort(String sortName,
int options,
int field1,
int field2,
int field3,
int field4)
throws IllegalArgumentException
IllegalArgumentException
public int addSort(String sortName,
int options,
String fieldList)
throws IllegalArgumentException
sortName - The name of the sort.options - Sorting options.fieldList - A comma separated field list.
IllegalArgumentException - if any of the fields could not be found, or if too many
fields are specified.public void removeField(int fieldID)
fieldID - the ID of the field to remove.public void removeSort(int sortID)
sortID - the ID of the sort to remove.public DatabaseEntry getNewData()
public void append(DatabaseEntry de)
throws IOException
IOException
public boolean reIndex(Handle h)
throws IOException
If you close the database without doing reIndex, it will be reIndexed automatically the next time it is opened.
h - a Handle that can be used to monitor or abort the operation.
IOException - if there was an error writing to the database.public FoundEntries getEmptyEntries()
public FoundEntries getEntries()
throws IOException,
DataTooBigException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
IOException
public FoundEntries getEntries(int sortID)
throws IOException,
DataTooBigException
sortID - The sortID to use. If this is 0 the entries are not sorted.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
int sortID)
throws IOException,
DataTooBigException
h - a handle that other threads can use to monitor the operation progress.sortID - The sortID to use. If this is 0 the entries are not sorted.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
int sortID,
EntrySelector selector)
throws IOException,
DataTooBigException
h - an optional Handle used to monitor and possibly abort the process.sortID - The sortID to use. If this is 0 the entries are not sorted.selector - An object used to select the data according to certain criteria.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
int sortID,
ObjectFinder finder)
throws IOException,
DataTooBigException
h - an optional Handle used to monitor and possibly abort the process.sortID - The sortID to use. If this is 0 the entries are not sorted.finder - This object will have its lookingFor(Object obj) method called for each
entry in the database. If the finder returns true, then that entry will be placed in the FoundEntries
returned.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
int sortID,
Object primarySearchFields)
throws IOException,
DataTooBigException
h - an optional Handle used to monitor and possibly abort the process.sortID - The sortID to use. If this is 0 the entries are not sorted.primarySearchFields - data that will be used to select entries in the Database.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
Comparer comparer)
throws IOException,
DataTooBigException
h - an optional Handle used to monitor and possibly abort the process.comparer - This is used to sort the entries.
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.
public FoundEntries getFoundEntries(Handle h,
String indexName)
throws IllegalArgumentException,
IOException,
DataTooBigException
h - an optional Handle used to monitor and possibly abort the process.indexName - a valid index name.
IllegalArgumentException
IOException
DataTooBigException - if the number of entries cannot fit in a FoundEntries
object. In this case the method should be called again with a finder that is more restrictive
of the included entries.public Handle getFoundEntries(int sortID)
sortID - The sortID to use. If this is 0 the entries are not sorted.
public Handle getFoundEntries(int sortID,
EntrySelector selector)
sortID - The sortID to use. If this is 0 the entries are not sorted.selector - An object used to select the data according to certain criteria.
public Handle getFoundEntries(int sortID,
ObjectFinder finder)
sortID - The sortID to use. If this is 0 the entries are not sorted.finder - This object will have its lookingFor(Object obj) method called for each
entry in the database. If the finder returns true, then that entry will be placed in the FoundEntries
returned.
public Handle getFoundEntries(int sortID,
Object primarySearchFields)
sortID - The sortID to use. If this is 0 the entries are not sorted.primarySearchFields - data that will be used to select entries in the Database.
public Handle getFoundEntries(Comparer comparer)
comparer - This is used to sort the entries.
public Handle getFoundEntries(String indexName)
indexName - a valid index name.
public void save()
throws IOException
IOException - if an error occurs.
public void close()
throws IOException
IOException - on error.
public void delete()
throws IOException
IOException - if the database could not be deleted.
public void rename(String newName)
throws IOException
newName - the new name for the database.
IOException - if the database could not be renamed.
public Time getModifiedTime()
throws IOException
IOException - on error.
public boolean setModifiedTime(Time t)
throws IOException
t - the modified time.
IOException - on error.
public void addSpecialField(int fieldCode)
throws IllegalArgumentException
IllegalArgumentException
public void enableSynchronization(int syncOptions)
throws IOException
IOException
public boolean enableSynchronization(Handle h,
int syncOptions)
throws IOException
IOException
public int getIdentifier()
throws IOException
IOException
public void setSynchronizedTime(int remoteDatabaseID,
Time syncTime)
throws IOException
IOException
public Time getSynchronizedTime(int remoteDatabaseID)
throws IOException
IOException
public long getEntriesCount()
throws IOException
IOException - on error.
public long estimateEntriesCount()
throws IOException
IOException - on error.public Handle countEntries()
public Iterator entries()
throws IOException
The getNext() method of the returned iterator may throw a DatabaseIOException if there is an IO error when retrieving the next entry.
IOException
public Iterator entries(ObjectFinder entry)
throws IOException
The getNext() method of the returned iterator may throw a DatabaseIOException if there is an IO error when retrieving the next entry.
IOException
public Iterator entries(Object searchData,
Comparer comparer)
throws IOException
The getNext() method of the returned iterator may throw a DatabaseIOException if there is an IO error when retrieving the next entry.
IOException
public boolean indexBy(Handle h,
int sortID,
String name)
throws IOException,
IllegalArgumentException
Creating a new index will usually involve sorting all the entries of the database so this may take some time to complete and you can monitor and abort the operation using the Handle parameter.
h - An optional handle that you can use to monitor and control any index creation
operation.sortID - A valid sort ID for the database.name - A distinct name for the index. If it is null then the same name as the sort ID
will be used.
IOException - If an IO error occured using the database.
IllegalArgumentException - if the sort ID is invalid.
public boolean indexBy(Handle h,
Class databaseEntryComparer,
String name)
throws IOException,
IllegalArgumentException
Creating a new index will usually involve sorting all the entries of the database so this may take some time to complete and you can monitor and abort the operation using the Handle parameter.
h - An optional handle that you can use to monitor and control any index creation
operation.databaseEntryComparer - A valid object that implements DatabaseEntryComparername - A distinct name for the index, which must not be null.
IOException - If an IO error occured using the database.
IllegalArgumentException - if the comparer or name is invalid.
public void indexBy(int sortID)
throws IOException,
IllegalArgumentException
sortID - A valid sort ID for the database.
IOException - If an IO error occured using the database.
IllegalArgumentException - if the sort ID is invalid.public boolean isIndexedBy(int sortID)
public IndexEntry[] getIndexes()
public long getCurrentState()
public boolean hasChangedSince(long previousState)
public void change()
public EventDispatcher getEventDispatcher()
public Stream openStreamForWriting(String name,
boolean append)
throws IOException
name - The name of the meta-data Stream.append - Set this true if you want to add to the data already stored in the stream.
IOException - if an error occurs.
public Stream openStreamForReplacing(String name)
throws IOException
name - The name of the meta-data Stream.
IOException - if an error occurs.
public Stream openStreamForReading(String name)
throws IOException
name - The name of the meta-data Stream.
IOException - if an error occurs or if the Stream does not exist.
public boolean deleteStream(String name)
throws IOException
name - The name of the meta-data Stream.
IOException - if an error occurs.
IOException - if an error occurs.
public long getStreamLength(String name)
throws IOException
name - the name of the Stream.
IOException - if an error occurs.public void setDataValidator(DataValidator validator)
validator - A validator or null to clear the validator.
IOException - if there was an error saving the validator.
public void readMetaData(Object metaLocation,
int metaOffset,
byte[] data,
int offset,
int length)
throws IOException
IOException
public void writeMetaData(Object metaLocation,
int metaOffset,
byte[] data,
int offset,
int length)
throws IOException
IOException
public Object getMetaData(String name,
int length,
boolean mustExist)
throws IOException,
IllegalArgumentException
IOException
IllegalArgumentException
public boolean deleteMetaData(String name)
throws IOException
IOException
public int readMetaDataInt(Object metaLocation,
int offset)
throws IOException
IOException
public void writeMetaDataInt(Object metaLocation,
int offset,
int value)
throws IOException
IOException
public int metaDataLength(String name)
throws IOException
IOException
public boolean enableLookupMode()
throws IOException
Not all Databases may support this and if it does not, it will return false - although normal database operations will not be affected. In other words - if this method returns false, the application can continue as if it returned true - but its operations will not be optimized in this way.
IOException - if an IO error occurs.
public void openLookup()
throws IOException
IOException - if an IO error occurs.
public void closeLookup()
throws IOException
IOException - if an IO error occurs.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||