org.nees.metadata.service
Class CachingNMDSFacade

java.lang.Object
  extended byorg.nees.metadata.service.NMDSCommandDispatcher
      extended byorg.nees.metadata.service.NMDSFacade
          extended byorg.nees.metadata.service.CachingNMDSFacade
All Implemented Interfaces:
Rewindable

public class CachingNMDSFacade
extends NMDSFacade

This class represents an interaction with NMDS and provides convenience API's for executing commands against the service.


Field Summary
 
Fields inherited from interface org.nees.metadata.service.Rewindable
ACCESSION_NOT_REWOUND, TIME_NOT_REWOUND
 
Constructor Summary
CachingNMDSFacade(NMDSSession s, long t)
           
 
Method Summary
 void containerAdd(Identifier id, Identifier containerId)
           
 ContainerList containerList(Identifier containerId)
           
 void containerRemove(Identifier id, Identifier containerId)
           
 MetadataObject create(MetadataObject o)
          Create an object
 MetadataObject[] create(MetadataObject[] o)
          Create a batch of objects
 MetadataObject forceRetrieve(Identifier id)
          retrieve an object
 MetadataObject[] forceRetrieve(Identifier[] ids)
          retrieve a batch of objects
 void permit(Identifier id, Identifier group, NMDSPermissions p)
          Change permissions on an object
 void permit(Identifier id, Identifier group, java.lang.String p)
          Change permissions on an object
 void permit(Identifier id, java.lang.String dn, NMDSPermissions p)
          Change permissions on an object
 void permit(Identifier id, java.lang.String dn, java.lang.String p)
          Change permissions on an object
 MetadataObject retrieve(Identifier id)
          retrieve a (possibly cached) object
 MetadataObject[] retrieve(Identifier[] ids)
          retrieve a batch of (possibly cached) objects
 void returnToCurrent()
          Return from a rewind.
 int rewindToAccessionNumber(int accNo)
          Rewind the session to a particular accession number.
 int rewindToTime(java.util.Date time)
          Rewind the session to an earlier time.
 Identifier[] searchNumeric(Identifier rid, double value)
           
 Identifier[] searchNumeric(Identifier rid, double low, double high, boolean lowInclusive, boolean highInclusive)
          Numeric search
 Identifier[] searchNumeric(Identifier rid, int value)
           
 Identifier[] searchNumeric(Identifier rid, int low, int high, boolean lowInclusive, boolean highInclusive)
           
 Identifier[] searchReference(Identifier rid, Identifier searchId)
          Exact-match string search
 Identifier[] searchString(Identifier rid, java.lang.String searchString)
          Exact-match string search
 Identifier[] searchText(Identifier rid, java.lang.String searchPattern)
          Fulltext search
 Identifier[] searchText(java.lang.String searchPattern)
           
 MetadataObjectSummary summarize(Identifier oid)
          retrieve an object summary
 MetadataObject update(MetadataObject o)
          Update an object
 
Methods inherited from class org.nees.metadata.service.NMDSFacade
executeCommand, executeCommands, getGroups, getGroups, getIds, getRewindAccessionNumber, getRewindTime, getSession, intern, intern, isRewound, joinAnd, joinOr, matchAll, matchAny, permit, permit, permit, permit, releaseSession, retrieveAllObjectsOfClass, retrieveAllObjectsOfClass, summarize
 
Methods inherited from class org.nees.metadata.service.NMDSCommandDispatcher
dispatchCommand, dispatchContainerAddCommand, dispatchContainerListCommand, dispatchContainerRemoveCommand, dispatchCreateCommand, dispatchGetGroupsCommand, dispatchInternCommand, dispatchPermitCommand, dispatchRetrieveCommand, dispatchRewindCommand, dispatchSearchNumericCommand, dispatchSearchReferenceCommand, dispatchSearchStringCommand, dispatchSearchTextCommand, dispatchSummarizeCommand, dispatchUpdateCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingNMDSFacade

public CachingNMDSFacade(NMDSSession s,
                         long t)
Method Detail

retrieve

public MetadataObject retrieve(Identifier id)
                        throws NMDSException
retrieve a (possibly cached) object

Overrides:
retrieve in class NMDSFacade
Parameters:
id - the id of the object to retrieve
Returns:
the object
Throws:
NMDSException

retrieve

public MetadataObject[] retrieve(Identifier[] ids)
                          throws NMDSUnavailableException
retrieve a batch of (possibly cached) objects

Overrides:
retrieve in class NMDSFacade
Parameters:
ids - the ids of the objects to retrieve
Returns:
each elt is either a) the object or b) null if there was an unspecified failure
Throws:
NMDSUnavailableException

summarize

public MetadataObjectSummary summarize(Identifier oid)
                                throws NMDSException
retrieve an object summary

Overrides:
summarize in class NMDSFacade
Parameters:
oid - the object to summarize
Returns:
the summary
Throws:
NMDSException

forceRetrieve

public MetadataObject forceRetrieve(Identifier id)
                             throws NMDSException
retrieve an object

Parameters:
id - the id of the object to retrieve
Returns:
the object
Throws:
NMDSException

forceRetrieve

public MetadataObject[] forceRetrieve(Identifier[] ids)
                               throws NMDSUnavailableException
retrieve a batch of objects

Parameters:
ids - the ids of the objects to retrieve
Returns:
each elt is either a) the object or b) null if there was an unspecified failure
Throws:
NMDSUnavailableException

