com.niggle.data.jndi
Class JNDIMutableDataSource
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--com.niggle.data.AbstractDataSource
|
+--com.niggle.data.AbstractMutableDataSource
|
+--com.niggle.data.jndi.JNDIMutableDataSource
- All Implemented Interfaces:
- DataChangeNotifier, DataSource, MutableDataSource, java.rmi.Remote, java.io.Serializable
- public class JNDIMutableDataSource
- extends AbstractMutableDataSource
A JNDI implementation of the com.niggle.data.MutableDataSource
interface.
- Author:
- Paul Murphy
- See Also:
- Serialized Form
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Method Summary |
void |
close()
A method that should be called to free any resources associated
with the data source. |
void |
delete(java.lang.String type,
java.lang.Object key)
Delete a record given its primary lookup key. |
void |
forceUpdate(Record rec,
Record oldRec)
Replace an existing version of a record with a new updated version. |
Record |
get(java.lang.String type,
java.lang.Object key)
|
void |
init(java.util.Properties props)
TODO |
void |
insert(Record rec)
Adds a new record to the managed pool. |
java.util.List |
keys(java.lang.String type)
|
java.util.List |
select(java.lang.String type,
RecordFilter filter)
Fetches a list of records matching filter. |
void |
update(Record record)
Replaces an existing version of a record with a new updated version. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
INITIAL_CONTEXT_FACTORY_KEY
public static final java.lang.String INITIAL_CONTEXT_FACTORY_KEY
PROVIDER_URL_KEY
public static final java.lang.String PROVIDER_URL_KEY
SEC_PRINCIPAL_KEY
public static final java.lang.String SEC_PRINCIPAL_KEY
SEC_CREDENTIALS_KEY
public static final java.lang.String SEC_CREDENTIALS_KEY
OBJECT_FACTORIES_KEY
public static final java.lang.String OBJECT_FACTORIES_KEY
INDEX_FIELD_KEY
public static final java.lang.String INDEX_FIELD_KEY
INDEX_FIELD_PREFIX_KEY
public static final java.lang.String INDEX_FIELD_PREFIX_KEY
INDEX_FIELD_SUFFIX_KEY
public static final java.lang.String INDEX_FIELD_SUFFIX_KEY
JNDIMutableDataSource
public JNDIMutableDataSource()
throws java.io.IOException
init
public void init(java.util.Properties props)
throws java.io.IOException
- Description copied from class:
AbstractMutableDataSource
- TODO
- Overrides:
init
in class AbstractMutableDataSource
close
public void close()
throws java.io.IOException
- Description copied from interface:
DataSource
- A method that should be called to free any resources associated
with the data source. Note that no other methods should be called
on this object after this one.
(In many implementations, this method will likely do nothing.)
- Overrides:
close
in class AbstractMutableDataSource
update
public void update(Record record)
throws java.io.IOException
- Description copied from interface:
MutableDataSource
- Replaces an existing version of a record with a new updated version.
Automatically replaces the previous version if it has not been
modified since the object was taken from the data source. A
ModifiedRecordException is thrown otherwise.
Not all underlying storage mediums will be able to support these
semantics. Check your implementation carefully.
- Following copied from interface:
com.niggle.data.MutableDataSource
- Parameters:
rec
- the new updated record.- Throws:
ModifiedRecordException
- thrown if the record was modified
by another process since rec was requested from a data source.java.io.IOException
- thrown in case of any other database or
communication error.
forceUpdate
public void forceUpdate(Record rec,
Record oldRec)
throws java.io.IOException
- Description copied from interface:
MutableDataSource
- Replace an existing version of a record with a new updated version.
Automatically replaces the prevous version, even if it has been
modified by another process.
The client's version of the original record is passed in order
to allow implementations to make the update as fine-grained as
possible. Some will simply update the entire records, while others
will update only modified fields.
- Overrides:
forceUpdate
in class AbstractMutableDataSource
- Following copied from interface:
com.niggle.data.MutableDataSource
- Parameters:
rec
- the new updated record.oldRec
- the client's copy of the record it removed from
the data source.- Throws:
java.io.IOException
- thrown in case of a database or communication
error. Note that ModifiedRecordException is never thrown
by this method.
insert
public void insert(Record rec)
throws java.io.IOException
- Description copied from interface:
MutableDataSource
- Adds a new record to the managed pool.
- Following copied from interface:
com.niggle.data.MutableDataSource
- Parameters:
rec
- the record to add- Throws:
DuplicateRecordException
- if another record already exists
with same primary key as 'rec'.java.io.IOException
- if the record cannot be
initialized (i.e. has missing fields or invalid
field values, etc.), or in case of a low-level error.
delete
public void delete(java.lang.String type,
java.lang.Object key)
throws java.io.IOException
- Description copied from interface:
MutableDataSource
- Delete a record given its primary lookup key.
- Following copied from interface:
com.niggle.data.MutableDataSource
- Parameters:
type
- the record type we want to delete
If this is null, we delete indistinctly with no sanity check.key
- the key to the object to delete.- Throws:
MissingRecordException
- thrown if the record to be
deleted could not be found.DataException
- thrown if the key maps to more than
one record.java.io.IOException
- thrown in case of any other database or
communication error.
get
public Record get(java.lang.String type,
java.lang.Object key)
throws java.io.IOException
- Following copied from interface:
com.niggle.data.DataSource
- Parameters:
type
- the type of the record, if this is null,
then any type will do.key
- the lookup key- Returns:
- a Record of the given type, with
the given lookup key. If the data source allows multiple records,
only returns the first one found. Use getRecords() in that situation.
returns null if none is found.
select
public java.util.List select(java.lang.String type,
RecordFilter filter)
throws java.io.IOException
- Description copied from interface:
MutableDataSource
- Fetches a list of records matching filter. If filter is null,
returns all the records in the container.
- Following copied from interface:
com.niggle.data.MutableDataSource
- Parameters:
the
- type of record we are interested in, possibly nullfilter
- the record filter, or null.- Returns:
- a List of all the records that are an instance of a
given class. If no records match the filter, an empty List.
keys
public java.util.List keys(java.lang.String type)
throws java.io.IOException
- Following copied from interface:
com.niggle.data.DataSource
- Parameters:
type
- the record type we are interested,
under some circumstances, this may be null.- Returns:
- a list of all valid lookup keys that correspond
to a given record type.