Package org.dlese.dpc.repository
Class RepositoryManager
java.lang.Object
org.dlese.dpc.repository.RepositoryManager
Manages a repository of metadata files for use in discovery, cataloging, OAI and other applications.
Provides and maintains a Lucene index of the metadata, with support for multiple collections and metadata
formats.
- Version:
- $Id: RepositoryManager.java,v 1.187.2.1 2012/02/15 23:28:03 jweather Exp $
- Author:
- John Weatherley
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSpecifies in thesetFileIndexingPlugin(String xmlFormat, FileIndexingPlugin plugin)method that the given plugin should be used when indexing all XML formats. -
Constructor Summary
ConstructorsConstructorDescriptionRepositoryManager(File repositoryConfigDir, File itemIndexerConfigDir, String repositoryDataDir, String indexLocation, String indexingStartTime, String indexingDaysOfWeek, RecordDataService recordDataService, boolean removeDocs, boolean reindexAllFiles) Constructor for the RepositoryManager.RepositoryManager(File repositoryConfigDir, String repositoryDataDir, int updateFrequency, int maxFilesToIndex, boolean removeDocs) Constructor for the RepositoryManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdminEmail(String email) Add the given admin e-mail to the repository.voidaddCompression(String value) Adds a feature to the Compression attribute of the RepositoryManager object.voidaddDescription(String value) Adds a feature to the Description attribute of the RepositoryManager objectvoidaddSetInfo(SetInfo setInfo) Adds a new set of files to the repository configuration, but does not index them.booleancanDisseminateFormat(String format) Determines whether this repository can disseminate the given format.booleandeleteCollection(String collectionKey) Delete a collection and all its records from the repository.voidDeletes the repository index and re-initializes a new, empty one in its place.booleandeleteRecord(String id) Deletes a record from the repository if one exists with the given ID.voiddestroy()Tear down and clean up by gracefully stopping threads.voiddisableSet(String setUid) Disabled the given set of files from discovery.voidEnables the given set of files for discovery.final StringBoost items in the DRC absolutely.getAdminEmail(int i) Gets the adminEmail attribute of the RepositoryManager objectGets the adminEmails attribute of the RepositoryManager objectGets the ResultDocs for all records in the index, excluding records with errors, or null if none exist.final HashtableGets all possible metadata formats that may be disiminated by this RepositoryManager.Gets all possible metadata formats that are available for a given ID.Gets all possible metadata formats that may be disiminated by this RepositoryManager.Gets all possible metadata formats that are available for a given ID.Gets the boosting values for fields used to boost search results.Gets the path for the directory of collect-level records this RepositoryManager is using, or empty string if none is configured.Gets the compressions attribute of the RepositoryManager object.Gets the directory where the RepositoryManager config files reside.Gets a List of native file format Strings that are currently configured in this repository.Gets a HashMap of SetInfos (directories of files) that are currently configured in this repository keyed by their set spec, for example dcc.Gets a List of file set key Strings such as 'dcc' or 'comet' that are currently configured in this repository.final StringgetConvertableFormatsQuery(String toFormat) Gets a query that limits a search to only those xml formats that can be converted to the format indicated.protected static final StringReturn a string for the current time and date, sutiable for display in log files and output to standout:String[]Gets the names of the fields that are serched for terms that match a users query.final ResultDocListGets the ResultDocs for all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.final org.apache.lucene.search.QueryGets a Query that will return all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.Gets the OAI-PMH deletedRecord support, which depends on whether deleted records are removed from the repository index or kept as status deleted.getDescription(int i) Gets the description attribute of the RepositoryManager objectGets the descriptions availalable for this repository.Gets the configured file sets that are currently disabled in this repository.Gets the configured sets that are currently disabled in this repository.org.apache.lucene.search.QueryGets a Lucene Query for all disabled sets, or null if none.final StringGets the query string used to limit searches to only those ADN items-level records that should be displayed in discovery.final org.apache.lucene.search.QueryGets the query string used to limit searches to only those records, of any format (item, collection, anno, etc.), that should be accessable for OAI including 'enabled' deleted records.final StringGets the query string used to limit searches to only those records, of any format (item, collection, anno, etc.), that should be accessable in discovery or via the web service.Gets the boosting factor used to rank items in the DRC.final StringBoost items in the DRC.Gets the earliestDatestamp attribute of the RepositoryManager objectGets the configured sets (directories of files) that are currently enabled in this repository.Gets the configured sets that are currently enabled in this repository.final StringGets the configured sets that are currently enabled in this repository as a String suitable for use in s Lucene query, or an empty string if no sets are enabled.Get an example ID that might be disiminated from this repository.org.apache.lucene.search.QuerygetExpandedSearchQuery(String queryString) Gets a Query for the given Lucene query String that is expanded using the default search fields, boosting fields and virtual search field mappings that are configured in this RepositoryManager.String[]Gets the names of the index fields that are used to boost records that match a users query.Gets the fileIndexingService attribute.Gets all formats that can be converted to the given Format.getFormatsThatCanBeConvertedToFormats(String[] formats) Gets all formats that can be converted to the given Formats.Gets the granularity attribute of the RepositoryManager object.Gets the harvesterStatus attribute of the RepositoryManager objectbooleangetHasOaiSetConfigured(String setSpec) Determines whether the given OAI set is configured in this repository.booleanDetermines whether one or more OAI sets are configured for this repository.Gets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of duplicates.getIndex()Gets the index attribute of the RepositoryManager objectGets a list of all accession statusus in the index.Gets all formats that exist natively in the index.Gets a list of all ID mapper errors that have been indexed.Gets the sets that are in the index.int[]Gets the days of the week the indexer will run as an array of Calendar.DAY_OF_WEEK fields, or null to indicate all days of the week.Gets the ResultDocs for those records that had errors and could not be indexed, or null if none exist.Gets the indexingMessages attribute of the RepositoryManager objectGets the date the indexer scheduled to start.longGets the version number of the last time the repository index was modified by adding, deleting or changing an item.booleanGets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository.Get the directory where the repository ItemIndexer configs are located.Gets the OAI sets configuration XML for this repository, used to generate the ListSets OAI response.getMetadataNamespace(String metadataPrefix) Gets the metadata namespace for the given metadataPrefix (XML format).Gets a Map of metadata namespaces for all metadataPrefixes (XML formats) in the repository, or null if none exist.Gets the path for the directory of metadata records this RepositoryManager is using, or empty string if none is configured.getMetadataSchemaURL(String metadataPrefix) Gets the metadata schema URL for the given metadataPrefix (XML format).Gets a Map of metadata schema URLs for all metadataPrefixes (XML formats) in the repository, or null if none exist.Gets the metadataVocabAudienceDefault attribute of the RepositoryManager objectGets the metadataVocabLanguageDefault attribute of the RepositoryManager objectGets the boosting factor used to rank resources that are referenced by more than one record.final StringBoost items that have multiple records associated with them.intGets the total number of OAI status deleted records.intGets the total number of all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.intgetNumDeletedRecordsInSet(String setSpec) Gets the number of deleted records that are in the given OAI, or -1 if no such set is configured.final intGets the number of descrete ADN item-level resources that have been indexed and are currently discoverable.final intGets the number of descrete resources of any format (adn, dlese_anno, news_opps, etc) that have been indexed and are currently discoverable.Gets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.intGets the number of records that had indexing errors.intGets the total number of records that are not OAI status deleted.intGets the number of records in the index, excluding records with errors.intgetNumRecordsInSet(String setSpec) Gets the number of records that are in the given OAI set excluding deletions, or -1 if no such set is configured.Gets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.Gets the OAI Identifier Format's scheme and namespace-identifier prefix, for example 'oai:dlese.org:'.getOaiQueryResults(String format, String set, String from, String until) Gets the results from a standard OAI-PMH ListIdentifiers or ListRecords query or an ODL search request.org.apache.lucene.search.QuerygetOaiSetQuery(String setSpec) Gets the Lucene Query for the given setSpec, or null if none exists.String[]Gets the OAI sets configured in this repository.Gets the OAI sets associated with this record ID as a List of Strings, for example 'mySet' or null.Gets the results of an OAI-PMH ListRecords or ListIdentifiers request or an OLD search.Gets the protocolVersion attribute of the RepositoryManager objectGets the Base URL that refers to the current OAI provider, for example "http://host:8080/my_oai_context/provider".Gets the status of the OAI data provider.Gets a single record from the repository by ID.Gets the recordDataService attribute of the RepositoryManager objectgetRecordOai(String id) Gets a single record from the repository by ID, restricted to those records that are avaiable/discoverable for OAI.Gets the removeInvalidRecords attribute, which is true|false.Get the directory where the repository persistent data and certain configs resides, including the collections configs, specified by the init param repositoryData.Gets the repositoryIdentifier for this provider, for example 'dlese.org'.Gets the repositoryName attribute of the RepositoryManager objectgetSetInfo(int i) Gets the SetInfo (directory of files) at the give index, suitable for reading but not modifying.getSetInfo(String key) Gets the SetInfo (directory of files) by the given set key, for example 'dcc'.getSetInfoCopy(int i) Gets the setInfo at the give index, safe for modifying.Gets the SetInfos (directories of files) that are currently configured in the repository.Gets a copy of the SetInfos (directories of files) that are currently configured in the repository.Gets the SetInfos (directories of files) that are currently configured in the repository as a HashMap keyed by setInfo.directory().Gets a list of all search keys used to search for sets.longGets the time the sets configuation status was last modified (enabled, disabled, added, deleted).Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.Deprecated.As of 12/2004, boosting behavior is controlled by properties set in the RepositoryManager config.Gets a Comma-separated String of IP address regular expressions that are trusted for access to non-discoverable items through the web service.String[]Gets an array of IP address regular expressions that are trusted for access to non-discoverable items through the web service.intGets the interval by which the index is updated to check for changes in the meatdata files, in minutes.Gets the getValidateRecords attribute, which is true|false.Gets the VirtualSearchFieldMapper that defines the virtual field/term definitions for this RepositoryManager.Gets the XMLConversionService used by this RepositoryManager, or null if none available.final booleanindexCollection(String set, FileIndexingObserver observer, boolean indexAll) Instructs the repository to index all of the files for the given set/collection.final voidindexFiles(FileIndexingObserver observer, boolean indexAll) Instructs the repository to index all of it's files.intinit(boolean indexCollectionRecords) Init method initializes the data for serving.booleanisDirectoryConfigured(File sourceDirectory) Determines whether the given directory is configured in the repository.booleanDetermines whether the given ID is in the repository.booleanDetermins whether indexing is in progress.booleanisSetConfigured(String set) Determines whether the given set is currently configured in this repository.booleanisSetDisabled(String set) Determines whether the given set is currently disabled in this repository.booleanisSetEnabled(String set) Determines whether the given set is currently enabled in this repository.booleanisSetInIndex(String set) Determines whether the given set is in the repository index.booleanDeprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.voidloadCollectionRecords(boolean indexCollectionRecs) Loads the collections found in the collection-level records.voidLoads the OAI sets configuration from file and configures the corresponding set mappings in this repository.protected final voidOutput a line of text to standard out, with datestamp, if debug is set to true.protected final voidOutput a line of text to error out, with datestamp.putCollection(String collectionKey, String xmlFormat, String title, String description, String additionalMetadata) Put a collection in the repository.Puts a record into the repository, replacing the existing record if one exists.putRecord(String recordXml, String xmlFormat, String collection, String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile) Puts a record into the repository, replacing the existing record if one exists.reindexRecord(String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile, boolean indexRelations) Reindexes an existing record in the repository, updating any related data from outside of the record XML such as annotations or data from a FileIndexingPlugin, replacing the existing index entry.voidInstructs the RepositoryManager to re-read and re-load the values found in it's configuration files.voidremoveAdminEmail(int i) Removes the given admin e-mail at the given ArrayList index from the repository.voidremoveAdminEmail(String email) Removes the given admin e-mail from the repository.voidremoveCompression(int i) Removes the given compression item.voidremoveCompression(String value) Removes the given compression value.voidremoveDescription(int i) Remove the given descrtiption item from the repository.voidremoveDescription(String value) Remove the given desctiption from the repository.booleanremoveMetadataNamespace(String metadataPrefix) Removes the metadata namespace for the given metadataPrefix (XML format).booleanremoveMetadataSchemaURL(String metadataPrefix) Removes the metadata schema URL for the given metadataPrefix (XML format).booleanremoveOAISetSpecDefinition(String setSpec) Removes the given OAI set definition from repository configuration.removeSetBySetSpec(String setSpec) Removes the cofiguration (SetInfo) for the given set of files from the repository and deletes the index entries for that set of files.voidremoveSetInfo(int i) Removes the given set of files form the repository.voidremoveSetInfo(SetInfo setInfo) Remove the given set of files from the repository.voidreplaceAdminEmail(int index, String email) Add the given admin e-mail to the repository.voidreplaceDescription(int index, String value) Add the given admin Description to the repository.voidreplaceSetInfo(int i, SetInfo newSetInfo) Replace a given SetInfo object with a new one, updating the index as appropriate.voidreplaceSetInfo(String key, SetInfo newSetInfo) Replace a given SetInfo object with a new one, updating the index as appropriate.voidResets the boosting factors to the default values.voidsetAdditionalIndices(Hashtable additionalIndexers) static voidsetDebug(boolean db) Sets the debug attribute of the objectvoidSets the default schema and namespace for the given XML format, used in the OAI ListMetadataFormats response.voidsetDrcBoostFactor(double boostFactor) Sets the boosting factor used to rank items in the DRC.voidsetDupItemsIndex(SimpleLuceneIndex dupItemsIndex) Sets the de-duping index to use.final voidsetFileIndexingPlugin(String xmlFormat, FileIndexingPlugin plugin) Sets the fileIndexingPlugin that will be used during indexing.voidsetGranularity(String value) Sets the granularity attribute of the RepositoryManager object.voidsetHarvesterStatus(String value) Sets the harvesterStatus attribute of the RepositoryManager objectvoidsetIdMapperExclusionFilePath(String filePath) Sets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of duplicates.voidsetIsOaiPmhEnabled(boolean isEnabled) Sets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository.booleansetMetadataNamespace(String metadataPrefix, String metadataNamespace) Sets the metadata namespace for the given metadataPrefix (XML format).booleansetMetadataSchemaURL(String metadataPrefix, String metadataSchema) Sets the metadata schema URL for the given metadataPrefix (XML format).voidsetMetadataVocabAudienceDefault(String audience) Sets the metadataVocabAudienceDefault attribute of the RepositoryManager objectvoidsetMetadataVocabLanguageDefault(String language) Sets the metadataVocabLanguageDefault attribute of the RepositoryManager objectvoidsetMultiDocBoostFactor(double boostFactor) Sets the boosting factor used to rank resources that are referenced by more than one record.voidsetNumIdentifiersResults(String value) Sets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.voidsetNumRecordsResults(String value) Sets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.voidsetOaiFilterQuery(String luceneQuery) Sets a Lucene query that filters the records served by the OAI data provider.voidsetOAISetSpecDefinition(SetDefinitionsForm setDefinitionsForm) Sets the definition for a given OAI set, initializing it in the repository and writing the ListSets config XML to persistent file.voidsetProviderBaseUrlEnding(String baseUrlEnding) Sets the end portion of the OAI baseURL that is being used, for example 'provider'.voidsetProviderStatus(String value) Sets the status of the OAI data provider.final voidsetRecordsLocation(String collectionRecordsLocation, String metadataRecordsLocation) Sets the absolute path to the collectionRecordsLocation and the metadataRecordsLocation.voidsetRemoveInvalidRecords(String value) Sets the removeInvalidRecords attribute.voidsetRepositoryIdentifier(String value) Sets the oaiIdentifier attribute of the RepositoryManager objectvoidsetRepositoryName(String value) Sets the repositoryName attribute of the RepositoryManager objectvoidsetServerUrl(String serverUrl) Sets the serverUrl (scheme, hostname and port) displayed in the OAI data provider baseUrl and elsewhere.voidsetStemmingBoostFactor(double boostFactor) Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.voidsetStemmingEnabled(boolean stemmingEnabled) Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.voidsetTitleBoostFactor(double boostFactor) Deprecated.As of 12/2004, boosting behavior is controlled by properties set in the RepositoryManager config.voidsetTrustedWsIps(String value) Sets the trustedWsIps attribute of the RepositoryManager, which should contain a comma-separated list of IP addresses for IPs that may access non-discoverable items through the web service.voidsetValidateRecords(String value) Sets the setValidateRecords attribute.voidSets the XMLConversionService used by this RepositoryManager and puts it into the index as an attribute under the key xmlConversionService for use in the XMLDocReaders.voidInstructs the indexer to stop indexing wherever its at in the process.voidupdateVocab(MetadataVocab newVocab) Update the current MetadataVocab with a new one.
-
Field Details
-
PLUGIN_ALL_FORMATS
Specifies in thesetFileIndexingPlugin(String xmlFormat, FileIndexingPlugin plugin)method that the given plugin should be used when indexing all XML formats.- See Also:
-
-
Constructor Details
-
RepositoryManager
public RepositoryManager(File repositoryConfigDir, String repositoryDataDir, int updateFrequency, int maxFilesToIndex, boolean removeDocs) Constructor for the RepositoryManager. Known uses: OAIProviderServlet.- Parameters:
repositoryConfigDir- The directory where config files reside (default search/boosting fields, other config)repositoryDataDir- The directory where the repository data and certain configs resides.updateFrequency- How often to update the index, in minutes.maxFilesToIndex- Max files to index per block.removeDocs- True to remove documents completely from the index, false to keep the documents in the index but marked as deleted.
-
RepositoryManager
public RepositoryManager(File repositoryConfigDir, File itemIndexerConfigDir, String repositoryDataDir, String indexLocation, String indexingStartTime, String indexingDaysOfWeek, RecordDataService recordDataService, boolean removeDocs, boolean reindexAllFiles) Constructor for the RepositoryManager. Known uses: DDSServlet.- Parameters:
repositoryConfigDir- The directory where config files reside (default search/boosting fields, other config)itemIndexerConfigDir- The directory where ItemIndexer configs are locatedrepositoryDataDir- Directory where admin data is stored.indexLocation- Directory where index is stored.indexingStartTime- The time of day to start the indexer, in H:mm, for example 0:11 or 23:11.indexingDaysOfWeek- The days of week to run the indexer as a comma separated list of integers, for example 1,3,5 where 1=Sunday, 2=Monday, 7=Saturday etc. or null for all days.recordDataService- The RecordDataService to use, or null if none is needed.removeDocs- True to remove documents completely from the index, false to keep the documents in the index but marked as deleted.reindexAllFiles- True to instruct the indexer to delete and reindex each file during each indexing pass, false to only reindex those files whoes mod time have changed (more efficient).
-
-
Method Details
-
setAdditionalIndices
-
init
public int init(boolean indexCollectionRecords) Init method initializes the data for serving.- Parameters:
indexCollectionRecords- True to index the collections records when called- Returns:
- 1 iff successful.
-
destroy
public void destroy()Tear down and clean up by gracefully stopping threads. -
getIndex
Gets the index attribute of the RepositoryManager object- Returns:
- The index value
-
deleteIndex
public void deleteIndex()Deletes the repository index and re-initializes a new, empty one in its place. -
stopIndexing
public void stopIndexing()Instructs the indexer to stop indexing wherever its at in the process. This method may take several seconds to return. -
isIndexing
public boolean isIndexing()Determins whether indexing is in progress.- Returns:
- True if indexing is in progress, false if not
-
setDupItemsIndex
Sets the de-duping index to use.- Parameters:
dupItemsIndex- The new dupItemsIndex value
-
getIndexLastModifiedCount
public long getIndexLastModifiedCount()Gets the version number of the last time the repository index was modified by adding, deleting or changing an item. The version number counts the number of times the index was modified.- Returns:
- The indexLastModifiedCount value
-
getSetStatusModifiedTime
public long getSetStatusModifiedTime()Gets the time the sets configuation status was last modified (enabled, disabled, added, deleted).- Returns:
- The setStatusModifiedTime value
-
getIndexingMessages
Gets the indexingMessages attribute of the RepositoryManager object- Returns:
- The indexingMessages value
-
getConfigDir
Gets the directory where the RepositoryManager config files reside.- Returns:
- The configDir value
-
getIdMapperExclusionFilePath
Gets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of duplicates.- Returns:
- The idMapperExclusionFilePath, or null if none used
-
setIdMapperExclusionFilePath
Sets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of duplicates. Set to null to use none- Parameters:
filePath- The new idMapperExclusionFilePath value, or null to specify none
-
getUpdateFrequency
public int getUpdateFrequency()Gets the interval by which the index is updated to check for changes in the meatdata files, in minutes. A value of 0 indicates the index is not updated automatically.- Returns:
- The updateFrequency in minutes.
-
getIndexingStartTime
Gets the date the indexer scheduled to start.- Returns:
- The the date the indexer scheduled to start, or null if not available.
-
getIndexingDaysOfWeek
public int[] getIndexingDaysOfWeek()Gets the days of the week the indexer will run as an array of Calendar.DAY_OF_WEEK fields, or null to indicate all days of the week.- Returns:
- The indexingDaysOfWeek or null for all days
-
updateVocab
Update the current MetadataVocab with a new one.- Parameters:
newVocab- The new MetadataVocab object.
-
setMetadataVocabAudienceDefault
Sets the metadataVocabAudienceDefault attribute of the RepositoryManager object- Parameters:
audience- The new metadataVocabAudienceDefault value
-
getMetadataVocabAudienceDefault
Gets the metadataVocabAudienceDefault attribute of the RepositoryManager object- Returns:
- The metadataVocabAudienceDefault value
-
setMetadataVocabLanguageDefault
Sets the metadataVocabLanguageDefault attribute of the RepositoryManager object- Parameters:
language- The new metadataVocabLanguageDefault value
-
getMetadataVocabLanguageDefault
Gets the metadataVocabLanguageDefault attribute of the RepositoryManager object- Returns:
- The metadataVocabLanguageDefault value
-
getFileIndexingService
Gets the fileIndexingService attribute.- Returns:
- The fileIndexingService.
-
getNumIdentifiersResults
Gets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.- Returns:
- The numIdentifiersResults value
-
setNumIdentifiersResults
Sets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.- Parameters:
value- The new numIdentifiersResults value
-
getRemoveInvalidRecords
Gets the removeInvalidRecords attribute, which is true|false.- Returns:
- true|false or null if not found.
-
setRemoveInvalidRecords
Sets the removeInvalidRecords attribute. The input must be "true" or "false".- Parameters:
value- The String "true" or "false".
-
getValidateRecords
Gets the getValidateRecords attribute, which is true|false.- Returns:
- true|false or null if not found.
-
setValidateRecords
Sets the setValidateRecords attribute. The input must be "true" or "false".- Parameters:
value- The String "true" or "false".
-
getNumRecordsResults
Gets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.- Returns:
- The numRecordsResults value
-
setNumRecordsResults
Sets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.- Parameters:
value- The new numRecordsResults value
-
getExampleID
Get an example ID that might be disiminated from this repository.- Returns:
- An example ID from this repository.
-
getProviderStatus
Gets the status of the OAI data provider.- Returns:
- The providerStatus value [ENABLED or DISABLED]
-
setProviderStatus
Sets the status of the OAI data provider.- Parameters:
value- The new providerStatus value [ENABLED or DISABLED]- Throws:
Exception- NOT YET DOCUMENTED
-
getHarvesterStatus
Gets the harvesterStatus attribute of the RepositoryManager object- Returns:
- The harvesterStatus value [ENABLED or DISABLED]
-
setHarvesterStatus
Sets the harvesterStatus attribute of the RepositoryManager object- Parameters:
value- The new harvesterStatus value [ENABLED or DISABLED]
-
getRepositoryIdentifier
Gets the repositoryIdentifier for this provider, for example 'dlese.org'. This equates to the namespace-identifier portion of the OAI Identifier Format. An example namespace-identifier is 'dlese.org'. See OAI Identifier Format for information.- Returns:
- The repositoryIdentifier, which is the namespace-identifier portion of the OAI identifier format.
-
getOaiIdPrefix
Gets the OAI Identifier Format's scheme and namespace-identifier prefix, for example 'oai:dlese.org:'. This prefix should be appended to the beginning of the local-identifier to create the fully-qualified OAI Identifier for a given item in the repository. See OAI Identifier Format for information.- Returns:
- The OAI Identifier Format's scheme and namespace-identifier prefix, for example 'oai:dlese.org:'.
-
setRepositoryIdentifier
Sets the oaiIdentifier attribute of the RepositoryManager object- Parameters:
value- The new oaiIdentifier value
-
getProtocolVersion
Gets the protocolVersion attribute of the RepositoryManager object- Returns:
- The protocolVersion value
-
getRepositoryName
Gets the repositoryName attribute of the RepositoryManager object- Returns:
- The repositoryName value
-
setRepositoryName
Sets the repositoryName attribute of the RepositoryManager object- Parameters:
value- The new repositoryName value
-
getEarliestDatestamp
Gets the earliestDatestamp attribute of the RepositoryManager object- Returns:
- The earliestDatestamp value
-
getDeletedRecord
Gets the OAI-PMH deletedRecord support, which depends on whether deleted records are removed from the repository index or kept as status deleted. Valid responses include "no" (deletions not keept or advertised) or "transient" (deletions are kept and advertised, unless the repository index is reset).- Returns:
- The String "no" or "transient"
-
getGranularity
Gets the granularity attribute of the RepositoryManager object. Legitimate values are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ with meanings as defined in ISO8601.- Returns:
- The granularity value
-
setGranularity
Sets the granularity attribute of the RepositoryManager object. Legitimate values are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ with meanings as defined in ISO8601.- Parameters:
value- The new granularity value
-
setProviderBaseUrlEnding
Sets the end portion of the OAI baseURL that is being used, for example 'provider'.- Parameters:
baseUrlEnding- The new providerBaseUrlEnding value
-
setServerUrl
Sets the serverUrl (scheme, hostname and port) displayed in the OAI data provider baseUrl and elsewhere. Example values: 'http://www.example.com' or 'http://www.example.com:8080'. If set to null (default), then the scheme, hostname and port number will be determined automatically by examining the URL that was requested by the client.- Parameters:
serverUrl- The new serverUrl value
-
getProviderBaseUrl
Gets the Base URL that refers to the current OAI provider, for example "http://host:8080/my_oai_context/provider".- Parameters:
req- The request.- Returns:
- The providerBaseUrl value.
-
getCompressions
Gets the compressions attribute of the RepositoryManager object.- Returns:
- The compressions value
-
addCompression
Adds a feature to the Compression attribute of the RepositoryManager object. "none" indicates no compression is supported. Others: gzip ; compress.- Parameters:
value- The feature to be added to the Compression attribute
-
removeCompression
Removes the given compression value.- Parameters:
value- The compression value to remove.
-
removeCompression
public void removeCompression(int i) Removes the given compression item.- Parameters:
i- The compression ArrayList item to remove.
-
getDescriptions
Gets the descriptions availalable for this repository.- Returns:
- The descriptions value
-
getDescription
Gets the description attribute of the RepositoryManager object- Parameters:
i- The index of the description to remove- Returns:
- The description value
-
addDescription
Adds a feature to the Description attribute of the RepositoryManager object- Parameters:
value- The feature to be added to the Description attribute
-
replaceDescription
Add the given admin Description to the repository. The aDescription is used in the Identify request. If the given Description already exists, nothing is changed.- Parameters:
index- The index.value- The new description
-
removeDescription
Remove the given desctiption from the repository.- Parameters:
value- The description to remove.
-
removeDescription
public void removeDescription(int i) Remove the given descrtiption item from the repository.- Parameters:
i- The description ArrayList index to remove.
-
getTrustedWsIpsArray
Gets an array of IP address regular expressions that are trusted for access to non-discoverable items through the web service. The regular expressions may be used directly in the String.matches() method. For example:String IP = "128.66.45.88";
boolean isAuthorized = IP.matches(getTrustedWsIpsArray()[0]);- Returns:
- array of IP address regular expressions.
-
getTrustedWsIps
Gets a Comma-separated String of IP address regular expressions that are trusted for access to non-discoverable items through the web service.- Returns:
- Comma-separated String of IP address regular expressions.
-
setTrustedWsIps
Sets the trustedWsIps attribute of the RepositoryManager, which should contain a comma-separated list of IP addresses for IPs that may access non-discoverable items through the web service. These may contain numbers, periods and the * wildcard only, for example 128.166.26.*.- Parameters:
value- The new trustedWsIps value
-
getRecord
Gets a single record from the repository by ID.- Parameters:
id- The ID for the item- Returns:
- The record or null if not available
-
getDisabledSetsQuery
public org.apache.lucene.search.Query getDisabledSetsQuery()Gets a Lucene Query for all disabled sets, or null if none.- Returns:
- The disabledSetsQuery
-
getRecordOai
Gets a single record from the repository by ID, restricted to those records that are avaiable/discoverable for OAI.- Parameters:
id- The ID for the item- Returns:
- The record or null if not available
- See Also:
-
getOaiQueryResults
public ResultDocList getOaiQueryResults(String format, String set, String from, String until) throws Exception Gets the results from a standard OAI-PMH ListIdentifiers or ListRecords query or an ODL search request.- Parameters:
format- The metadata format.set- The set, or null.from- The from time, or null.until- The until time, or null.- Returns:
- The queryResults value.
- Throws:
Exception- If error occues, exception will contain a message- See Also:
-
getOdlQueryResults
public ResultDocList getOdlQueryResults(String format, String set, String from, String until, String queryString) throws Exception Gets the results of an OAI-PMH ListRecords or ListIdentifiers request or an OLD search. Set queryString to null to perform a standard OAI-PMH search and non-null for ODL search.- Parameters:
format- The metadata format.set- The set to search over, or null.from- The from time, or null.until- The until time, or null.queryString- Must be non-null to indicate ODL search and null to indicate regular OAI-PMH request.- Returns:
- The queryResults value.
- Throws:
Exception- If error occues, exception will contain a message meant for human consumption in response error messages.- See Also:
-
setOaiFilterQuery
public void setOaiFilterQuery(String luceneQuery) throws org.apache.lucene.queryParser.ParseException Sets a Lucene query that filters the records served by the OAI data provider. Records that match this query will not be served by the OAI data provider. The given filter query persists until this method is called again or the RepositoryManager is reinstantiated. Pass null to this method to remove the filter query.- Parameters:
luceneQuery- The Lucene query to filter records- Throws:
org.apache.lucene.queryParser.ParseException- If query parse error
-
getFormatsThatCanBeConvertedToFormat
Gets all formats that can be converted to the given Format.- Parameters:
format- The target format.- Returns:
- The formatsThatCanBeConvertedToFormat list.
-
getFormatsThatCanBeConvertedToFormats
Gets all formats that can be converted to the given Formats.- Parameters:
formats- Formats that we want converted to.- Returns:
- The formatsThatCanBeConvertedToFormats list.
-
getConvertableFormatsQuery
Gets a query that limits a search to only those xml formats that can be converted to the format indicated. The conversion is done using the XmlConversionService.- Parameters:
toFormat- The xml format to convert to- Returns:
- A query that will return only records that can be converted to the given format, or null if no convertable formats are avialable.
-
getIndexedSets
Gets the sets that are in the index.- Returns:
- A list of set setSecs.
- See Also:
-
getSetSearchKeys
Gets a list of all search keys used to search for sets.- Returns:
- The setSearchKeys value.
- See Also:
-
getIndexedAccessionStatuses
Gets a list of all accession statusus in the index.- Returns:
- All accession statusus in the index.
-
getIndexedIdMapperErrors
Gets a list of all ID mapper errors that have been indexed.- Returns:
- The available ID mapper errors, as integer strings.
-
isIdInRepository
Determines whether the given ID is in the repository. Note that if given document was indexed but is not valid, this method MAY return false.- Parameters:
id- An ID.- Returns:
- True if the given ID is in the repository.
-
isSetInIndex
Determines whether the given set is in the repository index. Note that if the set is in the index it may also be disabled or all records in the set may have been moved to status deleted, if the set was removed from the repository.- Parameters:
set- A set.- Returns:
- True if the the given set is in the repository index.
- See Also:
-
canDisseminateFormat
Determines whether this repository can disseminate the given format.- Parameters:
format- The format.- Returns:
- True if this repository can dissiminate the format.
-
getAvailableFormats
Gets all possible metadata formats that may be disiminated by this RepositoryManager. This includes formats that are available by conversion from the native format via the XMLConversionService.- Returns:
- The metadataFormats available.
- See Also:
-
getAvailableFormatsList
Gets all possible metadata formats that are available for a given ID.- Parameters:
id- The id for the record.- Returns:
- The metadataFormats available.
-
getAvailableFormatsList
Gets all possible metadata formats that may be disiminated by this RepositoryManager. This includes formats that are available via the XMLConversionService.- Returns:
- The metadataFormats available.
-
getIndexedFormats
Gets all formats that exist natively in the index. If none exist, and empty list is returned.- Returns:
- The indexedFormats value or an empty list.
-
getAvailableFormats
Gets all possible metadata formats that are available for a given ID.- Parameters:
id- The id for the record.- Returns:
- The metadataFormats available.
-
isSetConfigured
Determines whether the given set is currently configured in this repository.- Parameters:
set- The set key, for example 'dcc'- Returns:
- True if the given set is currently configured in this repository.
- See Also:
-
isDirectoryConfigured
Determines whether the given directory is configured in the repository. Note: Each directory should only be configured in the repository once. This method can be used to check prior to adding a directory.- Parameters:
sourceDirectory- A directory of metadata files.- Returns:
- True if this directory is configured, false otherwise.
-
isSetEnabled
Determines whether the given set is currently enabled in this repository.- Parameters:
set- The name of the set or, if the vocab mgr is being used, the name of the encoded set key.- Returns:
- True if the given set is currently configured in this repository and is enabled.
-
isSetDisabled
Determines whether the given set is currently disabled in this repository.- Parameters:
set- The name of the set or, if the vocab mgr is being used, the name of the encoded set key.- Returns:
- True if the given set is currently configured in this repository and is disabled.
-
getConfiguredSets
Gets a List of file set key Strings such as 'dcc' or 'comet' that are currently configured in this repository.- Returns:
- The configuredSets key values, for example 'dcc', 'comet'
-
getConfiguredSetInfos
Gets a HashMap of SetInfos (directories of files) that are currently configured in this repository keyed by their set spec, for example dcc. If non, then empty Map is returned.- Returns:
- The configuredSetInfos
-
getConfiguredFormats
Gets a List of native file format Strings that are currently configured in this repository. This does not include formats that may be converted from the native formats via the XMLConversionService.- Returns:
- The file formats in the repository.
- See Also:
-
getEnabledSets
Gets the configured sets (directories of files) that are currently enabled in this repository. If the vacab manager is being used then the setSpec will be encoded into the vocab key, else it will not.- Returns:
- The enabledSets value.
-
getEnabledSetsHashMap
Gets the configured sets that are currently enabled in this repository. If the vocab manager is being used then the setSpecs are encoded, else they are not. Both the key and the values in the HashMap are the same.- Returns:
- The enabledSets value.
-
getDisabledSetsHashMap
Gets the configured sets that are currently disabled in this repository. If the vocab manager is being used then the setSpecs are encoded, else they are not. Both the key and the values in the HashMap are the same.- Returns:
- The disabled sets
-
getEnabledSetsQuery
Gets the configured sets that are currently enabled in this repository as a String suitable for use in s Lucene query, or an empty string if no sets are enabled.- Returns:
- The enabledSetsQuery value.
-
getDiscoverableItemsQuery
Gets the query string used to limit searches to only those ADN items-level records that should be displayed in discovery.- Returns:
- The query used to get only item-level records that are discoverable. The value returned is always non-null.
-
getDiscoverableRecordsQuery
Gets the query string used to limit searches to only those records, of any format (item, collection, anno, etc.), that should be accessable in discovery or via the web service.- Returns:
- The query used to get only records that are discoverable. The value returned is always non-null.
-
getDiscoverableOaiRecordsQuery
public final org.apache.lucene.search.Query getDiscoverableOaiRecordsQuery()Gets the query string used to limit searches to only those records, of any format (item, collection, anno, etc.), that should be accessable for OAI including 'enabled' deleted records. Removes all records in disabled file directories.Refactoring note: Consider using this for method
getDiscoverableRecordsQuery()instead.- Returns:
- The Query used to get only records that are not disabled
-
getNumDiscoverableADNResources
public final int getNumDiscoverableADNResources()Gets the number of descrete ADN item-level resources that have been indexed and are currently discoverable.- Returns:
- The number of ADN resources that are currently discoverable.
-
getNumDiscoverableResources
public final int getNumDiscoverableResources()Gets the number of descrete resources of any format (adn, dlese_anno, news_opps, etc) that have been indexed and are currently discoverable.- Returns:
- The number of resources of any format that are currently discoverable.
-
getDrcBoostingQuery
Boost items in the DRC.- Returns:
- A query String used to boost results that have DRC reviews.
-
getAbsoluteDrcBoostingQuery
Boost items in the DRC absolutely.- Returns:
- A query String used to boost results that have DRC reviews above all other criteria.
-
getMultiDocBoostingQuery
Boost items that have multiple records associated with them.- Returns:
- A query String used to boost multi-record resources.
-
getDrcBoostFactor
Gets the boosting factor used to rank items in the DRC.- Returns:
- The boosting factor used to rank items in the DRC.
-
getMultiDocBoostFactor
Gets the boosting factor used to rank resources that are referenced by more than one record.- Returns:
- The boosting factor used to rank items in multiple records.
-
setMultiDocBoostFactor
Sets the boosting factor used to rank resources that are referenced by more than one record.- Parameters:
boostFactor- The new boosting factor used to rank items in multiple records.- Throws:
Exception- If error.
-
setIsOaiPmhEnabled
public void setIsOaiPmhEnabled(boolean isEnabled) Sets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository. Set to false to disable regular OAI-PMH ListRecord and ListIdentifier resonses. QDL ListRecord and ListIdentifier requests are not effected.- Parameters:
isEnabled- False to disable regular ListRecord and ListIdentifier OAI-PMH responses
-
getIsOaiPmhEnabled
public boolean getIsOaiPmhEnabled()Gets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository. False means regular ListRecord and ListIdentifier responses are disabled. QDL ListRecord and ListIdentifier are always available, regardless.- Returns:
- False means regular ListRecord and ListIdentifier OAI-PMH responses are disabled
-
setDrcBoostFactor
Sets the boosting factor used to rank items in the DRC. Value must be zero or greater.- Parameters:
boostFactor- The new boosting factor used to rank items in the DRC.- Throws:
Exception- If error.
-
getTitleBoostFactor
Deprecated.As of 12/2004, boosting behavior is controlled by properties set in the RepositoryManager config.Gets the boosting factor used to rank items with matching terms in the title field.- Returns:
- The boosting factor used to rank items with matching terms in the title field.
-
setTitleBoostFactor
Deprecated.As of 12/2004, boosting behavior is controlled by properties set in the RepositoryManager config.Sets the boosting factor used to rank items with matching terms in the title field. Value must be zero or greater.- Parameters:
boostFactor- The boosting factor used to rank items with matching terms in the title field.- Throws:
Exception- If error
-
resetBoostingFactorDefaults
Resets the boosting factors to the default values.- Throws:
Exception- If error
-
getStemmingBoostFactor
Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.Gets the boosting factor used to rank items with matching stemmed terms.- Returns:
- The boosting factor used to rank items with matching stemmed terms.
-
setStemmingBoostFactor
Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.Sets the boosting factor used to rank items with matching stemmed terms. Value must be zero or greater.- Parameters:
boostFactor- The boosting factor used to rank items with matching stemmed terms.- Throws:
Exception- If error.
-
isStemmingEnabled
public boolean isStemmingEnabled()Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.Indicates whether stemming support is enabled.- Returns:
- true if stemming is enabled, false otherwise.
-
setStemmingEnabled
public void setStemmingEnabled(boolean stemmingEnabled) Deprecated.As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager config.Sets whether stemming is enabled.- Parameters:
stemmingEnabled- true to enable stemming, false to disable it.
-
getExpandedSearchQuery
public org.apache.lucene.search.Query getExpandedSearchQuery(String queryString) throws org.apache.lucene.queryParser.ParseException Gets a Query for the given Lucene query String that is expanded using the default search fields, boosting fields and virtual search field mappings that are configured in this RepositoryManager. The Query may then be used to search the index to find matching results.- Parameters:
queryString- The query String- Returns:
- The Query, expanded
- Throws:
org.apache.lucene.queryParser.ParseException- If error parsing the query String- See Also:
-
getDefaultSearchFields
Gets the names of the fields that are serched for terms that match a users query. These are defined in the file named search_fields.properties found in the repository config directory.- Returns:
- The defaultSearchFields value
- See Also:
-
getFieldsUsedForBoosting
Gets the names of the index fields that are used to boost records that match a users query. These are defined in the file named search_fields.properties found in the repository config directory.- Returns:
- The fieldsUsedForBoosting value
- See Also:
-
getBoostingValues
Gets the boosting values for fields used to boost search results. These are defined in the file named search_fields.properties found in the repository config directory.- Returns:
- The boostingValues value
- See Also:
-
reloadConfigFiles
public void reloadConfigFiles()Instructs the RepositoryManager to re-read and re-load the values found in it's configuration files. -
getDisabledSets
Gets the configured file sets that are currently disabled in this repository.- Returns:
- The disabledSets value
-
getSetInfos
Gets the SetInfos (directories of files) that are currently configured in the repository.- Returns:
- The setInfos.
- See Also:
-
enableSet
Enables the given set of files for discovery.- Parameters:
setUid- The set Uid
-
disableSet
Disabled the given set of files from discovery.- Parameters:
setUid- The set Uid
-
getSetInfosHashMap
Gets the SetInfos (directories of files) that are currently configured in the repository as a HashMap keyed by setInfo.directory().- Returns:
- The setInfos HashMap.
- See Also:
-
getSetInfosCopy
Gets a copy of the SetInfos (directories of files) that are currently configured in the repository. The copy is suitable for modifying without effecting the data in the repository.- Returns:
- The setInfosCopy value.
- See Also:
-
getSetInfo
Gets the SetInfo (directory of files) at the give index, suitable for reading but not modifying.- Parameters:
i- The index into the SetInfo.- Returns:
- The setInfo value.
-
getSetInfo
Gets the SetInfo (directory of files) by the given set key, for example 'dcc'.- Parameters:
key- The set key, for example 'dcc'- Returns:
- The setInfo, or null if not available
-
getSetInfoCopy
Gets the setInfo at the give index, safe for modifying.- Parameters:
i- The index into the SetInfo.- Returns:
- The setInfo value.
-
addSetInfo
Adds a new set of files to the repository configuration, but does not index them.- Parameters:
setInfo- The SetInfo to add to the reposigory configuration.- Throws:
Exception- If one of the directories is already configured or none is specified.
-
removeSetInfo
Remove the given set of files from the repository.- Parameters:
setInfo- The set info to remove.- See Also:
-
removeSetInfo
public void removeSetInfo(int i) Removes the given set of files form the repository.- Parameters:
i- The index of the SetInfo to remove.- See Also:
-
removeSetBySetSpec
Removes the cofiguration (SetInfo) for the given set of files from the repository and deletes the index entries for that set of files.- Parameters:
setSpec- The setSpec, or collection, to remove for example 'dcc'- Returns:
- The removed SetInfo if successful, null if the given set was not found
-
replaceSetInfo
Replace a given SetInfo object with a new one, updating the index as appropriate.- Parameters:
key- The set key for the set to replace, for example 'dcc'newSetInfo- The new SetInfo
-
replaceSetInfo
Replace a given SetInfo object with a new one, updating the index as appropriate.- Parameters:
i- The index into the array of SetInfos to removenewSetInfo- The new SetInfo
-
getNumIndexingErrors
public int getNumIndexingErrors()Gets the number of records that had indexing errors.- Returns:
- The number of indexing errors
-
getIndexingErrorDocs
Gets the ResultDocs for those records that had errors and could not be indexed, or null if none exist.- Returns:
- The indexing error ResultDocs, or null if none
- See Also:
-
getNumRecordsInIndex
public int getNumRecordsInIndex()Gets the number of records in the index, excluding records with errors.- Returns:
- The number of records in the index
- See Also:
-
getAllRecordsInIndex
Gets the ResultDocs for all records in the index, excluding records with errors, or null if none exist.- Returns:
- All records ResultDocs, or null if none
- See Also:
-
getNumDeletedDocs
public int getNumDeletedDocs()Gets the total number of OAI status deleted records. Records are set to status deleted when their source file has been removed (if removeDocs has been set to false in the RepositoryManager).- Returns:
- The number of OAI status deleted records
-
getNumNonDeletedDocs
public int getNumNonDeletedDocs()Gets the total number of records that are not OAI status deleted. Records are set to status deleted when their source file has been removed (if removeDocs has been set to false in the RepositoryManager).- Returns:
- The number of records not OAI status deleted
-
getNumDeletedDocsNotFromAnyDirectory
public int getNumDeletedDocsNotFromAnyDirectory()Gets the total number of all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.- Returns:
- Number of deleted documents not from any directory
- See Also:
-
getDeletedDocsNotFromAnyDirectory
Gets the ResultDocs for all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.- Returns:
- Deleted documents not from any directory, or null if none
- See Also:
-
getDeletedDocsNotFromAnyDirectoryQuery
public final org.apache.lucene.search.Query getDeletedDocsNotFromAnyDirectoryQuery()Gets a Query that will return all OAI status deleted records that did not come from any of the existing file directories configured in the RepositoryManager.- Returns:
- A Query for deleted documents not from any directory
- See Also:
-
setFileIndexingPlugin
Sets the fileIndexingPlugin that will be used during indexing. In order to take effect, this method MUST be called prior to calling themethod. An individual plugin may be specified for each XML format and a global plugin may also be specified for use with all formats. Plugin precedence is determined as follows: if a plugin has been set for a specific XML format, use it; else if a plugin has been set for all formats, use it; else if a plugin has not been set for either, use none.invalid reference
#init()To configure one or more Lucene Analyzers to use on a per-field basis for your plugins, provide a properties file within your application's class path named 'FileIndexingPluginLuceneAnalyzers.properties'. See
PerFieldAnalyzerfor details.- Parameters:
xmlFormat- The XML format for which this plugin is used orPLUGIN_ALL_FORMATSto specify that the plugin should be used with all formatsplugin- The FileIndexingPlugin that will be used- See Also:
-
putRecord
public String putRecord(String recordXml, String xmlFormat, String collection, String id, boolean saveXmlAsFile) throws RecordUpdateException Puts a record into the repository, replacing the existing record if one exists. If the record format is dlese_anno then the annotated record itemID will be reindexed to include the annotation data.- Parameters:
recordXml- The record XML as a StringxmlFormat- The XML format of the record, for example 'adn'collection- The collection vocab for the collection or set, for example 'dcc'id- A unique identifier for the record, for example DLESE-000-000-000-001. This parameter is ignored and may be null if the ID can be derived from the record XML.saveXmlAsFile- True to save the XML record as a file on disc as well as in the index, false to only save it in the index- Returns:
- The ID of the record as inserted, which may be different than the ID requested
- Throws:
RecordUpdateException- If unable to insert the record for any reason
-
putRecord
public String putRecord(String recordXml, String xmlFormat, String collection, String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile) throws RecordUpdateException Puts a record into the repository, replacing the existing record if one exists. If the record format is dlese_anno then the annotated record itemID will be reindexed to include the annotation data.- Parameters:
recordXml- The record XML as a StringxmlFormat- The XML format of the record, for example 'adn'collection- The collection vocab for the collection or set, for example 'dcc'id- A unique identifier for the record, for example DLESE-000-000-000-001. This parameter is ignored and may be null if the ID can be derived from the record XML.indexingPlugin- A plugin to use while indexing, or null to specify none. This plugin takes precedence over a previously configured plugin. If none is supplied here, the previously configured plugin will be used if available.saveXmlAsFile- True to save the XML record as a file on disc as well as in the index, false to only save it in the index- Returns:
- The ID of the record as inserted, which may be different than the ID requested
- Throws:
RecordUpdateException- If unable to insert the record for any reason
-
deleteRecord
Deletes a record from the repository if one exists with the given ID. Returns false if no such record exists, else true if the deletion was successful. Reindexes all records that were related to the item, such as annotations, to remove related fields from the index.- Parameters:
id- The unique identifier for the record, for example DLESE-000-000-000-001.- Returns:
- True if the deletion was successful, false if no such record exists.
- Throws:
Exception- If unable to delete the record for any reason
-
reindexRecord
public String reindexRecord(String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile, boolean indexRelations) throws RecordUpdateException Reindexes an existing record in the repository, updating any related data from outside of the record XML such as annotations or data from a FileIndexingPlugin, replacing the existing index entry. This is equivilent to calling #getRecord to fetch the record XML and then calling #putRecord with the same XML.- Parameters:
id- A unique identifier for the record, for example DLESE-000-000-000-001.indexingPlugin- A plugin to use while indexing, or null to specify none. This plugin takes precedence over a previously configured plugin. If none is supplied here, the previously configured plugin will be used if available.saveXmlAsFile- True to save the XML record as a file on disc as well as in the index, false to only save it in the indexindexRelations- True to index the records that this item assigns a relation for- Returns:
- The ID of the record that was reindexed.
- Throws:
RecordUpdateException- If record ID does not exist or unable to reindex the record for any reason
-
indexFiles
Instructs the repository to index all of it's files. The index will add, update or delete the entries for each file in the repository. The indexAll parameter indicates whether to index all files regardless of modification or only those files that have been modified, added or deleted since the last index update. This method returns immediately and execution occurs in a background thread. Progress may be monitored using methodgetIndexingMessages().- Parameters:
observer- The FileIndexingObserver that will be notified when indexing is complete, or null to use noneindexAll- True to index all files, false to index modified files only
-
indexCollection
Instructs the repository to index all of the files for the given set/collection. The index will add, update or delete the entries for each file in the collection. The indexAll parameter indicates whether to index all files regardless of modification or only those files that have been modified, added or deleted since the last index update. This method returns immediately and execution occurs in a background thread. Progress may be monitored using methodgetIndexingMessages().- Parameters:
set- The set key, for example 'dcc'observer- The FileIndexingObserver that will be notified when indexing is complete, or null to use noneindexAll- True to index all files, false to index modified files only- Returns:
- True if the collection exists in the repository, false if the collection does not exist in the repository.
-
setRecordsLocation
public final void setRecordsLocation(String collectionRecordsLocation, String metadataRecordsLocation) Sets the absolute path to the collectionRecordsLocation and the metadataRecordsLocation. If supplied, the RepositoryManager will index the Collecton Records and they can then be used to configure the collections found in this repository. This must be called prior to calling the init() method.- Parameters:
collectionRecordsLocation- The absolute path to a directory of DLESE collection-level XML records.metadataRecordsLocation- The absolute path to a directory containing item-level metadata. All metadata files must reside in sub-directores by format and collection, for example: metadataRecordsLocation + /adn/dcc/DLESE-000-000-000-001.xml.
-
getCollectionRecordsLocation
Gets the path for the directory of collect-level records this RepositoryManager is using, or empty string if none is configured.- Returns:
- The collectionRecordsLocation value
-
getMetadataRecordsLocation
Gets the path for the directory of metadata records this RepositoryManager is using, or empty string if none is configured.- Returns:
- The metadataRecordsLocation value
-
putCollection
public String putCollection(String collectionKey, String xmlFormat, String title, String description, String additionalMetadata) throws PutCollectionException Put a collection in the repository. The collection can then have items added to it with the putRecord method.- Parameters:
collectionKey- The unique collection key, for example 'dcc'. The key and record ID are set to the same value.xmlFormat- The xml format of the records in this collection, for example 'nsdl_dc'title- The titledescription- The descriptionadditionalMetadata- A text or XML string to be inserted into the additionalMetadata element of the collection record, or null for none- Returns:
- The collection record ID
- Throws:
PutCollectionException- If error occurs, indicates the type of error
-
deleteCollection
Delete a collection and all its records from the repository.- Parameters:
collectionKey- The unique collection key, for example 'dcc'- Returns:
- True if the collection existed and was deleted, false if no such collection exists
- Throws:
Exception- Description of the Exception
-
loadCollectionRecords
public void loadCollectionRecords(boolean indexCollectionRecs) Loads the collections found in the collection-level records.- Parameters:
indexCollectionRecs- True to index the collection records, false not to.
-
getRecordDataService
Gets the recordDataService attribute of the RepositoryManager object- Returns:
- The recordDataService value
-
getAdminEmails
Gets the adminEmails attribute of the RepositoryManager object- Returns:
- The adminEmails value
-
getAdminEmail
Gets the adminEmail attribute of the RepositoryManager object- Parameters:
i- The index of the e-mail to get- Returns:
- The adminEmails value
-
addAdminEmail
Add the given admin e-mail to the repository. The admin e-mail is used in the Identify request. If the given e-mail already exists, nothing is changed.- Parameters:
email- The admin e-mail to be added.
-
replaceAdminEmail
Add the given admin e-mail to the repository. The admin e-mail is used in the Identify request. If the given e-mail already exists, nothing is changed.- Parameters:
index- DESCRIPTIONemail- The admin e-mail to be added.
-
removeAdminEmail
Removes the given admin e-mail from the repository. The admin e-mail is used in the Identify request. If no such e-mail exists, nothing is done.- Parameters:
email- The admin e-mail to be removed.
-
removeAdminEmail
public void removeAdminEmail(int i) Removes the given admin e-mail at the given ArrayList index from the repository. If no such e-mail exists, nothing is done.- Parameters:
i- The admin e-mail ArrayList index to be removed.
-
setMetadataNamespace
Sets the metadata namespace for the given metadataPrefix (XML format). If a metadata namespace is already configured it will be replaced with the new value. These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_annometadataNamespace- The namspace URI for the given XML format- Returns:
- True if successful
-
getMetadataNamespace
Gets the metadata namespace for the given metadataPrefix (XML format). These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_anno- Returns:
- The namspace URI for the given XML format, or null if not available
-
removeMetadataNamespace
Removes the metadata namespace for the given metadataPrefix (XML format). These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_anno- Returns:
- True if successful
-
getMetadataNamespaces
Gets a Map of metadata namespaces for all metadataPrefixes (XML formats) in the repository, or null if none exist. These are used in the OAI ListMetadataFormats response.- Returns:
- A Map of all metadata namespaces, keyed by metadataPrefix
-
setMetadataSchemaURL
Sets the metadata schema URL for the given metadataPrefix (XML format). If a schema URL is already configured it will be replaced with the new value. These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_annometadataSchema- The schema URL for the given XML format- Returns:
- True if successful
-
getMetadataSchemaURL
Gets the metadata schema URL for the given metadataPrefix (XML format). These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_anno- Returns:
- The schema URL for the given XML format, or null if not available
-
removeMetadataSchemaURL
Removes the metadata schema URL for the given metadataPrefix (XML format). These are used in the OAI ListMetadataFormats response.- Parameters:
metadataPrefix- The metadata specifier, for example oai_dc, adn, dlese_anno- Returns:
- True if successful
-
getMetadataSchemaURLs
Gets a Map of metadata schema URLs for all metadataPrefixes (XML formats) in the repository, or null if none exist. These are used in the OAI ListMetadataFormats response.- Returns:
- A Map of all metadata schema URLs, keyed by metadataPrefix
-
setDefaultXmlFormatInfo
Sets the default schema and namespace for the given XML format, used in the OAI ListMetadataFormats response. Value passed in must be of the form [metadataPrefix]|[schema]|[namespace], for example 'oai_dc|http://www.openarchives.org/OAI/2.0/oai_dc.xsd|http://www.openarchives.org/OAI/2.0/oai_dc/'. If a namespace or schema value is already configured for the given metadataPrefix, no change will be made. Values may be changed later using #setMetadataSchemaURL and #setMetadataNamespace.- Parameters:
info- String of the form [metadataPrefix]|[schema]|[namespace]- Throws:
Exception- If unable to parse the String properly
-
setXMLConversionService
Sets the XMLConversionService used by this RepositoryManager and puts it into the index as an attribute under the key xmlConversionService for use in the XMLDocReaders.- Parameters:
cs- The new XMLConversionService.
-
getXMLConversionService
Gets the XMLConversionService used by this RepositoryManager, or null if none available.- Returns:
- The XMLConversionService or null
-
getRepositoryDataDir
Get the directory where the repository persistent data and certain configs resides, including the collections configs, specified by the init param repositoryData.- Returns:
- The directory where the repository data and certain configs resides.
- Throws:
Exception- If error
-
getItemIndexerConfigDir
Get the directory where the repository ItemIndexer configs are located.- Returns:
- The directory where the repository ItemIndexer configs are located
- Throws:
Exception- If error
-
getListSetsConfigXml
Gets the OAI sets configuration XML for this repository, used to generate the ListSets OAI response. See sample ListSets XML config file .- Returns:
- The listSetsConfigXml String, or null if none are configured
-
loadListSetsConfigFile
Loads the OAI sets configuration from file and configures the corresponding set mappings in this repository. See sample ListSets XML config file . If not file exists, nothing is done.- Throws:
Exception- If error parsing or loading the config
-
removeOAISetSpecDefinition
Removes the given OAI set definition from repository configuration.- Parameters:
setSpec- The set to remove- Returns:
- True if the set was removed
-
setOAISetSpecDefinition
Sets the definition for a given OAI set, initializing it in the repository and writing the ListSets config XML to persistent file. If the given set already exists, it will be re-defined, if not, a new set will be added to the existsing sets in the config XML file.- Parameters:
setDefinitionsForm- A bean holding the set definiton info- Throws:
Exception- If error
-
getHasOaiSetsConfigured
public boolean getHasOaiSetsConfigured()Determines whether one or more OAI sets are configured for this repository.- Returns:
- True if one or more OAI sets are configured for this repository
-
getHasOaiSetConfigured
Determines whether the given OAI set is configured in this repository.- Parameters:
setSpec- The OAI setSpec- Returns:
- True if the OAI set is configured in this repository
-
getOaiSets
Gets the OAI sets configured in this repository.- Returns:
- The OAI sets configured in this repository, or null
-
getOaiSetQuery
Gets the Lucene Query for the given setSpec, or null if none exists.- Parameters:
setSpec- The OAI setSpec- Returns:
- The Query for the given setSpec or null
-
getOaiSetsForId
Gets the OAI sets associated with this record ID as a List of Strings, for example 'mySet' or null.- Parameters:
id- The record ID (without OAI prefix)- Returns:
- A List of OAI set Strings, or null if none
-
getNumRecordsInSet
Gets the number of records that are in the given OAI set excluding deletions, or -1 if no such set is configured.- Parameters:
setSpec- The OAI setSpec- Returns:
- The number of non-deleted records in the set or -1 if the given set does not exist
- See Also:
-
getNumDeletedRecordsInSet
Gets the number of deleted records that are in the given OAI, or -1 if no such set is configured.- Parameters:
setSpec- The OAI setSpec- Returns:
- The number of deleted records in the set or -1 if the given set does not exist
- See Also:
-
getVirtualSearchFieldMapper
Gets the VirtualSearchFieldMapper that defines the virtual field/term definitions for this RepositoryManager. Dev note: may want to add RM methods to update/add stuff to the VirtualSearchFieldMapper, but for now this method can be used to get and then modify it.- Returns:
- The virtualSearchFieldMapper or null if none
-
getDateStamp
Return a string for the current time and date, sutiable for display in log files and output to standout:- Returns:
- The dateStamp value
-
prtlnErr
Output a line of text to error out, with datestamp.- Parameters:
s- The text that will be output to error out.
-
prtln
Output a line of text to standard out, with datestamp, if debug is set to true.- Parameters:
s- The String that will be output.
-
setDebug
public static void setDebug(boolean db) Sets the debug attribute of the object- Parameters:
db- The new debug value
-