Author: ogrisel
Date: Fri May 13 15:29:20 2011
New Revision: 1102791
URL: http://svn.apache.org/viewvc?rev=1102791&view=rev
Log:
batch formatting the solr yard before starting work on STANBOL-197
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/IndexDataTypeEnum.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/SolrConst.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/ConfigUtils.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrDirectoryManager.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/DefaultSolrServerProvider.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/EmbeddedSolrPorovider.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrFieldMapper.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrQueryFactory.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYard.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/SolrYardConfig.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/install/IndexInstallTask.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/install/IndexInstallerConstants.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/install/IndexRemoveTask.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/install/SolrIndexInstaller.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/AssignmentEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/DataTypeEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/FieldEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/GeEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/GtEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LangEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LeEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/LtEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/RegexEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/impl/queryencoders/WildcardEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/FieldMapper.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/IndexDataType.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/IndexField.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/IndexValue.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/IndexValueFactory.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/NoConverterException.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/TypeConverter.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/UnsupportedIndexTypeException.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/model/UnsupportedValueException.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/ConstraintTypePosition.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/EncodedConstraintParts.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/IndexConstraintTypeEncoder.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/query/IndexConstraintTypeEnum.java
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/utils/SolrUtil.java
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManagerTest.java
incubator/stanbol/trunk/entityhub/yard/solr/src/test/java/org/apache/stanbol/entityhub/yard/solr/SolrYardTest.java
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java?rev=1102791&r1=1102790&r2=1102791&view=diff
==============================================================================
---
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java
(original)
+++
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrDirectoryManager.java
Fri May 13 15:29:20 2011
@@ -31,56 +31,54 @@ import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
/**
- * Service that provides access to an managed Solr directory - a directory that
- * manages the files (configuration and data) needed to create a Solr Server.
<p>
- * Note that is only refers to the Files and not the Solr server (or
- * EmbeddedSolrServer). Users need to use the
- * {@link SolrServerProvider#getSolrServer(Type, String, String...)} to get an
- * {@link SolrServer} instance based on the directory provided by this
- * Interface.<p>
- * The {@link #MANAGED_SOLR_DIR_PROPERTY} property can be used to define the
location
- * of the internally managed index. Implementations need to load this property
- * by the {@link ComponentContext} if running within an OSGI container or
- * otherwise use the system properties. In cases a relative path is configured
- * the "user.dir" need to be used as base. Implementations need also to provide
- * an default value in case no configuration is present.<br>
- * Implementations need also support property substitution based on the system
- * properties for the {@link #MANAGED_SOLR_DIR_PROPERTY}. E.g. parsing the
value
- * "${user.home}/.stanbol/indexes" will create the managed solr indexes within
- * the home directory of the user.<p>
- * This Service is also useful if one needs to initialise an own Solr Core
- * for the manage Solr Server. In this case the {@link #getManagedDirectory()}
- * method can be used to get the managed Solr directory and new indices can be
- * added as sub directories. Utility methods for initialising cores are
available
- * as part of the {@link ConfigUtils}.
+ * Service that provides access to an managed Solr directory - a directory
that manages the files
+ * (configuration and data) needed to create a Solr Server.
+ * <p>
+ * Note that is only refers to the Files and not the Solr server (or
EmbeddedSolrServer). Users need to use
+ * the {@link SolrServerProvider#getSolrServer(Type, String, String...)} to
get an {@link SolrServer} instance
+ * based on the directory provided by this Interface.
+ * <p>
+ * The {@link #MANAGED_SOLR_DIR_PROPERTY} property can be used to define the
location of the internally
+ * managed index. Implementations need to load this property by the {@link
ComponentContext} if running within
+ * an OSGI container or otherwise use the system properties. In cases a
relative path is configured the
+ * "user.dir" need to be used as base. Implementations need also to provide an
default value in case no
+ * configuration is present.<br>
+ * Implementations need also support property substitution based on the system
properties for the
+ * {@link #MANAGED_SOLR_DIR_PROPERTY}. E.g. parsing the value
"${user.home}/.stanbol/indexes" will create the
+ * managed solr indexes within the home directory of the user.
+ * <p>
+ * This Service is also useful if one needs to initialise an own Solr Core for
the manage Solr Server. In this
+ * case the {@link #getManagedDirectory()} method can be used to get the
managed Solr directory and new
+ * indices can be added as sub directories. Utility methods for initialising
cores are available as part of
+ * the {@link ConfigUtils}.
*
* @author Rupert Westenthaler
- *
+ *
*/
public interface SolrDirectoryManager {
/**
- * This property can be used to configure the location of the internally
- * managed EmbeddedSolrServer.<p>
- * Configuring an absolute path (starting with {@link File#separatorChar})
- * will cause the index to be initialised in this directory.<p>
- * Configuring an relative value will use <ul>
- * <li> the working directory (<code>Systen.getProperty("user.dir")</code>)
- * outside of an OSGI environment
- * <li> the data directory provided by the SolrYard bundle (by calling
- * {@link BundleContext#getDataFile(String)} with the relative path.
+ * This property can be used to configure the location of the internally
managed EmbeddedSolrServer.
+ * <p>
+ * Configuring an absolute path (starting with {@link File#separatorChar})
will cause the index to be
+ * initialised in this directory.
+ * <p>
+ * Configuring an relative value will use
+ * <ul>
+ * <li>the working directory (<code>Systen.getProperty("user.dir")</code>)
outside of an OSGI environment
+ * <li>the data directory provided by the SolrYard bundle (by calling
+ * {@link BundleContext#getDataFile(String)} with the relative path.
* </ul>
- * In case this property is not present the {@link #DEFAULT_SOLR_DATA_DIR}
- * (an relative path) is used.
+ * In case this property is not present the {@link #DEFAULT_SOLR_DATA_DIR}
(an relative path) is used.
*/
String MANAGED_SOLR_DIR_PROPERTY =
"org.apache.stanbol.entityhub.yard.solr.managedSolrDir";
/**
- * Default value for the relative path used if the {@link
#MANAGED_SOLR_DIR_PROPERTY}
- * is not present. It is not required that implementations use this as
default.
+ * Default value for the relative path used if the {@link
#MANAGED_SOLR_DIR_PROPERTY} is not present. It
+ * is not required that implementations use this as default.
*/
String DEFAULT_SOLR_DATA_DIR = "indexes";
- /**
+/**
* Checks if a solrIndex with the parsed name is managed or not. Note that
* an Index might be managed, but not yet be initialised. To check if an
* index is managed and can be used use {@link #isInitialisedIndex(String)
@@ -93,85 +91,103 @@ public interface SolrDirectoryManager {
* @throws IllegalArgumentException In case <code>null</code> or an empty
* string is parsed as solrIndexName
*/
- boolean isManagedIndex(String solrIndexName) throws
IllegalStateException,IllegalArgumentException;
+ boolean isManagedIndex(String solrIndexName) throws IllegalStateException,
IllegalArgumentException;
+
/**
- * Checks if the managed index is also initialised and ready to be used.<p>
- * Indexes are managed as soon as they are announced to the
- * SolrDirectoryManager. However when using the
- * {@link #createSolrDirectory(String, String, Properties)} it can not be
- * assured that the archive with the actual data is already available.<p>
- * @param indexName the name of the index
+ * Checks if the managed index is also initialised and ready to be used.
+ * <p>
+ * Indexes are managed as soon as they are announced to the
SolrDirectoryManager. However when using the
+ * {@link #createSolrDirectory(String, String, Properties)} it can not be
assured that the archive with
+ * the actual data is already available.
+ * <p>
+ *
+ * @param indexName
+ * the name of the index
* @return
* @throws IllegalStateException
* @throws IllegalArgumentException
*/
- boolean isInitialisedIndex(String indexName) throws
IllegalStateException,IllegalArgumentException;
+ boolean isInitialisedIndex(String indexName) throws IllegalStateException,
IllegalArgumentException;
/**
- * Getter for all the indexes currently available in the managed solr
directory.
- * The key is the name of the index and the value is the File pointing to
the
- * directory. For uninitialised indexes the value will be
<code>null</code>.
+ * Getter for all the indexes currently available in the managed solr
directory. The key is the name of
+ * the index and the value is the File pointing to the directory. For
uninitialised indexes the value will
+ * be <code>null</code>.
+ *
* @return map containing all the currently available indexes
- * @throws IllegalStateException In case the managed Solr directory can not
- * be obtained (usually indicates that this component is currently
- * deactivated) or initialised.
+ * @throws IllegalStateException
+ * In case the managed Solr directory can not be obtained
(usually indicates that this
+ * component is currently deactivated) or initialised.
*/
Map<String,File> getManagedIndices() throws IllegalStateException;
/**
- * Getter for the directory of the parsed index. Implementations need to
- * ensure that returned directories are valid Solr indices (or Solr
Cores)<p>
- * Directories returned by this method are typically used as second
parameter
- * of {@link SolrServerProvider#getSolrServer(Type, String, String...)} to
- * create an {@link SolrServer} instance.<p>
- * This method may trigger the initialisation of the SolrIndex if not
already
- * done.<p>
- * This method needs to wait until the initialisation of the index i
- * completed (even in multi threaded environments) <p>
- * @param solrPathOrUri the name of the requested solr index. If no index
- * with that name does exist a new one will be initialised base on the
- * default core configuration part of this bundle.
- * @param allowDefaultInit If <code>true</code> the Solr Index can be
initialised
- * with the default configuration if not already present.
- * @return the directory (instanceDir) of the index or <code>null</code> if
- * <code>false</code> was parsed as allowDefaultInit and the data for the
index
- * are not yet available.
- * @throws IllegalArgumentException if the parsed solrIndexName is
- * <code>null</code> or empty
+ * Getter for the directory of the parsed index. Implementations need to
ensure that returned directories
+ * are valid Solr indices (or Solr Cores)
+ * <p>
+ * Directories returned by this method are typically used as second
parameter of
+ * {@link SolrServerProvider#getSolrServer(Type, String, String...)} to
create an {@link SolrServer}
+ * instance.
+ * <p>
+ * This method may trigger the initialisation of the SolrIndex if not
already done.
+ * <p>
+ * This method needs to wait until the initialisation of the index i
completed (even in multi threaded
+ * environments)
+ * <p>
+ *
+ * @param solrPathOrUri
+ * the name of the requested solr index. If no index with that
name does exist a new one will
+ * be initialised base on the default core configuration part
of this bundle.
+ * @param allowDefaultInit
+ * If <code>true</code> the Solr Index can be initialised with
the default configuration if not
+ * already present.
+ * @return the directory (instanceDir) of the index or <code>null</code>
if <code>false</code> was parsed
+ * as allowDefaultInit and the data for the index are not yet
available.
+ * @throws IllegalArgumentException
+ * if the parsed solrIndexName is <code>null</code> or empty
*/
- File getSolrIndexDirectory(final String solrIndexName,boolean
allowDefaultInit) throws IllegalArgumentException;
+ File getSolrIndexDirectory(final String solrIndexName, boolean
allowDefaultInit) throws IllegalArgumentException;
+
/**
* Creates a new Solr Index based on the data in the provided {@link
ArchiveInputStream}
- * @param solrIndexName the name of the index to create
- * @param ais the stream providing the data for the new index
+ *
+ * @param solrIndexName
+ * the name of the index to create
+ * @param ais
+ * the stream providing the data for the new index
* @return the directory (instanceDir) of the index.
- * @throws IOException On any error while reading from the parsed input
stream
- * @throws IllegalArgumentException if the parsed solrIndexName is
- * <code>null</code> or empty
- */
- File createSolrIndex(final String solrIndexName, ArchiveInputStream ais)
throws IllegalArgumentException, IOException;
+ * @throws IOException
+ * On any error while reading from the parsed input stream
+ * @throws IllegalArgumentException
+ * if the parsed solrIndexName is <code>null</code> or empty
+ */
+ File createSolrIndex(final String solrIndexName, ArchiveInputStream ais)
throws IllegalArgumentException,
+
IOException;
/**
- * Creates a new Solr Index based on looking up the Index data via the
- * {@link DataFileProvider} service
- * @param solrIndexName The name of the solrIndex to create
- * @param indexPath the name of the dataFile looked up via the {@link
DataFileProvider}
- * @param propergies Additional properties describing the index
- * @return the directory (instanceDir) of the index or null if the index
- * data could not be found
+ * Creates a new Solr Index based on looking up the Index data via the
{@link DataFileProvider} service
+ *
+ * @param solrIndexName
+ * The name of the solrIndex to create
+ * @param indexPath
+ * the name of the dataFile looked up via the {@link
DataFileProvider}
+ * @param propergies
+ * Additional properties describing the index
+ * @return the directory (instanceDir) of the index or null if the index
data could not be found
* @throws IllegalArgumentException
* @throws IOException
*/
- File createSolrDirectory(final String solrIndexName, String
indexPath,Properties propergies) throws IllegalArgumentException, IOException;
+ File createSolrDirectory(final String solrIndexName, String indexPath,
Properties propergies) throws IllegalArgumentException,
+
IOException;
/**
* Getter for the managed Solr Directory.
- * @return the directory of the Solr Home used for the internally managed
- * {@link CoreContainer} or <code>null</code> if running within an OSGI
- * Environment and this component is deactivated.
- * @throws IllegalStateException In case the managed Solr directory can not
- * be obtained (usually indicates that this component is currently
- * deactivated) or initialised.
+ *
+ * @return the directory of the Solr Home used for the internally managed
{@link CoreContainer} or
+ * <code>null</code> if running within an OSGI Environment and
this component is deactivated.
+ * @throws IllegalStateException
+ * In case the managed Solr directory can not be obtained
(usually indicates that this
+ * component is currently deactivated) or initialised.
*/
File getManagedDirectory() throws IllegalStateException;
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java?rev=1102791&r1=1102790&r2=1102791&view=diff
==============================================================================
---
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java
(original)
+++
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProvider.java
Fri May 13 15:29:20 2011
@@ -22,14 +22,15 @@ import org.apache.felix.scr.annotations.
import org.apache.solr.client.solrj.SolrServer;
/**
- * The main function of this provider interface is to allow, that moving the
- * support for an embedded {@link SolrServer} can be realised by an own
bundle.<p>
- * The reason for that is, that this requires to include a lot of dependencies
- * to the Solr core and all the Lucene libraries one might not need in most of
- * the useage cases of the SolrYard because typically one might want to run the
- * SolrServer in an own virtual machine or even on an own server.<p>
- * However for some usage scenarios and especially for testing it is very
- * useful to have the possibility to use Solr as embedded service.
+ * The main function of this provider interface is to allow, that moving the
support for an embedded
+ * {@link SolrServer} can be realised by an own bundle.
+ * <p>
+ * The reason for that is, that this requires to include a lot of dependencies
to the Solr core and all the
+ * Lucene libraries one might not need in most of the useage cases of the
SolrYard because typically one might
+ * want to run the SolrServer in an own virtual machine or even on an own
server.
+ * <p>
+ * However for some usage scenarios and especially for testing it is very
useful to have the possibility to
+ * use Solr as embedded service.
*
* @author Rupert Westenthaler
*/
@@ -37,10 +38,10 @@ import org.apache.solr.client.solrj.Solr
public interface SolrServerProvider {
/**
- * SolrServer types defined here to avoid java dependencies to the
according
- * java classes
+ * SolrServer types defined here to avoid java dependencies to the
according java classes
+ *
* @author Rupert Westenthaler
- *
+ *
*/
enum Type {
/**
@@ -56,31 +57,34 @@ public interface SolrServerProvider {
*/
STREAMING,
/**
- * This allows to use load balancing on multiple SolrServers via a
round
- * robin algorithm.
+ * This allows to use load balancing on multiple SolrServers via a
round robin algorithm.
*/
LOAD_BALANCE
}
+
/**
* Getter for the supported types of this Provider
+ *
* @return the Types supported by this Provider
*/
Set<Type> supportedTypes();
+
/**
- * Getter for the {@link SolrServer} instance for the provided URI or path
- * (in case of an embedded server)
- * @param type The type of the requested SolrServer instance or
<code>null</code>
- * for the default type
- * @param uriOrPath the URI (in case of an remote SolrServer that is
accessed
- * via RESTfull services) or the Path (in case of an embedded SolrServer)
- * @param additional This allows to parse additional SolrServers. This may
be
- * ignored if the requested type does not support the usage of multiple
- * servers.
+ * Getter for the {@link SolrServer} instance for the provided URI or path
(in case of an embedded server)
+ *
+ * @param type
+ * The type of the requested SolrServer instance or
<code>null</code> for the default type
+ * @param uriOrPath
+ * the URI (in case of an remote SolrServer that is accessed
via RESTfull services) or the Path
+ * (in case of an embedded SolrServer)
+ * @param additional
+ * This allows to parse additional SolrServers. This may be
ignored if the requested type does
+ * not support the usage of multiple servers.
* @return the configured SolrServer client for the parsed parameter
- * @throws NullPointerException
- * @throws IllegalArgumentException if <code>null</code> is parsed as
uriOrPath
- * or if the parsed URI or path is not valid for the requested {@link
Type}
- * or the parsed type is not supported by this provider
+ * @throws NullPointerException
+ * @throws IllegalArgumentException
+ * if <code>null</code> is parsed as uriOrPath or if the
parsed URI or path is not valid for
+ * the requested {@link Type} or the parsed type is not
supported by this provider
*/
- SolrServer getSolrServer(Type type,String uriOrPath,String...additional)
throws IllegalArgumentException;
+ SolrServer getSolrServer(Type type, String uriOrPath, String...
additional) throws IllegalArgumentException;
}
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java?rev=1102791&r1=1102790&r2=1102791&view=diff
==============================================================================
---
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java
(original)
+++
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/SolrServerProviderManager.java
Fri May 13 15:29:20 2011
@@ -41,118 +41,111 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Manager for different {@link SolrServerProvider} present in the current
- * environment.
- * This manager works both within an OSGI Environment by defining an Reference
- * and outside by using {@link #getInstance()}.
+ * Manager for different {@link SolrServerProvider} present in the current
environment. This manager works
+ * both within an OSGI Environment by defining an Reference and outside by
using {@link #getInstance()}.
* <p>
- * <b>TODO:</b> Race Condition (Rupert Westenthaler, 2011-03-21)
- * There are cases where the SolrYard requests a provider {@link Type} before
- * the actual {@link SolrServerProvider} instance that supports this type has
- * initialised. In such cases the {@link #getSolrServer(Type, String,
String...)}
- * would return an {@link IllegalArgumentException} what causes the
- * initialisation of the SolrYard to fail.<br>
- * For now this problem is solved by declaring a dependency of this manager
- * implementation to both the {@link EmbeddedSolrPorovider} and the
- * {@link DefaultSolrServerProvider}. This ensures that this manager is only
- * activated after this two implementations are available. <br>
- * A different solution that could ensure that the SolrYard does not request
- * an SolrServer before all the internal {@link SolrServerProvider}
- * implementations are initialised would be favourable.
- *
- *
+ * <b>TODO:</b> Race Condition (Rupert Westenthaler, 2011-03-21) There are
cases where the SolrYard requests a
+ * provider {@link Type} before the actual {@link SolrServerProvider} instance
that supports this type has
+ * initialised. In such cases the {@link #getSolrServer(Type, String,
String...)} would return an
+ * {@link IllegalArgumentException} what causes the initialisation of the
SolrYard to fail.<br>
+ * For now this problem is solved by declaring a dependency of this manager
implementation to both the
+ * {@link EmbeddedSolrPorovider} and the {@link DefaultSolrServerProvider}.
This ensures that this manager is
+ * only activated after this two implementations are available. <br>
+ * A different solution that could ensure that the SolrYard does not request
an SolrServer before all the
+ * internal {@link SolrServerProvider} implementations are initialised would
be favourable.
+ *
+ *
* @author Rupert Westenthaler
- *
+ *
*/
-@Component(immediate=true)
+@Component(immediate = true)
@Service(SolrServerProviderManager.class)
public final class SolrServerProviderManager {
/**
- * Used for the singleton pattern, but also init within the OSGI
environment
- * when {@link #activate(ComponentContext)} is called.
+ * Used for the singleton pattern, but also init within the OSGI
environment when
+ * {@link #activate(ComponentContext)} is called.
*/
private static SolrServerProviderManager solrServerProviderManager;
-
-// //TODO See Race Condition in class doc
-// @Reference
-// private EmbeddedSolrPorovider embeddedProvider;
-//
-// //TODO See Race Condition in class doc
-// @Reference
-// private DefaultSolrServerProvider defaultProvider;
-
+
+ // //TODO See Race Condition in class doc
+ // @Reference
+ // private EmbeddedSolrPorovider embeddedProvider;
+ //
+ // //TODO See Race Condition in class doc
+ // @Reference
+ // private DefaultSolrServerProvider defaultProvider;
+
private static final Logger log =
LoggerFactory.getLogger(SolrServerProviderManager.class);
- @Reference(
- referenceInterface=SolrServerProvider.class,
- strategy=ReferenceStrategy.EVENT,
- policy=ReferencePolicy.DYNAMIC,
- cardinality=ReferenceCardinality.MANDATORY_MULTIPLE,
- bind="addSolrProvider",unbind="removeSolrProvider")
- private Map<Type,List<SolrServerProvider>> solrServerProviders =
Collections.synchronizedMap(new
EnumMap<Type,List<SolrServerProvider>>(Type.class));
+ @Reference(referenceInterface = SolrServerProvider.class, strategy =
ReferenceStrategy.EVENT, policy = ReferencePolicy.DYNAMIC, cardinality =
ReferenceCardinality.MANDATORY_MULTIPLE, bind = "addSolrProvider", unbind =
"removeSolrProvider")
+ private Map<Type,List<SolrServerProvider>> solrServerProviders =
Collections
+ .synchronizedMap(new
EnumMap<Type,List<SolrServerProvider>>(Type.class));
- public static SolrServerProviderManager getInstance(){
- if(solrServerProviderManager == null){
+ public static SolrServerProviderManager getInstance() {
+ if (solrServerProviderManager == null) {
SolrServerProviderManager manager = new
SolrServerProviderManager();
- Iterator<SolrServerProvider> providerIt =
ServiceLoader.load(SolrServerProvider.class,SolrServerProviderManager.class.getClassLoader()).iterator();
- while(providerIt.hasNext()){
+ Iterator<SolrServerProvider> providerIt =
ServiceLoader.load(SolrServerProvider.class,
+ SolrServerProviderManager.class.getClassLoader()).iterator();
+ while (providerIt.hasNext()) {
SolrServerProvider provider = providerIt.next();
- log.info("load provider "+provider.getClass()+" supporting
"+provider.supportedTypes());
+ log.info("load provider " + provider.getClass() + " supporting
" + provider.supportedTypes());
manager.addSolrProvider(provider);
}
solrServerProviderManager = manager;
}
return solrServerProviderManager;
}
-
+
@Activate
protected void activate(ComponentContext context) {
log.debug("Activate SolrServerProviderManager");
- if(solrServerProviderManager == null){
+ if (solrServerProviderManager == null) {
solrServerProviderManager = this;
}
}
+
@Deactivate
protected void deactivate(ComponentContext context) {
log.debug("Activate SolrServerProviderManager");
solrServerProviderManager = null;
}
- public SolrServer getSolrServer(Type type, String uriOrPath,
String...additionalServerLocations){
+
+ public SolrServer getSolrServer(Type type, String uriOrPath, String...
additionalServerLocations) {
List<SolrServerProvider> providers = solrServerProviders.get(type);
- if(providers == null){
- throw new IllegalArgumentException("No Provider for type "+type+"
available");
+ if (providers == null) {
+ throw new IllegalArgumentException("No Provider for type " + type
+ " available");
}
- for(SolrServerProvider provider : providers){
+ for (SolrServerProvider provider : providers) {
try {
return provider.getSolrServer(type, uriOrPath,
additionalServerLocations);
} catch (RuntimeException e) {
- log.warn("Unable to create SolrServer by using Provider
"+provider,e);
+ log.warn("Unable to create SolrServer by using Provider " +
provider, e);
}
}
- throw new IllegalArgumentException(String.format("Unable to create
SolrServer for type %s and service location %s",
- type,uriOrPath));
+ throw new IllegalArgumentException(String.format(
+ "Unable to create SolrServer for type %s and service location %s",
type, uriOrPath));
}
-
- protected void addSolrProvider(SolrServerProvider provider){
- log.info("add SolrProvider "+provider+" types
"+provider.supportedTypes());
- for(Type type : provider.supportedTypes()){
+
+ protected void addSolrProvider(SolrServerProvider provider) {
+ log.info("add SolrProvider " + provider + " types " +
provider.supportedTypes());
+ for (Type type : provider.supportedTypes()) {
List<SolrServerProvider> providers = solrServerProviders.get(type);
- if(providers == null){
+ if (providers == null) {
providers = new CopyOnWriteArrayList<SolrServerProvider>();
solrServerProviders.put(type, providers);
}
providers.add(provider);
}
}
-
- protected void removeSolrProvider(SolrServerProvider provider){
- log.info("remove SolrProvider "+provider+" types
"+provider.supportedTypes());
- for(Type type : provider.supportedTypes()){
+
+ protected void removeSolrProvider(SolrServerProvider provider) {
+ log.info("remove SolrProvider " + provider + " types " +
provider.supportedTypes());
+ for (Type type : provider.supportedTypes()) {
List<SolrServerProvider> providers = solrServerProviders.get(type);
- if(providers != null){
- if(providers.remove(provider) && providers.isEmpty()){
- //last element removed -> remove the mapping
- solrServerProviders.remove(type);
+ if (providers != null) {
+ if (providers.remove(provider) && providers.isEmpty()) {
+ // last element removed -> remove the mapping
+ solrServerProviders.remove(type);
}
}
}
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/IndexDataTypeEnum.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/IndexDataTypeEnum.java?rev=1102791&r1=1102790&r2=1102791&view=diff
==============================================================================
---
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/IndexDataTypeEnum.java
(original)
+++
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/IndexDataTypeEnum.java
Fri May 13 15:29:20 2011
@@ -32,51 +32,53 @@ import org.apache.stanbol.entityhub.serv
import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
import org.apache.stanbol.entityhub.yard.solr.model.IndexDataType;
-
/**
- * Holds the default configuration for <ul>
+ * Holds the default configuration for
+ * <ul>
* <li> {@link IndexDataType}s
- * <li> Default mapping of {@link IndexDataType}s to Java Objects
- * <li> Prefixes/Suffixes used to mark {@link IndexDataType}s in
- * SolrDocument fields
+ * <li>Default mapping of {@link IndexDataType}s to Java Objects
+ * <li>Prefixes/Suffixes used to mark {@link IndexDataType}s in SolrDocument
fields
* </ul>
- * This Enumeration may be replaced later on by a more flexible way to
configure
- * such things.
- *
+ * This Enumeration may be replaced later on by a more flexible way to
configure such things.
+ *
* @author Rupert Westenthaler
- *
+ *
*/
public enum IndexDataTypeEnum {
- BOOLEAN(NamespaceEnum.xsd+"boolean","bool",Boolean.class),
-// BYTE("byt",Byte.class),
- INT(NamespaceEnum.xsd+"integer","int",Integer.class),
- LONG(NamespaceEnum.xsd+"long","lon",Long.class),
- FLOAT(NamespaceEnum.xsd+"float","flo",Float.class),
- DOUBLE(NamespaceEnum.xsd+"double","dou",Double.class),
- REF(RdfResourceEnum.ReferenceDataType.getUri(),"ref",Reference.class),
-// URI(NamespaceEnum.xsd+"anyURI","uri",URI.class), //currently URIs are
modelled as REF
- //TODO: DATE & DUR to be removed. The plan is to add explicit support for
ranged queries over time spans/points!
- DATE(NamespaceEnum.xsd+"dateTime","cal",Date.class),
- DUR(NamespaceEnum.xsd+"duration","dur",Duration.class),
- TXT(RdfResourceEnum.TextDataType.getUri(),null,Text.class,true), //no type
prefix, but typically languageType prefixes
- STR(NamespaceEnum.xsd+"string","str",String.class,true), //string values
(not used for languageType)
- ID(NamespaceEnum.xsd+"id","id",UUID.class),
- ;
+ BOOLEAN(NamespaceEnum.xsd + "boolean", "bool", Boolean.class),
+ // BYTE("byt",Byte.class),
+ INT(NamespaceEnum.xsd + "integer", "int", Integer.class),
+ LONG(NamespaceEnum.xsd + "long", "lon", Long.class),
+ FLOAT(NamespaceEnum.xsd + "float", "flo", Float.class),
+ DOUBLE(NamespaceEnum.xsd + "double", "dou", Double.class),
+ REF(RdfResourceEnum.ReferenceDataType.getUri(), "ref", Reference.class),
+ // URI(NamespaceEnum.xsd+"anyURI","uri",URI.class), //currently URIs are
modelled as REF
+ // TODO: DATE & DUR to be removed. The plan is to add explicit support for
ranged queries over time
+ // spans/points!
+ DATE(NamespaceEnum.xsd + "dateTime", "cal", Date.class),
+ DUR(NamespaceEnum.xsd + "duration", "dur", Duration.class),
+ TXT(RdfResourceEnum.TextDataType.getUri(), null, Text.class, true), // no
type prefix, but typically
+ //
languageType prefixes
+ STR(NamespaceEnum.xsd + "string", "str", String.class, true), // string
values (not used for languageType)
+ ID(NamespaceEnum.xsd + "id", "id", UUID.class), ;
private IndexDataType indexType;
private Class<?> javaType;
private String prefix;
private String suffix;
/**
- * if true, values of this dataType should be treated as natural
languageType
- * texts and added to the {@link SolrConst#LANG_MERGER_FIELD}
+ * if true, values of this dataType should be treated as natural
languageType texts and added to the
+ * {@link SolrConst#LANG_MERGER_FIELD}
*/
private boolean languageType;
+
IndexDataTypeEnum(String name, String prefix, Class<?> type) {
- this(name,prefix,null,type,false);
+ this(name, prefix, null, type, false);
}
+
IndexDataTypeEnum(String name, String prefix, Class<?> type, boolean
language) {
- this(name,prefix,null,type,language);
+ this(name, prefix, null, type, language);
}
+
IndexDataTypeEnum(String name, String prefix, String suffix, Class<?>
type, boolean language) {
this.indexType = new IndexDataType(name);
this.prefix = prefix;
@@ -84,38 +86,47 @@ public enum IndexDataTypeEnum {
this.javaType = type;
this.languageType = language;
}
+
/**
* The prefix to be used for index fields of that type
+ *
* @return the prefix
*/
public String getPrefix() {
return prefix;
}
+
/**
* The suffix to be used for index fields of that type
+ *
* @return
*/
- public String getSuffix(){
+ public String getSuffix() {
return suffix;
}
+
/**
* The index type
+ *
* @return the indexType
*/
- public IndexDataType getIndexType(){
+ public IndexDataType getIndexType() {
return indexType;
}
+
/**
* The java type
+ *
* @return the java class for the index type
*/
public final Class<?> getJavaType() {
return javaType;
}
+
/**
- * Returns <code>true</code> if values of this dataType should be included
- * in searches for natural language texts. This means that such values are
- * added to the {@link SolrConst#LANG_MERGER_FIELD}
+ * Returns <code>true</code> if values of this dataType should be included
in searches for natural
+ * language texts. This means that such values are added to the {@link
SolrConst#LANG_MERGER_FIELD}
+ *
* @return the languageType
*/
public boolean isLanguageType() {
@@ -127,41 +138,43 @@ public enum IndexDataTypeEnum {
*
--------------------------------------------------------------------------
*/
- private static Map<Class<?>, IndexDataTypeEnum> javaTypeMap;
- private static Map<IndexDataType, IndexDataTypeEnum> indexTypeMap;
+ private static Map<Class<?>,IndexDataTypeEnum> javaTypeMap;
+ private static Map<IndexDataType,IndexDataTypeEnum> indexTypeMap;
private static Map<List<String>,IndexDataTypeEnum> prefixSuffixMap;
private static Map<String,IndexDataTypeEnum> uriMap;
static {
/*
- * This inits the Mappings and also validates the configuration
provided
- * by the Enumeration!
+ * This inits the Mappings and also validates the configuration
provided by the Enumeration!
*/
- Map<Class<?>, IndexDataTypeEnum> jtm = new HashMap<Class<?>,
IndexDataTypeEnum>();
- Map<IndexDataType, IndexDataTypeEnum> itm = new HashMap<IndexDataType,
IndexDataTypeEnum>();
- Map<List<String>, IndexDataTypeEnum> psm = new HashMap<List<String>,
IndexDataTypeEnum>();
- Map<String,IndexDataTypeEnum> um = new HashMap<String,
IndexDataTypeEnum>();
- for(IndexDataTypeEnum dt : IndexDataTypeEnum.values()){
- if(jtm.containsKey(dt.javaType)){
- throw new IllegalStateException(String.format("Found multiple
IndexTypes %s and %s for Class %s! Wrong Data provided by %s",
-
dt.indexType,jtm.get(dt.javaType).indexType,dt.javaType,IndexDataTypeEnum.class));
+ Map<Class<?>,IndexDataTypeEnum> jtm = new
HashMap<Class<?>,IndexDataTypeEnum>();
+ Map<IndexDataType,IndexDataTypeEnum> itm = new
HashMap<IndexDataType,IndexDataTypeEnum>();
+ Map<List<String>,IndexDataTypeEnum> psm = new
HashMap<List<String>,IndexDataTypeEnum>();
+ Map<String,IndexDataTypeEnum> um = new
HashMap<String,IndexDataTypeEnum>();
+ for (IndexDataTypeEnum dt : IndexDataTypeEnum.values()) {
+ if (jtm.containsKey(dt.javaType)) {
+ throw new IllegalStateException(String.format(
+ "Found multiple IndexTypes %s and %s for Class %s! Wrong
Data provided by %s",
+ dt.indexType, jtm.get(dt.javaType).indexType, dt.javaType,
IndexDataTypeEnum.class));
} else {
jtm.put(dt.javaType, dt);
}
- if(itm.containsKey(dt.indexType)){
- throw new IllegalStateException(String.format("Found multiple
Entries with IndexType %s! Wrong Data provided by %s",
- dt.indexType,IndexDataTypeEnum.class));
+ if (itm.containsKey(dt.indexType)) {
+ throw new IllegalStateException(String.format(
+ "Found multiple Entries with IndexType %s! Wrong Data
provided by %s", dt.indexType,
+ IndexDataTypeEnum.class));
} else {
itm.put(dt.indexType, dt);
}
- //NOTE: Do not use Arrays.asList(..) directly, because it does not
- // implement equals and hashCode!
+ // NOTE: Do not use Arrays.asList(..) directly, because it does not
+ // implement equals and hashCode!
List<String> ps = new ArrayList<String>(2);
ps.add(dt.prefix);
ps.add(dt.suffix);
psm.put(ps, dt);
- if(um.containsKey(dt.getIndexType().getId())){
- throw new IllegalStateException(String.format("Found multiple
Entries with the same data type URI %s! Uri used by %s and %s!",
-
dt.getIndexType().getId(),dt.name(),um.get(dt.getIndexType().getName()).name()));
+ if (um.containsKey(dt.getIndexType().getId())) {
+ throw new IllegalStateException(String.format(
+ "Found multiple Entries with the same data type URI %s!
Uri used by %s and %s!", dt
+ .getIndexType().getId(), dt.name(),
um.get(dt.getIndexType().getName()).name()));
} else {
um.put(dt.getIndexType().getId(), dt);
}
@@ -171,46 +184,58 @@ public enum IndexDataTypeEnum {
prefixSuffixMap = Collections.unmodifiableMap(psm);
uriMap = Collections.unmodifiableMap(um);
}
+
/**
* Lookup table for the IndexDataTypeEnum based on the java type
- * @param type the java type
- * @return the IndexDataTypeEnum for the parsed type or <code>null</code>
if
- * no IndexDataTypeEnum is configured for the parsed type.
+ *
+ * @param type
+ * the java type
+ * @return the IndexDataTypeEnum for the parsed type or <code>null</code>
if no IndexDataTypeEnum is
+ * configured for the parsed type.
*/
- public static IndexDataTypeEnum forJavaType(Class<?> type){
+ public static IndexDataTypeEnum forJavaType(Class<?> type) {
return javaTypeMap.get(type);
}
+
/**
* Lookup table for the IndexDataTypeEnum based on the IndexType.
- * @param indexType the indexType
- * @return the IndexDataTypeEnum for the parsed IndexTyep or
<code>null</code>
- * if no IndexDataTypeEnum is configured for the parsed IndexType.
+ *
+ * @param indexType
+ * the indexType
+ * @return the IndexDataTypeEnum for the parsed IndexTyep or
<code>null</code> if no IndexDataTypeEnum is
+ * configured for the parsed IndexType.
*/
- public static IndexDataTypeEnum forIndexType(IndexDataType indexType){
+ public static IndexDataTypeEnum forIndexType(IndexDataType indexType) {
return indexTypeMap.get(indexType);
}
+
/**
* Lookup table for the IndexDataTypeEnum based on the prefix and suffix
- * @param prefix the prefix (might be <code>null</code>)
- * @param suffix the suffix ( (might be <code>null</code>)
- * @return the IndexDataTypeEnum for the parsed prefix and suffix or
- * <code>null</code> if no IndexDataTypeEnum is configured for the parsed
- * parameter.
+ *
+ * @param prefix
+ * the prefix (might be <code>null</code>)
+ * @param suffix
+ * the suffix ( (might be <code>null</code>)
+ * @return the IndexDataTypeEnum for the parsed prefix and suffix or
<code>null</code> if no
+ * IndexDataTypeEnum is configured for the parsed parameter.
*/
- public static IndexDataTypeEnum forPrefixSuffix(String prefix,String
suffix){
+ public static IndexDataTypeEnum forPrefixSuffix(String prefix, String
suffix) {
List<String> ps = new ArrayList<String>(2);
ps.add(prefix);
ps.add(suffix);
return prefixSuffixMap.get(ps);
}
+
/**
- * Lookup table for the IndexDataTypeEnum based on the data type uri
- * as stored in the {@link IndexDataType#getName()} property.
- * @param uri the uri of the dataType
- * @return the IndexDataTypeEnum for the parsed uri or <code>null</code>
if
- * no IndexDataTypeEnum is configured for the parsed parameter.
+ * Lookup table for the IndexDataTypeEnum based on the data type uri as
stored in the
+ * {@link IndexDataType#getName()} property.
+ *
+ * @param uri
+ * the uri of the dataType
+ * @return the IndexDataTypeEnum for the parsed uri or <code>null</code>
if no IndexDataTypeEnum is
+ * configured for the parsed parameter.
*/
- public static IndexDataTypeEnum forUri(String uri){
+ public static IndexDataTypeEnum forUri(String uri) {
return uriMap.get(uri);
}
}
Modified:
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/SolrConst.java
URL:
http://svn.apache.org/viewvc/incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/SolrConst.java?rev=1102791&r1=1102790&r2=1102791&view=diff
==============================================================================
---
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/SolrConst.java
(original)
+++
incubator/stanbol/trunk/entityhub/yard/solr/src/main/java/org/apache/stanbol/entityhub/yard/solr/defaults/SolrConst.java
Fri May 13 15:29:20 2011
@@ -16,86 +16,83 @@
*/
package org.apache.stanbol.entityhub.yard.solr.defaults;
-
/**
- * Defines the defaults used to encode the fields for the index.<p>
- * The configuration provided by this class MUST be in agreement with the
- * schema.xml configured for the Solr Server
+ * Defines the defaults used to encode the fields for the index.
+ * <p>
+ * The configuration provided by this class MUST be in agreement with the
schema.xml configured for the Solr
+ * Server
+ *
* @author Rupert Westenthaler
- *
+ *
*/
public final class SolrConst {
- private SolrConst(){}
+ private SolrConst() {}
+
/**
- * Char used to mark special fields. Special fields are internally used
- * fields that do not represent a value that was present in the original
- * resource. They are used to store configurations, to collect values of
- * different fields (e.g. labels with different languages)
+ * Char used to mark special fields. Special fields are internally used
fields that do not represent a
+ * value that was present in the original resource. They are used to store
configurations, to collect
+ * values of different fields (e.g. labels with different languages)
*/
public static final char SPECIAL_FIELD_PREFIX = '_';
/**
- * The Char used to separate prefix, path elements and suffix.
- * Currently there is no support for escaping path elements. Therefore
- * there is only the possibility to use '/' or '#' because they do not
- * appear in prefixes or suffixes and are replaced by prefixes for the
- * path elements.
+ * The Char used to separate prefix, path elements and suffix. Currently
there is no support for escaping
+ * path elements. Therefore there is only the possibility to use '/' or
'#' because they do not appear in
+ * prefixes or suffixes and are replaced by prefixes for the path elements.
*/
public static final char PATH_SEPERATOR = '/';
/**
- * All fields indicating a language start with this character.
- * Special fields that indicate a language start with the
- * {@link #SPECIAL_FIELD_PREFIX} followed by this one.<p>
- * Examples:<ul>
+ * All fields indicating a language start with this character. Special
fields that indicate a language
+ * start with the {@link #SPECIAL_FIELD_PREFIX} followed by this one.
+ * <p>
+ * Examples:
+ * <ul>
* <li>@en ... for a field storing English text
- * <li>@ ... for a field storing text without a language
- * (meaning that this text is valid in any language)
- * <li>_!@ ... for a field that index all labels in any language. This
field
- * uses the {@link #SPECIAL_FIELD_PREFIX},{@link #MERGER_INDICATOR} and
- * the {@link #LANG_INDICATOR}
+ * <li>@ ... for a field storing text without a language (meaning that
this text is valid in any language)
+ * <li>_!@ ... for a field that index all labels in any language. This
field uses the
+ * {@link #SPECIAL_FIELD_PREFIX},{@link #MERGER_INDICATOR} and the {@link
#LANG_INDICATOR}
* </ul>
*/
public static final char LANG_INDICATOR = '@';
/**
- * Merger Fields are fields that collect different values already indexed
- * in some other fields. This fields are usually configured as
- * <code>store=false</code> and <code>multiValue=true</code> in the index
- * and are used for queries.<p>
- * The most used merger field is the {@link #LANG_MERGER_FIELD} that
contains
- * all natural language values of all languages!
+ * Merger Fields are fields that collect different values already indexed
in some other fields. This
+ * fields are usually configured as <code>store=false</code> and
<code>multiValue=true</code> in the index
+ * and are used for queries.
+ * <p>
+ * The most used merger field is the {@link #LANG_MERGER_FIELD} that
contains all natural language values
+ * of all languages!
*/
public static final char MERGER_INDICATOR = '!';
/**
- * Field that stores all natural language text values of a field -
- * regardless of the language of the text.
+ * Field that stores all natural language text values of a field -
regardless of the language of the text.
*/
- public static final String LANG_MERGER_FIELD =
""+SPECIAL_FIELD_PREFIX+MERGER_INDICATOR+LANG_INDICATOR;
+ public static final String LANG_MERGER_FIELD = "" + SPECIAL_FIELD_PREFIX +
MERGER_INDICATOR
+ + LANG_INDICATOR;
/**
- * The name of the field used to store the unique id of the Documents
(usually
- * the URI of the resource)
+ * The name of the field used to store the unique id of the Documents
(usually the URI of the resource)
*/
public static final String DOCUMENT_ID_FIELD = "uri";
/**
- * This is used as field name to store all URIs a document
- * refers to. If a document is deleted from the index, than all other
documents
- * that refer to this URI need to be updated
+ * This is used as field name to store all URIs a document refers to. If a
document is deleted from the
+ * index, than all other documents that refer to this URI need to be
updated
*/
- public static final String REFERRED_DOCUMENT_FIELD =
SPECIAL_FIELD_PREFIX+"ref";
+ public static final String REFERRED_DOCUMENT_FIELD = SPECIAL_FIELD_PREFIX
+ "ref";
/**
- * This is used as field name to store all URIs a document uses in one of
- * it's paths.<p> If a document in the index is changed, than all documents
- * that are dependent on this one need to be updated.
+ * This is used as field name to store all URIs a document uses in one of
it's paths.
+ * <p>
+ * If a document in the index is changed, than all documents that are
dependent on this one need to be
+ * updated.
*/
- public static final String DEPENDENT_DOCUMENT_FIELD =
SPECIAL_FIELD_PREFIX+"dep";
+ public static final String DEPENDENT_DOCUMENT_FIELD = SPECIAL_FIELD_PREFIX
+ "dep";
- public static final String SPECIAL_CONFIG_FIELD =
SPECIAL_FIELD_PREFIX+"config";
+ public static final String SPECIAL_CONFIG_FIELD = SPECIAL_FIELD_PREFIX +
"config";
/**
- * The name of the field that indicates the domain of a document.<p>
+ * The name of the field that indicates the domain of a document.
+ * <p>
* Within the schema.xml this field is usually configures as
- * <code>multiValued=false stored=false indexed=true</code>.
- * NOTE: that the two domains sharing the same SolrIndex MUST NOT add
- * Documents with the same ID (equal values for {@link #DOCUMENT_ID_FIELD})
+ * <code>multiValued=false stored=false indexed=true</code>. NOTE: that
the two domains sharing the same
+ * SolrIndex MUST NOT add Documents with the same ID (equal values for
{@link #DOCUMENT_ID_FIELD})
*/
- public static final String DOMAIN_FIELD = SPECIAL_FIELD_PREFIX+"domain";
+ public static final String DOMAIN_FIELD = SPECIAL_FIELD_PREFIX + "domain";
/**
* The field name used by Solr for the score of query results
*/