|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.services.dds.toolkit.DDSServicesToolkit
public class DDSServicesToolkit
Toolkit for working with DDS repository Search and Update Web Services (DDSWS and DDSUpdateWS) for read and write operations. All methods use only local variables and are thread safe but are not synchronized. See DDSWS documentation and DDSUpdateWS documentation
Field Summary | |
---|---|
static int |
SORT_ORDER_ASCENDING
Indicates the optional sort order for search results should be ascending |
static int |
SORT_ORDER_DESCENDING
Indicates the optional sort order for search results should be descending |
static int |
SORT_ORDER_NO_SORT
Indicates no sorting should be applied to search results |
Constructor Summary | |
---|---|
DDSServicesToolkit(String ddsServicesUrl,
String clientName)
Constructor for the DDSServicesToolkit object |
Method Summary | |
---|---|
protected String[] |
checkForErrorResponseDDSUpdateWS(Document ddsupdateResponse)
Checks for the existance of an error response from a DDS update service request (DDSUpdateWS). |
protected String[] |
checkForErrorResponseDDSWS(Document ddswsResponse)
Checks for the existance of an error response from a DDS service request (DDSWS). |
DDSServicesResponse |
deleteRecord(String recordId)
Deletes a record from a DDS repository. |
protected static String |
getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout: |
String |
getIndexVersion()
Gets the index version, which can be useful to determine if a service response cache needs to be updated. |
DDSServicesResponse |
getRecord(String id,
String showRelation,
String xmlFormat,
Map additionalRequestParams,
boolean soAllRecords,
boolean localizeXml)
Performs a GetRecord request from a DDSWS repository. |
boolean |
hasCollection(String collectionKey,
String xmlFormat)
Determines whether the given collection is in this DDS repository. |
boolean |
hasRecord(String id,
String xmlFormat)
Determines whether the given record is in this DDS repository. |
DDSServicesResponse |
listCollections(boolean localizeXml)
Performs a ListCollections request from a DDSWS repository. |
DDSServicesResponse |
listFields(boolean localizeXml)
Performs a ListFields request from a DDSWS repository. |
DDSServicesResponse |
listTerms(String[] fields,
boolean localizeXml)
Performs a ListTerms request from a DDSWS repository. |
DDSServicesResponse |
putCollection(String collectionKey,
String xmlFormat,
String collectionName,
String collectionDescription)
Puts a collection into a DDS repository. |
Document |
putRecord(String recordId,
String recordXml,
String collectionKey,
String xmlFormat)
Puts a record into a DDS repository. |
DDSServicesResponse |
search(String query,
String xmlFormat,
int startOffset,
int numReturns,
String sortByField,
int sortOrder,
String showRelation,
Map additionalRequestParams,
boolean soAllRecords,
boolean localizeXml)
Performs a Search request from a DDSWS repository. |
DDSServicesResponse |
serviceInfo(boolean localizeXml)
Performs a ServiceInfo request from a DDSWS repository. |
static void |
setDebug(boolean db)
Sets the debug attribute of the object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int SORT_ORDER_ASCENDING
public static int SORT_ORDER_DESCENDING
public static int SORT_ORDER_NO_SORT
Constructor Detail |
---|
public DDSServicesToolkit(String ddsServicesUrl, String clientName)
ddsServicesUrl
- Common baseUrl for DDS services, for example http://www.dlese.org/dds/services/clientName
- The client name, or null to send noneMethod Detail |
---|
public DDSServicesResponse getRecord(String id, String showRelation, String xmlFormat, Map additionalRequestParams, boolean soAllRecords, boolean localizeXml) throws DDSServiceErrorResponseException, Exception
id
- Record IDshowRelation
- The relation data to include in the response for example
isAnnotatedBy, or null for nonexmlFormat
- The XML format to return, or null for native formatadditionalRequestParams
- A Map that contains param/value pairs. Values must be of
type String to indicate a single value, or a String [] to indicate multiple values. Map may be null
for none.soAllRecords
- True to search all records including non-discoverable ones
(client must be authorized by IP)localizeXml
- True to localize the response
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic boolean hasRecord(String id, String xmlFormat) throws DDSServiceErrorResponseException, Exception
id
- The record idxmlFormat
- The XML format to check availability for, or null for
any/all
DDSServiceErrorResponseException
- If service error
Exception
- If other errorpublic DDSServicesResponse search(String query, String xmlFormat, int startOffset, int numReturns, String sortByField, int sortOrder, String showRelation, Map additionalRequestParams, boolean soAllRecords, boolean localizeXml) throws DDSServiceErrorResponseException, Exception
query
- The search query, or nullxmlFormat
- The xmlFormat for which results must be dissiminated, or
null for any/allstartOffset
- Starting offset in the returnsnumReturns
- Number of records to returnshowRelation
- The relation data to include in the response for example
isAnnotatedBy, or null for noneadditionalRequestParams
- A Map that contains param/value pairs. Values must be of
type String to indicate a single value, or a String [] to indicate multiple values. Map may be null
for none.soAllRecords
- True to search all records including non-discoverable ones
(client must be authorized by IP)localizeXml
- True to localize the responsesortByField
- Indicates the search field to sort the results by, or null
for nonesortOrder
- The sort order to apply (ascending, descending). Ignored if
no sortByField has been indicated
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic DDSServicesResponse listCollections(boolean localizeXml) throws DDSServiceErrorResponseException, Exception
localizeXml
- True to localize the response XML
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic DDSServicesResponse serviceInfo(boolean localizeXml) throws DDSServiceErrorResponseException, Exception
localizeXml
- True to localize the response XML
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic String getIndexVersion() throws DDSServiceErrorResponseException, Exception
DDSServiceErrorResponseException
- If DDSServiceErrorResponseException error
Exception
- If exceptionpublic DDSServicesResponse listFields(boolean localizeXml) throws DDSServiceErrorResponseException, Exception
localizeXml
- True to localize the response XML
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic DDSServicesResponse listTerms(String[] fields, boolean localizeXml) throws DDSServiceErrorResponseException, Exception
fields
- One or more fields to list terms forlocalizeXml
- True to localize the response XML
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic boolean hasCollection(String collectionKey, String xmlFormat) throws DDSServiceErrorResponseException, Exception
collectionKey
- The collection key, for example 'dcc'xmlFormat
- The xml format for this collection, for example 'adn'
DDSServiceErrorResponseException
- If service error
Exception
- If other errorprotected String[] checkForErrorResponseDDSWS(Document ddswsResponse)
ddswsResponse
- The service response
public Document putRecord(String recordId, String recordXml, String collectionKey, String xmlFormat) throws DDSServiceErrorResponseException, Exception
recordId
- recordIdrecordXml
- recordXmlcollectionKey
- collectionKeyxmlFormat
- xmlFormat
Exception
- If error
DDSServiceErrorResponseException
- Standard service error if one was returnedpublic DDSServicesResponse deleteRecord(String recordId) throws DDSServiceErrorResponseException, Exception
recordId
- recordId
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occurspublic DDSServicesResponse putCollection(String collectionKey, String xmlFormat, String collectionName, String collectionDescription) throws DDSServiceErrorResponseException, Exception
collectionKey
- The collection key, for example 'dcc'xmlFormat
- The xml format, for example 'adn'collectionName
- The name of the collectioncollectionDescription
- Description of the collection
DDSServiceErrorResponseException
- Standard service error if one was returned
Exception
- If other error occursprotected String[] checkForErrorResponseDDSUpdateWS(Document ddsupdateResponse)
ddsupdateResponse
- The DDS response
protected static final String getDateStamp()
public static void setDebug(boolean db)
db
- The new debug value
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |