org.opencms.search
Class CmsSearchIndexSource

java.lang.Object
  extended by org.opencms.search.CmsSearchIndexSource
All Implemented Interfaces:
java.lang.Comparable<CmsSearchIndexSource>

public class CmsSearchIndexSource
extends java.lang.Object
implements java.lang.Comparable<CmsSearchIndexSource>

A search index source is a description of a list of Cms resources to be indexed.

Since:
6.0.0
Version:
$Revision: 1.20 $
Author:
Thomas Weckert

Constructor Summary
CmsSearchIndexSource()
          Creates a new CmsSearchIndexSource.
 
Method Summary
 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)
          Returns 0 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 by getName() is equal.
 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).
 boolean isContaining(java.lang.String rootPath)
          Returns true 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 documentType)
          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.
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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 parameter
value - 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)
Returns 0 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 interface java.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 by getName() is equal.

Note that the name of an index source has to be unique within OpenCms.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

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 class java.lang.Object
See Also:
Object.hashCode()

isContaining

public boolean isContaining(java.lang.String rootPath)
Returns true 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 documentType)
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.

Parameters:
rootPath - the resource root path to check
documentType - the document type factory name to check
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