create

public MetadataObject create(MetadataObject o)
                      throws NMDSException
Create an object

Overrides:
create in class NMDSFacade
Parameters:
o - the object to create
Returns:
the id of the new object
Throws:
NMDSException

create

public MetadataObject[] create(MetadataObject[] o)
                        throws NMDSUnavailableException
Create a batch of objects

Overrides:
create in class NMDSFacade
Parameters:
o - the object to create
Returns:
the id of the new object, or null if unspecified error
Throws:
NMDSUnavailableException

update

public MetadataObject update(MetadataObject o)
                      throws NMDSException
Update an object

Overrides:
update in class NMDSFacade
Parameters:
o - the object to update
Returns:
the version number of the new version
Throws:
NMDSException

permit

public void permit(Identifier id,
                   Identifier group,
                   NMDSPermissions p)
            throws NMDSException
Change permissions on an object

Overrides:
permit in class NMDSFacade
Parameters:
p - the permissions
id - the object
group - the group id
Throws:
NMDSException

permit

public void permit(Identifier id,
                   java.lang.String dn,
                   NMDSPermissions p)
            throws NMDSException
Change permissions on an object

Overrides:
permit in class NMDSFacade
Parameters:
p - the permissions
id - the object
dn - the user's distinguished name
Throws:
NMDSException

permit

public void permit(Identifier id,
                   Identifier group,
                   java.lang.String p)
            throws NMDSException
Change permissions on an object

Overrides:
permit in class NMDSFacade
Parameters:
p - the permission descriptor (e.g., "-r", "a-Cr");
id - the object
group - the group id
Throws:
NMDSException

permit

public void permit(Identifier id,
                   java.lang.String dn,
                   java.lang.String p)
            throws NMDSException
Change permissions on an object

Overrides:
permit in class NMDSFacade
Parameters:
p - the permission descriptor (e.g., "-r", "a-Cr");
id - the object
dn - the user's distinguished name
Throws:
NMDSException

containerAdd

public void containerAdd(Identifier id,
                         Identifier containerId)
                  throws NMDSException
Overrides:
containerAdd in class NMDSFacade
Throws:
NMDSException

containerRemove

public void containerRemove(Identifier id,
                            Identifier containerId)
                     throws NMDSException
Overrides:
containerRemove in class NMDSFacade
Throws:
NMDSException

containerList

public ContainerList containerList(Identifier containerId)
                            throws NMDSException
Overrides:
containerList in class NMDSFacade
Throws:
NMDSException

searchText

public Identifier[] searchText(Identifier rid,
                               java.lang.String searchPattern)
                        throws NMDSException
Fulltext search

Overrides:
searchText in class NMDSFacade
Throws:
NMDSException

searchText

public Identifier[] searchText(java.lang.String searchPattern)
                        throws NMDSException
Overrides:
searchText in class NMDSFacade
Throws:
NMDSException

searchString

public Identifier[] searchString(Identifier rid,
                                 java.lang.String searchString)
                          throws NMDSException
Exact-match string search

Overrides:
searchString in class NMDSFacade
Throws:
NMDSException

searchReference

public Identifier[] searchReference(Identifier rid,
                                    Identifier searchId)
                             throws NMDSException
Exact-match string search

Overrides:
searchReference in class NMDSFacade
Throws:
NMDSException

searchNumeric

public Identifier[] searchNumeric(Identifier rid,
                                  double low,
                                  double high,
                                  boolean lowInclusive,
                                  boolean highInclusive)
                           throws NMDSException
Numeric search

Overrides:
searchNumeric in class NMDSFacade
Throws:
NMDSException

searchNumeric

public Identifier[] searchNumeric(Identifier rid,
                                  int low,
                                  int high,
                                  boolean lowInclusive,
                                  boolean highInclusive)
                           throws NMDSException
Overrides:
searchNumeric in class NMDSFacade
Throws:
NMDSException

searchNumeric

public Identifier[] searchNumeric(Identifier rid,
                                  double value)
                           throws NMDSException
Overrides:
searchNumeric in class NMDSFacade
Throws:
NMDSException

searchNumeric

public Identifier[] searchNumeric(Identifier rid,
                                  int value)
                           throws NMDSException
Overrides:
searchNumeric in class NMDSFacade
Throws:
NMDSException

rewindToTime

public int rewindToTime(java.util.Date time)
                 throws NMDSException
Rewind the session to an earlier time. This determines the greatest accession number whose timestamp is <= the given time, and rewinds to that accession number. This can also be accomplished using NMDSRewindCommand.

Specified by:
rewindToTime in interface Rewindable
Overrides:
rewindToTime in class NMDSFacade
Parameters:
time - the time to rewind to.
Returns:
the accession number rewound to.
Throws:
NMDSException

rewindToAccessionNumber

public int rewindToAccessionNumber(int accNo)
                            throws NMDSException
Rewind the session to a particular accession number.

Specified by:
rewindToAccessionNumber in interface Rewindable
Overrides:
rewindToAccessionNumber in class NMDSFacade
Parameters:
accNo - the accession number to rewind to.
Returns:
the accession number rewound to.
Throws:
NMDSException

returnToCurrent

public void returnToCurrent()
                     throws NMDSException
Return from a rewind. Can also be accomplished using NMDSRewindCommand

Specified by:
returnToCurrent in interface Rewindable
Overrides:
returnToCurrent in class NMDSFacade
Throws:
NMDSException