exo-jcr SVN: r3067 - core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-07 10:27:50 -0400 (Tue, 07 Sep 2010)
New Revision: 3067
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
Log:
EXOJCR-749: TikaDocumentReader - all actions preformed as privileged
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2010-09-07 13:12:48 UTC (rev 3066)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2010-09-07 14:27:50 UTC (rev 3067)
@@ -36,6 +36,9 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
/**
@@ -63,95 +66,201 @@
this.mimeType = mimeType;
}
- public Reader getContentAsReader(InputStream is, String encoding) throws IOException, DocumentReadException
+ public Reader getContentAsReader(final InputStream is, final String encoding) throws IOException,
+ DocumentReadException
{
- Metadata metadata = new Metadata();
- metadata.set(Metadata.CONTENT_TYPE, mimeType);
- metadata.set(Metadata.CONTENT_ENCODING, encoding);
- ParseContext context = new ParseContext();
- context.set(Parser.class, parser);
- return new ParsingReader(parser, is, metadata, context);
- }
-
- public Reader getContentAsReader(InputStream is) throws IOException, DocumentReadException
- {
- Metadata metadata = new Metadata();
- metadata.set(Metadata.CONTENT_TYPE, mimeType);
- ParseContext context = new ParseContext();
- context.set(Parser.class, parser);
- return new ParsingReader(parser, is, metadata, context);
- }
-
- public String getContentAsText(InputStream is) throws IOException, DocumentReadException
- {
try
{
- Metadata metadata = new Metadata();
- metadata.set(Metadata.CONTENT_TYPE, mimeType);
+ return (Reader)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+ {
- ContentHandler handler = new BodyContentHandler();
- ParseContext context = new ParseContext();
- context.set(Parser.class, parser);
- try
+ public Object run() throws Exception
+ {
+ Metadata metadata = new Metadata();
+ metadata.set(Metadata.CONTENT_TYPE, mimeType);
+ metadata.set(Metadata.CONTENT_ENCODING, encoding);
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, parser);
+ return new ParsingReader(parser, is, metadata, context);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
{
- parser.parse(is, handler, metadata, context);
- return handler.toString();
+ throw (IOException)cause;
}
- catch (SAXException e)
+ else if (cause instanceof RuntimeException)
{
- throw new DocumentReadException(e.getMessage(), e);
+ throw (RuntimeException)cause;
}
- catch (TikaException e)
+ else
{
- throw new DocumentReadException(e.getMessage(), e);
+ throw new RuntimeException(cause);
}
}
- finally
+ }
+
+ public Reader getContentAsReader(final InputStream is) throws IOException, DocumentReadException
+ {
+ try
{
- try
+ return (Reader)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
- is.close();
+
+ public Object run() throws Exception
+ {
+ Metadata metadata = new Metadata();
+ metadata.set(Metadata.CONTENT_TYPE, mimeType);
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, parser);
+ return new ParsingReader(parser, is, metadata, context);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
+ {
+ throw (IOException)cause;
}
- catch (Throwable e)
+ else if (cause instanceof RuntimeException)
{
+ throw (RuntimeException)cause;
}
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
+
}
- public String getContentAsText(InputStream is, String encoding) throws IOException, DocumentReadException
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
try
{
- Metadata metadata = new Metadata();
- metadata.set(Metadata.CONTENT_TYPE, mimeType);
- metadata.set(Metadata.CONTENT_ENCODING, encoding);
+ return (String)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
+ {
- ContentHandler handler = new BodyContentHandler();
- ParseContext context = new ParseContext();
- context.set(Parser.class, parser);
- try
+ public Object run() throws Exception
+ {
+ try
+ {
+ Metadata metadata = new Metadata();
+ metadata.set(Metadata.CONTENT_TYPE, mimeType);
+
+ ContentHandler handler = new BodyContentHandler();
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, parser);
+ try
+ {
+ parser.parse(is, handler, metadata, context);
+ return handler.toString();
+ }
+ catch (SAXException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+ catch (TikaException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
{
- parser.parse(is, handler, metadata, context);
- return handler.toString();
+ throw (IOException)cause;
}
- catch (SAXException e)
+ else if (cause instanceof RuntimeException)
{
- throw new DocumentReadException(e.getMessage(), e);
+ throw (RuntimeException)cause;
}
- catch (TikaException e)
+ else
{
- throw new DocumentReadException(e.getMessage(), e);
+ throw new RuntimeException(cause);
}
}
- finally
+ }
+
+ public String getContentAsText(final InputStream is, final String encoding) throws IOException,
+ DocumentReadException
+ {
+ try
{
- try
+ return (String)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
- is.close();
+ public Object run() throws Exception
+ {
+ try
+ {
+ Metadata metadata = new Metadata();
+ metadata.set(Metadata.CONTENT_TYPE, mimeType);
+ metadata.set(Metadata.CONTENT_ENCODING, encoding);
+
+ ContentHandler handler = new BodyContentHandler();
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, parser);
+ try
+ {
+ parser.parse(is, handler, metadata, context);
+ return handler.toString();
+ }
+ catch (SAXException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+ catch (TikaException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
+ {
+ throw (IOException)cause;
}
- catch (Throwable e)
+ else if (cause instanceof RuntimeException)
{
+ throw (RuntimeException)cause;
}
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
}
@@ -160,63 +269,91 @@
return new String[]{mimeType};
}
- public Properties getProperties(InputStream is) throws IOException, DocumentReadException
+ public Properties getProperties(final InputStream is) throws IOException, DocumentReadException
{
try
{
- Metadata metadata = new Metadata();
- metadata.set(Metadata.CONTENT_TYPE, mimeType);
-
- ContentHandler handler = new WriteOutContentHandler(MAX_READED_SIZE);
- ParseContext context = new ParseContext();
- context.set(Parser.class, parser);
- try
+ return (Properties)AccessController.doPrivileged(new PrivilegedExceptionAction<Object>()
{
- parser.parse(is, handler, metadata, context);
- }
- catch (SAXException e)
- {
- throw new DocumentReadException(e.getMessage(), e);
- }
- catch (TikaException e)
- {
- throw new DocumentReadException(e.getMessage(), e);
- }
- // construct Properties set
- Properties props = new Properties();
- convertProperty(metadata, props, DCMetaData.CONTRIBUTOR, new String[]{DublinCore.CONTRIBUTOR,
- MSOffice.LAST_AUTHOR});
- convertProperty(metadata, props, DCMetaData.COVERAGE, DublinCore.COVERAGE);
- convertProperty(metadata, props, DCMetaData.CREATOR, new String[]{MSOffice.AUTHOR, DublinCore.CREATOR});
- //TODO different parsers return date in different formats, so keep it as String
- convertProperty(metadata, props, DCMetaData.DATE, new String[]{DublinCore.DATE, MSOffice.LAST_SAVED,
- MSOffice.CREATION_DATE});
- convertProperty(metadata, props, DCMetaData.DESCRIPTION, new String[]{DublinCore.DESCRIPTION,
- MSOffice.COMMENTS});
- convertProperty(metadata, props, DCMetaData.FORMAT, DublinCore.FORMAT);
- convertProperty(metadata, props, DCMetaData.IDENTIFIER, DublinCore.IDENTIFIER);
- convertProperty(metadata, props, DCMetaData.LANGUAGE, DublinCore.LANGUAGE);
- //convertProperty(metadata, props, DCMetaData.?, DublinCore.MODIFIED);
- convertProperty(metadata, props, DCMetaData.PUBLISHER, DublinCore.PUBLISHER);
- convertProperty(metadata, props, DCMetaData.RELATION, DublinCore.RELATION);
- convertProperty(metadata, props, DCMetaData.RESOURCE, DublinCore.SOURCE);
- convertProperty(metadata, props, DCMetaData.RIGHTS, DublinCore.RIGHTS);
- convertProperty(metadata, props, DCMetaData.SUBJECT, new String[]{DublinCore.SUBJECT, MSOffice.KEYWORDS});
- convertProperty(metadata, props, DCMetaData.TITLE, DublinCore.TITLE);
- convertProperty(metadata, props, DCMetaData.TYPE, DublinCore.TYPE);
+ public Object run() throws Exception
+ {
+ try
+ {
+ Metadata metadata = new Metadata();
+ metadata.set(Metadata.CONTENT_TYPE, mimeType);
- return props;
+ ContentHandler handler = new WriteOutContentHandler(MAX_READED_SIZE);
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, parser);
+ try
+ {
+ parser.parse(is, handler, metadata, context);
+ }
+ catch (SAXException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+ catch (TikaException e)
+ {
+ throw new DocumentReadException(e.getMessage(), e);
+ }
+
+ // construct Properties set
+ Properties props = new Properties();
+ convertProperty(metadata, props, DCMetaData.CONTRIBUTOR, new String[]{DublinCore.CONTRIBUTOR,
+ MSOffice.LAST_AUTHOR});
+ convertProperty(metadata, props, DCMetaData.COVERAGE, DublinCore.COVERAGE);
+ convertProperty(metadata, props, DCMetaData.CREATOR,
+ new String[]{MSOffice.AUTHOR, DublinCore.CREATOR});
+ //TODO different parsers return date in different formats, so keep it as String
+ convertProperty(metadata, props, DCMetaData.DATE, new String[]{DublinCore.DATE, MSOffice.LAST_SAVED,
+ MSOffice.CREATION_DATE});
+ convertProperty(metadata, props, DCMetaData.DESCRIPTION, new String[]{DublinCore.DESCRIPTION,
+ MSOffice.COMMENTS});
+ convertProperty(metadata, props, DCMetaData.FORMAT, DublinCore.FORMAT);
+ convertProperty(metadata, props, DCMetaData.IDENTIFIER, DublinCore.IDENTIFIER);
+ convertProperty(metadata, props, DCMetaData.LANGUAGE, DublinCore.LANGUAGE);
+ //convertProperty(metadata, props, DCMetaData.?, DublinCore.MODIFIED);
+ convertProperty(metadata, props, DCMetaData.PUBLISHER, DublinCore.PUBLISHER);
+ convertProperty(metadata, props, DCMetaData.RELATION, DublinCore.RELATION);
+ convertProperty(metadata, props, DCMetaData.RESOURCE, DublinCore.SOURCE);
+ convertProperty(metadata, props, DCMetaData.RIGHTS, DublinCore.RIGHTS);
+ convertProperty(metadata, props, DCMetaData.SUBJECT, new String[]{DublinCore.SUBJECT,
+ MSOffice.KEYWORDS});
+ convertProperty(metadata, props, DCMetaData.TITLE, DublinCore.TITLE);
+ convertProperty(metadata, props, DCMetaData.TYPE, DublinCore.TYPE);
+
+ return props;
+ }
+ finally
+ {
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ });
}
- finally
+ catch (PrivilegedActionException pae)
{
- try
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
{
- is.close();
+ throw (IOException)cause;
}
- catch (Throwable e)
+ else if (cause instanceof RuntimeException)
{
+ throw (RuntimeException)cause;
}
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
}
15 years, 8 months
exo-jcr SVN: r3066 - jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-07 09:12:48 -0400 (Tue, 07 Sep 2010)
New Revision: 3066
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
Log:
EXOJCR-865: registration required node types for testing
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-09-07 13:00:55 UTC (rev 3065)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-09-07 13:12:48 UTC (rev 3066)
@@ -118,6 +118,7 @@
<property name="rma" value="http://www.rma.com/jcr/"/>
<property name="metadata" value="http://www.exoplatform.com/jcr/metadata/1.1/"/>
<property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ <property name="publication" value="http://www.exoplatform.com/jcr/publication/1.1/"/>
</properties-param>
</init-params>
</component-plugin>
@@ -134,7 +135,11 @@
<value>jar:/conf/test/nodetypes-usecase.xml</value>
<value>jar:/conf/test/nodetypes-config.xml</value>
<value>jar:/conf/test/nodetypes-config-extended.xml</value>
+ <value>jar:/conf/test/wcm-nodetypes.xml</value>
+ <value>jar:/conf/test/nodetypes-publication-config.xml</value>
+ <value>jar:/conf/test/publication-plugins-nodetypes-config.xml</value>
</values-param>
+
<values-param>
<name>testInitNodeTypesRepository</name>
15 years, 8 months
exo-jcr SVN: r3065 - in jcr/trunk/exo.jcr.component.core/src: main/java/org/exoplatform/services/jcr/impl/core/query and 5 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-07 09:00:55 -0400 (Tue, 07 Sep 2010)
New Revision: 3065
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestJBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java
Log:
EXOJCR--942: Reply on JBC regions to avoid having too many JBC instances
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -51,6 +51,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
+import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -217,7 +218,7 @@
InitialContextInitializer context, TransactionManager transactionManager, ConfigurationManager cfm)
throws RepositoryConfigurationException, RepositoryException
{
- lockRoot = Fqn.fromElements(LOCKS);
+ lockRoot = Fqn.fromElements(config.getUniqueName(), LOCKS);
List<SimpleParameterEntry> paramenerts = config.getLockManager().getParameters();
@@ -258,13 +259,16 @@
cache = factory.createCache(config.getLockManager());
- PrivilegedCacheHelper.create(cache);
+ Fqn<String> rootFqn = Fqn.fromElements(config.getUniqueName());
+ cache = ExoJBossCacheFactory.getUniqueInstance(CacheType.LOCK_CACHE, rootFqn, cache);
+ cache.create();
+ if (cache.getCacheStatus().startAllowed())
+ {
+ // Add the cache loader needed to prevent TimeoutException
+ addCacheLoader();
+ cache.start();
+ }
- // Add the cache loader needed to prevent TimeoutException
- addCacheLoader();
-
- PrivilegedCacheHelper.start(cache);
-
createStructuredNode(lockRoot);
// Context recall is a workaround of JDBCCacheLoader starting.
@@ -480,7 +484,7 @@
{
public Integer execute(Object arg)
{
- return ((CacheSPI<Serializable, Object>)cache).getNumberOfNodes() - 1;
+ return ((CacheSPI<Serializable, Object>)cache).getNode(lockRoot).getChildrenDirect().size();
}
};
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -26,6 +26,7 @@
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.QueryHandlerParams;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.dataflow.ItemState;
@@ -136,6 +137,11 @@
protected IndexerChangesFilter changesFilter;
/**
+ * The unique name of the related workspace
+ */
+ protected final String wsId;
+
+ /**
* Creates a new <code>SearchManager</code>.
*
* @param config
@@ -159,12 +165,12 @@
* @throws RepositoryConfigurationException
*/
- public SearchManager(QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
+ public SearchManager(WorkspaceEntry wsConfig, QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, SystemSearchManagerHolder parentSearchManager,
DocumentReaderService extractor, ConfigurationManager cfm, final RepositoryIndexSearcherHolder indexSearcherHolder)
throws RepositoryException, RepositoryConfigurationException
{
-
+ this.wsId = wsConfig.getUniqueName();
this.extractor = extractor;
indexSearcherHolder.addIndexSearcher(this);
this.config = config;
@@ -843,4 +849,9 @@
return false;
}
+ public String getWsId()
+ {
+ return wsId;
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SystemSearchManager.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -20,6 +20,7 @@
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
@@ -56,11 +57,11 @@
public static final String INDEX_DIR_SUFFIX = "system";
- public SystemSearchManager(QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
+ public SystemSearchManager(WorkspaceEntry wsConfig, QueryHandlerEntry config, NamespaceRegistryImpl nsReg, NodeTypeDataManager ntReg,
WorkspacePersistentDataManager itemMgr, DocumentReaderService service, ConfigurationManager cfm,
RepositoryIndexSearcherHolder indexSearcherHolder) throws RepositoryException, RepositoryConfigurationException
{
- super(config, nsReg, ntReg, itemMgr, null, service, cfm, indexSearcherHolder);
+ super(wsConfig, config, nsReg, ntReg, itemMgr, null, service, cfm, indexSearcherHolder);
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerCacheLoader.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -29,6 +29,7 @@
import org.jboss.cache.Modification;
import java.io.IOException;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -42,16 +43,13 @@
*/
public class IndexerCacheLoader extends AbstractWriteOnlyCacheLoader
{
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.IndexerCacheLoader");
+ private static final Log log = ExoLogger.getLogger("exo.jcr.component.core.IndexerCacheLoader");
- private SearchManager searchManager;
+ /**
+ * A map of all the indexers that has been registered
+ */
+ private final Map<Fqn<String>, Indexer> indexers = new HashMap<Fqn<String>, Indexer>();
- private SearchManager parentSearchManager;
-
- private QueryHandler handler;
-
- private QueryHandler parentHandler;
-
private volatile IndexerIoModeHandler modeHandler;
/**
@@ -62,9 +60,9 @@
{
// do nothing. Everything is done on prepare phase.
}
-
+
/**
- * Inject dependencies needed for CacheLoader: SearchManagers and QueryHandlers.
+ * This method will register a new Indexer according to the given parameters.
*
* @param searchManager
* @param parentSearchManager
@@ -72,13 +70,11 @@
* @param parentHandler
* @throws RepositoryConfigurationException
*/
- public void init(SearchManager searchManager, SearchManager parentSearchManager, QueryHandler handler,
+ public void register(SearchManager searchManager, SearchManager parentSearchManager, QueryHandler handler,
QueryHandler parentHandler) throws RepositoryConfigurationException
{
- this.searchManager = searchManager;
- this.parentSearchManager = parentSearchManager;
- this.handler = handler;
- this.parentHandler = parentHandler;
+ indexers.put(Fqn.fromElements(searchManager.getWsId()), new Indexer(searchManager, parentSearchManager, handler,
+ parentHandler));
}
/**
@@ -96,7 +92,8 @@
ChangesFilterListsWrapper wrapper = (ChangesFilterListsWrapper)value;
try
{
- updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
+ Indexer indexer = indexers.get(name.getParent());
+ indexer.updateIndex(wrapper.getAddedNodes(), wrapper.getRemovedNodes(), wrapper.getParentAddedNodes(), wrapper
.getParentRemovedNodes());
}
finally
@@ -172,63 +169,86 @@
}
/**
- * Flushes lists of added/removed nodes to SearchManagers, starting indexing.
- *
- * @param addedNodes
- * @param removedNodes
- * @param parentAddedNodes
- * @param parentRemovedNodes
+ * This class will update the indexes of the related workspace
*/
- protected void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
- Set<String> parentRemovedNodes)
+ private static class Indexer
{
- // pass lists to search manager
- if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
+
+ private final SearchManager searchManager;
+
+ private final SearchManager parentSearchManager;
+
+ private final QueryHandler handler;
+
+ private final QueryHandler parentHandler;
+
+ public Indexer(SearchManager searchManager, SearchManager parentSearchManager, QueryHandler handler,
+ QueryHandler parentHandler) throws RepositoryConfigurationException
{
- try
+ this.searchManager = searchManager;
+ this.parentSearchManager = parentSearchManager;
+ this.handler = handler;
+ this.parentHandler = parentHandler;
+ }
+ /**
+ * Flushes lists of added/removed nodes to SearchManagers, starting indexing.
+ *
+ * @param addedNodes
+ * @param removedNodes
+ * @param parentAddedNodes
+ * @param parentRemovedNodes
+ */
+ protected void updateIndex(Set<String> addedNodes, Set<String> removedNodes, Set<String> parentAddedNodes,
+ Set<String> parentRemovedNodes)
+ {
+ // pass lists to search manager
+ if (searchManager != null && (addedNodes.size() > 0 || removedNodes.size() > 0))
{
- searchManager.updateIndex(removedNodes, addedNodes);
- }
- catch (RepositoryException e)
- {
- log.error("Error indexing changes " + e, e);
- }
- catch (IOException e)
- {
- log.error("Error indexing changes " + e, e);
try
{
- handler.logErrorChanges(removedNodes, addedNodes);
+ searchManager.updateIndex(removedNodes, addedNodes);
}
- catch (IOException ioe)
+ catch (RepositoryException e)
{
- log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
+ log.error("Error indexing changes " + e, e);
}
+ catch (IOException e)
+ {
+ log.error("Error indexing changes " + e, e);
+ try
+ {
+ handler.logErrorChanges(removedNodes, addedNodes);
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
+ }
+ }
}
- }
- // pass lists to parent search manager
- if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
- {
- try
+ // pass lists to parent search manager
+ if (parentSearchManager != null && (parentAddedNodes.size() > 0 || parentRemovedNodes.size() > 0))
{
- parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
- }
- catch (RepositoryException e)
- {
- log.error("Error indexing changes " + e, e);
- }
- catch (IOException e)
- {
- log.error("Error indexing changes " + e, e);
try
{
- parentHandler.logErrorChanges(removedNodes, addedNodes);
+ parentSearchManager.updateIndex(parentRemovedNodes, parentAddedNodes);
}
- catch (IOException ioe)
+ catch (RepositoryException e)
{
- log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
+ log.error("Error indexing changes " + e, e);
}
+ catch (IOException e)
+ {
+ log.error("Error indexing changes " + e, e);
+ try
+ {
+ parentHandler.logErrorChanges(removedNodes, addedNodes);
+ }
+ catch (IOException ioe)
+ {
+ log.warn("Exception occure when errorLog writed. Error log is not complete. " + ioe, ioe);
+ }
+ }
}
- }
+ }
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/IndexerSingletonStoreCacheLoader.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -64,32 +64,36 @@
if (debugEnabled)
log.debug("start pushing in-memory state to cache cacheLoader collection");
- final Set<String> removedNodes = new HashSet<String>();
- final Set<String> addedNodes = new HashSet<String>();
- final Set<String> parentRemovedNodes = new HashSet<String>();
- final Set<String> parentAddedNodes = new HashSet<String>();
// merging all lists stored in memory
Collection<NodeSPI> children = cache.getRoot().getChildren();
- for (NodeSPI aChildren : children)
+ for (NodeSPI wsChildren : children)
{
- Fqn<?> fqn = aChildren.getFqn();
- Object value = cache.get(fqn, JBossCacheIndexChangesFilter.LISTWRAPPER);
- if (value != null && value instanceof ChangesFilterListsWrapper)
+ final Set<String> removedNodes = new HashSet<String>();
+ final Set<String> addedNodes = new HashSet<String>();
+ final Set<String> parentRemovedNodes = new HashSet<String>();
+ final Set<String> parentAddedNodes = new HashSet<String>();
+ Collection<NodeSPI> changes = wsChildren.getChildren();
+ for (NodeSPI aChildren : changes)
{
- // get wrapper object
- ChangesFilterListsWrapper listsWrapper = (ChangesFilterListsWrapper)value;
- // get search manager lists
- addedNodes.addAll(listsWrapper.getAddedNodes());
- removedNodes.addAll(listsWrapper.getRemovedNodes());
- // parent search manager lists
- parentAddedNodes.addAll(listsWrapper.getParentAddedNodes());
- parentRemovedNodes.addAll(listsWrapper.getParentAddedNodes());
- };
+ Fqn<?> fqn = aChildren.getFqn();
+ Object value = cache.get(fqn, JBossCacheIndexChangesFilter.LISTWRAPPER);
+ if (value != null && value instanceof ChangesFilterListsWrapper)
+ {
+ // get wrapper object
+ ChangesFilterListsWrapper listsWrapper = (ChangesFilterListsWrapper)value;
+ // get search manager lists
+ addedNodes.addAll(listsWrapper.getAddedNodes());
+ removedNodes.addAll(listsWrapper.getRemovedNodes());
+ // parent search manager lists
+ parentAddedNodes.addAll(listsWrapper.getParentAddedNodes());
+ parentRemovedNodes.addAll(listsWrapper.getParentAddedNodes());
+ }
+ }
+ //TODO: recover logic is here, lists are: removedNodes and addedNodes String id = IdGenerator.generate();
+ String id = IdGenerator.generate();
+ cache.put(Fqn.fromRelativeElements(wsChildren.getFqn(), id), JBossCacheIndexChangesFilter.LISTWRAPPER, new ChangesFilterListsWrapper(addedNodes,
+ removedNodes, parentAddedNodes, parentRemovedNodes));
}
- //TODO: recover logic is here, lists are: removedNodes and addedNodes String id = IdGenerator.generate();
- String id = IdGenerator.generate();
- cache.put(id, JBossCacheIndexChangesFilter.LISTWRAPPER, new ChangesFilterListsWrapper(addedNodes,
- removedNodes, parentAddedNodes, parentRemovedNodes));
if (debugEnabled)
log.debug("in-memory state passed to cache cacheLoader successfully");
return null;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -30,15 +30,19 @@
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
+import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
import org.jboss.cache.CacheSPI;
+import org.jboss.cache.Fqn;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
+import org.jboss.cache.config.Configuration.CacheMode;
+import org.jboss.cache.loader.SingletonStoreCacheLoader.PushStateException;
import java.io.IOException;
import java.io.Serializable;
@@ -61,6 +65,8 @@
private final Cache<Serializable, Object> cache;
+ private final Fqn<String> rootFqn;
+
public static final String LISTWRAPPER = "$lists".intern();
/**
@@ -77,12 +83,10 @@
super(searchManager, parentSearchManager, config, indexingTree, parentIndexingTree, handler, parentHandler, cfm);
// create cache using custom factory
ExoJBossCacheFactory<Serializable, Object> factory = new ExoJBossCacheFactory<Serializable, Object>(cfm);
- this.cache = factory.createCache(config);
+ Cache<Serializable, Object> initCache = factory.createCache(config);
// initialize IndexerCacheLoader
IndexerCacheLoader indexerCacheLoader = new IndexerCacheLoader();
- // inject dependencies
- indexerCacheLoader.init(searchManager, parentSearchManager, handler, parentHandler);
// set SingltonStoreCacheLoader
SingletonStoreConfig singletonStoreConfig = new SingletonStoreConfig();
singletonStoreConfig.setSingletonStoreClass(IndexerSingletonStoreCacheLoader.class.getName());
@@ -114,31 +118,53 @@
cacheLoaderConfig.setPassivation(false);
cacheLoaderConfig.addIndividualCacheLoaderConfig(individualCacheLoaderConfig);
// insert CacheLoaderConfig
- this.cache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
+ initCache.getConfiguration().setCacheLoaderConfig(cacheLoaderConfig);
+ this.rootFqn = Fqn.fromElements(searchManager.getWsId());
+ this.cache = ExoJBossCacheFactory.getUniqueInstance(CacheType.INDEX_CACHE, rootFqn, initCache);
+ this.cache.create();
+ this.cache.start();
- PrivilegedCacheHelper.create(cache);
- PrivilegedCacheHelper.start(cache);
-
// start will invoke cache listener which will notify handler that mode is changed
IndexerIoMode ioMode =
((CacheSPI)cache).getRPCManager().isCoordinator() ? IndexerIoMode.READ_WRITE : IndexerIoMode.READ_ONLY;
+
+ // Could have change of cache
+ IndexerSingletonStoreCacheLoader issCacheLoader =
+ (IndexerSingletonStoreCacheLoader)((CacheSPI)cache).getCacheLoaderManager().getCacheLoader();
+
+ // This code make it possible to use the JBossCacheIndexChangesFilter in
+ // a non-cluster environment
+ if (cache.getConfiguration().getCacheMode() == CacheMode.LOCAL)
+ {
+ // Activate the cache loader
+ try
+ {
+ issCacheLoader.activeStatusChanged(true);
+ }
+ catch (PushStateException e)
+ {
+ // ignore me;
+ }
+ }
+ indexerCacheLoader = (IndexerCacheLoader)issCacheLoader.getCacheLoader();
+
+ indexerCacheLoader.register(searchManager, parentSearchManager, handler, parentHandler);
IndexerIoModeHandler modeHandler = indexerCacheLoader.getModeHandler();
handler.setIndexerIoModeHandler(modeHandler);
parentHandler.setIndexerIoModeHandler(modeHandler);
if (!parentHandler.isInitialized())
{
- parentHandler.setIndexInfos(new JBossCacheIndexInfos(cache, true, modeHandler));
- parentHandler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(cache, true, modeHandler));
+ parentHandler.setIndexInfos(new JBossCacheIndexInfos(rootFqn, cache, true, modeHandler));
+ parentHandler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(rootFqn, cache, true, modeHandler));
parentHandler.init();
}
if (!handler.isInitialized())
{
- handler.setIndexInfos(new JBossCacheIndexInfos(cache, false, modeHandler));
- handler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(cache, false, modeHandler));
+ handler.setIndexInfos(new JBossCacheIndexInfos(rootFqn, cache, false, modeHandler));
+ handler.setIndexUpdateMonitor(new JBossCacheIndexUpdateMonitor(rootFqn, cache, false, modeHandler));
handler.init();
}
-
}
/**
@@ -151,8 +177,8 @@
String id = IdGenerator.generate();
try
{
- PrivilegedCacheHelper.put(cache, id, LISTWRAPPER, new ChangesFilterListsWrapper(addedNodes, removedNodes,
- parentAddedNodes, parentRemovedNodes));
+ PrivilegedCacheHelper.put(cache, Fqn.fromRelativeElements(rootFqn, id), LISTWRAPPER,
+ new ChangesFilterListsWrapper(addedNodes, removedNodes, parentAddedNodes, parentRemovedNodes));
}
catch (CacheException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -84,16 +84,16 @@
/**
* @param cache instance of JbossCache that is used to deliver index names
*/
- public JBossCacheIndexInfos(Cache<Serializable, Object> cache, boolean system, IndexerIoModeHandler modeHandler)
+ public JBossCacheIndexInfos(Fqn<String> rootFqn, Cache<Serializable, Object> cache, boolean system, IndexerIoModeHandler modeHandler)
{
- this(DEFALUT_NAME, cache, system, modeHandler);
+ this(rootFqn, DEFALUT_NAME, cache, system, modeHandler);
}
/**
* @param fileName where index names are stored.
* @param cache instance of JbossCache that is used to deliver index names
*/
- public JBossCacheIndexInfos(String fileName, Cache<Serializable, Object> cache, boolean system,
+ public JBossCacheIndexInfos(Fqn<String> rootFqn, String fileName, Cache<Serializable, Object> cache, boolean system,
IndexerIoModeHandler modeHandler)
{
super(fileName);
@@ -101,7 +101,7 @@
this.modeHandler = modeHandler;
modeHandler.addIndexerIoModeListener(this);
// store parsed FQN to avoid it's parsing each time cache event is generated
- namesFqn = Fqn.fromString(system ? SYSINDEX_NAMES : INDEX_NAMES);
+ namesFqn = Fqn.fromRelativeElements(rootFqn, system ? SYSINDEX_NAMES : INDEX_NAMES);
Node<Serializable, Object> cacheRoot = cache.getRoot();
// prepare cache structures
if (!cacheRoot.hasChild(namesFqn))
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -78,14 +78,14 @@
/**
* @param cache instance of JbossCache that is used to deliver index names
*/
- public JBossCacheIndexUpdateMonitor(Cache<Serializable, Object> cache, boolean system,
+ public JBossCacheIndexUpdateMonitor(Fqn<String> rootFqn, Cache<Serializable, Object> cache, boolean system,
IndexerIoModeHandler modeHandler)
{
this.cache = cache;
this.modeHandler = modeHandler;
this.listeners = new CopyOnWriteArrayList<IndexUpdateMonitorListener>();
// store parsed FQN to avoid it's parsing each time cache event is generated
- this.parametersFqn = Fqn.fromString(system ? INDEX_PARAMETERS : SYSINDEX_PARAMETERS);
+ this.parametersFqn = Fqn.fromRelativeElements(rootFqn, system ? INDEX_PARAMETERS : SYSINDEX_PARAMETERS);
modeHandler.addIndexerIoModeListener(this);
Node<Serializable, Object> cacheRoot = cache.getRoot();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -36,6 +36,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
+import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.TransactionService;
@@ -305,16 +306,19 @@
LOG.info("Using BufferedJBossCache compatible with Expiration algorithm.");
}
+ Fqn<String> rootFqn = Fqn.fromElements(wsConfig.getUniqueName());
+ parentCache = ExoJBossCacheFactory.getUniqueInstance(CacheType.JCR_CACHE, rootFqn, parentCache);
+
// if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
this.cache =
- new BufferedJBossCache(factory.createCache(wsConfig.getCache()), useExpiration, wsConfig.getCache()
+ new BufferedJBossCache(parentCache, useExpiration, wsConfig.getCache()
.getParameterTime(JBOSSCACHE_EXPIRATION, JBOSSCACHE_EXPIRATION_DEFAULT));
- this.itemsRoot = Fqn.fromElements(ITEMS);
- this.childNodes = Fqn.fromElements(CHILD_NODES);
- this.childProps = Fqn.fromElements(CHILD_PROPS);
- this.childNodesList = Fqn.fromElements(CHILD_NODES_LIST);
- this.childPropsList = Fqn.fromElements(CHILD_PROPS_LIST);
+ this.itemsRoot = Fqn.fromRelativeElements(rootFqn, ITEMS);
+ this.childNodes = Fqn.fromRelativeElements(rootFqn, CHILD_NODES);
+ this.childProps = Fqn.fromRelativeElements(rootFqn, CHILD_PROPS);
+ this.childNodesList = Fqn.fromRelativeElements(rootFqn, CHILD_NODES_LIST);
+ this.childPropsList = Fqn.fromRelativeElements(rootFqn, CHILD_PROPS_LIST);
this.cache.create();
this.cache.start();
@@ -722,7 +726,7 @@
public long getSize()
{
// Total number of JBC nodes in the cache - the total amount of resident nodes
- return cache.getNumberOfNodes() - 5;
+ return cache.getNumberOfNodes() - 5 * cache.getRoot().getChildrenNames().size();
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -63,15 +63,15 @@
log.debug("Unable to evict " + fqn, e);
result = false;
}
- if (fqn.size() != 3)
+ if (fqn.size() != 4)
{
return result;
}
try
{
Fqn parentFqn = fqn.getParent();
- if (parentFqn.get(0).equals(JBossCacheWorkspaceStorageCache.CHILD_NODES)
- || parentFqn.get(0).equals(JBossCacheWorkspaceStorageCache.CHILD_PROPS))
+ if (parentFqn.get(1).equals(JBossCacheWorkspaceStorageCache.CHILD_NODES)
+ || parentFqn.get(1).equals(JBossCacheWorkspaceStorageCache.CHILD_PROPS))
{
// The expected data structure is of type $CHILD_NODES/${node-id}/${sub-node-name} or
// $CHILD_PROPS/${node-id}/${sub-property-name}
@@ -83,7 +83,7 @@
if (node != null)
{
Set<Object> names = node.getChildrenNamesDirect();
- if (names.isEmpty() || (names.size() == 1 && names.contains(fqn.get(2))))
+ if (names.isEmpty() || (names.size() == 1 && names.contains(fqn.get(3))))
{
if (log.isTraceEnabled())
log.trace("Evicting Fqn " + fqn);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.jbosscache;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -27,12 +29,19 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
+import org.jboss.cache.Region;
+import org.jboss.cache.config.Configuration;
+import org.jboss.cache.config.EvictionConfig;
+import org.jboss.cache.config.EvictionRegionConfig;
import org.jgroups.JChannelFactory;
import java.io.IOException;
import java.io.InputStream;
import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
import javax.transaction.TransactionManager;
@@ -60,13 +69,20 @@
public static final String JGROUPS_MUX_ENABLED = "jgroups-multiplexer-stack";
+ /**
+ * A Map that contains all the registered JBC instances, ordered by
+ * {@link ExoContainer} instances, {@link CacheType} and JBC Configuration.
+ */
+ private static Map<ExoContainer, Map<CacheType, Map<Configuration, Cache>>> CACHES =
+ new HashMap<ExoContainer, Map<CacheType, Map<Configuration, Cache>>>();
+
private final TemplateConfigurationHelper configurationHelper;
private final TransactionManager transactionManager;
private ConfigurationManager configurationManager;
- private final Log log = ExoLogger.getLogger("exo.jcr.component.core.ExoJBossCacheFactory");
+ private static final Log log = ExoLogger.getLogger("exo.jcr.component.core.ExoJBossCacheFactory");
/**
* Creates ExoJbossCacheFactory with provided configuration transaction managers.
@@ -156,6 +172,7 @@
// Create and inject multiplexer factory
JChannelFactory muxFactory = new JChannelFactory();
muxFactory.setMultiplexerConfig(configurationManager.getResource(jgroupsConfigurationFilePath));
+
cache.getConfiguration().getRuntimeConfig().setMuxChannelFactory(muxFactory);
log.info("Multiplexer stack successfully enabled for the cache.");
}
@@ -188,4 +205,84 @@
}
return cache;
}
+
+ /**
+ * Add a region to the given cache
+ * @param fqn the roof fqn of the region to add
+ * @param cache the cache to which we want to add the region
+ * @param cfg the configuration from which the Eviction Algorithm Config must be extracted
+ */
+ private static <K, V> void addEvictionRegion(Fqn<String> fqn, Cache<K, V> cache, Configuration cfg)
+ {
+ EvictionConfig ec = cfg.getEvictionConfig();
+ // Create the region and set the config
+ Region region = cache.getRegion(fqn, true);
+ if (ec != null && ec.getDefaultEvictionRegionConfig() != null
+ && ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig() != null)
+ {
+ EvictionRegionConfig erc =
+ new EvictionRegionConfig(fqn, ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig());
+ region.setEvictionRegionConfig(erc);
+ }
+ }
+
+ /**
+ * Try to find if a Cache of the same type (i.e. their {@link Configuration} are equals)
+ * has already been registered for the same current container and the same {@link CacheType}.
+ * If no cache has been registered, we register the given cache otherwise we
+ * use the previously registered cache and we create a dedicated region to the shared cache
+ * for the given cache.
+ * @param cacheType The type of the target cache
+ * @param rootFqn the rootFq
+ * @param cache the cache to register
+ * @return the unique instance of the same cache registered
+ * @throws RepositoryConfigurationException
+ */
+ @SuppressWarnings("unchecked")
+ public static synchronized <K, V> Cache<K, V> getUniqueInstance(CacheType cacheType, Fqn<String> rootFqn,
+ Cache<K, V> cache) throws RepositoryConfigurationException
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ Map<CacheType, Map<Configuration, Cache>> allCacheTypes = CACHES.get(container);
+ if (allCacheTypes == null)
+ {
+ allCacheTypes = new HashMap<CacheType, Map<Configuration, Cache>>();
+ CACHES.put(container, allCacheTypes);
+ }
+ Map<Configuration, Cache> caches = allCacheTypes.get(cacheType);
+ if (caches == null)
+ {
+ caches = new HashMap<Configuration, Cache>();
+ allCacheTypes.put(cacheType, caches);
+ }
+ Configuration cfg;
+ try
+ {
+ cfg = cache.getConfiguration().clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+ throw new RepositoryConfigurationException("Cannot clone the configuration.", e);
+ }
+ if (caches.containsKey(cfg))
+ {
+ cache = caches.get(cfg);
+ if (log.isInfoEnabled())
+ log.info("The region " + rootFqn + " has been registered for a cache of type " + cacheType
+ + " and the container " + container.getContext().getName());
+ }
+ else
+ {
+ caches.put(cfg, cache);
+ }
+ addEvictionRegion(rootFqn, cache, cfg);
+ return cache;
+ }
+
+ /**
+ * All the known cache types
+ */
+ public enum CacheType {
+ JCR_CACHE, INDEX_CACHE, LOCK_CACHE
+ };
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestJBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestJBossCacheWorkspaceStorageCache.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestJBossCacheWorkspaceStorageCache.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -49,6 +49,7 @@
CacheEntry entry = new CacheEntry(list);
WorkspaceEntry workspaceEntry = new WorkspaceEntry();
+ workspaceEntry.setUniqueName("WS_UUID");
workspaceEntry.setCache(entry);
return new JBossCacheWorkspaceStorageCache(workspaceEntry,
transactionService == null ? null : transactionService, new ConfigurationManagerImpl());
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java 2010-09-07 09:36:10 UTC (rev 3064)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/lab/cluster/prepare/TestIndexUpdateMonitor.java 2010-09-07 13:00:55 UTC (rev 3065)
@@ -29,6 +29,7 @@
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.DefaultCacheFactory;
+import org.jboss.cache.Fqn;
import java.io.Serializable;
@@ -58,7 +59,7 @@
super.setUp();
cache = createCache();
indexUpdateMonitor =
- new JBossCacheIndexUpdateMonitor(cache, false, new IndexerIoModeHandler(IndexerIoMode.READ_WRITE));
+ new JBossCacheIndexUpdateMonitor(Fqn.fromString("root"),cache, false, new IndexerIoModeHandler(IndexerIoMode.READ_WRITE));
}
/**
15 years, 8 months
exo-jcr SVN: r3064 - core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-07 05:36:10 -0400 (Tue, 07 Sep 2010)
New Revision: 3064
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
Log:
EXOJCR-749: TikaDocumentReaderService updated
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2010-09-06 13:54:01 UTC (rev 3063)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReader.java 2010-09-07 09:36:10 UTC (rev 3064)
@@ -108,7 +108,13 @@
}
finally
{
- is.close();
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
}
}
@@ -139,7 +145,13 @@
}
finally
{
- is.close();
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
}
}
@@ -198,7 +210,13 @@
}
finally
{
- is.close();
+ try
+ {
+ is.close();
+ }
+ catch (Throwable e)
+ {
+ }
}
}
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-06 13:54:01 UTC (rev 3063)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-07 09:36:10 UTC (rev 3064)
@@ -72,7 +72,8 @@
public DocumentReader getDocumentReader(String mimeType) throws HandlerNotFoundException
{
// first check user defined old-style and previously registered TikaDocumentReaders
- DocumentReader reader = readers_.get(mimeType.toLowerCase());
+ mimeType = mimeType.toLowerCase();
+ DocumentReader reader = readers_.get(mimeType);
if (reader != null)
{
@@ -83,32 +84,32 @@
// tika-config may contain really big amount of mimetypes, but used only few,
// so to avoid load in memory many copies of DocumentReader, we will register it
// only if someone need it
- synchronized (this)
+ Parser tikaParser = conf.getParser(mimeType);
+ if (tikaParser != null)
{
- // Check if the reader has been registered since the thread is blocked
- reader = readers_.get(mimeType);
- if (reader != null)
+ synchronized (this)
{
- return reader;
- }
+ // Check if the reader has been registered since the thread is blocked
+ reader = readers_.get(mimeType);
+ if (reader != null)
+ {
+ return reader;
+ }
- Parser tikaParser = conf.getParser(mimeType);
- if (tikaParser != null)
- {
reader = new TikaDocumentReader(tikaParser, mimeType);
// Initialize the map with the existing values
Map<String, DocumentReader> tmpReaders = new HashMap<String, DocumentReader>(readers_);
// Register new document reader
tmpReaders.put(mimeType, reader);
// Update the map of readers
- this.readers_ = tmpReaders;
+ readers_ = tmpReaders;
return reader;
}
- else
- {
- throw new HandlerNotFoundException("No appropriate properties extractor for " + mimeType);
- }
}
+ else
+ {
+ throw new HandlerNotFoundException("No appropriate properties extractor for " + mimeType);
+ }
}
}
}
15 years, 8 months
exo-jcr SVN: r3063 - in core/trunk/exo.core.component.document/src/main: resources/conf/portal and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-06 09:54:01 -0400 (Mon, 06 Sep 2010)
New Revision: 3063
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/DocumentReaderServiceImpl.java
core/trunk/exo.core.component.document/src/main/resources/conf/portal/configuration.xml
Log:
EXOJCR-749: readers map is volatile now; configuration updated
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/DocumentReaderServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/DocumentReaderServiceImpl.java 2010-09-06 13:03:31 UTC (rev 3062)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/DocumentReaderServiceImpl.java 2010-09-06 13:54:01 UTC (rev 3063)
@@ -37,7 +37,7 @@
*/
public class DocumentReaderServiceImpl implements DocumentReaderService
{
- protected Map<String, DocumentReader> readers_;
+ protected volatile Map<String, DocumentReader> readers_;
public DocumentReaderServiceImpl(InitParams params)
{
Modified: core/trunk/exo.core.component.document/src/main/resources/conf/portal/configuration.xml
===================================================================
--- core/trunk/exo.core.component.document/src/main/resources/conf/portal/configuration.xml 2010-09-06 13:03:31 UTC (rev 3062)
+++ core/trunk/exo.core.component.document/src/main/resources/conf/portal/configuration.xml 2010-09-06 13:54:01 UTC (rev 3063)
@@ -15,7 +15,8 @@
<component>
<key>org.exoplatform.services.document.DocumentReaderService</key>
- <type>org.exoplatform.services.document.impl.DocumentReaderServiceImpl</type>
+ <type>org.exoplatform.services.document.impl.tika.TikaDocumentReaderServiceImpl</type>
+
<component-plugins>
<component-plugin>
<name>pdf.document.reader</name>
@@ -108,5 +109,13 @@
</component-plugin>
</component-plugins>
+
+ <init-params>
+ <value-param>
+ <name>tika-configuration</name>
+ <value>jar:/conf/portal/tika-config.xml</value>
+ </value-param>
+ </init-params>
+
</component>
</configuration>
15 years, 8 months
exo-jcr SVN: r3061 - core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/tika.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-06 07:33:15 -0400 (Mon, 06 Sep 2010)
New Revision: 3061
Modified:
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/tika/TestPropertiesExtractionOnTika.java
Log:
EXOJCR-749: TestPropertiesExtractionOnTika dates fixed
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/tika/TestPropertiesExtractionOnTika.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/tika/TestPropertiesExtractionOnTika.java 2010-09-06 11:00:50 UTC (rev 3060)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/tika/TestPropertiesExtractionOnTika.java 2010-09-06 11:33:15 UTC (rev 3061)
@@ -24,6 +24,7 @@
import java.io.InputStream;
import java.util.Calendar;
+import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
@@ -96,7 +97,7 @@
Properties props = service.getDocumentReader("application/msword").getProperties(is);
Properties etalon = new Properties();
etalon.put(DCMetaData.TITLE, "test-Title");
- etalon.put(DCMetaData.DATE, "Tue Aug 31 12:31:00 EEST 2010");
+ etalon.put(DCMetaData.DATE, (new Date(1283247060000L)).toString());
etalon.put(DCMetaData.SUBJECT, "test-Subject");
etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
@@ -117,11 +118,8 @@
{
Properties props = service.getDocumentReader("application/powerpoint").getProperties(is);
Properties etalon = new Properties();
- Calendar date = Calendar.getInstance();
- date.setTimeInMillis(41);
- date.set(2010, 7, 31, 12, 34, 15);
etalon.put(DCMetaData.TITLE, "test-Title");
- etalon.put(DCMetaData.DATE, date.getTime().toString());
+ etalon.put(DCMetaData.DATE, (new Date(1283247255041L)).toString());
etalon.put(DCMetaData.SUBJECT, "test-Subject");
etalon.put(DCMetaData.CREATOR, "Max Yakimenko");
etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
@@ -141,12 +139,8 @@
{
Properties props = service.getDocumentReader("application/excel").getProperties(is);
Properties etalon = new Properties();
- Calendar date = Calendar.getInstance();
- date.setTimeInMillis(0);
- date.set(2010, 7, 31, 12, 34, 53);
-
etalon.put(DCMetaData.TITLE, "test-Title");
- etalon.put(DCMetaData.DATE, date.getTime().toString());
+ etalon.put(DCMetaData.DATE, (new Date(1283247293000L)).toString());
etalon.put(DCMetaData.SUBJECT, "test-Subject");
etalon.put(DCMetaData.CREATOR, "KHANH NGUYEN GIA");
etalon.put(DCMetaData.CONTRIBUTOR, "Max Yakimenko");
15 years, 8 months
exo-jcr SVN: r3060 - core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-06 07:00:50 -0400 (Mon, 06 Sep 2010)
New Revision: 3060
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
Log:
EXOJCR-749: TikaDocumentReaderService updated
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-06 09:26:17 UTC (rev 3059)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-06 11:00:50 UTC (rev 3060)
@@ -25,6 +25,8 @@
import org.exoplatform.services.document.impl.DocumentReaderServiceImpl;
import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
/**
* Created by The eXo Platform SAS.
@@ -69,34 +71,37 @@
*/
public DocumentReader getDocumentReader(String mimeType) throws HandlerNotFoundException
{
- try
+ // first check user defined old-style and previously registered TikaDocumentReaders
+ DocumentReader reader = readers_.get(mimeType.toLowerCase());
+
+ if (reader != null)
{
- // first check user defined old-style and previously registered TikaDocumentReaders
- return super.getDocumentReader(mimeType);
+ return reader;
}
- catch (HandlerNotFoundException e)
+ else
{
// tika-config may contain really big amount of mimetypes, but used only few,
// so to avoid load in memory many copies of DocumentReader, we will register it
// only if someone need it
synchronized (this)
{
- //check again - previous thread may register TikaDocumenReader that we are looking
- try
+ // Check if the reader has been registered since the thread is blocked
+ reader = readers_.get(mimeType);
+ if (reader != null)
{
- return super.getDocumentReader(mimeType);
+ return reader;
}
- catch (HandlerNotFoundException ex)
- {
- // keep working
- }
Parser tikaParser = conf.getParser(mimeType);
if (tikaParser != null)
{
- TikaDocumentReader reader = new TikaDocumentReader(tikaParser, mimeType);
- //register new document reader
- super.readers_.put(mimeType, reader);
+ reader = new TikaDocumentReader(tikaParser, mimeType);
+ // Initialize the map with the existing values
+ Map<String, DocumentReader> tmpReaders = new HashMap<String, DocumentReader>(readers_);
+ // Register new document reader
+ tmpReaders.put(mimeType, reader);
+ // Update the map of readers
+ this.readers_ = tmpReaders;
return reader;
}
else
15 years, 8 months
exo-jcr SVN: r3059 - core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-06 05:26:17 -0400 (Mon, 06 Sep 2010)
New Revision: 3059
Modified:
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
Log:
EXOJCR-749: TikaDocumentReaderService: lazy TikaDocumentReader registering synchronized
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-05 23:13:00 UTC (rev 3058)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/tika/TikaDocumentReaderServiceImpl.java 2010-09-06 09:26:17 UTC (rev 3059)
@@ -79,18 +79,31 @@
// tika-config may contain really big amount of mimetypes, but used only few,
// so to avoid load in memory many copies of DocumentReader, we will register it
// only if someone need it
- Parser tikaParser = conf.getParser(mimeType);
- if (tikaParser != null)
+ synchronized (this)
{
- TikaDocumentReader reader = new TikaDocumentReader(tikaParser, mimeType);
- //register new document reader
- super.readers_.put(mimeType, reader);
- return reader;
+ //check again - previous thread may register TikaDocumenReader that we are looking
+ try
+ {
+ return super.getDocumentReader(mimeType);
+ }
+ catch (HandlerNotFoundException ex)
+ {
+ // keep working
+ }
+
+ Parser tikaParser = conf.getParser(mimeType);
+ if (tikaParser != null)
+ {
+ TikaDocumentReader reader = new TikaDocumentReader(tikaParser, mimeType);
+ //register new document reader
+ super.readers_.put(mimeType, reader);
+ return reader;
+ }
+ else
+ {
+ throw new HandlerNotFoundException("No appropriate properties extractor for " + mimeType);
+ }
}
- else
- {
- throw new HandlerNotFoundException("No appropriate properties extractor for " + mimeType);
- }
}
}
}
15 years, 9 months
exo-jcr SVN: r3058 - in jcr/branches/1.12.x: applications and 23 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-09-05 19:13:00 -0400 (Sun, 05 Sep 2010)
New Revision: 3058
Modified:
jcr/branches/1.12.x/
jcr/branches/1.12.x/applications/
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/
jcr/branches/1.12.x/applications/exo.jcr.applications.browser/
jcr/branches/1.12.x/applications/exo.jcr.applications.config/
jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor/
jcr/branches/1.12.x/applications/exo.jcr.applications.jboss/
jcr/branches/1.12.x/applications/exo.jcr.applications.jonas/
jcr/branches/1.12.x/applications/exo.jcr.applications.rest/
jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat/
jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient/
jcr/branches/1.12.x/applications/exo.jcr.ear/
jcr/branches/1.12.x/exo.jcr.component.core/
jcr/branches/1.12.x/exo.jcr.component.ext/
jcr/branches/1.12.x/exo.jcr.component.ftp/
jcr/branches/1.12.x/exo.jcr.component.statistics/
jcr/branches/1.12.x/exo.jcr.component.webdav/
jcr/branches/1.12.x/exo.jcr.connectors.localadapter/
jcr/branches/1.12.x/exo.jcr.docs/
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/
jcr/branches/1.12.x/exo.jcr.framework.command/
jcr/branches/1.12.x/exo.jcr.framework.ftpclient/
jcr/branches/1.12.x/exo.jcr.framework.web/
jcr/branches/1.12.x/packaging/module/
Log:
Add/Update svn:ignore property to not commit IDEs/Maven generated files and directories
Property changes on: jcr/branches/1.12.x
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.browser
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.config
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.fckeditor
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.jboss
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.jonas
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.rest
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.applications.tomcat
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.cluster.testclient
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/applications/exo.jcr.ear
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.component.core
___________________________________________________________________
Name: svn:ignore
- .settings
target
.classpath
.project
ObjectStore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.component.ext
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.component.ftp
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.component.statistics
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.component.webdav
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.connectors.localadapter
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.docs
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.framework.command
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.framework.ftpclient
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/exo.jcr.framework.web
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: jcr/branches/1.12.x/packaging/module
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
15 years, 9 months
exo-jcr SVN: r3057 - in ws/branches/2.1.x: exo.ws.commons and 6 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-09-05 19:12:09 -0400 (Sun, 05 Sep 2010)
New Revision: 3057
Modified:
ws/branches/2.1.x/
ws/branches/2.1.x/exo.ws.commons/
ws/branches/2.1.x/exo.ws.frameworks.json/
ws/branches/2.1.x/exo.ws.frameworks.servlet/
ws/branches/2.1.x/exo.ws.rest.core/
ws/branches/2.1.x/exo.ws.rest.ext/
ws/branches/2.1.x/exo.ws.testframework/
ws/branches/2.1.x/packaging/module/
Log:
Add/Update svn:ignore property to not commit IDEs/Maven generated files and directories
Property changes on: ws/branches/2.1.x
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.commons
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.frameworks.json
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.frameworks.servlet
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.rest.core
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.rest.ext
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/exo.ws.testframework
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: ws/branches/2.1.x/packaging/module
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
15 years, 9 months