public class RepositoryManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PLUGIN_ALL_FORMATS
Specifies in the
setFileIndexingPlugin(String xmlFormat, FileIndexingPlugin plugin) method that
the given plugin should be used when indexing all XML formats. |
Constructor and Description |
---|
RepositoryManager(java.io.File repositoryConfigDir,
java.io.File itemIndexerConfigDir,
java.lang.String repositoryDataDir,
java.lang.String indexLocation,
java.lang.String indexingStartTime,
java.lang.String indexingDaysOfWeek,
RecordDataService recordDataService,
boolean removeDocs,
boolean reindexAllFiles)
Constructor for the RepositoryManager.
|
RepositoryManager(java.io.File repositoryConfigDir,
java.lang.String repositoryDataDir,
int updateFrequency,
int maxFilesToIndex,
boolean removeDocs)
Constructor for the RepositoryManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addAdminEmail(java.lang.String email)
Add the given admin e-mail to the repository.
|
void |
addCompression(java.lang.String value)
Adds a feature to the Compression attribute of the RepositoryManager object.
|
void |
addDescription(java.lang.String value)
Adds a feature to the Description attribute of the RepositoryManager object
|
void |
addSetInfo(SetInfo setInfo)
Adds a new set of files to the repository configuration, but does not index them.
|
boolean |
canDisseminateFormat(java.lang.String format)
Determines whether this repository can disseminate the given format.
|
boolean |
deleteCollection(java.lang.String collectionKey)
Delete a collection and all its records from the repository.
|
void |
deleteIndex()
Deletes the repository index and re-initializes a new, empty one in its place.
|
boolean |
deleteRecord(java.lang.String id)
Deletes a record from the repository if one exists with the given ID.
|
void |
destroy()
Tear down and clean up by gracefully stopping threads.
|
void |
disableSet(java.lang.String setUid)
Disabled the given set of files from discovery.
|
void |
enableSet(java.lang.String setUid)
Enables the given set of files for discovery.
|
java.lang.String |
getAbsoluteDrcBoostingQuery()
Boost items in the DRC absolutely.
|
java.lang.String |
getAdminEmail(int i)
Gets the adminEmail attribute of the RepositoryManager object
|
java.util.ArrayList |
getAdminEmails()
Gets the adminEmails attribute of the RepositoryManager object
|
ResultDocList |
getAllRecordsInIndex()
Gets the ResultDocs for all records in the index, excluding records with errors, or null if none exist.
|
java.util.Hashtable |
getAvailableFormats()
Gets all possible metadata formats that may be disiminated by this RepositoryManager.
|
java.util.Hashtable |
getAvailableFormats(java.lang.String id)
Gets all possible metadata formats that are available for a given ID.
|
java.util.List |
getAvailableFormatsList()
Gets all possible metadata formats that may be disiminated by this RepositoryManager.
|
java.util.List |
getAvailableFormatsList(java.lang.String id)
Gets all possible metadata formats that are available for a given ID.
|
java.util.Map |
getBoostingValues()
Gets the boosting values for fields used to boost search results.
|
java.lang.String |
getCollectionRecordsLocation()
Gets the path for the directory of collect-level records this RepositoryManager is using, or empty string
if none is configured.
|
java.util.ArrayList |
getCompressions()
Gets the compressions attribute of the RepositoryManager object.
|
java.io.File |
getConfigDir()
Gets the directory where the RepositoryManager config files reside.
|
java.util.ArrayList |
getConfiguredFormats()
Gets a List of native file format Strings that are currently configured in this repository.
|
java.util.HashMap |
getConfiguredSetInfos()
Gets a HashMap of SetInfos (directories of files) that are currently configured in this repository keyed
by their set spec, for example dcc.
|
java.util.ArrayList |
getConfiguredSets()
Gets a List of file set key Strings such as 'dcc' or 'comet' that are currently configured in this
repository.
|
java.lang.String |
getConvertableFormatsQuery(java.lang.String toFormat)
Gets a query that limits a search to only those xml formats that can be converted to the format
indicated.
|
protected static java.lang.String |
getDateStamp()
Return a string for the current time and date, sutiable for display in log files and output to standout:
|
java.lang.String[] |
getDefaultSearchFields()
Gets the names of the fields that are serched for terms that match a users query.
|
ResultDocList |
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.
|
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.
|
java.lang.String |
getDeletedRecord()
Gets the OAI-PMH deletedRecord support, which depends on whether deleted records are removed from the
repository index or kept as status deleted.
|
java.lang.String |
getDescription(int i)
Gets the description attribute of the RepositoryManager object
|
java.util.ArrayList |
getDescriptions()
Gets the descriptions availalable for this repository.
|
java.util.ArrayList |
getDisabledSets()
Gets the configured file sets that are currently disabled in this repository.
|
java.util.HashMap |
getDisabledSetsHashMap()
Gets the configured sets that are currently disabled in this repository.
|
org.apache.lucene.search.Query |
getDisabledSetsQuery()
Gets a Lucene Query for all disabled sets, or null if none.
|
java.lang.String |
getDiscoverableItemsQuery()
Gets the query string used to limit searches to only those ADN items-level records that should be
displayed in discovery.
|
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.
|
java.lang.String |
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.
|
java.lang.String |
getDrcBoostFactor()
Gets the boosting factor used to rank items in the DRC.
|
java.lang.String |
getDrcBoostingQuery()
Boost items in the DRC.
|
java.lang.String |
getEarliestDatestamp()
Gets the earliestDatestamp attribute of the RepositoryManager object
|
java.util.ArrayList |
getEnabledSets()
Gets the configured sets (directories of files) that are currently enabled in this repository.
|
java.util.HashMap |
getEnabledSetsHashMap()
Gets the configured sets that are currently enabled in this repository.
|
java.lang.String |
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.
|
java.lang.String |
getExampleID()
Get an example ID that might be disiminated from this repository.
|
org.apache.lucene.search.Query |
getExpandedSearchQuery(java.lang.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.
|
java.lang.String[] |
getFieldsUsedForBoosting()
Gets the names of the index fields that are used to boost records that match a users query.
|
FileIndexingService |
getFileIndexingService()
Gets the fileIndexingService attribute.
|
java.util.ArrayList |
getFormatsThatCanBeConvertedToFormat(java.lang.String format)
Gets all formats that can be converted to the given Format.
|
java.util.ArrayList |
getFormatsThatCanBeConvertedToFormats(java.lang.String[] formats)
Gets all formats that can be converted to the given Formats.
|
java.lang.String |
getGranularity()
Gets the granularity attribute of the RepositoryManager object.
|
java.lang.String |
getHarvesterStatus()
Gets the harvesterStatus attribute of the RepositoryManager object
|
boolean |
getHasOaiSetConfigured(java.lang.String setSpec)
Determines whether the given OAI set is configured in this repository.
|
boolean |
getHasOaiSetsConfigured()
Determines whether one or more OAI sets are configured for this repository.
|
java.lang.String |
getIdMapperExclusionFilePath()
Gets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of
duplicates.
|
SimpleLuceneIndex |
getIndex()
Gets the index attribute of the RepositoryManager object
|
java.util.List |
getIndexedAccessionStatuses()
Gets a list of all accession statusus in the index.
|
java.util.List |
getIndexedFormats()
Gets all formats that exist natively in the index.
|
java.util.List |
getIndexedIdMapperErrors()
Gets a list of all ID mapper errors that have been indexed.
|
java.util.ArrayList |
getIndexedSets()
Gets the sets that are in the index.
|
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.
|
ResultDocList |
getIndexingErrorDocs()
Gets the ResultDocs for those records that had errors and could not be indexed, or null if none exist.
|
java.util.ArrayList |
getIndexingMessages()
Gets the indexingMessages attribute of the RepositoryManager object
|
java.util.Date |
getIndexingStartTime()
Gets the date the indexer scheduled to start.
|
long |
getIndexLastModifiedCount()
Gets the version number of the last time the repository index was modified by adding, deleting or
changing an item.
|
boolean |
getIsOaiPmhEnabled()
Gets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository.
|
java.io.File |
getItemIndexerConfigDir()
Get the directory where the repository ItemIndexer configs are located.
|
java.lang.String |
getListSetsConfigXml()
Gets the OAI sets configuration XML for this repository, used to generate the ListSets OAI response.
|
java.lang.String |
getMetadataNamespace(java.lang.String metadataPrefix)
Gets the metadata namespace for the given metadataPrefix (XML format).
|
java.util.Map |
getMetadataNamespaces()
Gets a Map of metadata namespaces for all metadataPrefixes (XML formats) in the repository, or null if
none exist.
|
java.lang.String |
getMetadataRecordsLocation()
Gets the path for the directory of metadata records this RepositoryManager is using, or empty string if
none is configured.
|
java.lang.String |
getMetadataSchemaURL(java.lang.String metadataPrefix)
Gets the metadata schema URL for the given metadataPrefix (XML format).
|
java.util.Map |
getMetadataSchemaURLs()
Gets a Map of metadata schema URLs for all metadataPrefixes (XML formats) in the repository, or null if
none exist.
|
java.lang.String |
getMetadataVocabAudienceDefault()
Gets the metadataVocabAudienceDefault attribute of the RepositoryManager object
|
java.lang.String |
getMetadataVocabLanguageDefault()
Gets the metadataVocabLanguageDefault attribute of the RepositoryManager object
|
java.lang.String |
getMultiDocBoostFactor()
Gets the boosting factor used to rank resources that are referenced by more than one record.
|
java.lang.String |
getMultiDocBoostingQuery()
Boost items that have multiple records associated with them.
|
int |
getNumDeletedDocs()
Gets the total number of OAI status deleted records.
|
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.
|
int |
getNumDeletedRecordsInSet(java.lang.String setSpec)
Gets the number of deleted records that are in the given OAI, or -1 if no such set is configured.
|
int |
getNumDiscoverableADNResources()
Gets the number of descrete ADN item-level resources that have been indexed and are currently
discoverable.
|
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.
|
java.lang.String |
getNumIdentifiersResults()
Gets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.
|
int |
getNumIndexingErrors()
Gets the number of records that had indexing errors.
|
int |
getNumNonDeletedDocs()
Gets the total number of records that are not OAI status deleted.
|
int |
getNumRecordsInIndex()
Gets the number of records in the index, excluding records with errors.
|
int |
getNumRecordsInSet(java.lang.String setSpec)
Gets the number of records that are in the given OAI set excluding deletions, or -1 if no such set is
configured.
|
java.lang.String |
getNumRecordsResults()
Gets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.
|
java.lang.String |
getOaiIdPrefix()
Gets the OAI Identifier Format's scheme and namespace-identifier prefix, for example 'oai:dlese.org:'.
|
ResultDocList |
getOaiQueryResults(java.lang.String format,
java.lang.String set,
java.lang.String from,
java.lang.String until)
Gets the results from a standard OAI-PMH ListIdentifiers or ListRecords query or an ODL search request.
|
org.apache.lucene.search.Query |
getOaiSetQuery(java.lang.String setSpec)
Gets the Lucene Query for the given setSpec, or null if none exists.
|
java.lang.String[] |
getOaiSets()
Gets the OAI sets configured in this repository.
|
java.util.List |
getOaiSetsForId(java.lang.String id)
Gets the OAI sets associated with this record ID as a List of Strings, for example 'mySet' or null.
|
ResultDocList |
getOdlQueryResults(java.lang.String format,
java.lang.String set,
java.lang.String from,
java.lang.String until,
java.lang.String queryString)
Gets the results of an OAI-PMH ListRecords or ListIdentifiers request or an OLD search.
|
java.lang.String |
getProtocolVersion()
Gets the protocolVersion attribute of the RepositoryManager object
|
java.lang.String |
getProviderBaseUrl(javax.servlet.http.HttpServletRequest req)
Gets the Base URL that refers to the current OAI provider, for example
"http://host:8080/my_oai_context/provider".
|
java.lang.String |
getProviderStatus()
Gets the status of the OAI data provider.
|
ResultDoc |
getRecord(java.lang.String id)
Gets a single record from the repository by ID.
|
RecordDataService |
getRecordDataService()
Gets the recordDataService attribute of the RepositoryManager object
|
ResultDoc |
getRecordOai(java.lang.String id)
Gets a single record from the repository by ID, restricted to those records that are
avaiable/discoverable for OAI.
|
java.lang.String |
getRemoveInvalidRecords()
Gets the removeInvalidRecords attribute, which is true|false.
|
java.io.File |
getRepositoryDataDir()
Get the directory where the repository persistent data and certain configs resides, including the
collections configs, specified by the init param repositoryData.
|
java.lang.String |
getRepositoryIdentifier()
Gets the repositoryIdentifier for this provider, for example 'dlese.org'.
|
java.lang.String |
getRepositoryName()
Gets the repositoryName attribute of the RepositoryManager object
|
SetInfo |
getSetInfo(int i)
Gets the SetInfo (directory of files) at the give index, suitable for reading but not modifying.
|
SetInfo |
getSetInfo(java.lang.String key)
Gets the SetInfo (directory of files) by the given set key, for example 'dcc'.
|
SetInfo |
getSetInfoCopy(int i)
Gets the setInfo at the give index, safe for modifying.
|
java.util.ArrayList |
getSetInfos()
Gets the SetInfos (directories of files) that are currently configured in the repository.
|
java.util.ArrayList |
getSetInfosCopy()
Gets a copy of the SetInfos (directories of files) that are currently configured in the repository.
|
java.util.HashMap |
getSetInfosHashMap()
Gets the SetInfos (directories of files) that are currently configured in the repository as a HashMap
keyed by setInfo.directory().
|
java.util.List |
getSetSearchKeys()
Gets a list of all search keys used to search for sets.
|
long |
getSetStatusModifiedTime()
Gets the time the sets configuation status was last modified (enabled, disabled, added, deleted).
|
java.lang.String |
getStemmingBoostFactor()
Deprecated.
As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager
config.
|
java.lang.String |
getTitleBoostFactor()
Deprecated.
As of 12/2004, boosting behavior is controlled by properties set in the RepositoryManager
config.
|
java.lang.String |
getTrustedWsIps()
Gets a Comma-separated String of IP address regular expressions that are trusted for access to
non-discoverable items through the web service.
|
java.lang.String[] |
getTrustedWsIpsArray()
Gets an array of IP address regular expressions that are trusted for access to non-discoverable items
through the web service.
|
int |
getUpdateFrequency()
Gets the interval by which the index is updated to check for changes in the meatdata files, in minutes.
|
java.lang.String |
getValidateRecords()
Gets the getValidateRecords attribute, which is true|false.
|
VirtualSearchFieldMapper |
getVirtualSearchFieldMapper()
Gets the VirtualSearchFieldMapper that defines the virtual field/term definitions for this
RepositoryManager.
|
XMLConversionService |
getXMLConversionService()
Gets the XMLConversionService used by this RepositoryManager, or null if none available.
|
boolean |
indexCollection(java.lang.String set,
FileIndexingObserver observer,
boolean indexAll)
Instructs the repository to index all of the files for the given set/collection.
|
void |
indexFiles(FileIndexingObserver observer,
boolean indexAll)
Instructs the repository to index all of it's files.
|
int |
init(boolean indexCollectionRecords)
Init method initializes the data for serving.
|
boolean |
isDirectoryConfigured(java.io.File sourceDirectory)
Determines whether the given directory is configured in the repository.
|
boolean |
isIdInRepository(java.lang.String id)
Determines whether the given ID is in the repository.
|
boolean |
isIndexing()
Determins whether indexing is in progress.
|
boolean |
isSetConfigured(java.lang.String set)
Determines whether the given set is currently configured in this repository.
|
boolean |
isSetDisabled(java.lang.String set)
Determines whether the given set is currently disabled in this repository.
|
boolean |
isSetEnabled(java.lang.String set)
Determines whether the given set is currently enabled in this repository.
|
boolean |
isSetInIndex(java.lang.String set)
Determines whether the given set is in the repository index.
|
boolean |
isStemmingEnabled()
Deprecated.
As of 12/2004, stemming behavior is controlled by properties set in the RepositoryManager
config.
|
void |
loadCollectionRecords(boolean indexCollectionRecs)
Loads the collections found in the collection-level records.
|
void |
loadListSetsConfigFile()
Loads the OAI sets configuration from file and configures the corresponding set mappings in this
repository.
|
protected void |
prtln(java.lang.String s)
Output a line of text to standard out, with datestamp, if debug is set to true.
|
protected void |
prtlnErr(java.lang.String s)
Output a line of text to error out, with datestamp.
|
java.lang.String |
putCollection(java.lang.String collectionKey,
java.lang.String xmlFormat,
java.lang.String title,
java.lang.String description,
java.lang.String additionalMetadata)
Put a collection in the repository.
|
java.lang.String |
putRecord(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String collection,
java.lang.String id,
boolean saveXmlAsFile)
Puts a record into the repository, replacing the existing record if one exists.
|
java.lang.String |
putRecord(java.lang.String recordXml,
java.lang.String xmlFormat,
java.lang.String collection,
java.lang.String id,
FileIndexingPlugin indexingPlugin,
boolean saveXmlAsFile)
Puts a record into the repository, replacing the existing record if one exists.
|
java.lang.String |
reindexRecord(java.lang.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.
|
void |
reloadConfigFiles()
Instructs the RepositoryManager to re-read and re-load the values found in it's configuration files.
|
void |
removeAdminEmail(int i)
Removes the given admin e-mail at the given ArrayList index from the repository.
|
void |
removeAdminEmail(java.lang.String email)
Removes the given admin e-mail from the repository.
|
void |
removeCompression(int i)
Removes the given compression item.
|
void |
removeCompression(java.lang.String value)
Removes the given compression value.
|
void |
removeDescription(int i)
Remove the given descrtiption item from the repository.
|
void |
removeDescription(java.lang.String value)
Remove the given desctiption from the repository.
|
boolean |
removeMetadataNamespace(java.lang.String metadataPrefix)
Removes the metadata namespace for the given metadataPrefix (XML format).
|
boolean |
removeMetadataSchemaURL(java.lang.String metadataPrefix)
Removes the metadata schema URL for the given metadataPrefix (XML format).
|
boolean |
removeOAISetSpecDefinition(java.lang.String setSpec)
Removes the given OAI set definition from repository configuration.
|
SetInfo |
removeSetBySetSpec(java.lang.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.
|
void |
removeSetInfo(int i)
Removes the given set of files form the repository.
|
void |
removeSetInfo(SetInfo setInfo)
Remove the given set of files from the repository.
|
void |
replaceAdminEmail(int index,
java.lang.String email)
Add the given admin e-mail to the repository.
|
void |
replaceDescription(int index,
java.lang.String value)
Add the given admin Description to the repository.
|
void |
replaceSetInfo(int i,
SetInfo newSetInfo)
Replace a given SetInfo object with a new one, updating the index as appropriate.
|
void |
replaceSetInfo(java.lang.String key,
SetInfo newSetInfo)
Replace a given SetInfo object with a new one, updating the index as appropriate.
|
void |
resetBoostingFactorDefaults()
Resets the boosting factors to the default values.
|
void |
setAdditionalIndices(java.util.Hashtable additionalIndexers) |
static void |
setDebug(boolean db)
Sets the debug attribute of the object
|
void |
setDefaultXmlFormatInfo(java.lang.String info)
Sets the default schema and namespace for the given XML format, used in the OAI ListMetadataFormats
response.
|
void |
setDrcBoostFactor(double boostFactor)
Sets the boosting factor used to rank items in the DRC.
|
void |
setDupItemsIndex(SimpleLuceneIndex dupItemsIndex)
Sets the de-duping index to use.
|
void |
setFileIndexingPlugin(java.lang.String xmlFormat,
FileIndexingPlugin plugin)
Sets the fileIndexingPlugin that will be used during indexing.
|
void |
setGranularity(java.lang.String value)
Sets the granularity attribute of the RepositoryManager object.
|
void |
setHarvesterStatus(java.lang.String value)
Sets the harvesterStatus attribute of the RepositoryManager object
|
void |
setIdMapperExclusionFilePath(java.lang.String filePath)
Sets the path to an XML file the defines IDs that the IDMapper service should exclude from its list of
duplicates.
|
void |
setIsOaiPmhEnabled(boolean isEnabled)
Sets whether OAI-PMH ListRecords and ListIdentifiers functionality is enabled for this repository.
|
boolean |
setMetadataNamespace(java.lang.String metadataPrefix,
java.lang.String metadataNamespace)
Sets the metadata namespace for the given metadataPrefix (XML format).
|
boolean |
setMetadataSchemaURL(java.lang.String metadataPrefix,
java.lang.String metadataSchema)
Sets the metadata schema URL for the given metadataPrefix (XML format).
|
void |
setMetadataVocabAudienceDefault(java.lang.String audience)
Sets the metadataVocabAudienceDefault attribute of the RepositoryManager object
|
void |
setMetadataVocabLanguageDefault(java.lang.String language)
Sets the metadataVocabLanguageDefault attribute of the RepositoryManager object
|
void |
setMultiDocBoostFactor(double boostFactor)
Sets the boosting factor used to rank resources that are referenced by more than one record.
|
void |
setNumIdentifiersResults(java.lang.String value)
Sets the numIdentifiersResults per resumptionToken to be returned in OAI ListIdentifiers requests.
|
void |
setNumRecordsResults(java.lang.String value)
Sets the numRecordsResults per resumptionToken to be returned in OAI ListRecords requests.
|
void |
setOaiFilterQuery(java.lang.String luceneQuery)
Sets a Lucene query that filters the records served by the OAI data provider.
|
void |
setOAISetSpecDefinition(SetDefinitionsForm setDefinitionsForm)
Sets the definition for a given OAI set, initializing it in the repository and writing the ListSets
config XML to persistent file.
|
void |
setProviderBaseUrlEnding(java.lang.String baseUrlEnding)
Sets the end portion of the OAI baseURL that is being used, for example 'provider'.
|
void |
setProviderStatus(java.lang.String value)
Sets the status of the OAI data provider.
|
void |
setRecordsLocation(java.lang.String collectionRecordsLocation,
java.lang.String metadataRecordsLocation)
Sets the absolute path to the collectionRecordsLocation and the metadataRecordsLocation.
|
void |
setRemoveInvalidRecords(java.lang.String value)
Sets the removeInvalidRecords attribute.
|
void |
setRepositoryIdentifier(java.lang.String value)
Sets the oaiIdentifier attribute of the RepositoryManager object
|
void |
setRepositoryName(java.lang.String value)
Sets the repositoryName attribute of the RepositoryManager object
|
void |
setServerUrl(java.lang.String serverUrl)
Sets the serverUrl (scheme, hostname and port) displayed in the OAI data provider baseUrl and elsewhere.
|
void |
setStemmingBoostFactor(double boostFactor)
Deprecated.
As of 12/2004, stemming behavior is controlled by properties set in the
RepositoryManager config.
|
void |
setStemmingEnabled(boolean stemmingEnabled)
Deprecated.
As of 12/2004, stemming behavior is controlled by properties set in the
RepositoryManager config.
|
void |
setTitleBoostFactor(double boostFactor)
Deprecated.
As of 12/2004, boosting behavior is controlled by properties set in the
RepositoryManager config.
|
void |
setTrustedWsIps(java.lang.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.
|
void |
setValidateRecords(java.lang.String value)
Sets the setValidateRecords attribute.
|
void |
setXMLConversionService(XMLConversionService cs)
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.
|
void |
stopIndexing()
Instructs the indexer to stop indexing wherever its at in the process.
|
void |
updateVocab(MetadataVocab newVocab)
Update the current MetadataVocab with a new one.
|
public static final java.lang.String PLUGIN_ALL_FORMATS
setFileIndexingPlugin(String xmlFormat, FileIndexingPlugin plugin)
method that
the given plugin should be used when indexing all XML formats.public RepositoryManager(java.io.File repositoryConfigDir, java.lang.String repositoryDataDir, int updateFrequency, int maxFilesToIndex, boolean removeDocs)
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.public RepositoryManager(java.io.File repositoryConfigDir, java.io.File itemIndexerConfigDir, java.lang.String repositoryDataDir, java.lang.String indexLocation, java.lang.String indexingStartTime, java.lang.String indexingDaysOfWeek, RecordDataService recordDataService, boolean removeDocs, boolean reindexAllFiles)
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).public void setAdditionalIndices(java.util.Hashtable additionalIndexers)
public int init(boolean indexCollectionRecords)
indexCollectionRecords
- True to index the collections records when calledpublic void destroy()
public SimpleLuceneIndex getIndex()
public void deleteIndex()
public void stopIndexing()
public boolean isIndexing()
public void setDupItemsIndex(SimpleLuceneIndex dupItemsIndex)
dupItemsIndex
- The new dupItemsIndex valuepublic long getIndexLastModifiedCount()
public long getSetStatusModifiedTime()
public java.util.ArrayList getIndexingMessages()
public java.io.File getConfigDir()
public java.lang.String getIdMapperExclusionFilePath()
public void setIdMapperExclusionFilePath(java.lang.String filePath)
filePath
- The new idMapperExclusionFilePath value, or null to specify nonepublic int getUpdateFrequency()
public java.util.Date getIndexingStartTime()
public int[] getIndexingDaysOfWeek()
public void updateVocab(MetadataVocab newVocab)
newVocab
- The new MetadataVocab object.public void setMetadataVocabAudienceDefault(java.lang.String audience)
audience
- The new metadataVocabAudienceDefault valuepublic java.lang.String getMetadataVocabAudienceDefault()
public void setMetadataVocabLanguageDefault(java.lang.String language)
language
- The new metadataVocabLanguageDefault valuepublic java.lang.String getMetadataVocabLanguageDefault()
public FileIndexingService getFileIndexingService()
public java.lang.String getNumIdentifiersResults()
public void setNumIdentifiersResults(java.lang.String value)
value
- The new numIdentifiersResults valuepublic java.lang.String getRemoveInvalidRecords()
public void setRemoveInvalidRecords(java.lang.String value)
value
- The String "true" or "false".public java.lang.String getValidateRecords()
public void setValidateRecords(java.lang.String value)
value
- The String "true" or "false".public java.lang.String getNumRecordsResults()
public void setNumRecordsResults(java.lang.String value)
value
- The new numRecordsResults valuepublic java.lang.String getExampleID()
public java.lang.String getProviderStatus()
public void setProviderStatus(java.lang.String value) throws java.lang.Exception
value
- The new providerStatus value [ENABLED or DISABLED]java.lang.Exception
- NOT YET DOCUMENTEDpublic java.lang.String getHarvesterStatus()
public void setHarvesterStatus(java.lang.String value)
value
- The new harvesterStatus value [ENABLED or DISABLED]public java.lang.String getRepositoryIdentifier()
public java.lang.String getOaiIdPrefix()
public void setRepositoryIdentifier(java.lang.String value)
value
- The new oaiIdentifier valuepublic java.lang.String getProtocolVersion()
public java.lang.String getRepositoryName()
public void setRepositoryName(java.lang.String value)
value
- The new repositoryName valuepublic java.lang.String getEarliestDatestamp()
public java.lang.String getDeletedRecord()
public java.lang.String getGranularity()
public void setGranularity(java.lang.String value)
value
- The new granularity valuepublic void setProviderBaseUrlEnding(java.lang.String baseUrlEnding)
baseUrlEnding
- The new providerBaseUrlEnding valuepublic void setServerUrl(java.lang.String serverUrl)
serverUrl
- The new serverUrl valuepublic java.lang.String getProviderBaseUrl(javax.servlet.http.HttpServletRequest req)
req
- The request.public java.util.ArrayList getCompressions()
public void addCompression(java.lang.String value)
value
- The feature to be added to the Compression attributepublic void removeCompression(java.lang.String value)
value
- The compression value to remove.public void removeCompression(int i)
i
- The compression ArrayList item to remove.public java.util.ArrayList getDescriptions()
public java.lang.String getDescription(int i)
i
- The index of the description to removepublic void addDescription(java.lang.String value)
value
- The feature to be added to the Description attributepublic void replaceDescription(int index, java.lang.String value)
index
- The index.value
- The new descriptionpublic void removeDescription(java.lang.String value)
value
- The description to remove.public void removeDescription(int i)
i
- The description ArrayList index to remove.public java.lang.String[] getTrustedWsIpsArray()
String IP = "128.66.45.88";
boolean isAuthorized = IP.matches(getTrustedWsIpsArray()[0]);
public java.lang.String getTrustedWsIps()
public void setTrustedWsIps(java.lang.String value)
value
- The new trustedWsIps valuepublic ResultDoc getRecord(java.lang.String id)
id
- The ID for the itempublic org.apache.lucene.search.Query getDisabledSetsQuery()
public ResultDoc getRecordOai(java.lang.String id)
id
- The ID for the itemsetOaiFilterQuery(java.lang.String)
,
getOaiQueryResults(String format,String set,String from,String until)
public ResultDocList getOaiQueryResults(java.lang.String format, java.lang.String set, java.lang.String from, java.lang.String until) throws java.lang.Exception
format
- The metadata format.set
- The set, or null.from
- The from time, or null.until
- The until time, or null.java.lang.Exception
- If error occues, exception will contain a messagegetRecord(String id)
public ResultDocList getOdlQueryResults(java.lang.String format, java.lang.String set, java.lang.String from, java.lang.String until, java.lang.String queryString) throws java.lang.Exception
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.java.lang.Exception
- If error occues, exception will contain a message meant for human consumption in
response error messages.setOaiFilterQuery(java.lang.String)
public void setOaiFilterQuery(java.lang.String luceneQuery) throws org.apache.lucene.queryParser.ParseException
luceneQuery
- The Lucene query to filter recordsorg.apache.lucene.queryParser.ParseException
- If query parse errorpublic java.util.ArrayList getFormatsThatCanBeConvertedToFormat(java.lang.String format)
format
- The target format.public java.util.ArrayList getFormatsThatCanBeConvertedToFormats(java.lang.String[] formats)
formats
- Formats that we want converted to.public final java.lang.String getConvertableFormatsQuery(java.lang.String toFormat)
toFormat
- The xml format to convert topublic java.util.ArrayList getIndexedSets()
getSetSearchKeys()
public java.util.List getSetSearchKeys()
getIndexedSets()
public java.util.List getIndexedAccessionStatuses()
public java.util.List getIndexedIdMapperErrors()
public boolean isIdInRepository(java.lang.String id)
id
- An ID.public boolean isSetInIndex(java.lang.String set)
set
- A set.isSetConfigured(String set)
public boolean canDisseminateFormat(java.lang.String format)
format
- The format.public final java.util.Hashtable getAvailableFormats()
getConfiguredFormats()
public java.util.List getAvailableFormatsList(java.lang.String id)
id
- The id for the record.public java.util.List getAvailableFormatsList()
public java.util.List getIndexedFormats()
public java.util.Hashtable getAvailableFormats(java.lang.String id)
id
- The id for the record.public boolean isSetConfigured(java.lang.String set)
set
- The set key, for example 'dcc'isSetInIndex(String set)
public boolean isDirectoryConfigured(java.io.File sourceDirectory)
sourceDirectory
- A directory of metadata files.public boolean isSetEnabled(java.lang.String set)
set
- The name of the set or, if the vocab mgr is being used, the name of the encoded set key.public boolean isSetDisabled(java.lang.String set)
set
- The name of the set or, if the vocab mgr is being used, the name of the encoded set key.public java.util.ArrayList getConfiguredSets()
public java.util.HashMap getConfiguredSetInfos()
public java.util.ArrayList getConfiguredFormats()
getAvailableFormats()
public java.util.ArrayList getEnabledSets()
public java.util.HashMap getEnabledSetsHashMap()
public java.util.HashMap getDisabledSetsHashMap()
public final java.lang.String getEnabledSetsQuery()
public final java.lang.String getDiscoverableItemsQuery()
public final java.lang.String getDiscoverableRecordsQuery()
public final org.apache.lucene.search.Query getDiscoverableOaiRecordsQuery()
Refactoring note: Consider using this for method getDiscoverableRecordsQuery()
instead.
public final int getNumDiscoverableADNResources()
public final int getNumDiscoverableResources()
public final java.lang.String getDrcBoostingQuery()
public final java.lang.String getAbsoluteDrcBoostingQuery()
public final java.lang.String getMultiDocBoostingQuery()
public java.lang.String getDrcBoostFactor()
public java.lang.String getMultiDocBoostFactor()
public void setMultiDocBoostFactor(double boostFactor) throws java.lang.Exception
boostFactor
- The new boosting factor used to rank items in multiple records.java.lang.Exception
- If error.public void setIsOaiPmhEnabled(boolean isEnabled)
isEnabled
- False to disable regular ListRecord and ListIdentifier OAI-PMH responsespublic boolean getIsOaiPmhEnabled()
public void setDrcBoostFactor(double boostFactor) throws java.lang.Exception
boostFactor
- The new boosting factor used to rank items in the DRC.java.lang.Exception
- If error.public java.lang.String getTitleBoostFactor()
public void setTitleBoostFactor(double boostFactor) throws java.lang.Exception
boostFactor
- The boosting factor used to rank items with matching terms in the title field.java.lang.Exception
- If errorpublic void resetBoostingFactorDefaults() throws java.lang.Exception
java.lang.Exception
- If errorpublic java.lang.String getStemmingBoostFactor()
public void setStemmingBoostFactor(double boostFactor) throws java.lang.Exception
boostFactor
- The boosting factor used to rank items with matching stemmed terms.java.lang.Exception
- If error.public boolean isStemmingEnabled()
public void setStemmingEnabled(boolean stemmingEnabled)
stemmingEnabled
- true to enable stemming, false to disable it.public org.apache.lucene.search.Query getExpandedSearchQuery(java.lang.String queryString) throws org.apache.lucene.queryParser.ParseException
queryString
- The query Stringorg.apache.lucene.queryParser.ParseException
- If error parsing the query StringgetDefaultSearchFields()
,
getFieldsUsedForBoosting()
,
getBoostingValues()
,
getVirtualSearchFieldMapper()
public java.lang.String[] getDefaultSearchFields()
reloadConfigFiles()
public java.lang.String[] getFieldsUsedForBoosting()
reloadConfigFiles()
public java.util.Map getBoostingValues()
reloadConfigFiles()
public void reloadConfigFiles()
public java.util.ArrayList getDisabledSets()
public java.util.ArrayList getSetInfos()
SetInfo
public void enableSet(java.lang.String setUid)
setUid
- The set Uidpublic void disableSet(java.lang.String setUid)
setUid
- The set Uidpublic java.util.HashMap getSetInfosHashMap()
SetInfo
public java.util.ArrayList getSetInfosCopy()
SetInfo
public SetInfo getSetInfo(int i)
i
- The index into the SetInfo.public SetInfo getSetInfo(java.lang.String key)
key
- The set key, for example 'dcc'public SetInfo getSetInfoCopy(int i)
i
- The index into the SetInfo.public void addSetInfo(SetInfo setInfo) throws java.lang.Exception
setInfo
- The SetInfo to add to the reposigory configuration.java.lang.Exception
- If one of the directories is already configured or none is specified.public void removeSetInfo(SetInfo setInfo)
setInfo
- The set info to remove.SetInfo
public void removeSetInfo(int i)
i
- The index of the SetInfo to remove.SetInfo
public SetInfo removeSetBySetSpec(java.lang.String setSpec)
setSpec
- The setSpec, or collection, to remove for example 'dcc'public void replaceSetInfo(java.lang.String key, SetInfo newSetInfo)
key
- The set key for the set to replace, for example 'dcc'newSetInfo
- The new SetInfopublic void replaceSetInfo(int i, SetInfo newSetInfo)
i
- The index into the array of SetInfos to removenewSetInfo
- The new SetInfopublic int getNumIndexingErrors()
public ResultDocList getIndexingErrorDocs()
ErrorDocReader
public int getNumRecordsInIndex()
getAllRecordsInIndex()
public ResultDocList getAllRecordsInIndex()
getNumRecordsInIndex()
public int getNumDeletedDocs()
public int getNumNonDeletedDocs()
public int getNumDeletedDocsNotFromAnyDirectory()
getDeletedDocsNotFromAnyDirectory()
public final ResultDocList getDeletedDocsNotFromAnyDirectory()
getNumDeletedDocsNotFromAnyDirectory()
public final org.apache.lucene.search.Query getDeletedDocsNotFromAnyDirectoryQuery()
getDeletedDocsNotFromAnyDirectory()
public final void setFileIndexingPlugin(java.lang.String xmlFormat, FileIndexingPlugin plugin)
#init()
method. 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.
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 PerFieldAnalyzer
for details.
xmlFormat
- The XML format for which this plugin is used or PLUGIN_ALL_FORMATS
to specify
that the plugin should be used with all formatsplugin
- The FileIndexingPlugin that will be usedPLUGIN_ALL_FORMATS
public java.lang.String putRecord(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String collection, java.lang.String id, boolean saveXmlAsFile) throws RecordUpdateException
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 indexRecordUpdateException
- If unable to insert the record for any reasonpublic java.lang.String putRecord(java.lang.String recordXml, java.lang.String xmlFormat, java.lang.String collection, java.lang.String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile) throws RecordUpdateException
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 indexRecordUpdateException
- If unable to insert the record for any reasonpublic boolean deleteRecord(java.lang.String id) throws java.lang.Exception
id
- The unique identifier for the record, for example DLESE-000-000-000-001.java.lang.Exception
- If unable to delete the record for any reasonpublic java.lang.String reindexRecord(java.lang.String id, FileIndexingPlugin indexingPlugin, boolean saveXmlAsFile, boolean indexRelations) throws RecordUpdateException
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 forRecordUpdateException
- If record ID does not exist or unable to reindex the record for any
reasonpublic final void indexFiles(FileIndexingObserver observer, boolean indexAll)
getIndexingMessages()
.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 onlypublic final boolean indexCollection(java.lang.String set, FileIndexingObserver observer, boolean indexAll)
getIndexingMessages()
.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 onlypublic final void setRecordsLocation(java.lang.String collectionRecordsLocation, java.lang.String metadataRecordsLocation)
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.public java.lang.String getCollectionRecordsLocation()
public java.lang.String getMetadataRecordsLocation()
public java.lang.String putCollection(java.lang.String collectionKey, java.lang.String xmlFormat, java.lang.String title, java.lang.String description, java.lang.String additionalMetadata) throws PutCollectionException
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 nonePutCollectionException
- If error occurs, indicates the type of errorpublic boolean deleteCollection(java.lang.String collectionKey) throws java.lang.Exception
collectionKey
- The unique collection key, for example 'dcc'java.lang.Exception
- Description of the Exceptionpublic void loadCollectionRecords(boolean indexCollectionRecs)
indexCollectionRecs
- True to index the collection records, false not to.public RecordDataService getRecordDataService()
public java.util.ArrayList getAdminEmails()
public java.lang.String getAdminEmail(int i)
i
- The index of the e-mail to getpublic void addAdminEmail(java.lang.String email)
email
- The admin e-mail to be added.public void replaceAdminEmail(int index, java.lang.String email)
email
- The admin e-mail to be added.index
- DESCRIPTIONpublic void removeAdminEmail(java.lang.String email)
email
- The admin e-mail to be removed.public void removeAdminEmail(int i)
i
- The admin e-mail ArrayList index to be removed.public boolean setMetadataNamespace(java.lang.String metadataPrefix, java.lang.String metadataNamespace)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annometadataNamespace
- The namspace URI for the given XML formatpublic java.lang.String getMetadataNamespace(java.lang.String metadataPrefix)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annopublic boolean removeMetadataNamespace(java.lang.String metadataPrefix)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annopublic java.util.Map getMetadataNamespaces()
public boolean setMetadataSchemaURL(java.lang.String metadataPrefix, java.lang.String metadataSchema)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annometadataSchema
- The schema URL for the given XML formatpublic java.lang.String getMetadataSchemaURL(java.lang.String metadataPrefix)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annopublic boolean removeMetadataSchemaURL(java.lang.String metadataPrefix)
metadataPrefix
- The metadata specifier, for example oai_dc, adn, dlese_annopublic java.util.Map getMetadataSchemaURLs()
public void setDefaultXmlFormatInfo(java.lang.String info) throws java.lang.Exception
info
- String of the form [metadataPrefix]|[schema]|[namespace]java.lang.Exception
- If unable to parse the String properlypublic void setXMLConversionService(XMLConversionService cs)
cs
- The new XMLConversionService.public XMLConversionService getXMLConversionService()
public java.io.File getRepositoryDataDir() throws java.lang.Exception
java.lang.Exception
- If errorpublic java.io.File getItemIndexerConfigDir() throws java.lang.Exception
java.lang.Exception
- If errorpublic java.lang.String getListSetsConfigXml()
public void loadListSetsConfigFile() throws java.lang.Exception
java.lang.Exception
- If error parsing or loading the configpublic boolean removeOAISetSpecDefinition(java.lang.String setSpec)
setSpec
- The set to removepublic void setOAISetSpecDefinition(SetDefinitionsForm setDefinitionsForm) throws java.lang.Exception
setDefinitionsForm
- A bean holding the set definiton infojava.lang.Exception
- If errorpublic boolean getHasOaiSetsConfigured()
public boolean getHasOaiSetConfigured(java.lang.String setSpec)
setSpec
- The OAI setSpecpublic java.lang.String[] getOaiSets()
public org.apache.lucene.search.Query getOaiSetQuery(java.lang.String setSpec)
setSpec
- The OAI setSpecpublic java.util.List getOaiSetsForId(java.lang.String id)
id
- The record ID (without OAI prefix)public int getNumRecordsInSet(java.lang.String setSpec)
setSpec
- The OAI setSpecgetNumDeletedRecordsInSet(java.lang.String)
public int getNumDeletedRecordsInSet(java.lang.String setSpec)
setSpec
- The OAI setSpecgetNumRecordsInSet(java.lang.String)
public VirtualSearchFieldMapper getVirtualSearchFieldMapper()
protected static final java.lang.String getDateStamp()
protected final void prtlnErr(java.lang.String s)
s
- The text that will be output to error out.protected final void prtln(java.lang.String s)
s
- The String that will be output.public static void setDebug(boolean db)
db
- The new debug value