Package org.opencms.search
Class CmsSearchIndexSource
- java.lang.Object
-
- org.opencms.search.CmsSearchIndexSource
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<CmsSearchIndexSource>
public class CmsSearchIndexSource extends java.lang.Object implements java.lang.Comparable<CmsSearchIndexSource>, java.io.Serializable
A search index source is a description of a list of Cms resources to be indexed.- Since:
- 6.0.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CmsSearchIndexSource()
Creates a new CmsSearchIndexSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConfigurationParameter(java.lang.String key, java.lang.String value)
Adds a parameter.void
addDocumentType(java.lang.String key)
Adds the name of a document type.void
addResourceName(java.lang.String resourceName)
Adds the path of a Cms resource.int
compareTo(CmsSearchIndexSource obj)
Returns0
if the given object is an index source with the same name.boolean
equals(java.lang.Object obj)
Two index sources are considered equal if their names as returned bygetName()
is equal.I_CmsDocumentFactory
getDocumentFactory(java.lang.String documentTypeKey)
Returns the document factory for given key.java.util.List<java.lang.String>
getDocumentTypes()
Returns the list of names (Strings) of the document types to be indexed.I_CmsIndexer
getIndexer()
Returns the indexer.java.lang.String
getIndexerClassName()
Returns the class name of the indexer.java.lang.String
getName()
Returns the logical key/name of this search index source.java.lang.String
getParam(java.lang.String key)
Returns the value for a specified parameter key.java.util.Map<java.lang.String,java.lang.String>
getParams()
Returns the map of optional key/value parameters.java.util.List<java.lang.String>
getResourcesNames()
Returns the list of VFS resources to be indexed.int
hashCode()
Overriden to be consistents with overridden method
.equals(Object)
void
init()
Initialization for search index sources.boolean
isContaining(java.lang.String rootPath)
Returnstrue
in case the given resource root path is contained in the list of configured resource names of this index source.boolean
isIndexing(java.lang.String rootPath, java.lang.String documentTypeKey)
Returnstrue
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source.boolean
removeDocumentType(java.lang.String key)
Removes the name of a document type from the list of configured types of this index source.void
setDocumentTypes(java.util.List<java.lang.String> documentTypes)
Sets the list of document type names (Strings) to be indexed.void
setIndexerClassName(java.lang.String indexerClassName)
Sets the class name of the indexer.void
setName(java.lang.String name)
Sets the logical key/name of this search index source.void
setParams(java.util.Map<java.lang.String,java.lang.String> params)
Sets the map of optional key/value parameters.void
setResourcesNames(java.util.List<java.lang.String> resources)
Sets the list of Cms resources to be indexed.
-
-
-
Constructor Detail
-
CmsSearchIndexSource
public CmsSearchIndexSource()
Creates a new CmsSearchIndexSource.
-
-
Method Detail
-
addConfigurationParameter
public void addConfigurationParameter(java.lang.String key, java.lang.String value)
Adds a parameter.- Parameters:
key
- the key/name of the parametervalue
- the value of the parameter
-
addDocumentType
public void addDocumentType(java.lang.String key)
Adds the name of a document type.- Parameters:
key
- the name of a document type to add
-
addResourceName
public void addResourceName(java.lang.String resourceName)
Adds the path of a Cms resource.- Parameters:
resourceName
- the path of a Cms resource
-
compareTo
public int compareTo(CmsSearchIndexSource obj)
Returns0
if the given object is an index source with the same name.Note that the name of an index source has to be unique within OpenCms.
- Specified by:
compareTo
in interfacejava.lang.Comparable<CmsSearchIndexSource>
- Parameters:
obj
- another index source- Returns:
0
if the given object is an index source with the same name- See Also:
Comparable.compareTo(java.lang.Object)
-
equals
public boolean equals(java.lang.Object obj)
Two index sources are considered equal if their names as returned bygetName()
is equal.Note that the name of an index source has to be unique within OpenCms.
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
getDocumentFactory
public I_CmsDocumentFactory getDocumentFactory(java.lang.String documentTypeKey)
Returns the document factory for given key.Note that only the keys resulting from the document types for this source set are taken into account.
- Parameters:
documentTypeKey
- the key for the factory to use.- Returns:
- a document factory or null
-
getDocumentTypes
public java.util.List<java.lang.String> getDocumentTypes()
Returns the list of names (Strings) of the document types to be indexed.- Returns:
- the list of names (Strings) of the document types to be indexed
-
getIndexer
public I_CmsIndexer getIndexer()
Returns the indexer.- Returns:
- the indexer
-
getIndexerClassName
public java.lang.String getIndexerClassName()
Returns the class name of the indexer.- Returns:
- the class name of the indexer
-
getName
public java.lang.String getName()
Returns the logical key/name of this search index source.- Returns:
- the logical key/name of this search index source
-
getParam
public java.lang.String getParam(java.lang.String key)
Returns the value for a specified parameter key.- Parameters:
key
- the parameter key/name- Returns:
- the value for the specified parameter key
-
getParams
public java.util.Map<java.lang.String,java.lang.String> getParams()
Returns the map of optional key/value parameters.- Returns:
- the map of optional key/value parameters
-
getResourcesNames
public java.util.List<java.lang.String> getResourcesNames()
Returns the list of VFS resources to be indexed.- Returns:
- the list of VFS resources to be indexed
-
hashCode
public int hashCode()
Overriden to be consistents with overridden method
.equals(Object)
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
init
public void init()
Initialization for search index sources.
-
isContaining
public boolean isContaining(java.lang.String rootPath)
Returnstrue
in case the given resource root path is contained in the list of configured resource names of this index source.- Parameters:
rootPath
- the resource root path to check- Returns:
true
in case the given resource root path is contained in the list of configured resource names of this index source- See Also:
getResourcesNames()
-
isIndexing
public boolean isIndexing(java.lang.String rootPath, java.lang.String documentTypeKey)
Returnstrue
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source.- Parameters:
rootPath
- the resource root path to checkdocumentTypeKey
- the document type key for which the presence of a factory name has to be checked- Returns:
true
in case the given resource root path is contained in the list of configured resource names, and the given document type name is contained in the list if configured document type names of this index source- See Also:
isContaining(String)
,getDocumentTypes()
-
removeDocumentType
public boolean removeDocumentType(java.lang.String key)
Removes the name of a document type from the list of configured types of this index source.- Parameters:
key
- the name of the document type to remove- Returns:
- true if the given document type name was contained before thus could be removed successfully, false otherwise
-
setDocumentTypes
public void setDocumentTypes(java.util.List<java.lang.String> documentTypes)
Sets the list of document type names (Strings) to be indexed.- Parameters:
documentTypes
- the list of document type names (Strings) to be indexed
-
setIndexerClassName
public void setIndexerClassName(java.lang.String indexerClassName) throws CmsIllegalArgumentException
Sets the class name of the indexer.An Exception is thrown to allow GUI-display of wrong input.
- Parameters:
indexerClassName
- the class name of the indexer- Throws:
CmsIllegalArgumentException
- if the given String is not a fully qualified classname (within this Java VM)
-
setName
public void setName(java.lang.String name) throws CmsIllegalArgumentException
Sets the logical key/name of this search index source.- Parameters:
name
- the logical key/name of this search index source- Throws:
CmsIllegalArgumentException
- if argument name is null, an empty or whitespace-only Strings or already used for another indexsource's name.
-
setParams
public void setParams(java.util.Map<java.lang.String,java.lang.String> params)
Sets the map of optional key/value parameters.- Parameters:
params
- the map of optional key/value parameters
-
setResourcesNames
public void setResourcesNames(java.util.List<java.lang.String> resources)
Sets the list of Cms resources to be indexed.- Parameters:
resources
- the list of Cms resources (Strings) to be indexed
-
-