org.opencms.search
Class CmsSearchIndexSource

java.lang.Object
  extended byorg.opencms.search.CmsSearchIndexSource
All Implemented Interfaces:
java.lang.Comparable

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

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

Since:
6.0.0
Version:
$Revision: 1.13 $
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 key/name of a document type.
 void addResourceName(java.lang.String resourceName)
          Adds the path of a Cms resource.
 int compareTo(java.lang.Object o)
          Compares the internal name Strings of this instance and the argument casted to this type.
 boolean equals(java.lang.Object obj)
          Implemented to be consistent with overridden method compareTo(Object).
 java.util.List getDocumentTypes()
          Returns the list of Cms resource 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 getParams()
          Returns the map of optional key/value parameters.
 java.util.List getResourcesNames()
          Returns the list of Cms resources to be indexed.
 int hashCode()
          Overriden to be consistents with overridden method equals(Object).
 boolean removeDocumentType(java.lang.String key)
          Removes the key/name of a document type.
 void setDocumentTypes(java.util.List documentTypes)
          Sets the list of Cms resource types 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 params)
          Sets the map of optional key/value parameters.
 void setResourcesNames(java.util.List 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 key/name of a document type.

Parameters:
key - the key/name of a document type

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(java.lang.Object o)
              throws java.lang.ClassCastException
Compares the internal name Strings of this instance and the argument casted to this type.

Note that this method only should return 0 for the statement a.compareTo(a) as the name of a indexsource has to be unique within OpenCms.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - another indexsource.
Returns:
the comparison result (as specified in String.compareTo(java.lang.String) for the name member of both indexsource instances involved.
Throws:
java.lang.ClassCastException - if the given argument is not assignable from this class.
See Also:
Comparable.compareTo(java.lang.Object)

equals

public boolean equals(java.lang.Object obj)
Implemented to be consistent with overridden method compareTo(Object).

Note that this method only should return true for the statement a.compareTo(a) as the name of a indexsource has to be unique within OpenCms.

Parameters:
obj - another indexsource.
Returns:
true if compareTo(Object) with this argument returns 0, false else.
See Also:
Object.equals(java.lang.Object)

getDocumentTypes

public java.util.List getDocumentTypes()
Returns the list of Cms resource types to be indexed.

Returns:
the list of Cms resource 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 getParams()
Returns the map of optional key/value parameters.

Returns:
the map of optional key/value parameters

getResourcesNames

public java.util.List getResourcesNames()
Returns the list of Cms resources to be indexed.

Returns:
the list of Cms resources to be indexed

hashCode

public int hashCode()
Overriden to be consistents with overridden method equals(Object).

See Also:
Object.hashCode()

removeDocumentType

public boolean removeDocumentType(java.lang.String key)
Removes the key/name of a document type.

Parameters:
key - the key/name of a document type
Returns:
true if the given key was contained before thus could be removed successfully, false else.

setDocumentTypes

public void setDocumentTypes(java.util.List documentTypes)
Sets the list of Cms resource types to be indexed.

Parameters:
documentTypes - the list of Cms resource types 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 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 resources)
Sets the list of Cms resources to be indexed.

Parameters:
resources - the list of Cms resources (Strings) to be indexed