exo-jcr SVN: r5487 - in kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services: cache/impl/infinispan/distributed and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-19 14:54:39 -0500 (Thu, 19 Jan 2012)
New Revision: 5487
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
Log:
EXOJCR-1682: Sonar violations fixed for these projects
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/AbstractExoCache.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -62,7 +62,7 @@
/**
* Logger.
*/
- private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.AbstractExoCache");
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.AbstractExoCache"); //NOSONAR
private final AtomicInteger hits = new AtomicInteger(0);
@@ -101,7 +101,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("The listener cannot be null");
}
listeners.add(new ListenerContext<K, V>(listener, this));
}
@@ -225,7 +225,7 @@
{
if (key == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
else if (value == null)
{
@@ -260,7 +260,7 @@
{
if (objs == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
for (Serializable name : objs.keySet())
{
@@ -290,7 +290,7 @@
onPut(entry.getKey(), entry.getValue());
}
}
- catch (Exception e)
+ catch (Exception e) //NOSONAR
{
cache.endBatch(false);
LOG.warn("An error occurs while executing the putMap method", e);
@@ -308,7 +308,7 @@
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
V result = SecurityHelper.doPrivilegedAction(new PrivilegedAction<V>()
{
@@ -421,7 +421,7 @@
{
context.onExpire(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -441,7 +441,7 @@
{
context.onRemove(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -460,7 +460,7 @@
{
context.onPut(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -478,7 +478,7 @@
{
context.onGet(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -496,7 +496,7 @@
{
context.onClearCache();
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/ExoCacheFactoryImpl.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -75,7 +75,7 @@
* The logger
*/
private static final Log LOG = ExoLogger
- .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.ExoCacheFactoryImpl");
+ .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.ExoCacheFactoryImpl");//NOSONAR
/**
* The initial parameter key that defines the full path of the configuration template
@@ -164,7 +164,7 @@
this.configManager = configManager;
if (cacheConfigTemplate == null)
{
- throw new RuntimeException("The parameter '" + CACHE_CONFIG_TEMPLATE_KEY + "' must be set");
+ throw new IllegalArgumentException("The parameter '" + CACHE_CONFIG_TEMPLATE_KEY + "' must be set");
}
// Initialize the main cache manager
this.cacheManager = initCacheManager(cacheConfigTemplate);
@@ -191,7 +191,7 @@
// Read the configuration file of the cache
is = configManager.getInputStream(cacheConfigTemplate);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
throw new ExoCacheInitException("The configuration of the CacheManager cannot be loaded from '"
+ cacheConfigTemplate + "'", e);
@@ -211,7 +211,7 @@
configBuilder = holder.getGlobalConfigurationBuilder();
config = holder.getDefaultConfigurationBuilder().build();
}
- catch (Exception e)
+ catch (RuntimeException e) //NOSONAR
{
throw new ExoCacheInitException("Cannot parse the configuration '" + cacheConfigTemplate + "'", e);
}
@@ -221,7 +221,7 @@
// Create the CacheManager from the new configuration
return new DefaultCacheManager(configBuilder.build(), config);
}
- catch (Exception e)
+ catch (RuntimeException e) //NOSONAR
{
throw new ExoCacheInitException(
"Cannot initialize the CacheManager corresponding to the configuration '" + cacheConfigTemplate
@@ -235,7 +235,7 @@
Throwable cause = e.getCause();
if (cause instanceof ExoCacheInitException)
{
- throw (ExoCacheInitException)cause;
+ throw (ExoCacheInitException)cause;//NOSONAR
}
else
{
@@ -362,7 +362,7 @@
Throwable cause = e.getCause();
if (cause instanceof Exception)
{
- throw (Exception)cause;
+ throw (Exception)cause;//NOSONAR
}
else
{
@@ -385,7 +385,7 @@
// We expect a distributed cache
if (distributedCacheManager == null)
{
- throw new NullPointerException("The DistributedCacheManager has not been defined in the configuration,"
+ throw new IllegalStateException("The DistributedCacheManager has not been defined in the configuration,"
+ " please configure it at root container level if you want to use a distributed cache.");
}
return new DistributedExoCache(ctx, config,
@@ -440,7 +440,7 @@
Throwable cause = e.getCause();
if (cause instanceof Exception)
{
- throw (Exception)cause;
+ throw (Exception)cause;//NOSONAR
}
else
{
@@ -470,7 +470,7 @@
Set<String> implementations = creator.getExpectedImplementations();
if (implementations == null)
{
- throw new NullPointerException("The set of implementations cannot be null");
+ throw new IllegalArgumentException("The set of implementations cannot be null");
}
for (String imp : implementations)
{
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/distributed/DistributedExoCache.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -77,7 +77,7 @@
* Logger.
*/
private static final Log LOG = ExoLogger
- .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedExoCache");
+ .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedExoCache");//NOSONAR
public static final String CACHE_NAME = "eXoCache";
@@ -136,7 +136,7 @@
{
if (listener == null)
{
- throw new NullPointerException();
+ throw new IllegalArgumentException("The listener cannot be null");
}
List<ListenerContext> lListeners = getListeners(fullName);
if (lListeners == null)
@@ -364,7 +364,7 @@
{
if (key == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
else if (value == null)
{
@@ -400,7 +400,7 @@
{
if (objs == null)
{
- throw new NullPointerException("No null map accepted");
+ throw new IllegalArgumentException("No null map accepted");
}
for (Serializable name : objs.keySet())
{
@@ -430,7 +430,7 @@
onPut(entry.getKey(), entry.getValue());
}
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
cache.endBatch(false);
LOG.warn("An error occurs while executing the putMap method", e);
@@ -448,7 +448,7 @@
{
if (name == null)
{
- throw new NullPointerException("No null cache key accepted");
+ throw new IllegalArgumentException("No null cache key accepted");
}
@SuppressWarnings("rawtypes")
CacheKey key = new CacheKey<Serializable>(fullName, name);
@@ -570,7 +570,7 @@
{
context.onExpire(key.getKey(), obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -592,7 +592,7 @@
{
context.onRemove(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -624,7 +624,7 @@
{
context.onPut(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -646,7 +646,7 @@
{
context.onGet(key, obj);
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
@@ -668,7 +668,7 @@
{
context.onClearCache();
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
if (LOG.isWarnEnabled())
LOG.warn("Cannot execute the CacheListener properly", e);
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/cache/impl/infinispan/generic/GenericExoCacheCreator.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -124,7 +124,7 @@
{
return new GenericExoCache(config, cacheGetter.call());
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
throw new ExoCacheInitException("Cannot create the cache '" + config.getName() + "'", e);
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/DistributedCacheManager.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -65,7 +65,7 @@
* The logger
*/
private static final Log LOG = ExoLogger
- .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedCacheManager");
+ .getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.DistributedCacheManager");//NOSONAR
/**
* The parameter name corresponding to the infinispan configuration
@@ -188,9 +188,9 @@
}
});
}
- catch (Exception e)
+ catch (Exception e)//NOSONAR
{
- throw new RuntimeException("Could not initialize the cache manager corresponding to the configuration file "
+ throw new IllegalStateException("Could not initialize the cache manager corresponding to the configuration file "
+ configurationFile, e);
}
}
@@ -204,7 +204,7 @@
Cache<K, V> cache = manager.getCache(cacheName, false);
if (cache == null)
{
- throw new NullPointerException("The expected cache named '" + cacheName
+ throw new IllegalArgumentException("The expected cache named '" + cacheName
+ "' has not been defined in the configuration of infinispan as named cache.");
}
return cache;
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java 2012-01-19 18:45:11 UTC (rev 5486)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.infinispan.v5/src/main/java/org/exoplatform/services/ispn/Utils.java 2012-01-19 19:54:39 UTC (rev 5487)
@@ -42,7 +42,7 @@
/**
* The logger
*/
- private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");
+ private static final Log LOG = ExoLogger.getLogger("exo.kernel.component.ext.cache.impl.infinispan.v5.Utils");//NOSONAR
private Utils()
{
@@ -79,7 +79,7 @@
}
catch (IOException e)
{
- throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename + "'");
+ throw new IllegalStateException("The jgroups configuration cannot be read from '" + filename + "'", e);
}
// Remove the property corresponding to the configuration file
properties.remove(JGroupsTransport.CONFIGURATION_FILE);
@@ -111,7 +111,7 @@
{
inputStream.close();
}
- catch (Exception e)
+ catch (IOException e)
{
LOG.debug("Cannot close stream", e);
}
14 years, 3 months
exo-jcr SVN: r5486 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel and 12 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2012-01-19 13:45:11 -0500 (Thu, 19 Jan 2012)
New Revision: 5486
Added:
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/cache-server-configuration.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/distributed-cache-configuration.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/tcp-mux.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/udp-mux.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/distributed-cache-configuration.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/tcp-mux.xml
Removed:
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
Modified:
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml
jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
jcr/trunk/pom.xml
Log:
EXOJCR-1682: Improve ISPN integration to support properly the distribution mode (jcr part)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -17,7 +17,13 @@
package org.exoplatform.services.jcr.datamodel;
import org.exoplatform.services.jcr.dataflow.ItemDataVisitor;
+import org.exoplatform.services.jcr.impl.Constants;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
import javax.jcr.RepositoryException;
/**
@@ -28,18 +34,18 @@
* @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
* @version $Id: NullItemData.java 111 2008-11-11 11:11:11Z serg $
*/
-public abstract class NullItemData implements ItemData
+public abstract class NullItemData implements ItemData, Externalizable
{
public static final String NULL_ID = "_null_id";
- private final String id;
+ private String id;
- private final String parentId;
+ private String parentId;
- private final QPathEntry name;
+ private QPathEntry name;
- private final QPath path;
+ private QPath path;
public NullItemData(NodeData parent, QPathEntry name)
{
@@ -51,18 +57,12 @@
public NullItemData(String id)
{
- this.parentId = null;
- this.path = null;
- this.name = null;
this.id = id;
}
public NullItemData()
{
- this.parentId = null;
- this.path = null;
- this.name = null;
- this.id = NULL_ID;
+ this(NULL_ID);
}
public void accept(ItemDataVisitor visitor) throws RepositoryException
@@ -94,5 +94,95 @@
{
return name;
}
+ /**
+ * {@inheritDoc}
+ *
+ * We need to make it serializable mostly for distributed cache in case we
+ * don't allow local caching
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ byte[] buf = new byte[in.readInt()];
+ in.readFully(buf);
+ id = new String(buf, Constants.DEFAULT_ENCODING);
+ int length = in.readInt();
+ if (length > 0)
+ {
+ buf = new byte[length];
+ in.readFully(buf);
+ parentId = new String(buf, Constants.DEFAULT_ENCODING);
+ }
+ length = in.readInt();
+ if (length > 0)
+ {
+ buf = new byte[length];
+ in.readFully(buf);
+ try
+ {
+ name = QPathEntry.parse(new String(buf, Constants.DEFAULT_ENCODING));
+ }
+ catch (Exception e)
+ {
+ throw new IOException("Deserialization error, could not parse the name. ", e);
+ }
+ }
+ length = in.readInt();
+ if (length > 0)
+ {
+ buf = new byte[length];
+ in.readFully(buf);
+ try
+ {
+ path = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING));
+ }
+ catch (Exception e)
+ {
+ throw new IOException("Deserialization error, could not parse the path. ", e);
+ }
+ }
+ }
+ /**
+ * {@inheritDoc}
+ *
+ * We need to make it serializable mostly for distributed cache in case we
+ * don't allow local caching
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ byte[] buf = id.getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+
+ if (parentId == null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ buf = parentId.getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+ if (name == null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ buf = name.getAsString(true).getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+ if (path == null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ buf = path.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/ByteArrayPersistedValueData.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -169,7 +169,7 @@
orderNumber = in.readInt();
data = new byte[in.readInt()];
- in.readFully(data);
+ if (data.length > 0) in.readFully(data);
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -497,7 +497,8 @@
try
{
transactionManager =
- (TransactionManager)cache.getClass().getMethod("getTransactionManager", null).invoke(null, null);
+ (TransactionManager)cache.getClass().getMethod("getTransactionManager", (Class<?>[])null)
+ .invoke(cache, (Object[])null);
}
catch (Exception e)
{
@@ -1369,6 +1370,7 @@
while (patternIterator.hasNext())
{
QPathEntryFilter pattern = patternIterator.next();
+ @SuppressWarnings("unchecked")
List<NodeData> persistedNodeData = (List<NodeData>)pattern.accept(persistedItemList);
if (pattern.isExactName())
{
@@ -1667,6 +1669,7 @@
while (patternIterator.hasNext())
{
QPathEntryFilter pattern = patternIterator.next();
+ @SuppressWarnings("unchecked")
List<PropertyData> persistedPropData =
(List<PropertyData>)pattern.accept(persistedItemList);
if (pattern.isExactName())
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/pom.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -34,6 +34,7 @@
<cache.enabled>true</cache.enabled>
<value.storage.enabled>true</value.storage.enabled>
<statistics.enabled>false</statistics.enabled>
+ <use.distributed.cache>false</use.distributed.cache>
<properties.url.suffix>.properties</properties.url.suffix>
<properties.url.prefix>classpath:/conf/standalone/default</properties.url.prefix>
<test.cache.all>**/persistent/cache/**</test.cache.all>
@@ -58,8 +59,12 @@
<dependency>
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.ext.rpc.impl.jgroups.v3</artifactId>
- </dependency>
+ </dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.infinispan.v5</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.component.core</artifactId>
<exclusions>
@@ -72,7 +77,7 @@
<dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.component.core</artifactId>
- <classifier>sources</classifier>
+ <classifier>tests</classifier>
<scope>test</scope>
<version>${project.version}</version>
<exclusions>
@@ -104,6 +109,10 @@
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<!-- TCK binaries and deps for repo stub, some eXo API test -->
@@ -181,8 +190,12 @@
<property>
<name>value-storage-enabled</name>
<value>${value.storage.enabled}</value>
- </property>
+ </property>
<property>
+ <name>use-distributed-cache</name>
+ <value>${use.distributed.cache}</value>
+ </property>
+ <property>
<name>JDBCWorkspaceDataContainer.statistics.enabled</name>
<value>${statistics.enabled}</value>
</property>
@@ -360,7 +373,11 @@
<property>
<name>value-storage-enabled</name>
<value>${value.storage.enabled}</value>
- </property>
+ </property>
+ <property>
+ <name>use-distributed-cache</name>
+ <value>${use.distributed.cache}</value>
+ </property>
<property>
<name>known.issues</name>
<value>org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
@@ -440,6 +457,10 @@
<value>${value.storage.enabled}</value>
</property>
<property>
+ <name>use-distributed-cache</name>
+ <value>${use.distributed.cache}</value>
+ </property>
+ <property>
<name>known.issues</name>
<value>org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreName
org.apache.jackrabbit.test.api.version.RestoreTest#testRestoreOrder2
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -39,7 +39,6 @@
import org.exoplatform.services.naming.InitialContextInitializer;
import org.exoplatform.services.transaction.TransactionService;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.lifecycle.ComponentStatus;
import java.io.Serializable;
@@ -112,7 +111,7 @@
if (config.getLockManager() != null)
{
// create cache using custom factory
- ISPNCacheFactory<Serializable, Object> factory = new ISPNCacheFactory<Serializable, Object>(cfm);
+ ISPNCacheFactory<Serializable, Object> factory = new ISPNCacheFactory<Serializable, Object>(cfm, transactionManager);
// configure cache loader parameters with correct DB data-types
configureJDBCCacheLoader(config.getLockManager());
@@ -431,8 +430,7 @@
@Override
protected boolean isAloneInCluster()
{
- return cache.getConfiguration().getCacheMode() == CacheMode.LOCAL
- || cache.getCacheManager().getMembers().size() == 1;
+ return cache.getAdvancedCache().getRpcManager() == null || cache.getCacheManager().getMembers().size() == 1;
}
/**
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ChangesKey.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -19,7 +19,7 @@
package org.exoplatform.services.jcr.impl.core.query.ispn;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
import java.io.IOException;
import java.io.ObjectInput;
@@ -44,7 +44,7 @@
ChangesKey(String wsId, String id)
{
- super(id);
+ super(null, id);
this.wsId = wsId;
}
@@ -79,21 +79,4 @@
in.readFully(buf);
wsId = new String(buf, Constants.DEFAULT_ENCODING);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof ChangesKey)
- {
- ChangesKey key = (ChangesKey)obj;
- return (key.hash == hash && key.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -203,8 +203,9 @@
* @param event
* CacheEntryModifiedEvent
*/
+ @SuppressWarnings("unchecked")
@CacheEntryModified
- public void cacheEntryModified(CacheEntryModifiedEvent event)
+ public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
{
if (!event.isPre() && event.getKey().equals(namesKey))
{
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexUpdateMonitor.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -215,7 +215,7 @@
* CacheEntryModifiedEvent
*/
@CacheEntryModified
- public void cacheEntryModified(CacheEntryModifiedEvent event)
+ public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
{
if (!event.isPre() && event.getKey().equals(updateKey))
{
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexInfosKey.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query.ispn;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
/**
* Created by The eXo Platform SAS.
@@ -37,23 +37,6 @@
IndexInfosKey(String id)
{
- super(id);
+ super(null, id);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof IndexInfosKey)
- {
- IndexInfosKey key = (IndexInfosKey)obj;
- return (key.hash == hash && key.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexUpdateKey.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query.ispn;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
/**
* Created by The eXo Platform SAS.
@@ -38,23 +38,6 @@
IndexUpdateKey(String id)
{
- super(id);
+ super(null, id);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof IndexUpdateKey)
- {
- IndexUpdateKey key = (IndexUpdateKey)obj;
- return (key.hash == hash && key.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexerCacheStore.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -23,7 +23,6 @@
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.container.DataContainer;
import org.infinispan.container.entries.InternalCacheEntry;
import org.infinispan.lifecycle.ComponentStatus;
@@ -43,8 +42,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
-import java.util.Map.Entry;
/**
* Implements Cache Store for clustered environment. It gives control of Index for coordinator and
@@ -102,7 +101,7 @@
{
this.modeHandler =
new IndexerIoModeHandler(cacheManager.isCoordinator()
- || cache.getConfiguration().getCacheMode() == CacheMode.LOCAL ? IndexerIoMode.READ_WRITE
+ || cache.getAdvancedCache().getRpcManager() == null ? IndexerIoMode.READ_WRITE
: IndexerIoMode.READ_ONLY);
}
}
@@ -166,6 +165,7 @@
/**
* Flushes all cache content to underlying CacheStore
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
protected void doPushState()
{
final boolean debugEnabled = log.isDebugEnabled();
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -21,12 +21,12 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.infinispan.AdvancedCache;
import org.infinispan.Cache;
import org.infinispan.config.Configuration;
-import org.infinispan.config.Configuration.CacheMode;
import org.infinispan.context.Flag;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.manager.EmbeddedCacheManager;
@@ -53,7 +53,7 @@
* @version $Id: BufferedISPNCache.java 3514 2010-11-22 16:14:36Z nzamosenchuk $
*
*/
-@SuppressWarnings("unchecked")
+@SuppressWarnings({"unchecked", "deprecation"})
public class BufferedISPNCache implements Cache<CacheKey, Object>
{
/**
@@ -151,20 +151,9 @@
protected AdvancedCache<CacheKey, Object> setCacheLocalMode()
{
- if (localMode)
+ if (localMode && allowLocalChanges)
{
- if (allowLocalChanges == null)
- {
- CacheMode cacheMode = cache.getConfiguration().getCacheMode();
- if (cacheMode != CacheMode.DIST_ASYNC && cacheMode != CacheMode.DIST_SYNC)
- {
- return cache.withFlags(Flag.CACHE_MODE_LOCAL);
- }
- }
- else if (allowLocalChanges)
- {
- return cache.withFlags(Flag.CACHE_MODE_LOCAL);
- }
+ return cache.withFlags(Flag.CACHE_MODE_LOCAL);
}
return cache;
}
@@ -264,8 +253,7 @@
LOG.error("Unexpected object found by key " + key.toString() + ". Expected Set, but found:"
+ existingObject.getClass().getName());
}
- else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL
- && cache.getCacheManager().getMembers().size() > 1)
+ else if (!localMode && cache.getRpcManager() != null && cache.getCacheManager().getMembers().size() > 1)
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we clear the list in order to enforce other cluster nodes to reload it from the db
@@ -327,8 +315,7 @@
LOG.error("Unexpected object found by key " + key.toString() + ". Expected Map, but found:"
+ existingObject.getClass().getName());
}
- else if (!localMode && cache.getConfiguration().getCacheMode() != CacheMode.LOCAL
- && cache.getCacheManager().getMembers().size() > 1)
+ else if (!localMode && cache.getRpcManager() != null && cache.getCacheManager().getMembers().size() > 1)
{
// to prevent consistency issue since we don't have the list in the local cache, we are in cluster env
// and we are in a non local mode, we remove all the patterns in order to enforce other cluster nodes
@@ -866,9 +853,15 @@
/**
* {@inheritDoc}
*/
- public Object get(Object key)
+ public Object get(final Object key)
{
- return parentCache.get(key);
+ return SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return parentCache.get(key);
+ }
+ });
}
/**
@@ -895,6 +888,14 @@
}
/**
+ * {@inheritDoc}
+ */
+ public org.infinispan.configuration.cache.Configuration getCacheConfiguration()
+ {
+ return parentCache.getCacheConfiguration();
+ }
+
+ /**
* Put object in cache.
* @param key
* cache key
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,7 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
*
* @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
@@ -32,25 +34,8 @@
super();
}
- CacheId(String id)
+ CacheId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CacheId)
- {
- CacheId cacheId = (CacheId)obj;
- return (cacheId.hash == hash && cacheId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Deleted: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
-
-import org.exoplatform.services.jcr.impl.Constants;
-import org.infinispan.distribution.group.Group;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
-/**
- * Created by The eXo Platform SAS. <br/>
- * Base class for WorkspaceCache keys.<br/>
- *
- * Date: 10.06.2008<br/>
- *
- * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
- * @version $Id: CacheKey.java 2845 2010-07-30 13:29:37Z tolusha $
- */
-public abstract class CacheKey implements Externalizable, Comparable<CacheKey>
-{
-
- protected String id;
-
- protected int hash;
-
- /**
- * The value used in case, the grouping is enabled
- */
- protected String group;
-
- public CacheKey()
- {
- }
-
- public CacheKey(String id)
- {
- this(id, null);
- }
-
- public CacheKey(String id, String group)
- {
- this.id = id;
- this.hash = id.hashCode();
- this.group = group;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- return this.hash;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString()
- {
- return this.getClass().getSimpleName() + "-" + this.id + "-" + this.group;
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(CacheKey o)
- {
- int result = getClass().getName().compareTo(o.getClass().getName());
- return result == 0 ? id.compareTo(o.id) : result;
- }
-
- /**
- * This method is used for the grouping when its enabled. It will return
- * the value of the group if it has been explicitly set otherwise it will
- * return the value of the fullId
- * @return the group
- */
- @Group
- public String getGroup()
- {
- return group == null ? id : group;
- }
-
- /**
- * {@inheritDoc}
- */
- public void writeExternal(ObjectOutput out) throws IOException
- {
- byte[] buf;
- if (group == null)
- {
- out.writeInt(-1);
- }
- else
- {
- buf = group.getBytes(Constants.DEFAULT_ENCODING);
- out.writeInt(buf.length);
- out.write(buf);
- }
-
- buf = id.getBytes(Constants.DEFAULT_ENCODING);
- out.writeInt(buf.length);
- out.write(buf);
-
- }
-
- /**
- * {@inheritDoc}
- */
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- {
- byte[] buf;
- int length = in.readInt();
- if (length >= 0)
- {
- buf = new byte[length];
- in.readFully(buf);
- group = new String(buf, Constants.DEFAULT_ENCODING);
- }
-
- buf = new byte[in.readInt()];
- in.readFully(buf);
- id = new String(buf, Constants.DEFAULT_ENCODING);
- hash = id.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public abstract boolean equals(Object obj);
-}
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesByPageId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* @author <a href="abazko(a)exoplatform.com">Anatoliy Bazko</a>
* @version $Id: CachePagedNodes.java 34360 2009-07-22 23:58:59Z tolusha $
@@ -30,23 +32,8 @@
super();
}
- CacheNodesByPageId(String id)
+ CacheNodesByPageId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CacheNodesByPageId)
- {
- CacheNodesByPageId cacheNodesByPageId = (CacheNodesByPageId)obj;
- return (cacheNodesByPageId.hash == hash && cacheNodesByPageId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
-
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* Created by The eXo Platform SAS
*
@@ -36,22 +38,8 @@
super();
}
- CacheNodesId(String id)
+ CacheNodesId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CacheNodesId)
- {
- CacheNodesId cacheNodesId = (CacheNodesId)obj;
- return (cacheNodesId.hash == hash && cacheNodesId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternNodesId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -16,6 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* Created by The eXo Platform SAS.
*
@@ -32,22 +34,8 @@
super();
}
- CachePatternNodesId(String id)
+ CachePatternNodesId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CachePatternNodesId)
- {
- CachePatternNodesId cacheNodesId = (CachePatternNodesId)obj;
- return (cacheNodesId.hash == hash && cacheNodesId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePatternPropsId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -16,6 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* Created by The eXo Platform SAS.
*
@@ -32,22 +34,8 @@
super();
}
- CachePatternPropsId(String parentId)
+ CachePatternPropsId(String ownerId, String parentId)
{
- super(parentId);
+ super(ownerId, parentId);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CachePatternPropsId)
- {
- CachePatternPropsId cachePatternPropsId = (CachePatternPropsId)obj;
- return (cachePatternPropsId.hash == hash && cachePatternPropsId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* Created by The eXo Platform SAS
*
@@ -36,22 +38,8 @@
super();
}
- CachePropsId(String id)
+ CachePropsId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CachePropsId)
- {
- CachePropsId cachePropsId = (CachePropsId)obj;
- return (cachePropsId.hash == hash && cachePropsId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
/**
* Created by The eXo Platform SAS. <br/>
@@ -40,28 +41,14 @@
super();
}
- CacheQPath(String parentId, QPath path, ItemType itemType)
+ CacheQPath(String ownerId, String parentId, QPath path, ItemType itemType)
{
- this(parentId, path.getEntries()[path.getEntries().length - 1], itemType);
+ this(ownerId, parentId, path.getEntries()[path.getEntries().length - 1], itemType);
}
- CacheQPath(String parentId, QPathEntry name, ItemType itemType)
+ CacheQPath(String ownerId, String parentId, QPathEntry name, ItemType itemType)
{
- super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
+ super(ownerId, new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
.append(name.getAsString(true)).append(itemType.toString()).toString(), parentId);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CacheQPath)
- {
- CacheQPath cacheQPath = (CacheQPath)obj;
- return (cacheQPath.hash == hash && cacheQPath.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheRefsId.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
+
/**
* Created by The eXo Platform SAS
*
@@ -35,22 +37,8 @@
super();
}
- CacheRefsId(String id)
+ CacheRefsId(String ownerId, String id)
{
- super(id);
+ super(ownerId, id);
}
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof CacheRefsId)
- {
- CacheRefsId cachePropsId = (CacheRefsId)obj;
- return (cachePropsId.hash == hash && cachePropsId.id.equals(id));
- }
- else
- {
- return false;
- }
- }
}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -18,9 +18,13 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan;
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
+import org.exoplatform.services.ispn.DistributedCacheManager;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.config.CacheEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -49,11 +53,20 @@
import org.exoplatform.services.jcr.impl.core.itemfilters.QPathEntryFilter;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
+import org.exoplatform.services.jcr.infinispan.AbstractMapper;
+import org.exoplatform.services.jcr.infinispan.CacheKey;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.transaction.ActionNonTxAware;
+import org.exoplatform.services.transaction.TransactionService;
import org.infinispan.Cache;
+import org.infinispan.configuration.cache.CacheMode;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.context.Flag;
+import org.infinispan.distexec.mapreduce.Collector;
+import org.infinispan.distexec.mapreduce.MapReduceTask;
+import org.infinispan.distexec.mapreduce.Reducer;
import org.infinispan.lifecycle.ComponentStatus;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
@@ -61,6 +74,9 @@
import java.io.File;
import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -75,6 +91,9 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
/**
@@ -98,23 +117,42 @@
* @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
* @version $Id: ISPNCacheWorkspaceStorageCache.java 3514 2010-11-22 16:14:36Z nzamosenchuk $
*/
+@SuppressWarnings("unchecked")
public class ISPNCacheWorkspaceStorageCache implements WorkspaceStorageCache, Backupable
{
- private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.impl.infinispan.v5.ISPNCacheWorkspaceStorageCache");
+ private static final Log LOG = ExoLogger
+ .getLogger("exo.jcr.component.core.impl.infinispan.v5.ISPNCacheWorkspaceStorageCache");
+ /**
+ * Name of the cache in case of the distributed cache
+ */
+ private static final String CACHE_NAME = "JCRCache";
+
+ /**
+ * This id will be the unique identifier of the workspace in case the
+ * distributed mode is enabled as the cache will be then shared so we
+ * need this id to prevent mixing data of different workspace. In case
+ * the workspace is not distributed the value of this variable will be
+ * null to avoid consuming more memory for nothing
+ */
+ protected final String ownerId;
+
private final boolean enabled;
-
+
protected final BufferedISPNCache cache;
-
+
+ private final GlobalOperationCaller caller;
+
/**
* The list of all the listeners
*/
- private final List<WorkspaceStorageCacheListener> listeners = new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
+ private final List<WorkspaceStorageCacheListener> listeners =
+ new CopyOnWriteArrayList<WorkspaceStorageCacheListener>();
private final CacheActionNonTxAware<Void, Void> commitTransaction = new CacheActionNonTxAware<Void, Void>()
{
@Override
- protected Void execute(Void arg) throws RuntimeException
+ protected Void execute(Void arg)
{
cache.commitTransaction();
return null;
@@ -125,9 +163,9 @@
new CacheActionNonTxAware<ItemData, String>()
{
@Override
- protected ItemData execute(String id) throws RuntimeException
+ protected ItemData execute(String id)
{
- return id == null ? null : (ItemData)cache.get(new CacheId(id));
+ return id == null ? null : (ItemData)cache.get(new CacheId(getOwnerId(), id));
}
};
@@ -135,10 +173,10 @@
new CacheActionNonTxAware<List<NodeData>, NodeData>()
{
@Override
- protected List<NodeData> execute(NodeData parent) throws RuntimeException
+ protected List<NodeData> execute(NodeData parent)
{
// get list of children uuids
- final Set<String> set = (Set<String>)cache.get(new CacheNodesId(parent.getIdentifier()));
+ final Set<String> set = (Set<String>)cache.get(new CacheNodesId(getOwnerId(), parent.getIdentifier()));
if (set != null)
{
@@ -146,7 +184,7 @@
for (String childId : set)
{
- NodeData child = (NodeData)cache.get(new CacheId(childId));
+ NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
if (child == null)
{
return null;
@@ -170,7 +208,7 @@
new CacheActionNonTxAware<ItemData, Object>()
{
@Override
- protected ItemData execute(Object... args) throws RuntimeException
+ protected ItemData execute(Object... args)
{
String parentIdentifier = (String)args[0];
QPathEntry name = (QPathEntry)args[1];
@@ -180,12 +218,13 @@
if (itemType == ItemType.UNKNOWN)
{
// Try as node first.
- itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.NODE));
+ itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.NODE));
if (itemId == null || itemId.equals(NullItemData.NULL_ID))
{
// node with such a name is not found or marked as not-exist, so check the properties
- String propId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.PROPERTY));
+ String propId =
+ (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.PROPERTY));
if (propId != null)
{
itemId = propId;
@@ -194,11 +233,11 @@
}
else if (itemType == ItemType.NODE)
{
- itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.NODE));;
+ itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.NODE));;
}
else
{
- itemId = (String)cache.get(new CacheQPath(parentIdentifier, name, ItemType.PROPERTY));;
+ itemId = (String)cache.get(new CacheQPath(getOwnerId(), parentIdentifier, name, ItemType.PROPERTY));;
}
if (itemId != null)
@@ -227,9 +266,9 @@
new CacheActionNonTxAware<Integer, NodeData>()
{
@Override
- protected Integer execute(NodeData parent) throws RuntimeException
+ protected Integer execute(NodeData parent)
{
- Set<String> list = (Set<String>)cache.get(new CacheNodesId(parent.getIdentifier()));
+ Set<String> list = (Set<String>)cache.get(new CacheNodesId(getOwnerId(), parent.getIdentifier()));
return list != null ? list.size() : -1;
}
};
@@ -238,19 +277,19 @@
new CacheActionNonTxAware<List<PropertyData>, Object>()
{
@Override
- protected List<PropertyData> execute(Object... args) throws RuntimeException
+ protected List<PropertyData> execute(Object... args)
{
String parentId = (String)args[0];
boolean withValue = (Boolean)args[1];
// get list of children uuids
- final Set<String> set = (Set<String>)cache.get(new CachePropsId(parentId));
+ final Set<String> set = (Set<String>)cache.get(new CachePropsId(getOwnerId(), parentId));
if (set != null)
{
final List<PropertyData> childs = new ArrayList<PropertyData>();
for (String childId : set)
{
- PropertyData child = (PropertyData)cache.get(new CacheId(childId));
+ PropertyData child = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
if (child == null)
{
@@ -275,17 +314,17 @@
new CacheActionNonTxAware<List<PropertyData>, String>()
{
@Override
- protected List<PropertyData> execute(String identifier) throws RuntimeException
+ protected List<PropertyData> execute(String identifier)
{
// get list of children uuids
- final Set<String> set = (Set<String>)cache.get(new CacheRefsId(identifier));
+ final Set<String> set = (Set<String>)cache.get(new CacheRefsId(getOwnerId(), identifier));
if (set != null)
{
final List<PropertyData> props = new ArrayList<PropertyData>();
for (String childId : set)
{
- PropertyData prop = (PropertyData)cache.get(new CacheId(childId));
+ PropertyData prop = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
if (prop == null || prop instanceof NullItemData)
{
@@ -327,9 +366,9 @@
private final CacheActionNonTxAware<Long, Void> getSize = new CacheActionNonTxAware<Long, Void>()
{
@Override
- protected Long execute(Void arg) throws RuntimeException
+ protected Long execute(Void arg)
{
- return (long)cache.size();
+ return (long)caller.getCacheSize();
}
};
@@ -377,7 +416,7 @@
T n = null;
do
{
- n = (T)cache.get(new CacheId(childs.next()));
+ n = (T)cache.get(new CacheId(getOwnerId(), childs.next()));
}
while (n == null && childs.hasNext());
next = n;
@@ -415,7 +454,7 @@
{
ChildNodesIterator(String parentId)
{
- super(new CacheNodesId(parentId));
+ super(new CacheNodesId(getOwnerId(), parentId));
}
@Override
@@ -430,7 +469,7 @@
ChildPropertiesIterator(String parentId)
{
- super(new CachePropsId(parentId));
+ super(new CachePropsId(getOwnerId(), parentId));
}
@Override
@@ -441,41 +480,130 @@
}
/**
- * Cache constructor with eXo TransactionService support.
+ * Cache constructor.
*
- * @param wsConfig WorkspaceEntry workspace config
+ * @param wsConfig WorkspaceEntry workspace configuration
+ * @param cfm The configuration manager
* @throws RepositoryException if error of initialization
* @throws RepositoryConfigurationException if error of configuration
*/
public ISPNCacheWorkspaceStorageCache(WorkspaceEntry wsConfig, ConfigurationManager cfm) throws RepositoryException,
RepositoryConfigurationException
{
+ this(null, wsConfig, cfm, null, null);
+ }
+
+ /**
+ * Cache constructor.
+ *
+ * @param ctx The {@link ExoContainerContext} that owns the current component
+ * @param wsConfig WorkspaceEntry workspace configuration
+ * @param cfm The configuration manager
+ * @param ts TransactionService external transaction service
+ * @throws RepositoryException if error of initialization
+ * @throws RepositoryConfigurationException if error of configuration
+ */
+ public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+ TransactionService ts) throws RepositoryException, RepositoryConfigurationException
+ {
+ this(ctx, wsConfig, cfm, null, ts);
+ }
+
+ /**
+ * Cache constructor.
+ *
+ * @param ctx The {@link ExoContainerContext} that owns the current component
+ * @param wsConfig WorkspaceEntry workspace configuration
+ * @param cfm The configuration manager
+ * @param dcm The distributed cache manager
+ * @throws RepositoryException if error of initialization
+ * @throws RepositoryConfigurationException if error of configuration
+ */
+ public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+ DistributedCacheManager dcm) throws RepositoryException, RepositoryConfigurationException
+ {
+ this(ctx, wsConfig, cfm, dcm, null);
+ }
+
+ /**
+ * Cache constructor.
+ *
+ * @param ctx The {@link ExoContainerContext} that owns the current component
+ * @param wsConfig WorkspaceEntry workspace configuration
+ * @param cfm The configuration manager
+ * @param dcm The distributed cache manager
+ * @param ts TransactionService external transaction service
+ * @throws RepositoryException if error of initialization
+ * @throws RepositoryConfigurationException if error of configuration
+ */
+ public ISPNCacheWorkspaceStorageCache(ExoContainerContext ctx, WorkspaceEntry wsConfig, ConfigurationManager cfm,
+ DistributedCacheManager dcm, TransactionService ts) throws RepositoryException, RepositoryConfigurationException
+ {
if (wsConfig.getCache() == null)
{
throw new RepositoryConfigurationException("Cache configuration not found");
}
this.enabled = wsConfig.getCache().isEnabled();
-
+
// create cache using custom factory
- ISPNCacheFactory<CacheKey, Object> factory = new ISPNCacheFactory<CacheKey, Object>(cfm);
+ ISPNCacheFactory<CacheKey, Object> factory =
+ new ISPNCacheFactory<CacheKey, Object>(cfm, ts == null ? null : ts.getTransactionManager());
// create parent Infinispan instance
CacheEntry cacheEntry = wsConfig.getCache();
- Cache<CacheKey, Object> parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
-
- Boolean allowLocalChanges = null;
- try
+ boolean useDistributedCache = cacheEntry.getParameterBoolean("use-distributed-cache", false);
+ Cache<CacheKey, Object> parentCache;
+ if (useDistributedCache)
{
- allowLocalChanges = cacheEntry.getParameterBoolean("allow-local-changes");
+ // We expect a distributed cache
+ if (dcm == null)
+ {
+ throw new IllegalArgumentException("The DistributedCacheManager has not been defined in the configuration,"
+ + " please configure it at root container level if you want to use a distributed cache.");
+ }
+ parentCache = dcm.getCache(CACHE_NAME);
+ this.ownerId = ctx.getName();
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("The distributed cache has been enabled for the workspace whose unique id is " + ownerId);
+ }
}
- catch (RepositoryConfigurationException e)
+ else
{
- // do n't nothing
+ parentCache = factory.createCache("Data_" + wsConfig.getUniqueName(), cacheEntry);
+ Configuration config = parentCache.getCacheConfiguration();
+ if (config.clustering().cacheMode() == CacheMode.DIST_SYNC
+ || config.clustering().cacheMode() == CacheMode.DIST_ASYNC)
+ {
+ throw new IllegalArgumentException("Cache configuration not allowed, if you want to use the distributed "
+ + "cache please enable the parameter 'use-distributed-cache' and configure the DistributedCacheManager.");
+ }
+ this.ownerId = null;
}
+ Boolean allowLocalChanges =
+ useDistributedCache ? cacheEntry.getParameterBoolean("allow-local-changes", Boolean.TRUE) : Boolean.TRUE;
this.cache = new BufferedISPNCache(parentCache, allowLocalChanges);
- cache.addListener(new CacheEventListener());
+ if (useDistributedCache)
+ {
+ this.caller = new DistributedOperationCaller();
+ }
+ else
+ {
+ this.caller = new GlobalOperationCaller();
+ cache.addListener(new CacheEventListener());
+ }
}
+ private boolean isDistributedMode()
+ {
+ return ownerId != null;
+ }
+
+ private String getOwnerId()
+ {
+ return ownerId;
+ }
+
/**
* Return TransactionManager used by ISPN backing the JCR cache.
*
@@ -615,7 +743,7 @@
cache.setLocal(true);
- CacheNodesByPageId cacheId = new CacheNodesByPageId(parent.getIdentifier());
+ CacheNodesByPageId cacheId = new CacheNodesByPageId(getOwnerId(), parent.getIdentifier());
Map<Integer, Set<String>> pages = (Map<Integer, Set<String>>)cache.get(cacheId);
if (pages == null)
{
@@ -673,12 +801,12 @@
putNode(child, ModifyChildOption.NOT_MODIFY);
set.add(child.getIdentifier());
}
- cache.putIfAbsent(new CacheNodesId(parent.getIdentifier()), set);
+ cache.putIfAbsent(new CacheNodesId(getOwnerId(), parent.getIdentifier()), set);
}
else
{
// cache fact of empty childs list
- cache.putIfAbsent(new CacheNodesId(parent.getIdentifier()), new HashSet<Object>());
+ cache.putIfAbsent(new CacheNodesId(getOwnerId(), parent.getIdentifier()), new HashSet<Object>());
}
}
finally
@@ -713,7 +841,7 @@
set.add(child.getIdentifier());
}
- CachePatternNodesId cacheId = new CachePatternNodesId(parent.getIdentifier());
+ CachePatternNodesId cacheId = new CachePatternNodesId(getOwnerId(), parent.getIdentifier());
Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
if (patterns == null)
{
@@ -754,7 +882,7 @@
putProperty(child, ModifyChildOption.NOT_MODIFY);
set.add(child.getIdentifier());
}
- cache.putIfAbsent(new CachePropsId(parent.getIdentifier()), set);
+ cache.putIfAbsent(new CachePropsId(getOwnerId(), parent.getIdentifier()), set);
}
else
@@ -795,7 +923,7 @@
set.add(child.getIdentifier());
}
- CachePatternPropsId cacheId = new CachePatternPropsId(parent.getIdentifier());
+ CachePatternPropsId cacheId = new CachePatternPropsId(getOwnerId(), parent.getIdentifier());
Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
if (patterns == null)
{
@@ -862,7 +990,7 @@
{
// get list of children uuids
final Map<Integer, Set<String>> pages =
- (Map<Integer, Set<String>>)cache.get(new CacheNodesByPageId(parent.getIdentifier()));
+ (Map<Integer, Set<String>>)cache.get(new CacheNodesByPageId(getOwnerId(), parent.getIdentifier()));
if (pages == null)
{
@@ -878,7 +1006,7 @@
final List<NodeData> childs = new ArrayList<NodeData>();
for (String childId : set)
{
- NodeData child = (NodeData)cache.get(new CacheId(childId));
+ NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
if (child == null)
{
return null;
@@ -899,7 +1027,7 @@
{
// get list of children uuids
final Map<QPathEntryFilter, Set<String>> patterns =
- (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternNodesId(parent.getIdentifier()));
+ (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternNodesId(getOwnerId(), parent.getIdentifier()));
if (patterns == null)
{
@@ -916,7 +1044,7 @@
for (String childId : set)
{
- NodeData child = (NodeData)cache.get(new CacheId(childId));
+ NodeData child = (NodeData)cache.get(new CacheId(getOwnerId(), childId));
if (child == null)
{
return null;
@@ -951,7 +1079,7 @@
{
// get list of children uuids
final Map<QPathEntryFilter, Set<String>> patterns =
- (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternPropsId(parent.getIdentifier()));
+ (Map<QPathEntryFilter, Set<String>>)cache.get(new CachePatternPropsId(getOwnerId(), parent.getIdentifier()));
if (patterns == null)
{
@@ -968,7 +1096,7 @@
for (String childId : set)
{
- PropertyData child = (PropertyData)cache.get(new CacheId(childId));
+ PropertyData child = (PropertyData)cache.get(new CacheId(getOwnerId(), childId));
if (child == null)
{
@@ -1027,7 +1155,7 @@
{
return true;
}
-
+
/**
* {@inheritDoc}
*/
@@ -1079,32 +1207,33 @@
{
if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
{
- cache.putIfAbsent(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node
- .getIdentifier());
+ cache.putIfAbsent(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+ node.getIdentifier());
}
else
{
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
+ cache.put(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+ node.getIdentifier());
}
// if MODIFY and List present OR FORCE_MODIFY, then write
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
- cache.addToPatternList(new CachePatternNodesId(node.getParentIdentifier()), node);
- cache.addToList(new CacheNodesId(node.getParentIdentifier()), node.getIdentifier(),
+ cache.addToPatternList(new CachePatternNodesId(getOwnerId(), node.getParentIdentifier()), node);
+ cache.addToList(new CacheNodesId(getOwnerId(), node.getParentIdentifier()), node.getIdentifier(),
modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
- cache.remove(new CacheNodesByPageId(node.getParentIdentifier()));
+ cache.remove(new CacheNodesByPageId(getOwnerId(), node.getParentIdentifier()));
}
}
if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
{
- return (ItemData)cache.putIfAbsent(new CacheId(node.getIdentifier()), node);
+ return (ItemData)cache.putIfAbsent(new CacheId(getOwnerId(), node.getIdentifier()), node);
}
else
{
- return (ItemData)cache.put(new CacheId(node.getIdentifier()), node, true);
+ return (ItemData)cache.put(new CacheId(getOwnerId(), node.getIdentifier()), node, true);
}
}
@@ -1112,18 +1241,19 @@
{
if (node.getParentIdentifier() != null)
{
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath(), ItemType.NODE), node.getIdentifier());
+ cache.put(new CacheQPath(getOwnerId(), node.getParentIdentifier(), node.getQPath(), ItemType.NODE),
+ node.getIdentifier());
// if MODIFY and List present OR FORCE_MODIFY, then write
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
- cache.addToList(new CacheNodesId(node.getParentIdentifier()), node.getIdentifier(),
+ cache.addToList(new CacheNodesId(getOwnerId(), node.getParentIdentifier()), node.getIdentifier(),
modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
}
}
// NullNodeData must never be returned inside internal cache operations.
- ItemData itemData = (ItemData)cache.putInBuffer(new CacheId(node.getIdentifier()), node);
+ ItemData itemData = (ItemData)cache.putInBuffer(new CacheId(getOwnerId(), node.getIdentifier()), node);
return (itemData instanceof NullItemData) ? null : itemData;
}
@@ -1145,11 +1275,12 @@
if (!item.getIdentifier().equals(NullItemData.NULL_ID))
{
- cache.putIfAbsent(new CacheId(item.getIdentifier()), item);
+ cache.putIfAbsent(new CacheId(getOwnerId(), item.getIdentifier()), item);
}
else if (item.getName() != null && item.getParentIdentifier() != null)
{
- cache.putIfAbsent(new CacheQPath(item.getParentIdentifier(), item.getName(), ItemType.getItemType(item)),
+ cache.putIfAbsent(
+ new CacheQPath(getOwnerId(), item.getParentIdentifier(), item.getName(), ItemType.getItemType(item)),
NullItemData.NULL_ID);
}
}
@@ -1174,20 +1305,22 @@
// if MODIFY and List present OR FORCE_MODIFY, then write
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY)
{
- cache.addToPatternList(new CachePatternPropsId(prop.getParentIdentifier()), prop);
- cache.addToList(new CachePropsId(prop.getParentIdentifier()), prop.getIdentifier(),
+ cache.addToPatternList(new CachePatternPropsId(getOwnerId(), prop.getParentIdentifier()), prop);
+ cache.addToList(new CachePropsId(getOwnerId(), prop.getParentIdentifier()), prop.getIdentifier(),
modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
}
if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
{
- cache.putIfAbsent(new CacheQPath(prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY), prop.getIdentifier());
+ cache.putIfAbsent(
+ new CacheQPath(getOwnerId(), prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY),
+ prop.getIdentifier());
}
else
{
- cache.put(new CacheQPath(prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY), prop.getIdentifier());
+ cache.put(new CacheQPath(getOwnerId(), prop.getParentIdentifier(), prop.getQPath(), ItemType.PROPERTY),
+ prop.getIdentifier());
}
-
// add referenced property
if (modifyListsOfChild != ModifyChildOption.NOT_MODIFY && prop.getType() == PropertyType.REFERENCE)
{
@@ -1208,7 +1341,7 @@
{
// Do nothing. Never happens.
}
- cache.addToList(new CacheRefsId(nodeIdentifier), prop.getIdentifier(),
+ cache.addToList(new CacheRefsId(getOwnerId(), nodeIdentifier), prop.getIdentifier(),
modifyListsOfChild == ModifyChildOption.FORCE_MODIFY);
}
}
@@ -1216,41 +1349,42 @@
PropertyData propData;
if (modifyListsOfChild == ModifyChildOption.NOT_MODIFY)
{
- propData = (PropertyData)cache.putIfAbsent(new CacheId(prop.getIdentifier()), prop);
+ propData = (PropertyData)cache.putIfAbsent(new CacheId(getOwnerId(), prop.getIdentifier()), prop);
}
else
{
- propData = (PropertyData)cache.put(new CacheId(prop.getIdentifier()), prop, true);
+ propData = (PropertyData)cache.put(new CacheId(getOwnerId(), prop.getIdentifier()), prop, true);
}
-
+
return (propData instanceof NullPropertyData) ? null : propData;
}
protected void removeItem(ItemData item)
{
- cache.remove(new CacheId(item.getIdentifier()));
- cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
+ cache.remove(new CacheId(getOwnerId(), item.getIdentifier()));
+ cache
+ .remove(new CacheQPath(getOwnerId(), item.getParentIdentifier(), item.getQPath(), ItemType.getItemType(item)));
if (item.isNode())
{
if (item.getParentIdentifier() != null)
{
- cache.removeFromPatternList(new CachePatternNodesId(item.getParentIdentifier()), item);
- cache.removeFromList(new CacheNodesId(item.getParentIdentifier()), item.getIdentifier());
- cache.remove(new CacheNodesByPageId(item.getParentIdentifier()));
+ cache.removeFromPatternList(new CachePatternNodesId(getOwnerId(), item.getParentIdentifier()), item);
+ cache.removeFromList(new CacheNodesId(getOwnerId(), item.getParentIdentifier()), item.getIdentifier());
+ cache.remove(new CacheNodesByPageId(getOwnerId(), item.getParentIdentifier()));
}
- cache.remove(new CacheNodesId(item.getIdentifier()));
- cache.remove(new CachePropsId(item.getIdentifier()));
- cache.remove(new CacheNodesByPageId(item.getIdentifier()));
- cache.remove(new CachePatternNodesId(item.getIdentifier()));
- cache.remove(new CachePatternPropsId(item.getIdentifier()));
- cache.remove(new CacheRefsId(item.getIdentifier()));
+ cache.remove(new CacheNodesId(getOwnerId(), item.getIdentifier()));
+ cache.remove(new CachePropsId(getOwnerId(), item.getIdentifier()));
+ cache.remove(new CacheNodesByPageId(getOwnerId(), item.getIdentifier()));
+ cache.remove(new CachePatternNodesId(getOwnerId(), item.getIdentifier()));
+ cache.remove(new CachePatternPropsId(getOwnerId(), item.getIdentifier()));
+ cache.remove(new CacheRefsId(getOwnerId(), item.getIdentifier()));
}
else
{
- cache.removeFromPatternList(new CachePatternPropsId(item.getParentIdentifier()), item);
- cache.removeFromList(new CachePropsId(item.getParentIdentifier()), item.getIdentifier());
+ cache.removeFromPatternList(new CachePatternPropsId(getOwnerId(), item.getParentIdentifier()), item);
+ cache.removeFromList(new CachePropsId(getOwnerId(), item.getParentIdentifier()), item.getIdentifier());
}
}
@@ -1261,7 +1395,7 @@
*/
protected void updateMixin(NodeData node)
{
- NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node, true);
+ NodeData prevData = (NodeData)cache.put(new CacheId(getOwnerId(), node.getIdentifier()), node, true);
// prevent update NullNodeData
if (!(prevData instanceof NullNodeData))
{
@@ -1291,7 +1425,7 @@
protected void updateInBuffer(final NodeData node, final NodeData prevNode)
{
// I expect that NullNodeData will never update existing NodeData.
- CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath(), ItemType.NODE);
+ CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevNode.getQPath(), ItemType.NODE);
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
cache.remove(prevKey);
@@ -1316,75 +1450,7 @@
*/
protected void updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
{
- boolean inheritACL = acl != null;
-
- // check all ITEMS in cache
- Iterator<CacheKey> keys = cache.keySet().iterator();
-
- while (keys.hasNext())
- {
- CacheKey key = keys.next();
- if (key instanceof CacheId)
- {
- ItemData data = (ItemData)cache.get(key);
-
- if (data != null)
- {
- // check is this descendant of prevRootPath
- QPath nodeQPath = data.getQPath();
- if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
- {
- //make relative path
- QPathEntry[] relativePath = null;
- try
- {
- relativePath = nodeQPath.getRelPath(nodeQPath.getDepth() - prevRootPath.getDepth());
- }
- catch (IllegalPathException e)
- {
- // Do nothing. Never happens.
- }
-
- // make new path - no matter node or property
- QPath newPath = QPath.makeChildPath(newRootPath, relativePath);
-
- if (data.isNode())
- {
- // update node
- NodeData prevNode = (NodeData)data;
-
- TransientNodeData newNode =
- new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
- prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL());
-
- // update this node
- cache.put(new CacheId(newNode.getIdentifier()), newNode);
- }
- else
- {
- //update property
- PropertyData prevProp = (PropertyData)data;
-
- if (inheritACL
- && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath()
- .getName().equals(Constants.EXO_OWNER)))
- {
- inheritACL = false;
- }
-
- TransientPropertyData newProp =
- new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
- prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp
- .getValues());
-
- // update this property
- cache.put(new CacheId(newProp.getIdentifier()), newProp);
- }
- }
- }
- }
- }
+ caller.updateTreePath(prevRootPath, newRootPath, acl);
}
/**
@@ -1393,33 +1459,9 @@
* @param parentId String - root node id of JCR subtree.
* @param acl AccessControlList
*/
- protected void updateChildsACL(final String parentId, final AccessControlList acl)
+ protected void updateChildsACL(String parentId, AccessControlList acl)
{
- loop: for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
- {
- NodeData prevNode = iter.next();
-
- // is ACL changes on this node (i.e. ACL inheritance brokes)
- for (InternalQName mixin : prevNode.getMixinTypeNames())
- {
- if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
- {
- continue loop;
- }
- }
-
- // recreate with new path for child Nodes only
- TransientNodeData newNode =
- new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
- prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(), prevNode
- .getParentIdentifier(), acl);
-
- // update this node
- cache.put(new CacheId(newNode.getIdentifier()), newNode);
-
- // update childs recursive
- updateChildsACL(newNode.getIdentifier(), acl);
- }
+ caller.updateChildsACL(parentId, acl);
}
public void beginTransaction()
@@ -1485,7 +1527,7 @@
putProperty(prop, ModifyChildOption.NOT_MODIFY);
set.add(prop.getIdentifier());
}
- cache.putIfAbsent(new CacheRefsId(identifier), set);
+ cache.putIfAbsent(new CacheRefsId(getOwnerId(), identifier), set);
}
finally
{
@@ -1504,7 +1546,7 @@
{
return getReferencedProperties.run(identifier);
}
-
+
/**
* {@inheritDoc}
*/
@@ -1516,12 +1558,12 @@
* {@inheritDoc}
*/
@Managed
- @ManagedDescription("Remove all the existing items from the cache")
+ @ManagedDescription("Remove all the existing items from the cache")
public void clean() throws BackupException
{
if (cache.getStatus() == ComponentStatus.RUNNING)
{
- cache.clear();
+ caller.clearCache();
}
}
@@ -1537,7 +1579,7 @@
*/
public void clean() throws BackupException
{
- cache.clear();
+ caller.clearCache();
}
/**
@@ -1576,6 +1618,11 @@
*/
public void addListener(WorkspaceStorageCacheListener listener)
{
+ if (isDistributedMode())
+ {
+ throw new UnsupportedOperationException("The cache listeners are not supported by the "
+ + "ISPNCacheWorkspaceStorageCache in case of the distributed mode");
+ }
listeners.add(listener);
}
@@ -1584,9 +1631,14 @@
*/
public void removeListener(WorkspaceStorageCacheListener listener)
{
+ if (isDistributedMode())
+ {
+ throw new UnsupportedOperationException("The cache listeners are not supported by the "
+ + "ISPNCacheWorkspaceStorageCache in case of the distributed mode");
+ }
listeners.remove(listener);
}
-
+
/**
* Called when a cache entry corresponding to the given node has item updated
* @param data the item corresponding to the updated cache entry
@@ -1596,7 +1648,7 @@
if (data == null || data instanceof NullItemData)
{
return;
- }
+ }
for (WorkspaceStorageCacheListener listener : listeners)
{
try
@@ -1607,9 +1659,71 @@
{
LOG.warn("The method onCacheEntryUpdated fails for the listener " + listener.getClass(), e);
}
- }
+ }
}
-
+
+ private static void updateTreePath(Cache<CacheKey, Object> cache, String ownerId, ItemData data, QPath prevRootPath,
+ QPath newRootPath, AccessControlList acl)
+ {
+ if (data == null)
+ {
+ return;
+ }
+
+ boolean inheritACL = acl != null;
+ // check is this descendant of prevRootPath
+ QPath nodeQPath = data.getQPath();
+ if (nodeQPath != null && nodeQPath.isDescendantOf(prevRootPath))
+ {
+ //make relative path
+ QPathEntry[] relativePath = null;
+ try
+ {
+ relativePath = nodeQPath.getRelPath(nodeQPath.getDepth() - prevRootPath.getDepth());
+ }
+ catch (IllegalPathException e)
+ {
+ // Do nothing. Never happens.
+ }
+
+ // make new path - no matter node or property
+ QPath newPath = QPath.makeChildPath(newRootPath, relativePath);
+
+ if (data.isNode())
+ {
+ // update node
+ NodeData prevNode = (NodeData)data;
+
+ TransientNodeData newNode =
+ new TransientNodeData(newPath, prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+ prevNode.getParentIdentifier(), inheritACL ? acl : prevNode.getACL());
+
+ // update this node
+ cache.put(new CacheId(ownerId, newNode.getIdentifier()), newNode);
+ }
+ else
+ {
+ //update property
+ PropertyData prevProp = (PropertyData)data;
+
+ if (inheritACL
+ && (prevProp.getQPath().getName().equals(Constants.EXO_PERMISSIONS) || prevProp.getQPath().getName()
+ .equals(Constants.EXO_OWNER)))
+ {
+ inheritACL = false;
+ }
+
+ TransientPropertyData newProp =
+ new TransientPropertyData(newPath, prevProp.getIdentifier(), prevProp.getPersistedVersion(),
+ prevProp.getType(), prevProp.getParentIdentifier(), prevProp.isMultiValued(), prevProp.getValues());
+
+ // update this property
+ cache.put(new CacheId(ownerId, newProp.getIdentifier()), newProp);
+ }
+ }
+ }
+
/**
* Actions that are not supposed to be called within a transaction
*
@@ -1628,7 +1742,7 @@
return ISPNCacheWorkspaceStorageCache.this.getTransactionManager();
}
}
-
+
@SuppressWarnings("rawtypes")
@Listener
public class CacheEventListener
@@ -1643,5 +1757,546 @@
onCacheEntryUpdated(value);
}
}
- }
+ }
+
+ /**
+ * This class defines all the methods that could change between the replicated and the distributed mode. By default it implements
+ * the methods for the local and replicated mode.
+ *
+ */
+ private class GlobalOperationCaller
+ {
+ protected int getCacheSize()
+ {
+ return cache.size();
+ }
+
+ protected void clearCache()
+ {
+ cache.clear();
+ }
+
+ /**
+ * Update child Nodes ACLs.
+ *
+ * @param parentId String - root node id of JCR subtree.
+ * @param acl AccessControlList
+ */
+ protected void updateChildsACL(String parentId, AccessControlList acl)
+ {
+ loop : for (Iterator<NodeData> iter = new ChildNodesIterator<NodeData>(parentId); iter.hasNext();)
+ {
+ NodeData prevNode = iter.next();
+
+ // is ACL changes on this node (i.e. ACL inheritance brokes)
+ for (InternalQName mixin : prevNode.getMixinTypeNames())
+ {
+ if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
+ {
+ continue loop;
+ }
+ }
+
+ // recreate with new path for child Nodes only
+ TransientNodeData newNode =
+ new TransientNodeData(prevNode.getQPath(), prevNode.getIdentifier(), prevNode.getPersistedVersion(),
+ prevNode.getPrimaryTypeName(), prevNode.getMixinTypeNames(), prevNode.getOrderNumber(),
+ prevNode.getParentIdentifier(), acl);
+
+ // update this node
+ cache.put(new CacheId(getOwnerId(), newNode.getIdentifier()), newNode);
+
+ // update childs recursive
+ updateChildsACL(newNode.getIdentifier(), acl);
+ }
+ }
+
+ /**
+ * Check all items in cache - is it descendant of prevRootPath, and update path according newRootPath.
+ *
+ * @param prevRootPath
+ * @param newRootPath
+ * @param acl
+ */
+ protected void updateTreePath(QPath prevRootPath, QPath newRootPath, AccessControlList acl)
+ {
+
+ // check all ITEMS in cache
+ Iterator<CacheKey> keys = cache.keySet().iterator();
+
+ while (keys.hasNext())
+ {
+ CacheKey key = keys.next();
+ if (key instanceof CacheId)
+ {
+ ItemData data = (ItemData)cache.get(key);
+ ISPNCacheWorkspaceStorageCache.updateTreePath(cache, getOwnerId(), data, prevRootPath, newRootPath, acl);
+ }
+ }
+ }
+ }
+
+ /**
+ * This class implements all the global operations for the distributed mode
+ *
+ */
+ private class DistributedOperationCaller extends GlobalOperationCaller
+ {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected int getCacheSize()
+ {
+ Map<String, Integer> map = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Map<String, Integer>>()
+ {
+ public Map<String, Integer> run()
+ {
+ MapReduceTask<CacheKey, Object, String, Integer> task =
+ new MapReduceTask<CacheKey, Object, String, Integer>(cache);
+ task.mappedWith(new GetSizeMapper(getOwnerId())).reducedWith(new GetSizeReducer<String>());
+ return task.execute();
+ }
+
+ });
+ int sum = 0;
+ for (Integer i : map.values())
+ {
+ sum += i;
+ }
+ return sum;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void clearCache()
+ {
+ SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ MapReduceTask<CacheKey, Object, Void, Void> task =
+ new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+ task.mappedWith(new ClearCacheMapper(getOwnerId())).reducedWith(new IdentityReducer());
+ task.execute();
+ return null;
+ }
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
+ {
+ final TransactionManager tm = getTransactionManager();
+ if (tm != null)
+ {
+ try
+ {
+ // Add the action out of the current transaction to avoid deadlocks
+ tm.getTransaction().registerSynchronization(new Synchronization()
+ {
+
+ public void beforeCompletion()
+ {
+ }
+
+ public void afterCompletion(int status)
+ {
+ if (status == Status.STATUS_COMMITTED)
+ {
+ try
+ {
+ // Since the tx is successfully committed we can call components non tx aware
+
+ // The listeners will need to be executed outside the current tx so we suspend
+ // the current tx we can face enlistment issues on product like ISPN
+ tm.suspend();
+ _updateTreePath(prevRootPath, newRootPath, acl);
+ }
+ catch (SystemException e)
+ {
+ LOG.warn("Cannot suspend the transaction", e);
+ }
+ }
+ }
+ });
+ return;
+ }
+ catch (Exception e)
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("Cannot register the synchronization to the current transaction in order to update"
+ + " the path out of the transaction", e);
+ }
+ }
+ }
+ _updateTreePath(prevRootPath, newRootPath, acl);
+ }
+
+ private void _updateTreePath(final QPath prevRootPath, final QPath newRootPath, final AccessControlList acl)
+ {
+ SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ MapReduceTask<CacheKey, Object, Void, Void> task =
+ new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+ task.mappedWith(new UpdateTreePathMapper(getOwnerId(), prevRootPath, newRootPath, acl))
+ .reducedWith(new IdentityReducer());
+ task.execute();
+ return null;
+ }
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void updateChildsACL(String parentId, final AccessControlList acl)
+ {
+ ItemData parentItem = get(parentId);
+ if (!(parentItem instanceof NodeData))
+ {
+ return;
+ }
+ final QPath parentPath = ((NodeData)parentItem).getQPath();
+ SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ MapReduceTask<CacheKey, Object, Void, Void> task =
+ new MapReduceTask<CacheKey, Object, Void, Void>(cache);
+ task.mappedWith(new UpdateChildsACLMapper(getOwnerId(), parentPath, acl)).reducedWith(
+ new IdentityReducer());
+ task.execute();
+ return null;
+ }
+ });
+ }
+ }
+
+ public static class GetSizeMapper extends AbstractMapper<String, Integer>
+ {
+
+ public GetSizeMapper()
+ {
+ }
+
+ public GetSizeMapper(String ownerId)
+ {
+ super(ownerId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void _map(CacheKey key, Object value, Collector<String, Integer> collector)
+ {
+ collector.emit("total", Integer.valueOf(1));
+ }
+ }
+
+ public static class GetSizeReducer<K> implements Reducer<K, Integer>
+ {
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID = 7877781449514234007L;
+
+ /**
+ * @see org.infinispan.distexec.mapreduce.Reducer#reduce(java.lang.Object, java.util.Iterator)
+ */
+ public Integer reduce(K reducedKey, Iterator<Integer> iter)
+ {
+ int sum = 0;
+ while (iter.hasNext())
+ {
+ Integer i = iter.next();
+ sum += i;
+ }
+ return sum;
+ }
+ }
+
+ public static class ClearCacheMapper extends AbstractMapper<Void, Void>
+ {
+ public ClearCacheMapper()
+ {
+ }
+
+ public ClearCacheMapper(String ownerId)
+ {
+ super(ownerId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+ {
+ ExoContainer container = ExoContainerContext.getTopContainer();
+ if (container == null)
+ {
+ LOG.error("The top container could not be found");
+ return;
+ }
+ DistributedCacheManager dcm =
+ (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+ if (dcm == null)
+ {
+ LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+ return;
+ }
+ Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+ cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP, Flag.FAIL_SILENTLY).remove(key);
+ }
+ }
+
+ public static class IdentityReducer implements Reducer<Void, Void>
+ {
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID = -6193360351201912040L;
+
+ /**
+ * @see org.infinispan.distexec.mapreduce.Reducer#reduce(java.lang.Object, java.util.Iterator)
+ */
+ public Void reduce(Void reducedKey, Iterator<Void> iter)
+ {
+ return null;
+ }
+ }
+
+ public static class UpdateTreePathMapper extends AbstractMapper<Void, Void>
+ {
+ private QPath prevRootPath, newRootPath;
+
+ private AccessControlList acl;
+
+ public UpdateTreePathMapper()
+ {
+ }
+
+ public UpdateTreePathMapper(String ownerId, QPath prevRootPath, QPath newRootPath, AccessControlList acl)
+ {
+ super(ownerId);
+ this.prevRootPath = prevRootPath;
+ this.newRootPath = newRootPath;
+ this.acl = acl;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isValid(CacheKey key)
+ {
+ return super.isValid(key) && key instanceof CacheId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ byte[] buf = prevRootPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+
+ buf = newRootPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+
+ out.writeBoolean(acl != null);
+ if (acl != null)
+ {
+ acl.writeExternal(out);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ byte[] buf;
+
+ try
+ {
+ buf = new byte[in.readInt()];
+ in.readFully(buf);
+ String sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+ prevRootPath = QPath.parse(sQPath);
+ buf = new byte[in.readInt()];
+ in.readFully(buf);
+ sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+ newRootPath = QPath.parse(sQPath);
+ }
+ catch (IllegalPathException e)
+ {
+ throw new IOException("Deserialization error. ", e);
+ }
+ if (in.readBoolean())
+ {
+ this.acl = new AccessControlList();
+ acl.readExternal(in);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+ {
+ ExoContainer container = ExoContainerContext.getTopContainer();
+ if (container == null)
+ {
+ LOG.error("The top container could not be found");
+ return;
+ }
+ DistributedCacheManager dcm =
+ (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+ if (dcm == null)
+ {
+ LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+ return;
+ }
+ Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+ ISPNCacheWorkspaceStorageCache.updateTreePath(cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP), ownerId, (ItemData)value, prevRootPath, newRootPath, acl);
+ }
+ }
+
+ public static class UpdateChildsACLMapper extends AbstractMapper<Void, Void>
+ {
+ private QPath parentPath;
+
+ private AccessControlList acl;
+
+ public UpdateChildsACLMapper()
+ {
+ }
+
+ public UpdateChildsACLMapper(String ownerId, QPath parentPath, AccessControlList acl)
+ {
+ super(ownerId);
+ this.parentPath = parentPath;
+ this.acl = acl;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean isValid(CacheKey key)
+ {
+ return super.isValid(key) && key instanceof CacheId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+ byte[] buf = parentPath.getAsString().getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+
+ out.writeBoolean(acl != null);
+ if (acl != null)
+ {
+ acl.writeExternal(out);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+ byte[] buf;
+
+ try
+ {
+ buf = new byte[in.readInt()];
+ in.readFully(buf);
+ String sQPath = new String(buf, Constants.DEFAULT_ENCODING);
+ parentPath = QPath.parse(sQPath);
+ }
+ catch (IllegalPathException e)
+ {
+ throw new IOException("Deserialization error. ", e);
+ }
+ if (in.readBoolean())
+ {
+ this.acl = new AccessControlList();
+ acl.readExternal(in);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void _map(CacheKey key, Object value, Collector<Void, Void> collector)
+ {
+ if (!(value instanceof NodeData))
+ {
+ return;
+ }
+ NodeData prevNode = (NodeData)value;
+ // check is this descendant of parentPath
+ QPath nodeQPath = prevNode.getQPath();
+ if (nodeQPath == null || !nodeQPath.isDescendantOf(parentPath))
+ {
+ return;
+ }
+
+ // is ACL changes on this node (i.e. ACL inheritance brokes)
+ for (InternalQName mixin : prevNode.getMixinTypeNames())
+ {
+ if (mixin.equals(Constants.EXO_PRIVILEGEABLE) || mixin.equals(Constants.EXO_OWNEABLE))
+ {
+ return;
+ }
+ }
+ ExoContainer container = ExoContainerContext.getTopContainer();
+ if (container == null)
+ {
+ LOG.error("The top container could not be found");
+ return;
+ }
+ DistributedCacheManager dcm =
+ (DistributedCacheManager)container.getComponentInstanceOfType(DistributedCacheManager.class);
+ if (dcm == null)
+ {
+ LOG.error("The DistributedCacheManager could not be found at top container level, please configure it.");
+ return;
+ }
+ Cache<CacheKey, Object> cache = dcm.getCache(CACHE_NAME);
+ // we force the reloading
+ cache.getAdvancedCache().withFlags(Flag.SKIP_REMOTE_LOOKUP, Flag.FAIL_SILENTLY).remove(key);
+ }
+ }
}
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/AbstractMapper.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * This is the main class of all the mapper used in jcr
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public abstract class AbstractMapper<KOut, VOut> extends
+ org.exoplatform.services.ispn.AbstractMapper<CacheKey, Object, KOut, VOut> implements Externalizable
+{
+ /**
+ * This id will be the unique identifier of the workspace in case the
+ * distributed mode is enabled as the cache will be then shared so we
+ * need this id to prevent mixing data of different workspace. In case
+ * the workspace is not distributed the value of this variable will be
+ * null to avoid consuming more memory for nothing
+ */
+ protected String ownerId;
+
+ public AbstractMapper()
+ {
+ }
+
+ public AbstractMapper(String ownerId)
+ {
+ this.ownerId = ownerId;
+ }
+
+ /**
+ * @see org.exoplatform.services.ispn.AbstractMapper#isValid(java.lang.Object)
+ */
+ @Override
+ protected boolean isValid(CacheKey key)
+ {
+ return ownerId.equals(key.getOwnerId());
+ }
+
+ /**
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ byte[] buf = ownerId.getBytes("UTF-8");
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+
+ /**
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ byte[] buf = new byte[in.readInt()];
+ in.readFully(buf);
+ ownerId = new String(buf, "UTF-8");
+ }
+}
\ No newline at end of file
Copied: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java (from rev 5416, jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheKey.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import org.exoplatform.services.jcr.impl.Constants;
+import org.infinispan.distribution.group.Group;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+/**
+ * Created by The eXo Platform SAS. <br/>
+ * Base class for WorkspaceCache keys.<br/>
+ *
+ * Date: 10.06.2008<br/>
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: CacheKey.java 2845 2010-07-30 13:29:37Z tolusha $
+ */
+public abstract class CacheKey implements Externalizable, Comparable<CacheKey>
+{
+
+ /**
+ * This id will be the unique identifier of the workspace in case the
+ * distributed mode is enabled as the cache will be then shared so we
+ * need this id to prevent mixing data of different workspace. In case
+ * the workspace is not distributed the value of this variable will be
+ * null to avoid consuming more memory for nothing
+ */
+ protected String ownerId;
+
+ protected String id;
+
+ protected int hash;
+
+ /**
+ * The value used in case, the grouping is enabled
+ */
+ protected String group;
+
+ /**
+ * The full name of the group
+ */
+ protected String fullGroupName;
+
+ public CacheKey()
+ {
+ }
+
+ public CacheKey(String ownerId, String id)
+ {
+ this(ownerId, id, null);
+ }
+
+ public CacheKey(String ownerId, String id, String group)
+ {
+ this.ownerId = ownerId;
+ this.id = id;
+ this.hash = id.hashCode();
+ this.group = group;
+ }
+
+ /**
+ * @return the ownerId
+ */
+ public String getOwnerId()
+ {
+ return ownerId;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ return this.hash;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName() + "-" + (ownerId == null ? "" : (ownerId + "-")) + id + "-" + group;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int compareTo(CacheKey o)
+ {
+ int result = getClass().getName().compareTo(o.getClass().getName());
+ if (result == 0 && ownerId != null)
+ {
+ // The key is of the same type and we assume that the distributed mode is enabled
+ result = ownerId.compareTo(o.ownerId);
+ }
+ return result == 0 ? id.compareTo(o.id) : result;
+ }
+
+ /**
+ * This method is used for the grouping when its enabled. It will return
+ * the value of the group if it has been explicitly set otherwise it will
+ * return the value of the fullId
+ * @return the group
+ */
+ @Group
+ public String getGroup()
+ {
+ if (fullGroupName != null)
+ {
+ return fullGroupName;
+ }
+ StringBuilder sb = new StringBuilder();
+ if (ownerId != null)
+ {
+ sb.append(ownerId).append('-');
+ }
+ return fullGroupName = sb.append(group == null ? id : group).toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ byte[] buf;
+ if (ownerId == null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ buf = ownerId.getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+ if (group == null)
+ {
+ out.writeInt(-1);
+ }
+ else
+ {
+ buf = group.getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+ }
+
+ buf = id.getBytes(Constants.DEFAULT_ENCODING);
+ out.writeInt(buf.length);
+ out.write(buf);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ byte[] buf;
+ int length = in.readInt();
+ if (length >= 0)
+ {
+ buf = new byte[length];
+ in.readFully(buf);
+ ownerId = new String(buf, Constants.DEFAULT_ENCODING);
+ }
+ length = in.readInt();
+ if (length >= 0)
+ {
+ buf = new byte[length];
+ in.readFully(buf);
+ group = new String(buf, Constants.DEFAULT_ENCODING);
+ }
+ buf = new byte[in.readInt()];
+ in.readFully(buf);
+ id = new String(buf, Constants.DEFAULT_ENCODING);
+ hash = id.hashCode();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CacheKey cacheKey = (CacheKey)obj;
+ if (cacheKey.hash == hash && cacheKey.id.equals(id))
+ {
+ return ownerId != null ? ownerId.equals(cacheKey.ownerId) : true;
+ }
+ return false;
+ }
+}
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/CacheServer.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.infinispan;
+
+import org.exoplatform.container.StandaloneContainer;
+
+import java.net.URL;
+
+/**
+ * This class is used to be able to launch a cache instance as a JVM in standalone mode, it
+ * will then be able to join an existing cluster of distributed caches.
+ * It will be launched using the standalone container initialized thanks to the configuration
+ * file whose path is expected as the first argument, by default it will
+ * use <i>/conf/cache-server-configuration.xml</i> that is bundled into the current jar file.
+ *
+ * The expected path is an absolute path or a relative path from the user directory
+ * or from the {@link ClassLoader}.
+ *
+ * Please note that this cache server should be used only for a distributed cache.
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class CacheServer
+{
+
+ private static final String DEFAULT_CONFIG_FILE_PATH = "/conf/cache-server-configuration.xml";
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception
+ {
+ String configPath;
+ if (args == null || args.length == 0)
+ {
+ configPath = DEFAULT_CONFIG_FILE_PATH;
+ //NOSONAR
+ System.out.println("The configuration file will be loaded from '" + DEFAULT_CONFIG_FILE_PATH + "'");
+ }
+ else if (args.length == 1)
+ {
+ configPath = args[0];
+ //NOSONAR
+ System.out.println("The configuration file will be loaded from '" + args[0] + "'");
+ }
+ else
+ {
+ //NOSONAR
+ System.err.println("Too many arguments, the expected syntax is: java CacheServer <configuration-file-path>");
+ return;
+ }
+
+ URL configUrl = CacheServer.class.getResource(configPath);
+ if (configUrl != null)
+ {
+ StandaloneContainer.addConfigurationURL(configUrl.toString());
+ }
+ else
+ {
+ StandaloneContainer.addConfigurationPath(configPath);
+ }
+ StandaloneContainer.getInstance();
+ }
+
+}
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -22,30 +22,38 @@
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.services.ispn.Utils;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.TemplateConfigurationHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.Parser;
+import org.infinispan.distribution.ch.ConsistentHash;
+import org.infinispan.distribution.ch.DefaultConsistentHash;
import org.infinispan.jmx.MBeanServerLookup;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
+import org.infinispan.transaction.lookup.TransactionManagerLookup;
+import org.infinispan.util.Util;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.net.URL;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.management.MBeanServer;
+import javax.transaction.TransactionManager;
/**
* Factory that creates and starts pre-configured instances of Infinispan.
@@ -64,16 +72,17 @@
private final ConfigurationManager configurationManager;
+ private final TransactionManager transactionManager;
+
private final TemplateConfigurationHelper configurationHelper;
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.core.impl.infinispan.v5.InfinispanCacheFactory");
+ private static final Log log = ExoLogger
+ .getLogger("exo.jcr.component.core.impl.infinispan.v5.InfinispanCacheFactory");
/**
- * A Map that contains all the registered CacheManager order by {@link ExoContainer}
- * instances and {@link GlobalConfiguration}.
+ * A Map that contains all the registered CacheManager order by cluster name.
*/
- private static Map<GlobalConfiguration, EmbeddedCacheManager> CACHE_MANAGERS =
- new HashMap<GlobalConfiguration, EmbeddedCacheManager>();
+ private static Map<String, EmbeddedCacheManager> CACHE_MANAGERS = new HashMap<String, EmbeddedCacheManager>();
private static final MBeanServerLookup MBEAN_SERVER_LOOKUP = new MBeanServerLookup()
{
@@ -88,14 +97,26 @@
* Transaction manager will later be injected to cache instance.
*
* @param configurationManager
+ * @param transactionManager
*/
- public ISPNCacheFactory(ConfigurationManager configurationManager)
+ public ISPNCacheFactory(ConfigurationManager configurationManager, TransactionManager transactionManager)
{
this.configurationManager = configurationManager;
this.configurationHelper = new ISPNCacheHelper(configurationManager);
+ this.transactionManager = transactionManager;
}
/**
+ * Creates InfinispanCacheFactory with provided configuration transaction managers.
+ *
+ * @param configurationManager
+ */
+ public ISPNCacheFactory(ConfigurationManager configurationManager)
+ {
+ this(configurationManager, null);
+ }
+
+ /**
* Factory that creates and starts pre-configured instances of Infinispan.
* Path to Infinispan configuration or template should be provided as
* "infinispan-configuration" property in parameterEntry instance.
@@ -132,20 +153,24 @@
{
// creating new CacheManager using SecurityHelper
- manager = SecurityHelper.doPrivilegedIOExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>()
+ manager = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>()
{
- public EmbeddedCacheManager run() throws IOException
+ public EmbeddedCacheManager run() throws Exception
{
- DefaultCacheManager manager = new DefaultCacheManager(configStream, false);
- loadJGroupsConfig(manager);
- return getUniqueInstance(regionIdEscaped, manager);
+ Parser parser = new Parser(Thread.currentThread().getContextClassLoader());
+ // Loads the configuration from the input stream
+ ConfigurationBuilderHolder holder = parser.parse(configStream);
+ GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
+ Utils.loadJGroupsConfig(configurationManager, configBuilder.build(), configBuilder);
+ return getUniqueInstance(regionIdEscaped, holder, transactionManager);
}
});
}
- catch (IOException e)
+ catch (PrivilegedActionException pae)
{
- throw new RepositoryConfigurationException(e);
+ Throwable cause = pae.getCause();
+ throw new RepositoryConfigurationException(cause);
}
PrivilegedAction<Cache<K, V>> action = new PrivilegedAction<Cache<K, V>>()
@@ -161,95 +186,69 @@
}
/**
- * This method is used to load the file corresponding to the path set on the property
- * <tt>configurationFile</tt> using the configuration manager, then set the XML content
- * as value of the property <tt>configurationXml</tt>.
- * @param manager the manager from which we extract the transport properties in which
- * we will find the path of the JGroups configuration
- * @throws IOException if the configuration file cannot be read
- */
- private void loadJGroupsConfig(DefaultCacheManager manager) throws IOException
- {
- Properties p = manager.getGlobalConfiguration().getTransportProperties();
- if (p != null && p.containsKey("configurationFile"))
- {
- URL jgroupsConfigURL = null;
- InputStream jgroupsConfigInputStream = null;
- try
- {
- // Trying to get the configuration from the configuration manager
- String configurationFile = p.getProperty("configurationFile");
- jgroupsConfigInputStream = configurationManager.getInputStream(configurationFile);
- jgroupsConfigURL = configurationManager.getResource(configurationFile);
- }
- catch (Exception e)
- {
- // ignore me
- }
- if (jgroupsConfigInputStream != null)
- {
- try
- {
- log.info("Custom JGroups configuration set: " + jgroupsConfigURL);
-
- // Read stream content into StringWriter
- StringWriter sw = new StringWriter();
- InputStreamReader in = new InputStreamReader(jgroupsConfigInputStream);
-
- char[] buffer = new char[1024];
- int n = 0;
- while (-1 != (n = in.read(buffer)))
- {
- sw.write(buffer, 0, n);
- }
-
- p.setProperty("configurationXml", sw.toString());
- p.remove("configurationFile");
- }
- finally
- {
- jgroupsConfigInputStream.close();
- }
- }
- }
- }
-
- /**
- * Try to find if a {@link EmbeddedCacheManager} of the same type (i.e. their {@link GlobalConfiguration} are equals)
+ * Try to find if a {@link EmbeddedCacheManager} of the same type (i.e. the cluster names are equal)
* has already been registered for the same current container.
* If no cache manager has been registered, we register the given cache manager otherwise we
* use the previously registered cache manager and we define a dedicated region for the related cache.
* @param regionId the unique id of the cache region to create
- * @param manager the current cache manager of the cache to create
+ * @param holder the configuration holder of the the cache to create
+ * @param tm the transaction manager to put into the configuration of the cache
* @return the given cache manager if it has not been registered otherwise the cache manager of the same
* type that has already been registered..
*/
- private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId, EmbeddedCacheManager manager)
+ private static synchronized EmbeddedCacheManager getUniqueInstance(String regionId,
+ ConfigurationBuilderHolder holder, final TransactionManager tm)
{
- GlobalConfiguration gc = manager.getGlobalConfiguration();
+ GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder();
+ GlobalConfiguration gc = configBuilder.build();
ExoContainer container = ExoContainerContext.getCurrentContainer();
// Ensure that the cluster name won't be used between 2 ExoContainers
- gc.fluent().transport().clusterName(gc.getClusterName() + "_" + container.getContext().getName())
- .globalJmxStatistics().cacheManagerName(gc.getCacheManagerName() + "_" + container.getContext().getName()).
+ configBuilder.transport().clusterName(gc.transport().clusterName() + "_" + container.getContext().getName())
+ .globalJmxStatistics()
+ .cacheManagerName(gc.globalJmxStatistics().cacheManagerName() + "_" + container.getContext().getName()).
// Configure the MBeanServerLookup
mBeanServerLookup(MBEAN_SERVER_LOOKUP);
- Configuration conf = manager.getDefaultConfiguration();
- if (CACHE_MANAGERS.containsKey(gc))
+ EmbeddedCacheManager manager;
+ gc = configBuilder.build();
+ String clusterName = gc.transport().clusterName();
+ if (CACHE_MANAGERS.containsKey(clusterName))
{
- manager = CACHE_MANAGERS.get(gc);
+ manager = CACHE_MANAGERS.get(clusterName);
}
else
{
// Reset the manager before storing it into the map since the default config is used as
// template to define a new configuration
manager = new DefaultCacheManager(gc);
- CACHE_MANAGERS.put(gc, manager);
+ CACHE_MANAGERS.put(clusterName, manager);
if (log.isInfoEnabled())
{
log.info("A new ISPN Cache Manager instance has been registered for the region " + regionId
+ " and the container " + container.getContext().getName());
}
}
+ ConfigurationBuilder confBuilder = holder.getDefaultConfigurationBuilder();
+ if (tm != null)
+ {
+ TransactionManagerLookup tml = new TransactionManagerLookup()
+ {
+ public TransactionManager getTransactionManager() throws Exception
+ {
+ return tm;
+ }
+ };
+ confBuilder.transaction().transactionManagerLookup(tml);
+ }
+ //TODO remove it once ISPN-1687 will be fixed
+ confBuilder.storeAsBinary().enabled(false);
+ //TODO remove it once ISPN-1689 will be fixed
+ confBuilder
+ .clustering()
+ .hash()
+ .consistentHash(
+ Util.<ConsistentHash> getInstance(DefaultConsistentHash.class.getName(), Thread.currentThread()
+ .getContextClassLoader()));
+ Configuration conf = holder.getDefaultConfigurationBuilder().build();
// Define the configuration of the cache
manager.defineConfiguration(regionId, conf);
if (log.isInfoEnabled())
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/cache-server-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/cache-server-configuration.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/cache-server-configuration.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
+ xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
+ <component>
+ <type>org.exoplatform.services.ispn.DistributedCacheManager</type>
+ <init-params>
+ <value-param>
+ <name>infinispan-configuration</name>
+ <value>jar:/conf/distributed-cache-configuration.xml</value>
+ </value-param>
+ </init-params>
+ </component>
+ <component>
+ <key>org.infinispan.transaction.lookup.TransactionManagerLookup</key>
+ <type>org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup</type>
+ </component>
+
+ <component>
+ <key>org.exoplatform.services.transaction.TransactionService</key>
+ <type>org.exoplatform.services.transaction.infinispan.JBossTransactionsService</type>
+ <init-params>
+ <value-param>
+ <name>timeout</name>
+ <value>3000</value>
+ </value-param>
+ </init-params>
+ </component>
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+ <value-param>
+ <name>logger</name>
+ <value>org.exoplatform.services.log.impl.BufferedLog4JLogger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="INFO, stdout, file" />
+
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender" />
+ <property name="log4j.appender.stdout.threshold" value="DEBUG" />
+
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender" />
+ <property name="log4j.appender.file.File" value="jcr-cache-server.log" />
+
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+ </properties-param>
+ </init-params>
+ </component>
+</configuration>
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/distributed-cache-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/distributed-cache-configuration.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/distributed-cache-configuration.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2010 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
+ xmlns="urn:infinispan:config:5.1">
+ <global>
+ <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
+ <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="JCR-cluster" distributedSyncTimeout="20000">
+ <properties>
+ <property name="configurationFile" value="tcp-mux.xml"/>
+ </properties>
+ </transport>
+ <shutdown hookBehavior="DEFAULT"/>
+ </global>
+ <namedCache name="JCRCache">
+ <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true" />
+ <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" eagerLockSingleNode="true" transactionMode="TRANSACTIONAL"/>
+ <jmxStatistics enabled="true"/>
+ <clustering mode="distribution">
+ <l1 enabled="true" invalidationThreshold="-1"/>
+ <hash numOwners="2" rehashRpcTimeout="120000">
+ <groups enabled="true"/>
+ </hash>
+ <sync/>
+ </clustering>
+ </namedCache>
+</infinispan>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-data.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -47,7 +47,7 @@
</clustering>
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
- <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+ <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<eviction strategy="LRU" threadPolicy="DEFAULT" maxEntries="1000000"/>
<expiration wakeUpInterval="5000"/>
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-indexer.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -47,7 +47,7 @@
</clustering>
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
- <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+ <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<eviction strategy="NONE"/>
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/portal/cluster/infinispan-lock.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -47,7 +47,7 @@
</clustering>
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
- <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+ <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<eviction strategy="NONE"/>
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/tcp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/tcp-mux.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/tcp-mux.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,70 @@
+<!--
+ TCP based stack, with flow control and message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
+ Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
+ -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]
+ author: Bela Ban
+-->
+<config xmlns="urn:org:jgroups"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
+ <TCP singleton_name="JCR-cluster"
+ bind_port="7800"
+ loopback="false"
+ recv_buf_size="${tcp.recv_buf_size:20M}"
+ send_buf_size="${tcp.send_buf_size:640K}"
+ discard_incompatible_packets="true"
+ max_bundle_size="64K"
+ max_bundle_timeout="30"
+ enable_bundling="true"
+ use_send_queues="true"
+ sock_conn_timeout="300"
+
+ timer_type="new"
+ timer.min_threads="4"
+ timer.max_threads="10"
+ timer.keep_alive_time="3000"
+ timer.queue_max_size="500"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="10"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="discard"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800],localhost[7801]}"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 min_interval="10000"
+ max_interval="30000"/>
+ <FD_SOCK/>
+ <FD timeout="3000" max_tries="3" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <BARRIER />
+ <pbcast.NAKACK use_mcast_xmit="false"
+ exponential_backoff="500"
+ discard_delivered_msgs="true"/>
+ <UNICAST />
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="4M"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+
+ view_bundling="true"/>
+ <UFC max_credits="2M"
+ min_threshold="0.4"/>
+ <MFC max_credits="2M"
+ min_threshold="0.4"/>
+ <FRAG2 frag_size="60K" />
+ <pbcast.STATE_TRANSFER/>
+</config>
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/udp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/udp-mux.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/main/resources/conf/udp-mux.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,74 @@
+
+<!--
+ Default stack using IP multicasting. It is similar to the "udp"
+ stack in stacks.xml, but doesn't use streaming state transfer and flushing
+ author: Bela Ban
+-->
+
+<config xmlns="urn:org:jgroups"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
+ <UDP
+ singleton_name="JCR-cluster"
+ mcast_port="${jgroups.udp.mcast_port:45588}"
+ tos="8"
+ ucast_recv_buf_size="20M"
+ ucast_send_buf_size="640K"
+ mcast_recv_buf_size="25M"
+ mcast_send_buf_size="640K"
+ loopback="true"
+ discard_incompatible_packets="true"
+ max_bundle_size="64K"
+ max_bundle_timeout="30"
+ ip_ttl="${jgroups.udp.ip_ttl:8}"
+ enable_bundling="true"
+ enable_diagnostics="true"
+ thread_naming_pattern="cl"
+
+ timer_type="new"
+ timer.min_threads="4"
+ timer.max_threads="10"
+ timer.keep_alive_time="3000"
+ timer.queue_max_size="500"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="2"
+ thread_pool.max_threads="8"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="10000"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="Run"/>
+
+ <PING timeout="2000"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
+ min_interval="10000"/>
+ <FD_SOCK/>
+ <FD_ALL/>
+ <VERIFY_SUSPECT timeout="1500" />
+ <BARRIER />
+ <pbcast.NAKACK exponential_backoff="300"
+ xmit_stagger_timeout="200"
+ use_mcast_xmit="false"
+ discard_delivered_msgs="true"/>
+ <UNICAST />
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="4M"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ view_bundling="true"/>
+ <UFC max_credits="2M"
+ min_threshold="0.4"/>
+ <MFC max_credits="2M"
+ min_threshold="0.4"/>
+ <FRAG2 frag_size="60K" />
+ <pbcast.STATE_TRANSFER />
+ <!-- pbcast.FLUSH /-->
+</config>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/cache/infinispan/TestISPNCacheWorkspaceStorageCacheInClusterMode.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -23,8 +23,8 @@
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.impl.dataflow.persistent.TestWorkspaceStorageCacheInClusterMode;
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.TesterISPNCacheWorkspaceStorageCache;
-import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.ISPNCacheWorkspaceStorageCache;
import org.exoplatform.services.jcr.infinispan.ISPNCacheFactory;
import java.lang.reflect.Field;
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/java/org/exoplatform/services/jcr/lab/infinispan/TestISPNCache.java 2012-01-19 18:45:11 UTC (rev 5486)
@@ -21,8 +21,10 @@
import junit.framework.TestCase;
import org.infinispan.Cache;
-import org.infinispan.config.Configuration;
-import org.infinispan.config.GlobalConfiguration;
+import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.cache.ConfigurationBuilder;
+import org.infinispan.configuration.global.GlobalConfiguration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
@@ -62,13 +64,13 @@
public void testGetCache() throws Exception
{
// Create cache manager
- GlobalConfiguration myGlobalConfig = new GlobalConfiguration();
+ GlobalConfiguration myGlobalConfig = new GlobalConfigurationBuilder().build();
EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);
// Create a cache
- Configuration config = new Configuration();
+ Configuration config = new ConfigurationBuilder().build();
manager.defineConfiguration("cache", config);
- Cache cache = manager.getCache("cache");
+ Cache<String, String> cache = manager.getCache("cache");
cache.put("key", "value");
assertTrue(cache.size() == 1);
@@ -98,11 +100,12 @@
*/
public void testGetClusterCache() throws Exception
{
+ GlobalConfiguration myGlobalConfig = new GlobalConfigurationBuilder().clusteredDefault().build();
// Create cache manager
- EmbeddedCacheManager manager = new DefaultCacheManager(GlobalConfiguration.getClusteredDefault());
+ EmbeddedCacheManager manager = new DefaultCacheManager(myGlobalConfig);
// Create a cache
- Cache cache = manager.getCache();
+ Cache<String, String> cache = manager.getCache();
cache.put("key", "value");
assertTrue(cache.size() == 1);
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/distributed-cache-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/distributed-cache-configuration.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/distributed-cache-configuration.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright (C) 2010 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
+ xmlns="urn:infinispan:config:5.1">
+ <global>
+ <globalJmxStatistics jmxDomain="exo" enabled="true" allowDuplicateDomains="true"/>
+ <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport" clusterName="JCR-cluster" distributedSyncTimeout="20000">
+ <properties>
+ <property name="configurationFile" value="tcp-mux.xml"/>
+ </properties>
+ </transport>
+ <shutdown hookBehavior="DEFAULT"/>
+ </global>
+ <namedCache name="JCRCache">
+ <locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true" />
+ <transaction transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" eagerLockSingleNode="true" transactionMode="TRANSACTIONAL"/>
+ <jmxStatistics enabled="true"/>
+ <clustering mode="distribution">
+ <l1 enabled="true" invalidationThreshold="-1"/>
+ <hash numOwners="2" rehashRpcTimeout="120000">
+ <groups enabled="true"/>
+ </hash>
+ <sync replTimeout="60000"/>
+ </clustering>
+ </namedCache>
+</infinispan>
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/tcp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/tcp-mux.xml (rev 0)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/tcp-mux.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -0,0 +1,70 @@
+<!--
+ TCP based stack, with flow control and message bundling. This is usually used when IP
+ multicasting cannot be used in a network, e.g. because it is disabled (routers discard multicast).
+ Note that TCP.bind_addr and TCPPING.initial_hosts should be set, possibly via system properties, e.g.
+ -Djgroups.bind_addr=192.168.5.2 and -Djgroups.tcpping.initial_hosts=192.168.5.2[7800]
+ author: Bela Ban
+-->
+<config xmlns="urn:org:jgroups"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
+ <TCP singleton_name="JCR-cluster"
+ bind_port="7800"
+ loopback="false"
+ recv_buf_size="${tcp.recv_buf_size:20M}"
+ send_buf_size="${tcp.send_buf_size:640K}"
+ discard_incompatible_packets="true"
+ max_bundle_size="64K"
+ max_bundle_timeout="30"
+ enable_bundling="true"
+ use_send_queues="true"
+ sock_conn_timeout="300"
+
+ timer_type="new"
+ timer.min_threads="4"
+ timer.max_threads="10"
+ timer.keep_alive_time="3000"
+ timer.queue_max_size="500"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="1"
+ thread_pool.max_threads="10"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="false"
+ thread_pool.queue_max_size="100"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="discard"/>
+
+ <TCPPING timeout="3000"
+ initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800],localhost[7801]}"
+ port_range="1"
+ num_initial_members="3"/>
+ <MERGE2 min_interval="10000"
+ max_interval="30000"/>
+ <FD_SOCK/>
+ <FD timeout="3000" max_tries="3" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <BARRIER />
+ <pbcast.NAKACK use_mcast_xmit="false"
+ exponential_backoff="500"
+ discard_delivered_msgs="true"/>
+ <UNICAST />
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="4M"/>
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+
+ view_bundling="true"/>
+ <UFC max_credits="2M"
+ min_threshold="0.4"/>
+ <MFC max_credits="2M"
+ min_threshold="0.4"/>
+ <FRAG2 frag_size="60K" />
+ <pbcast.STATE_TRANSFER/>
+</config>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-configuration.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -214,7 +214,15 @@
</value-param>
</init-params>
</component>
-
+ <component>
+ <type>org.exoplatform.services.ispn.DistributedCacheManager</type>
+ <init-params>
+ <value-param>
+ <name>infinispan-configuration</name>
+ <value>jar:/conf/standalone/cluster/distributed-cache-configuration.xml</value>
+ </value-param>
+ </init-params>
+ </component>
<component>
<key>org.exoplatform.services.rpc.RPCService</key>
<type>org.exoplatform.services.rpc.jgv3.RPCServiceImpl</type>
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -58,6 +58,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -117,6 +118,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -184,6 +186,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -275,6 +278,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -359,6 +363,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -424,6 +429,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -500,6 +506,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -575,6 +582,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
@@ -649,6 +657,7 @@
<property name="infinispan-configuration" value="conf/standalone/cluster/test-infinispan-config.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="infinispan-cluster-name" value="JCR-cluster" />
+ <property name="use-distributed-cache" value="${use-distributed-cache}" />
</properties>
</cache>
<query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-config.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -36,7 +36,7 @@
<default>
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="true"/>
- <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+ <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<eviction strategy="LRU" threadPolicy="DEFAULT" maxEntries="1000000"/>
<expiration wakeUpInterval="5000"/>
Modified: jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/exo.jcr.component.core.impl.infinispan.v5/src/test/resources/conf/standalone/test-infinispan-lock.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -36,7 +36,7 @@
<default>
<locking isolationLevel="READ_COMMITTED" lockAcquisitionTimeout="20000" writeSkewCheck="false" concurrencyLevel="500" useLockStriping="false"/>
- <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true"/>
+ <transaction transactionManagerLookupClass="org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup" syncRollbackPhase="true" syncCommitPhase="true" transactionMode="TRANSACTIONAL"/>
<jmxStatistics enabled="true"/>
<eviction strategy="NONE"/>
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2012-01-19 14:28:39 UTC (rev 5485)
+++ jcr/trunk/pom.xml 2012-01-19 18:45:11 UTC (rev 5486)
@@ -85,8 +85,13 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.ext.rpc.impl.jgroups.v3</artifactId>
<version>${org.exoplatform.kernel.version}</version>
- </dependency>
+ </dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.infinispan.v5</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.database</artifactId>
<version>${org.exoplatform.core.version}</version>
@@ -392,12 +397,12 @@
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
- <version>5.1.0.CR1</version>
+ <version>5.1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-cachestore-jdbc</artifactId>
- <version>5.1.0.CR1</version>
+ <version>5.1.0.CR3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
14 years, 3 months
exo-jcr SVN: r5485 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr and 10 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-19 09:28:39 -0500 (Thu, 19 Jan 2012)
New Revision: 5485
Removed:
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupScheduler.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupSchedulerException.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/ValueStorageCleanHelper.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupScheduler.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/RepositoryService.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/JCRAddSystemNodeTest.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegister.java
jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupRestart.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-db2.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mssql.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mysql.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-oracle.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-pgsql.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-sybase.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
Log:
EXOJCR-1723: Removed deprecated methods and classes
Modified: jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-19 14:28:39 UTC (rev 5485)
@@ -7,4 +7,9 @@
* Index JCR_XITEM_PARENT_NAME removed (JCR_IDX_MITEM_PN - for DB2)
* Index JCR_IDX_XITEM_PARENT_N_ORDER_NUM from MySQL scripts.
* We will have RepositoryException when use Session or Node after session.logout
-* Removed SystemIdentity class
\ No newline at end of file
+* Removed SystemIdentity class
+* Removed BackupScheduler class
+* Removed TextFilter interfaces
+* Not supported fields autoInitializedRootNt and autoInitPermissions
+* Removed ValueStorageCleanHelper class
+* Removed BackupSchedulerException class
\ No newline at end of file
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/RepositoryService.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/RepositoryService.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/RepositoryService.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -45,14 +45,6 @@
ManageableRepository getDefaultRepository() throws RepositoryException, RepositoryConfigurationException;
/**
- * Get default repository.
- *
- * @return ManagableRepository
- * @deprecated use getDefaultRepository() instead
- */
- ManageableRepository getRepository() throws RepositoryException, RepositoryConfigurationException;
-
- /**
* Get repository by name.
*
* @param name
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -205,15 +205,6 @@
return getRepository(config.getDefaultRepositoryName());
}
- /**
- * @deprecated use getDefaultRepository() instead
- */
- @Deprecated
- public ManageableRepository getRepository() throws RepositoryException
- {
- return getDefaultRepository();
- }
-
// ------------------- Startable ----------------------------
public ManageableRepository getRepository(String name) throws RepositoryException
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -52,7 +52,7 @@
{
RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
assertNotNull(service);
- RepositoryImpl defRep = (RepositoryImpl)service.getRepository();
+ RepositoryImpl defRep = (RepositoryImpl)service.getDefaultRepository();
assertNotNull(defRep);
String sysWs = defRep.getSystemWorkspaceName();
assertFalse("Sys ws should not be initialized for this test!!", defRep.isWorkspaceInitialized(sysWs)); // Default Namespaces
@@ -69,7 +69,7 @@
{
RepositoryService service = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
- RepositoryImpl defRep = (RepositoryImpl)service.getRepository();
+ RepositoryImpl defRep = (RepositoryImpl)service.getDefaultRepository();
String sysWs = defRep.getSystemWorkspaceName();
assertFalse("Sys ws should not be initialized for this test!!", defRep.isWorkspaceInitialized(sysWs));
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/JCRAddSystemNodeTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/JCRAddSystemNodeTest.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/common/JCRAddSystemNodeTest.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -56,7 +56,7 @@
jcrSystem.addNode("Node1", "nt:unstructured");
jcrSystem.save();
session2.save();
- session2 = repositoryService.getRepository().getSystemSession(repository.getSystemWorkspaceName());
+ session2 = repositoryService.getDefaultRepository().getSystemSession(repository.getSystemWorkspaceName());
assertTrue(session2.getRootNode().getNode("jcr:system").hasNodes());
Node node1 = (Node)session2.getItem("/jcr:system/Node1");
jcrSystem.save();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegister.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegister.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegister.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -104,7 +104,7 @@
nodeTypeValue.setDeclaredSupertypeNames(superTypeNames);
nodeTypeValue.setPrimaryItemName("");
- ExtendedNodeTypeManager extNodeTypeManager = repositoryService.getRepository().getNodeTypeManager();
+ ExtendedNodeTypeManager extNodeTypeManager = repositoryService.getDefaultRepository().getNodeTypeManager();
try
{
nodeTypeManager.getNodeType("exo:testNodeType2");
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/pom.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -193,8 +193,7 @@
<excludes>
<exclude>**/BaseStandaloneTest.java</exclude>
<exclude>**/backup/AbstractBackupTestCase.java</exclude>
- <exclude>**/backup/BaseRDBMSBackupTest.java</exclude>
- <exclude>**/backup/TestBackupScheduler.java</exclude>
+ <exclude>**/backup/BaseRDBMSBackupTest.java</exclude>
<exclude>**/backup/TestBackupRestart.java</exclude>
<exclude>**/replication/**</exclude>
<exclude>**/repository/creation/cluster/**</exclude>
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -22,7 +22,6 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.ext.backup.impl.BackupMessage;
-import org.exoplatform.services.jcr.ext.backup.impl.BackupScheduler;
import org.exoplatform.services.jcr.ext.backup.impl.JobRepositoryRestore;
import org.exoplatform.services.jcr.ext.backup.impl.JobWorkspaceRestore;
@@ -197,14 +196,6 @@
RepositoryConfigurationException;
/**
- * Getting the scheduler.
- *
- * @return BackupScheduler
- * return the BackupScheduler
- */
- BackupScheduler getScheduler();
-
- /**
* Getting the backup messages.
*
* @return BackupMessage[]
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -215,8 +215,6 @@
private final RegistryService registryService;
- private BackupScheduler scheduler;
-
private final BackupMessagesLog messages;
private final MessagesListener messagesListener;
@@ -254,7 +252,6 @@
if (job != null)
{
-
switch (job.getType())
{
case BackupJob.FULL : {
@@ -314,7 +311,6 @@
public String printStackTrace(Throwable error)
{
-
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintWriter writer = new PrintWriter(out);
error.printStackTrace(writer);
@@ -517,8 +513,6 @@
messages = new BackupMessagesLog(MESSAGES_MAXSIZE);
- scheduler = new BackupScheduler(this, messages);
-
this.restoreJobs = new ArrayList<JobWorkspaceRestore>();
this.restoreRepositoryJobs = new ArrayList<JobRepositoryRestore>();
@@ -647,7 +641,6 @@
throws BackupOperationException, RepositoryException, RepositoryConfigurationException,
BackupConfigurationException
{
-
List<JobEntryInfo> list = log.getJobEntryInfos();
BackupConfig config = log.getBackupConfig();
@@ -681,7 +674,6 @@
// ws should not exists.
if (!workspaceAlreadyExist(reposytoryName, workspaceName))
{
-
for (int i = 0; i < list.size(); i++)
{
if (i == 0)
@@ -754,7 +746,6 @@
public BackupChain startBackup(BackupConfig config) throws BackupOperationException, BackupConfigurationException,
RepositoryException, RepositoryConfigurationException
{
-
return startBackup(config, null);
}
@@ -836,7 +827,6 @@
*/
public void start()
{
-
//remove if exists all old jcrrestorewi*.tmp files.
File[] files = PrivilegedFileHelper.listFiles(tempDir, new JcrRestoreWiFilter());
for (int i = 0; i < files.length; i++)
@@ -873,36 +863,6 @@
{
readParamsFromFile();
}
-
- // scan for task files
- File[] tasks = PrivilegedFileHelper.listFiles(this.logsDirectory, new TaskFilter());
- for (File task : tasks)
- {
- try
- {
- scheduler.restore(task);
- }
- catch (BackupSchedulerException e)
- {
- log.error("Can't restore backup scheduler task from file " + PrivilegedFileHelper.getAbsolutePath(task), e);
- }
- catch (BackupOperationException e)
- {
- log.error("Can't restore backup scheduler task from file " + PrivilegedFileHelper.getAbsolutePath(task), e);
- }
- catch (BackupConfigurationException e)
- {
- log.error("Can't restore backup scheduler task from file " + PrivilegedFileHelper.getAbsolutePath(task), e);
- }
- catch (RepositoryException e)
- {
- log.error("Can't restore backup scheduler task from file " + PrivilegedFileHelper.getAbsolutePath(task), e);
- }
- catch (RepositoryConfigurationException e)
- {
- log.error("Can't restore backup scheduler task from file " + PrivilegedFileHelper.getAbsolutePath(task), e);
- }
- }
}
/**
@@ -912,7 +872,6 @@
{
workspaceBackupStopper.close();
repositoryBackupStopper.close();
- scheduler.cancelTimer();
// 1. stop current backup chains
// for (Iterator iterator = currentBackups.iterator(); iterator.hasNext();) {
@@ -924,17 +883,6 @@
// scheduler = null;
}
- @Deprecated
- private void fullRestore(String pathBackupFile, String repositoryName, String workspaceName,
- WorkspaceEntry workspaceEntry) throws FileNotFoundException, IOException, RepositoryException,
- RepositoryConfigurationException
- {
-
- RepositoryImpl defRep = (RepositoryImpl)repoService.getRepository(repositoryName);
-
- defRep.importWorkspace(workspaceEntry.getName(), PrivilegedFileHelper.fileInputStream(pathBackupFile));
- }
-
private void fullRestoreOverInitializer(String pathBackupFile, String repositoryName, WorkspaceEntry workspaceEntry,
String fBackupType) throws FileNotFoundException, IOException, RepositoryException,
RepositoryConfigurationException, ClassNotFoundException
@@ -1193,14 +1141,6 @@
}
/**
- * {@inheritDoc}
- */
- public BackupScheduler getScheduler()
- {
- return scheduler;
- }
-
- /**
* getLogsDirectory.
*
* @return File
@@ -2072,5 +2012,4 @@
}
}
-
}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupScheduler.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupScheduler.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupScheduler.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -1,1146 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.backup.impl;
-
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.ext.backup.BackupChain;
-import org.exoplatform.services.jcr.ext.backup.BackupConfig;
-import org.exoplatform.services.jcr.ext.backup.BackupConfigurationException;
-import org.exoplatform.services.jcr.ext.backup.BackupJobListener;
-import org.exoplatform.services.jcr.ext.backup.BackupOperationException;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.net.MalformedURLException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.CountDownLatch;
-
-import javax.jcr.RepositoryException;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.stream.events.StartElement;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: BackupScheduler.java 760 2008-02-07 15:08:07Z pnedonosko $
- */
-public class BackupScheduler
-{
-
- public enum TaskStatus {
- VIRGIN, EXECUTED, FINISHED
- };
-
- protected Log log = ExoLogger.getLogger("exo.jcr.component.ext.BackupScheduler");
-
- private final BackupManagerImpl backup;
-
- private final BackupMessagesLog messages;
-
- private final Timer timer;
-
- private final List<WeakReference<SchedulerTask>> tasks = new ArrayList<WeakReference<SchedulerTask>>();
-
- private class TaskConfig
- {
-
- private final DateFormat datef = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
-
- BackupConfig backupConfig;
-
- Date startTime;
-
- Date stopTime;
-
- long chainPeriod;
-
- long incrPeriod;
-
- TaskConfig(BackupConfig backupConfig, Date startTime, Date stopTime, long chainPeriod, long incrPeriod)
- {
- this.backupConfig = backupConfig;
- this.startTime = startTime;
- this.stopTime = stopTime;
- this.chainPeriod = chainPeriod;
- this.incrPeriod = incrPeriod;
- }
-
- TaskConfig(File taskFile) throws IOException, XMLStreamException, FactoryConfigurationError, ParseException
- {
- read(taskFile);
- }
-
- Date parseDate(String dateString) throws ParseException
- {
- if ("null".equals(dateString))
- return null;
- else
- return datef.parse(dateString);
- }
-
- String formatDate(Date date)
- {
- return date == null ? "null" : datef.format(date);
- }
-
- void save(File taskFile) throws IOException, XMLStreamException, FactoryConfigurationError
- {
- TaskConfigWriter w = new TaskConfigWriter(taskFile);
- w.writeBackupConfig(backupConfig);
- w.writeSchedulerConfig(startTime, stopTime, chainPeriod, incrPeriod);
- w.writeEndLog();
- }
-
- void read(File taskFile) throws IOException, XMLStreamException, FactoryConfigurationError, ParseException
- {
- TaskConfigReader r = new TaskConfigReader(taskFile);
- r.readLogFile();
-
- // done
- this.backupConfig = r.backupConfig;
- this.startTime = r.startTime;
- this.stopTime = r.stopTime;
- this.chainPeriod = r.chainPeriod;
- this.incrPeriod = r.incrPeriod;
- }
-
- @Deprecated
- void read_old(File taskFile) throws IOException, ParseException, BackupSchedulerException
- {
- char[] cbuf = new char[1024];
- StringBuilder content = new StringBuilder();
-
- // read file
- FileReader fr = new FileReader(taskFile);
- int r = 0;
- while ((r = fr.read(cbuf)) >= 0)
- {
- content.append(cbuf, 0, r);
- };
- fr.close();
-
- // parse file
- String[] fc = content.toString().trim().split("\n");
- if (fc.length > 1)
- {
- File _backupLog = null;
- Date _startTime = null, _stopTime = null;
- long _chainPeriod = -1, _incrPeriod = -1;
-
- String[] terms = fc[fc.length - 1].split(",");
- for (int i = 0; i < terms.length; i++)
- {
- if (i == 0)
- {
- _backupLog = new File(terms[i]);
- }
- else if (i == 1)
- {
- _startTime = datef.parse(terms[i]);
- }
- else if (i == 2)
- {
- String t = terms[i];
- if (!"null".equals(t))
- _stopTime = datef.parse(t);
- }
- else if (i == 3)
- {
- _chainPeriod = Long.parseLong(terms[i]);
- }
- else if (i == 4)
- {
- _incrPeriod = Long.parseLong(terms[i]);
- }
- }
-
- if (PrivilegedFileHelper.exists(_backupLog))
- {
- // this.backupLog = _backupLog;
- this.startTime = _startTime;
- this.stopTime = _stopTime;
- this.chainPeriod = _chainPeriod;
- this.incrPeriod = _incrPeriod;
- }
- else
- throw new BackupSchedulerException(
- "Scheduler task skipped due to the error. Backup log file not exists "
- + PrivilegedFileHelper.getAbsolutePath(_backupLog) + ". Task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile));
- }
- else
- throw new BackupSchedulerException("Scheduler task skipped due to bad configured task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile) + ". File doesn't contains configuration line.");
- }
-
- @Deprecated
- File save_old(File taskFile) throws IOException
- {
- // File taskFile = new File(PrivilegedFileHelper.getAbsolutePath(backupLog) + ".task");
- if (!PrivilegedFileHelper.exists(taskFile))
- {
- FileWriter fw = new FileWriter(taskFile);
- fw.append("LogPath,StartTime,StopTime,ChainPeriod,IncrPeriod\n");
- fw.append(PrivilegedFileHelper.getAbsolutePath(taskFile) + "," + datef.format(startTime) + ","
- + (stopTime != null ? datef.format(stopTime) : "null") + "," + chainPeriod + "," + incrPeriod);
- fw.close();
- return taskFile;
- }
-
- return null;
- }
-
- class TaskConfigWriter
- {
-
- Log logger = ExoLogger.getLogger("exo.jcr.component.ext.TaskConfigWriter");
-
- final FileOutputStream logFile;
-
- final XMLStreamWriter writer;
-
- TaskConfigWriter(final File logFile) throws FileNotFoundException, XMLStreamException,
- FactoryConfigurationError
- {
- this.logFile = PrivilegedFileHelper.fileOutputStream(logFile);
-
- try
- {
- writer = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<XMLStreamWriter>()
- {
- public XMLStreamWriter run() throws Exception
- {
- return XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(logFile));
- }
- });
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof XMLStreamException)
- {
- throw (XMLStreamException)cause;
- }
- else if (cause instanceof FactoryConfigurationError)
- {
- throw (FactoryConfigurationError)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- };
-
- writer.writeStartDocument();
- writer.writeStartElement("backup-task-config");
- writer.flush();
- }
-
- void writeBackupConfig(BackupConfig config) throws XMLStreamException
- {
- writer.writeStartElement("backup-config");
-
- writer.writeStartElement("full-backup-type");
- writer.writeCharacters(backup.getFullBackupType());
- writer.writeEndElement();
-
- writer.writeStartElement("incremental-backup-type");
- writer.writeCharacters(backup.getIncrementalBackupType());
- writer.writeEndElement();
-
- if (config.getBackupDir() != null)
- {
- writer.writeStartElement("backup-dir");
- writer.writeCharacters(PrivilegedFileHelper.getAbsolutePath(config.getBackupDir()));
- writer.writeEndElement();
- }
-
- if (config.getRepository() != null)
- {
- writer.writeStartElement("repository");
- writer.writeCharacters(config.getRepository());
- writer.writeEndElement();
- }
-
- if (config.getWorkspace() != null)
- {
- writer.writeStartElement("workspace");
- writer.writeCharacters(config.getWorkspace());
- writer.writeEndElement();
- }
-
- writer.writeStartElement("incremental-job-period");
- writer.writeCharacters(Long.toString(config.getIncrementalJobPeriod()));
- writer.writeEndElement();
-
- writer.writeEndElement();
-
- writer.flush();
- }
-
- void writeSchedulerConfig(Date startTime, Date stopTime, long chainPeriod, long incrPeriod)
- throws XMLStreamException
- {
- writer.writeStartElement("scheduler-config");
-
- writer.writeStartElement("start-time");
- writer.writeCharacters(formatDate(startTime));
- writer.writeEndElement();
-
- writer.writeStartElement("stop-time");
- writer.writeCharacters(formatDate(stopTime));
- writer.writeEndElement();
-
- writer.writeStartElement("chain-period");
- writer.writeCharacters(String.valueOf(chainPeriod));
- writer.writeEndElement();
-
- writer.writeStartElement("incr-period");
- writer.writeCharacters(String.valueOf(incrPeriod));
- writer.writeEndElement();
-
- writer.writeEndElement();
-
- writer.flush();
- }
-
- void writeEndLog() throws XMLStreamException, IOException
- {
- writer.writeEndElement();
- writer.writeEndDocument();
- writer.flush();
-
- logFile.close();
- }
- }
-
- class TaskConfigReader
- {
- Log logger = ExoLogger.getLogger("exo.jcr.component.ext.TaskConfigReader");
-
- final FileInputStream logFile;
-
- final XMLStreamReader reader;
-
- BackupConfig backupConfig;
-
- Date startTime;
-
- Date stopTime;
-
- long chainPeriod;
-
- long incrPeriod;
-
- TaskConfigReader(File logFile) throws FileNotFoundException, XMLStreamException, FactoryConfigurationError
- {
- this.logFile = PrivilegedFileHelper.fileInputStream(logFile);
-
- this.reader = XMLInputFactory.newInstance().createXMLStreamReader(this.logFile);
- }
-
- void readLogFile() throws XMLStreamException, ParseException, IOException
- {
- try
- {
- while (true)
- {
- int eventCode = reader.next();
- switch (eventCode)
- {
-
- case StartElement.START_ELEMENT :
- String name = reader.getLocalName();
-
- if (name.equals("backup-config"))
- readBackupConfig();
-
- if (name.equals("scheduler-config"))
- readTaskConfig();
-
- break;
-
- case StartElement.END_DOCUMENT :
- return;
- }
- }
- }
- finally
- {
- logFile.close();
- }
- }
-
- private void readTaskConfig() throws XMLStreamException, MalformedURLException, ParseException
- {
- boolean endJobEntryInfo = false;
-
- while (!endJobEntryInfo)
- {
- int eventCode = reader.next();
- switch (eventCode)
- {
-
- case StartElement.START_ELEMENT :
- String name = reader.getLocalName();
-
- if (name.equals("start-time"))
- startTime = parseDate(readContent());
-
- if (name.equals("stop-time"))
- stopTime = parseDate(readContent());
-
- if (name.equals("chain-period"))
- chainPeriod = Long.valueOf(readContent()).longValue();
-
- if (name.equals("incr-period"))
- incrPeriod = Long.valueOf(readContent()).longValue();
-
- break;
-
- case StartElement.END_ELEMENT :
- String tagName = reader.getLocalName();
-
- if (tagName.equals("scheduler-config"))
- endJobEntryInfo = true;
- break;
- }
- }
- }
-
- private void readBackupConfig() throws XMLStreamException
- {
- BackupConfig conf = new BackupConfig();
-
- boolean endBackupConfig = false;
-
- while (!endBackupConfig)
- {
- int eventCode = reader.next();
- switch (eventCode)
- {
-
- case StartElement.START_ELEMENT :
- String name = reader.getLocalName();
-
- if (name.equals("backup-dir"))
- conf.setBackupDir(new File(readContent()));
-
- if (name.equals("repository"))
- conf.setRepository(readContent());
-
- if (name.equals("workspace"))
- conf.setWorkspace(readContent());
-
- if (name.equals("incremental-job-period"))
- conf.setIncrementalJobPeriod(Long.valueOf(readContent()));
-
- break;
-
- case StartElement.END_ELEMENT :
- String tagName = reader.getLocalName();
-
- if (tagName.equals("backup-config"))
- endBackupConfig = true;
- break;
- }
- }
-
- backupConfig = conf;
- }
-
- // Read CHARACTERS
- private String readContent() throws XMLStreamException
- {
- String content = null;
-
- int eventCode = reader.next();
-
- if (eventCode == StartElement.CHARACTERS)
- content = reader.getText();
-
- return content;
- }
- }
- }
-
- private class TaskThread extends Thread
- {
- private final CountDownLatch latch = new CountDownLatch(1);
-
- public TaskThread(String name)
- {
- super(name);
- }
-
- void markReady()
- {
- latch.countDown();
- }
-
- void await() throws InterruptedException
- {
- latch.await();
- }
- }
-
- class CleanupTasksListTask extends TimerTask
- {
-
- static final int PERIOD = 60000 * 30; // 30 min
-
- @Override
- public void run()
- {
- // pack tasks list if an empty references found
- synchronized (tasks)
- {
- for (Iterator<WeakReference<SchedulerTask>> ti = tasks.iterator(); ti.hasNext();)
- {
- if (ti.next().get() == null)
- // remove reference
- ti.remove();
- }
- }
- }
- }
-
- private abstract class SchedulerTask extends TimerTask
- {
-
- protected final BackupConfig config;
-
- protected BackupChain chain;
-
- protected TaskStatus status = TaskStatus.VIRGIN;
-
- protected final BackupJobListener listener;
-
- SchedulerTask(BackupConfig config, BackupJobListener listener)
- {
- this.config = config;
- this.listener = listener;
- }
-
- @Override
- public String toString()
- {
- return super.toString() + "-" + getChainName();
- }
-
- public String getChainName()
- {
- return config.getRepository() + "@" + config.getWorkspace();
- }
-
- public BackupChain getChain()
- {
- return chain;
- }
-
- protected TaskThread stop()
- {
- TaskThread stopper = new TaskThread("BackupScheduler_Task_" + getChainName() + "-stop")
- {
-
- @Override
- public void run()
- {
- try
- {
- synchronized (config)
- {
- backup.stopBackup(chain);
- if (log.isDebugEnabled())
- log.debug("Chain stopped " + chain.getLogFilePath());
- }
- }
- finally
- {
- markReady();
- }
- }
- };
- stopper.start();
-
- return stopper;
- }
-
- protected TaskThread start()
- {
- TaskThread starter = new TaskThread("BackupScheduler_Task_" + getChainName() + "-start")
- {
-
- @Override
- public void run()
- {
- try
- {
- synchronized (config)
- {
- chain = backup.startBackup(config, listener);
- if (log.isDebugEnabled())
- log.debug("Chain satarted " + chain.getLogFilePath());
- }
- }
- catch (BackupOperationException e)
- {
- postError(getChainName() + " start", e);
- }
- catch (BackupConfigurationException e)
- {
- postError(getChainName() + " start", e);
- }
- catch (RepositoryException e)
- {
- postError(getChainName() + " start", e);
- }
- catch (RepositoryConfigurationException e)
- {
- postError(getChainName() + " start", e);
- }
- finally
- {
- markReady();
- }
- }
- };
- starter.start();
-
- return starter;
- }
-
- protected void postError(String message, Throwable e)
- {
- messages.addError(message, e);
- log.error(message, e);
- if (listener != null)
- listener.onError(null, message, e);
- }
-
- /**
- * Backup task done, i.e. stopped and unscheduled
- */
- protected TaskThread done()
- {
- TaskThread done = new TaskThread("BackupScheduler_Task_" + getChainName() + "-done")
- {
- @Override
- public void run()
- {
- try
- {
- synchronized (config)
- {
- // cancel timer
- cancel();
-
- // stop the backup chain
- backup.stopBackup(chain);
-
- // remove task file config
- removeTaskConfig();
- if (log.isDebugEnabled())
- log.debug("Task done (stopped and scheduler canceled) "
- + (chain != null ? chain.getLogFilePath() : "[not started]"));
- }
- }
- finally
- {
- markReady();
- }
- }
- };
- done.start();
-
- return done;
- }
-
- protected void removeTaskConfig()
- {
- // remove task file config
- File taskFile =
- new File(PrivilegedFileHelper.getAbsolutePath(backup.getLogsDirectory()) + File.separator
- + config.getRepository() + "-" + config.getWorkspace() + ".task");
- if (PrivilegedFileHelper.exists(taskFile))
- {
- PrivilegedFileHelper.delete(taskFile);
- if (log.isDebugEnabled())
- log.debug("Remove scheduler task " + PrivilegedFileHelper.getAbsolutePath(taskFile));
- }
- }
-
- @Override
- public boolean cancel()
- {
- status = TaskStatus.FINISHED;
- if (log.isDebugEnabled())
- log.debug("Task scheduling canceled " + (chain != null ? chain.getLogFilePath() : "[not started]"));
- return super.cancel();
- }
- }
-
- // impl of p.3,4
- private class PeriodTask extends SchedulerTask
- {
-
- PeriodTask(BackupConfig config, BackupJobListener listener)
- {
- super(config, listener);
- }
-
- @Override
- public void run()
- {
- if (status == TaskStatus.VIRGIN)
- {
- // start
- start();
- status = TaskStatus.EXECUTED;
- }
- else if (status == TaskStatus.EXECUTED)
- {
- // stop backup and cancel scheduling
- done();
- }
- else
- {
- // do nothing or warn (shouldn't occurs)
- log.warn("Chain already task finished " + getChainName() + ", " + this);
- }
- }
- }
-
- // impl of p.5,6
- // &
- // impl of p7,8 (stopTime == null)
- private class PeriodicTask extends SchedulerTask
- {
-
- private final Date stopTime;
-
- PeriodicTask(BackupConfig config, Date stopTime, BackupJobListener listener)
- {
- super(config, listener);
- this.stopTime = stopTime;
- }
-
- @Override
- public void run()
- {
- if (chain != null && chain.isFinished())
- {
- // cancel scheduling
- cancel();
- // remove task file config
- removeTaskConfig();
- }
- else if (stopTime != null && new Date().after(stopTime))
- {
- // stop backup and cancel scheduling
- done();
- }
- else if (status == TaskStatus.VIRGIN)
- {
- // start
- start();
- status = TaskStatus.EXECUTED;
- }
- else if (status == TaskStatus.EXECUTED)
- {
- // stop current
- try
- {
- stop().await(); // wait if stop finished
- }
- catch (InterruptedException e)
- {
- postError("Can't stop task for periodic rotation ", e);
- }
-
- // start next
- start();
- }
- else
- {
- // do nothing or warn (shouldn't occurs)
- log.warn("Chain already task finished " + getChainName() + ", " + this);
- }
- }
- }
-
- // impl of p.1,2
- private class RunOnceTask extends SchedulerTask
- {
-
- RunOnceTask(BackupConfig config, BackupJobListener listener)
- {
- super(config, listener);
- }
-
- @Override
- public void run()
- {
- // start
- start();
- // remove task file config
- removeTaskConfig();
- }
- }
-
- BackupScheduler(BackupManagerImpl backup, BackupMessagesLog messages)
- {
- this.backup = backup;
- this.timer =
- new Timer("BackupScheduler_Timer_" + new SimpleDateFormat("yyyyMMdd.HHmmss.SSS").format(new Date()), true);
-
- // tasks list cleanup task
- this.timer.schedule(new CleanupTasksListTask(), CleanupTasksListTask.PERIOD, CleanupTasksListTask.PERIOD);
-
- this.messages = messages;
-
- // don't ask timer to cancel tasks
- // registerShutdownHook();
- }
-
- public BackupMessage[] getErrors()
- {
- return messages.getMessages();
- }
-
- /**
- * Restore scheduler after system shutdown etc. Called from manager at start.
- *
- * Should restore the scheduler tasks if start and stop time are correct and will be occured in
- * future. Or should restore and to continue the tasks if start time reached but stop time in
- * future or periodic scheduling enabled for the task (including incremental configuration too).
- *
- * @param taskFile
- * @throws ParseException
- * @throws BackupSchedulerException
- * @throws BackupOperationException
- * @throws RepositoryConfigurationException
- * @throws RepositoryException
- * @throws BackupConfigurationException
- * @throws IOException
- */
- void restore(final File taskFile) throws BackupSchedulerException, BackupOperationException,
- BackupConfigurationException, RepositoryException, RepositoryConfigurationException
- {
- try
- {
- TaskConfig tconf = new TaskConfig(taskFile);
-
- // check if the task is not expired
- final Date now = new Date();
- // by start time and periodic parameters
- if ((tconf.stopTime != null && tconf.stopTime.after(now)) || tconf.chainPeriod > 0 || tconf.incrPeriod > 0)
- {
-
- // by stop time
- // Restore without scheduler now. Add task search capabilities to the scheduler and add
- // listener to a task
- schedule(tconf.backupConfig, tconf.startTime, tconf.stopTime, tconf.chainPeriod, tconf.incrPeriod, null);
- } // else - the start time in past and no periodic configuration found
-
- }
- catch (IOException e)
- {
- throw new BackupSchedulerException("Can't restore scheduler from task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile), e);
- }
- catch (ParseException e)
- {
- throw new BackupSchedulerException("Can't restore scheduler from task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile), e);
- }
- catch (XMLStreamException e)
- {
- throw new BackupSchedulerException("Can't restore scheduler from task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile), e);
- }
- catch (FactoryConfigurationError e)
- {
- throw new BackupSchedulerException("Can't restore scheduler from task file "
- + PrivilegedFileHelper.getAbsolutePath(taskFile), e);
- }
- }
-
- /**
- * Schedule backup task with given configuration and scheduler parameters. The behaviour of a task
- * vary depending on scheduler parameters. If specified
- * <ul>
- * <li>1. startTime only - run once forever</li>
- * <li>2. startTime + incrementalPeriod - run once forever (with incremental backup)</li>
- * <li>3. startTime, endTime - run during given period</li>
- * <li>4. startTime, endTime + incrementalPeriod - run during given period (with incremental
- * backup)</li>
- * <li>5. startTime, endTime, chainPeriod - run periodic during given period</li>
- * <li>6. startTime, endTime, chainPeriod + incrementalPeriod - run periodic during given period
- * (with incremental backup)</li>
- * <li>7. startTime, chainPeriod - run periodic forever</li>
- * <li>8. startTime, chainPeriod + incrementalPeriod - run periodic forever (with incremental
- * backup)</li>
- * </ul>
- *
- * @param config
- * @param startTime
- * - task start time
- * @param stopTime
- * - task stop time, may be null i.e. the task will be executed forever
- * @param chainPeriod
- * - task chain period, means periodic execution of the configured backup chain
- * @param incrementalPeriod
- * - incr period
- * @param listener
- * - listener for each job produced by an each backup chain
- * @return
- * @throws BackupSchedulerException
- */
- public void schedule(BackupConfig config, Date startTime, Date stopTime, long chainPeriod, long incrementalPeriod)
- throws BackupSchedulerException
- {
- schedule(config, startTime, stopTime, chainPeriod, incrementalPeriod, null);
- }
-
- /**
- * Schedule backup task with given configuration and scheduler parameters. The behaviour of a task
- * vary depending on scheduler parameters. If specified
- * <ul>
- * <li>1. startTime only - run once forever</li>
- * <li>2. startTime + incrementalPeriod - run once forever (with incremental backup)</li>
- * <li>3. startTime, endTime - run during given period</li>
- * <li>4. startTime, endTime + incrementalPeriod - run during given period (with incremental
- * backup)</li>
- * <li>5. startTime, endTime, chainPeriod - run periodic during given period</li>
- * <li>6. startTime, endTime, chainPeriod + incrementalPeriod - run periodic during given period
- * (with incremental backup)</li>
- * <li>7. startTime, chainPeriod - run periodic forever</li>
- * <li>8. startTime, chainPeriod + incrementalPeriod - run periodic forever (with incremental
- * backup)</li>
- * </ul>
- *
- * The method will return immediate, a task will be scheduled and started as independent thread.
- *
- * @param config
- * @param startTime
- * - task start time
- * @param stopTime
- * - task stop time, may be null i.e. the task will be executed forever
- * @param chainPeriod
- * - task chain period, means periodic execution of the configured backup chain
- * @param incrementalPeriod
- * - incr period
- * @param listener
- * - listener for each job produced by an each backup chain
- * @return
- * @throws BackupSchedulerException
- */
- public void schedule(BackupConfig config, Date startTime, Date stopTime, long chainPeriod, long incrementalPeriod,
- BackupJobListener listener) throws BackupSchedulerException
- {
-
- long chainPeriodMilliseconds = chainPeriod * 1000;
-
- if (incrementalPeriod > 0)
- config.setIncrementalJobPeriod(incrementalPeriod); // override ones from config
-
- SchedulerTask ctask;
-
- if (stopTime != null)
- {
- if (stopTime.after(startTime))
- {
- if (chainPeriodMilliseconds > 0)
- {
- ctask = new PeriodicTask(config, stopTime, listener);
- // the task will be executed each time chainPeriod exceeded and stopped at stopTime
- timer.schedule(ctask, startTime, chainPeriodMilliseconds);
- }
- else
- {
- long stopPeriod = stopTime.getTime() - startTime.getTime();
- ctask = new PeriodTask(config, listener);
- // the task will be executed twice, second execution will means stop
- timer.schedule(ctask, startTime, stopPeriod);
- }
- }
- else
- throw new BackupSchedulerException("Stop time (" + stopTime + ") should be after the start time ("
- + startTime + ")");
- }
- else
- {
- if (chainPeriodMilliseconds > 0)
- {
- ctask = new PeriodicTask(config, null, listener);
- // the task will be executed each time chainPeriod exceeded and never stopped there
- timer.schedule(ctask, startTime, chainPeriodMilliseconds);
- }
- else
- {
- ctask = new RunOnceTask(config, listener);
- // the task will executed once at given startTime
- timer.schedule(ctask, startTime);
- }
- }
-
- synchronized (tasks)
- {
- tasks.add(new WeakReference<SchedulerTask>(ctask));
- }
-
- TaskConfig tc = new TaskConfig(config, startTime, stopTime, chainPeriod, incrementalPeriod);
- try
- {
- // PrivilegedFileHelper.getAbsolutePath(backup.getLogsDirectory())
- File taskFile =
- new File(PrivilegedFileHelper.getAbsolutePath(backup.getLogsDirectory()) + File.separator
- + config.getRepository() + "-" + config.getWorkspace() + ".task");
-
- if (PrivilegedFileHelper.exists(taskFile))
- {
- throw new BackupSchedulerException("Task for repository '" + config.getRepository() + "' workspace '"
- + config.getWorkspace() + "' already exists. File " + PrivilegedFileHelper.getAbsolutePath(taskFile));
- }
- tc.save(taskFile); // save task config
- }
- catch (IOException e)
- {
- throw new BackupSchedulerException("Can't save scheduler task file " + e, e);
- }
- catch (XMLStreamException e)
- {
- throw new BackupSchedulerException("Can't save scheduler task file " + e, e);
- }
- catch (FactoryConfigurationError e)
- {
- throw new BackupSchedulerException("Can't save scheduler task file " + e, e);
- }
- }
-
- /**
- * Search task by repository and workspace names
- *
- * @param repository
- * - name string
- * @param workspace
- * - name string
- *
- * @return SchedulerTask
- */
- public SchedulerTask findTask(String repository, String workspace)
- {
- synchronized (tasks)
- {
- for (Iterator<WeakReference<SchedulerTask>> ti = tasks.iterator(); ti.hasNext();)
- {
- WeakReference<SchedulerTask> tr = ti.next();
- SchedulerTask task = tr.get();
- if (task != null && task.config.getRepository().equals(repository)
- && task.config.getWorkspace().equals(workspace))
- {
- return task;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Unshedule the task scheduled before with the given configuration. The method will waits till
- * the task will be stopped.
- *
- * @param config
- * - configuration used for a task search
- * @return - true if task was searched and stopped ok
- * @throws BackupSchedulerException
- */
- public boolean unschedule(BackupConfig config) throws BackupSchedulerException
- {
- synchronized (tasks)
- {
- for (Iterator<WeakReference<SchedulerTask>> ti = tasks.iterator(); ti.hasNext();)
- {
- WeakReference<SchedulerTask> tr = ti.next();
- SchedulerTask task = tr.get();
- if (task != null && task.config.getRepository().equals(config.getRepository())
- && task.config.getWorkspace().equals(config.getWorkspace()))
- {
- // remove task
- try
- {
- task.done().await();
- }
- catch (InterruptedException e)
- {
- throw new BackupSchedulerException("Task stop operation fails " + e, e);
- }
- ti.remove();
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Simple method to release the thread used by timer used in scheduler
- */
- public void cancelTimer()
- {
- timer.cancel();
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupSchedulerException.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupSchedulerException.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupSchedulerException.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.backup.impl;
-
-import org.exoplatform.services.jcr.ext.backup.BackupOperationException;
-
-/**
- * Created by The eXo Platform SAS Author : Peter Nedonosko peter.nedonosko(a)exoplatform.com.ua
- * 06.12.2007
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: BackupSchedulerException.java 610 2008-01-11 17:01:49Z pnedonosko $
- */
-public class BackupSchedulerException extends BackupOperationException
-{
-
- public BackupSchedulerException(String message)
- {
- super(message);
- }
-
- public BackupSchedulerException(String message, Throwable e)
- {
- super(message, e);
- }
-
- public BackupSchedulerException(Throwable e)
- {
- super(e.getMessage(), e);
- }
-}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/ValueStorageCleanHelper.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/ValueStorageCleanHelper.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/ValueStorageCleanHelper.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2003-2010 eXo Platform SAS.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Affero General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see<http://www.gnu.org/licenses/>.
- */
-package org.exoplatform.services.jcr.ext.backup.impl;
-
-import org.exoplatform.commons.utils.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.config.ContainerEntry;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.ValueStorageEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.impl.storage.value.fs.FileValueStorage;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Created by The eXo Platform SAS.
- *
- * <br/>Date: 2010
- *
- * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
- * @version $Id: ValueStorageCleanerService.java 3219 2010-09-30 07:40:51Z areshetnyak $
- */
-public class ValueStorageCleanHelper
-{
-
- /**
- * Clear workspace value storage.
- *
- * @param wEntry
- * workspace configuration
- * @throws RepositoryConfigurationException
- * @throws IOException
- */
- public void removeWorkspaceValueStorage(WorkspaceEntry wEntry) throws RepositoryConfigurationException, IOException
- {
- ContainerEntry containerEntry = wEntry.getContainer();
-
- if (containerEntry.getValueStorages() != null)
- {
- for (ValueStorageEntry valueStorageEntry : containerEntry.getValueStorages())
- {
- String valueStorageDirName = valueStorageEntry.getParameterValue(FileValueStorage.PATH);
-
- File valueStorageDir = new File(valueStorageDirName);
- if (PrivilegedFileHelper.exists(valueStorageDir))
- {
- removeFolder(valueStorageDir);
- }
- }
- }
- }
-
- /**
- * Remove folder
- */
- private void removeFolder(File dir) throws IOException
- {
- if (PrivilegedFileHelper.isDirectory(dir))
- {
- for (File subFile : PrivilegedFileHelper.listFiles(dir))
- {
- removeFolder(subFile);
- }
-
- if (!PrivilegedFileHelper.delete(dir))
- {
- throw new IOException("Value storage folder was not deleted : "
- + PrivilegedFileHelper.getCanonicalPath(dir));
- }
- }
- else
- {
- if (!PrivilegedFileHelper.delete(dir))
- {
- throw new IOException("Value storage file was not deleted : " + PrivilegedFileHelper.getCanonicalPath(dir));
- }
- }
- }
-
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupRestart.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupRestart.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupRestart.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -18,11 +18,7 @@
*/
package org.exoplatform.services.jcr.ext.backup;
-import org.exoplatform.services.jcr.ext.backup.impl.BackupScheduler;
-
import java.io.File;
-import java.util.Calendar;
-import java.util.Date;
/**
* Created by The eXo Platform SAS
@@ -49,54 +45,6 @@
return (ExtendedBackupManager) container.getComponentInstanceOfType(BackupManager.class);
}
- /**
- * 4. startTime, endTime + incrementalPeriod - run during a given period (with incremental backup)
- */
- public void _testPeriodicSchedulerPrepare() throws Exception
- {
- Date startTime;
- Date stopTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE) + 10); // 10 min to stop
- stopTime = calendar.getTime();
-
- File backDir = new File("target/backup/ws1.restored");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setIncrementalJobPeriod(2 * 60); // incrementalPeriod = 2 min
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, stopTime, 0, 0);
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // play with incremental during 50 sec
- addContent(ws1TestRoot, 1, 50, 1000);
-
- // stop to be restarted
- Thread.sleep(1000);
- }
-
public void _testPeriodicSchedulerRestore() throws Exception
{
BackupChain bch = backup.getCurrentBackups().iterator().next();
@@ -112,5 +60,4 @@
// restore
restoreAndCheck("ws1back.restored", "jdbcjcr9", bch.getLogFilePath(), backDir, 1, 50);
}
-
}
Deleted: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupScheduler.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupScheduler.java 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/TestBackupScheduler.java 2012-01-19 14:28:39 UTC (rev 5485)
@@ -1,568 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.ext.backup;
-
-import org.exoplatform.services.jcr.ext.backup.impl.BackupMessagesLog;
-import org.exoplatform.services.jcr.ext.backup.impl.BackupScheduler;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.File;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Created by The eXo Platform SAS
- *
- * Date: 05.12.2007
- *
- * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
- * @version $Id: TestBackupScheduler.java 760 2008-02-07 15:08:07Z pnedonosko $
- */
-public class TestBackupScheduler extends AbstractBackupTestCase
-{
-
- private static final Log log = ExoLogger.getLogger("exo.jcr.component.ext.TestBackupScheduler");
-
- protected ExtendedBackupManager getBackupManager()
- {
- return (ExtendedBackupManager) container.getComponentInstanceOfType(BackupManager.class);
- }
-
- class BackupWaiter implements BackupJobListener
- {
-
- private int jobId;
-
- private int jobState;
-
- final BackupMessagesLog errors = new BackupMessagesLog();
-
- private CountDownLatch latch = null;
-
- public void onError(BackupJob job, String message, Throwable error)
- {
- errors.addError(message, error);
- }
-
- public void onStateChanged(BackupJob job)
- {
- if (job.getId() == jobId && job.getState() == jobState && latch != null)
- synchronized (latch)
- {
- latch.countDown(); // release waiter
- }
- }
-
- /**
- * @return true - ok, false - fail (tomeout expired)
- * @throws InterruptedException
- */
- boolean await(int jobId, int jobState, long timeout) throws InterruptedException
- {
-
- if (latch != null)
- synchronized (latch)
- {
- latch = new CountDownLatch(1);
- }
- else
- latch = new CountDownLatch(1);
-
- this.jobId = jobId;
- this.jobState = jobState;
- this.errors.clear();
-
- if (timeout > 0)
- {
- return this.latch.await(timeout, TimeUnit.MILLISECONDS);
- }
- else
- {
- this.latch.await();
- return true;
- }
- }
- }
-
- /**
- * 1. startTime only - run once forever
- */
- public void testScheduler_p1() throws Exception
- {
- Date startTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- // full backup & incremental
-
- File backDir = new File("target/backup/ws1.incr5");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, null, 0, 0);
-
- // wait till backup will be started
- while (Calendar.getInstance().getTime().before(startTime))
- Thread.sleep(100);
-
- Thread.sleep(100); // to know the full is started
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // play with incremental
- addContent(ws1TestRoot, 1, 20, 1);
-
- scheduler.unschedule(config);
-
- log.info("-----------------[ restore ]-------------------------");
- // restore
- restoreAndCheck("ws1back.incr5", "jdbcjcr6", bch.getLogFilePath(), backDir, 1, 20);
- }
-
- /**
- * 2. startTime + incrementalPeriod - run once forever (with incremental backup)
- *
- */
- public void testScheduler_p2() throws Exception
- {
- Date startTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- // full backup & incremental
-
- File backDir = new File("target/backup/ws1.incr6");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, null, 0, 10); // 10 sec incremental period
-
- // wait till backup will be started
- waitTime(startTime);
-
- Thread.sleep(100); // to know the full is started
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // play with incremental, each node will be added after 500ms
- addContent(ws1TestRoot, 1, 20, 1100); // 20 * 1100 = 220000 ms = 22sec
-
- scheduler.unschedule(config);
-
- log.info("-----------------[ restore ]-------------------------");
- // restore
- restoreAndCheck("ws1back.incr6", "jdbcjcr7", bch.getLogFilePath(), backDir, 1, 20);
- }
-
- /**
- * 3. startTime, endTime - run during a given period
- */
- public void testScheduler_p3() throws Exception
- {
- Date startTime;
- Date stopTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 40); // 30 sec to stop
- stopTime = calendar.getTime();
-
- // full backup & incremental forever (without log rotate)
-
- File backDir = new File("target/backup/ws1.incr4");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, stopTime, 0, 0);
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // play with incremental during 20 sec
- addContent(ws1TestRoot, 1, 20, 1000);
-
- // wait till backup will be stopped
- waitTime(stopTime);
-
- // wait a bit more
- Thread.sleep(5000);
-
- log.info("-----------------[ restore ]-------------------------");
- // restore
- restoreAndCheck("ws1back.incr4", "jdbcjcr8", bch.getLogFilePath(), backDir, 1, 20);
- }
-
- /**
- * 4. startTime, endTime + incrementalPeriod - run during a given period (with incremental backup)
- */
- public void testScheduler_p4() throws Exception
- {
- Date startTime;
- Date stopTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 60); // 60 sec to stop
- stopTime = calendar.getTime();
-
- // full backup & incremental with log rotation 20sec
-
- File backDir = new File("target/backup/ws1.incr3");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setIncrementalJobPeriod(20); // incrementalPeriod = 20 sec*
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, stopTime, 0, 0); // incrementalPeriod = 20sec* (see
- // before)
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- // play with incremental during 50 sec
- addContent(ws1TestRoot, 1, 50, 1000);
-
- // wait till backup will be stopped
- waitTime(stopTime);
-
- // wait a bit more
- Thread.sleep(5000);
-
- log.info("-----------------[ restore ]-------------------------");
- // restore
- restoreAndCheck("ws1back.incr3", "jdbcjcr9", bch.getLogFilePath(), backDir, 1, 50);
- }
-
- /**
- * 5. startTime, endTime, chainPeriod - run periodic at given period
- *
- * test with timing - listener to know we have jobs stared in required time
- */
- public void testScheduler_p5_timing() throws Exception
- {
- Date startTime;
- Date stopTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 61);
- stopTime = calendar.getTime();
-
- // full backup each 20sec
- File backDir = new File("target/backup/ws1.incr7");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_BACKUP_ONLY);;
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- BackupWaiter waiter = new BackupWaiter();
- scheduler.schedule(config, startTime, stopTime, 20, 0, waiter); // 20 sec chain period
-
- // wait till backup #1 will be started
- assertTrue("Full backup #1 start expired", waiter.await(0, BackupJob.STARTING, 20500)); // 20.5sec
- // to
- // start
-
- BackupChain bch1 = backup.getCurrentBackups().iterator().next();
- log.info("full #1 " + bch1.getLogFilePath());
-
- final int nodesCount = 20;
- final int nodeTimeout = 500;
- addContent(ws1TestRoot, 11, 10 + nodesCount, nodeTimeout);
-
- // wait till full backup #2 will be started
- assertTrue("Full backup #2 start expired", waiter.await(0, BackupJob.STARTING, 20500)); // 20.5sec
- // for
- // next
-
- BackupChain bch2 = backup.getCurrentBackups().iterator().next();
- log.info("full #2 " + bch2.getLogFilePath());
-
- addContent(ws1TestRoot, 31, 30 + nodesCount, nodeTimeout);
-
- // wait till full backup #3 will be started
- assertTrue("Full backup #3 start expired", waiter.await(0, BackupJob.STARTING, 20500)); // 20.5sec
- // for
- // next
-
- BackupChain bch3 = backup.getCurrentBackups().iterator().next();
- log.info("full #3 " + bch3.getLogFilePath());
-
- // wait till backup will be stopped
- waitTime(stopTime);
-
- Thread.sleep(20000); // wait 20 sec if next chain was started before the stop
-
- log.info("-----------------[ restore #1 ]-------------------------");
- restoreAndCheck("ws1back.incr7", "jdbcjcr10", bch1.getLogFilePath(), backDir, 1, 10);
-
- log.info("-----------------[ restore #2 ]-------------------------");
- restoreAndCheck("ws1back.incr8", "jdbcjcr11", bch2.getLogFilePath(), backDir, 11, 30);
-
- log.info("-----------------[ restore #3 ]-------------------------");
- restoreAndCheck("ws1back.incr9", "jdbcjcr12", bch3.getLogFilePath(), backDir, 31, 50);
- }
-
- // 6. startTime, endTime, chainPeriod + incrementalPeriod - run periodic at // given period (with
- // incremental backup)
- public void testScheduler_p6() throws Exception
- {
-
- Date startTime;
- Date stopTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
-
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 55);
- stopTime = calendar.getTime();
- // full backup & incremental
-
- File backDir = new File("target/backup/ws1.incr10");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, stopTime, 25, 10);
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch = backup.getCurrentBackups().iterator().next();
-
- // wait till full backup will be stopped
- while (bch.getFullBackupState() != BackupJob.FINISHED)
- {
- Thread.yield();
- Thread.sleep(50);
- }
-
- BackupChain bch1 = backup.getCurrentBackups().iterator().next();
- log.info(" #1 " + bch1.getLogFilePath());
- // BackupChain bch1 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- // incr works, 15sec+
- addContent(ws1TestRoot, 1, 20, 750);
-
- // wait till next backup chain will be started
- Thread.sleep(10000);
-
- BackupChain bch2 = backup.getCurrentBackups().iterator().next();
- log.info(" #2 " + bch2.getLogFilePath());
- // BackupChain bch2 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- addContent(ws1TestRoot, 21, 40, 750);
-
- // wait till backup will be stopped
- waitTime(stopTime);
-
- Thread.sleep(25000); // wait 25 sec if next chain was started before the stop
-
- log.info(" restore #1 " + bch1.getLogFilePath());
- restoreAndCheck("ws1back.incr10", "jdbcjcr13", bch1.getLogFilePath(), backDir, 1, 20);
-
- log.info(" restore #2 " + bch2.getLogFilePath());
- restoreAndCheck("ws1back.incr11", "jdbcjcr14", bch2.getLogFilePath(), backDir, 21, 40);
- }
-
- /**
- * 7. startTime, chainPeriod - run periodic forever
- */
- public void testScheduler_p7() throws Exception
- {
- Date startTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
-
- startTime = calendar.getTime();
- // full backup & incremental
-
- File backDir = new File("target/backup/ws1.incr11");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, null, 10, 0);
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch1 = backup.getCurrentBackups().iterator().next();
- // BackupChain bch1 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- addContent(ws1TestRoot, 1, 20, 10);
- // wait till next backup will be started
- Thread.sleep(11000);
-
- BackupChain bch2 = backup.getCurrentBackups().iterator().next();
- // BackupChain bch2 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- addContent(ws1TestRoot, 21, 40, 1);
-
- // Stop backup
- Thread.sleep(10000); // for last started chain
- scheduler.unschedule(config);
-
- log.info("-----------------[ restore #1 ]-------------------------");
- restoreAndCheck("ws1back.incr12", "jdbcjcr15", bch1.getLogFilePath(), backDir, 1, 20);
-
- log.info("-----------------[ restore #2 ]-------------------------");
- restoreAndCheck("ws1back.incr13", "jdbcjcr16", bch2.getLogFilePath(), backDir, 21, 40);
- }
-
- // 8. startTime, chainPeriod + incrementalPeriod - run periodic forever (with incremental backup)
- public void testScheduler_p8() throws Exception
- {
-
- Date startTime;
-
- Calendar calendar = Calendar.getInstance();
- calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 10);
- startTime = calendar.getTime();
- // full backup & incremental
-
- File backDir = new File("target/backup/ws1.incr13");
- backDir.mkdirs();
-
- BackupConfig config = new BackupConfig();
- config.setRepository(repository.getName());
- config.setWorkspace("ws1");
- config.setBackupType(BackupManager.FULL_AND_INCREMENTAL);
- config.setBackupDir(backDir);
-
- BackupScheduler scheduler = backup.getScheduler();
-
- scheduler.schedule(config, startTime, null, 10, 6);
-
- // wait till backup will be started
- waitTime(startTime);
-
- BackupChain bch1 = backup.getCurrentBackups().iterator().next();
- // BackupChain bch1 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- addContent(ws1TestRoot, 1, 20, 15);
- // wait till next backup will be started
- Thread.sleep(11000);
-
- BackupChain bch2 = backup.getCurrentBackups().iterator().next();
- // BackupChain bch2 = backup.findBackup(config.getRepository(), config.getWorkspace());
-
- addContent(ws1TestRoot, 21, 40, 15);
-
- // Stop backup
- Thread.sleep(10000); // for last started chain
- scheduler.unschedule(config);
-
- log.info("-----------------[ restore #1 ]-------------------------");
- restoreAndCheck("ws1back.incr14", "jdbcjcr17", bch1.getLogFilePath(), backDir, 1, 20);
-
- log.info("-----------------[ restore #2 ]-------------------------");
- restoreAndCheck("ws1back.incr15", "jdbcjcr18", bch2.getLogFilePath(), backDir, 21, 40);
- }
-
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-db2.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-db2.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-db2.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mssql.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mssql.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mssql.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mysql.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mysql.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-mysql.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-oracle.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-oracle.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-oracle.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-pgsql.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-pgsql.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-pgsql.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-sybase.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-sybase.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup-sybase.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration-backup.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -51,8 +51,8 @@
<property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
<property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
- <!-- property name="log4j.category.ext.BackupScheduler" value="DEBUG"/>
- <property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
+
+ <!-- property name="log4j.category.ext.BackupManagerImpl" value="DEBUG"/ -->
<property name="log4j.category.jcr.ext.RestRepositoryService" value="DEBUG"/>
<!-- property name="log4j.category.org.exoplatform.services.jcr.ext.script.groovy.JcrGroovyResourceLoader" value="DEBUG" / -->
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2012-01-19 11:37:18 UTC (rev 5484)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/exojcr-backup-service.xml 2012-01-19 14:28:39 UTC (rev 5485)
@@ -608,104 +608,6 @@
</section>
<section>
- <title>Scheduling (experimental)</title>
-
- <para>The Backup service has an additional feature that can be useful for
- a production level backup implementation. When you need to organize a
- backup of a repository, it's necessary to have a tool which will be able
- to create and manage a cycle of Full and Incremental backups in periodic
- manner.</para>
-
- <para>The service has internal BackupScheduler which can run a
- configurable cycle of BackupChains as if they have been executed by a user
- during some period of time. I.e. BackupScheduler is a user-like daemon
- which asks the BackupManager to start or stop backup operations.</para>
-
- <para>For that purpose, BackupScheduler has the method.</para>
-
- <para>BackupScheduler.schedule(backupConfig, startDate, stopDate,
- chainPeriod, incrementalPeriod)</para>
-
- <para>where</para>
-
- <itemizedlist>
- <listitem>
- <para>backupConfig: A ready configuration which will be given to the
- BackupManager.startBackup() method</para>
- </listitem>
-
- <listitem>
- <para>startDate: The date and time of the backup start</para>
- </listitem>
-
- <listitem>
- <para>stopDate: The date and time of the backup stop</para>
- </listitem>
-
- <listitem>
- <para>chainPeriod: A period after which a current BackupChain will be
- stopped and a new one will be started in seconds</para>
- </listitem>
-
- <listitem>
- <para>incrementalPeriod: If it is greater than 0, it will be used to
- override the same value in backupConfig.</para>
- </listitem>
- </itemizedlist>
-
- <programlisting language="java">// geting the scheduler from the BackupManager
- BackupScheduler scheduler = backup.getScheduler();
-
-// schedule backup using a ready configuration (Full + Incrementals) to run from startTime
-// to stopTime. Full backuop will be performed every 24 hours (BackupChain lifecycle),
-// incremental will rotate result files every 3 hours.
- scheduler.schedule(config, startTime, stopTime, 3600 * 24, 3600 * 3);
-
-// it's possible to run the scheduler for an uncertain period of time (i.e. without stop time).
-// schedule backup to run from startTime till it will be stopped manually
-// also there, the incremental will rotate result files as it configured in BackupConfig
- scheduler.schedule(config, startTime, null, 3600 * 24, 0);
-
-// to unschedule backup simply call the scheduler with the configuration describing the
-// already planned backup cycle.
-// the scheduler will search in internal tasks list for task with repository and
-// workspace name from the configuration and will stop that task.
- scheduler.unschedule(config);</programlisting>
-
- <para>When the BackupScheduler starts the scheduling, it uses the internal
- Timer with startDate for the first (or just once) execution. If
- chainPeriod is greater than 0, then the task is repeated with this value
- used as a period starting from startDate. Otherwise, the task will be
- executed once at startDate time. If the scheduler has stopDate, it will
- stop the task ( the chain cycle) after stopDate. And the last parameter
- incrementalPeriod will be used instead of the same from BackupConfig if
- its values are greater than 0.</para>
-
- <para>Starting each task (BackupScheduler.schedule(...)), the scheduler
- creates a task file in the service working directory (see <emphasis
- role="bold">Configuration</emphasis>, backup-dir) which describes the task
- backup configuration and periodic values. These files will be used at the
- backup service start (JVM start) to reinitialize BackupScheduler for
- continuous task scheduling. Only tasks that don't have a stopDate or a
- stopDate not expired will be reinitialized.</para>
-
- <para>There is one notice about BackupScheduler task reinitialization in
- the current implementation. It comes from the BackupScheduler nature and
- its implemented behaviour. As the scheduler is just a virtual user which
- asks the BackupManager to start or stop backup operations, it isn't able
- to reinitialize each existing BackupChain before the service (JVM) is
- stopped. But it's possible to start a new operation with the same
- configuration via BackupManager (that was configured before and stored in
- a task file).</para>
-
- <para>This is a main detail of the BackupScheduler which should be taken
- into suggestion of a backup operation design now. In case of
- reinitialization, the task will have new time values for the backup
- operation cycle as the chainPeriod and incrementalPeriod will be applied
- again. That behaviour may be changed in the future.</para>
- </section>
-
- <section>
<title>Restore existing workspace or repository</title>
<para>The resore of existing workspace or repositry is available.</para>
14 years, 3 months
exo-jcr SVN: r5484 - jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-19 06:37:18 -0500 (Thu, 19 Jan 2012)
New Revision: 5484
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
Log:
EXOJCR-1724: Use lastNodeId parameter in RDBMS reindexing for DB2 database
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-01-19 11:28:20 UTC (rev 5483)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-01-19 11:37:18 UTC (rev 5484)
@@ -133,7 +133,7 @@
@Override
public boolean isIDNeededForPaging()
{
- return false;
+ return true;
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2012-01-19 11:28:20 UTC (rev 5483)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2012-01-19 11:37:18 UTC (rev 5484)
@@ -92,7 +92,7 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setString(1, lastNodeId);
+ findNodesAndProperties.setString(1, getInternalId(lastNodeId));
findNodesAndProperties.setInt(2, offset);
findNodesAndProperties.setInt(3, limit);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2012-01-19 11:28:20 UTC (rev 5483)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2012-01-19 11:37:18 UTC (rev 5484)
@@ -93,7 +93,7 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setString(2, lastNodeId);
+ findNodesAndProperties.setString(2, getInternalId(lastNodeId));
findNodesAndProperties.setInt(3, offset);
findNodesAndProperties.setInt(4, limit);
findNodesAndProperties.setString(5, containerName);
14 years, 3 months
exo-jcr SVN: r5483 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-19 06:28:20 -0500 (Thu, 19 Jan 2012)
New Revision: 5483
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
Log:
EXOJCR-1724: Use lastNodeId parameter in RDBMS reindexing for DB2 database
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-01-19 10:22:14 UTC (rev 5482)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2ConnectionFactory.java 2012-01-19 11:28:20 UTC (rev 5483)
@@ -133,7 +133,7 @@
@Override
public boolean isIDNeededForPaging()
{
- return false;
+ return true;
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2012-01-19 10:22:14 UTC (rev 5482)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2MultiDbJDBCConnection.java 2012-01-19 11:28:20 UTC (rev 5483)
@@ -92,7 +92,7 @@
findNodesAndProperties.clearParameters();
}
- findNodesAndProperties.setString(1, lastNodeId);
+ findNodesAndProperties.setString(1, getInternalId(lastNodeId));
findNodesAndProperties.setInt(2, offset);
findNodesAndProperties.setInt(3, limit);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2012-01-19 10:22:14 UTC (rev 5482)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/DB2SingleDbJDBCConnection.java 2012-01-19 11:28:20 UTC (rev 5483)
@@ -93,7 +93,7 @@
}
findNodesAndProperties.setString(1, containerName);
- findNodesAndProperties.setString(2, lastNodeId);
+ findNodesAndProperties.setString(2, getInternalId(lastNodeId));
findNodesAndProperties.setInt(3, offset);
findNodesAndProperties.setInt(4, limit);
findNodesAndProperties.setString(5, containerName);
14 years, 3 months
exo-jcr SVN: r5482 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype and 25 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-19 05:22:14 -0500 (Thu, 19 Jan 2012)
New Revision: 5482
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextFilter.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ExtendedNodeTypeManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeManagerImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/OrderQueryNode.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextsearchQueryNode.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionEventMatcher.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/EntityCollection.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/resources/binding.xml
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/MixinTest.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/AbstractImportTest.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSVNodeDataOptimization.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestExcerpt.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/export/ExportWorkspaceSystemViewTest.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegisterReferenced.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryMixinNodeTypes.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml
jcr/branches/1.15.x/exo.jcr.component.ftp/src/test/resources/conf/standalone/test-jcr-config.xml
jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavService.java
jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml
jcr/branches/1.15.x/exo.jcr.framework.command/src/test/resources/conf/standalone/test-jcr-framework-config.xml
Log:
EXOJCR-1723: Removed deprecated methods and classes
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/WorkspaceEntry.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -32,9 +32,6 @@
protected int lazyReadThreshold;
- @Deprecated
- protected String autoInitializedRootNt;
-
protected ContainerEntry container;
protected QueryHandlerEntry queryHandler;
@@ -49,20 +46,10 @@
protected WorkspaceInitializerEntry initializer;
- @Deprecated
- protected String autoInitPermissions;
-
public WorkspaceEntry()
{
}
- @Deprecated
- public WorkspaceEntry(String name, String rootNt)
- {
- this.name = name;
- this.autoInitializedRootNt = rootNt;
- }
-
public String getName()
{
return name;
@@ -74,25 +61,6 @@
}
/**
- * @return Returns the autoInitializedRootNt.
- */
- @Deprecated
- public String getAutoInitializedRootNt()
- {
- return autoInitializedRootNt;
- }
-
- /**
- * @param autoInitializedRootNt
- * The autoInitializedRootNt to set.
- */
- @Deprecated
- public void setAutoInitializedRootNt(String autoInitializedRootNt)
- {
- this.autoInitializedRootNt = autoInitializedRootNt;
- }
-
- /**
* @return Returns the container.
*/
public ContainerEntry getContainer()
@@ -153,18 +121,6 @@
this.accessManager = accessManager;
}
- @Deprecated
- public String getAutoInitPermissions()
- {
- return autoInitPermissions;
- }
-
- @Deprecated
- public void setAutoInitPermissions(String autoInitPermissions)
- {
- this.autoInitPermissions = autoInitPermissions;
- }
-
public LockManagerEntry getLockManager()
{
return lockManager;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ExtendedNodeTypeManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ExtendedNodeTypeManager.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/nodetype/ExtendedNodeTypeManager.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.core.nodetype;
import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeExistsException;
import java.io.InputStream;
import java.util.List;
@@ -64,16 +65,6 @@
* @param alreadyExistsBehaviour a int
* @throws RepositoryException
*/
- @Deprecated
- NodeTypeIterator registerNodeTypes(InputStream xml, int alreadyExistsBehaviour) throws RepositoryException;
-
- /**
- * Registers all node types using XML binding value objects from xml stream.
- *
- * @param xml a InputStream
- * @param alreadyExistsBehaviour a int
- * @throws RepositoryException
- */
NodeTypeIterator registerNodeTypes(InputStream xml, int alreadyExistsBehaviour, String contentType)
throws RepositoryException;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
@@ -337,7 +338,8 @@
{
log.debug("Trying register node types from xml-file " + nodeTypeFilesName);
}
- ntManager.registerNodeTypes(inXml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ ntManager.registerNodeTypes(inXml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
if (log.isDebugEnabled())
{
log.debug("Node types is registered from xml-file " + nodeTypeFilesName);
@@ -360,7 +362,8 @@
}
log.info("Trying register node types (" + repositoryName + ") from xml-file " + nodeTypeFilesName);
- ntManager.registerNodeTypes(inXml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ ntManager.registerNodeTypes(inXml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
log.info("Node types is registered (" + repositoryName + ") from xml-file " + nodeTypeFilesName);
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -633,7 +633,6 @@
public void save() throws ReferentialIntegrityException, AccessDeniedException, LockException,
ConstraintViolationException, InvalidItemStateException, ReferentialIntegrityException, RepositoryException
{
-
checkValid();
if (isNew())
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -255,12 +255,6 @@
{
}
- @Deprecated
- DataManager getDataManager()
- {
- return dataManager;
- }
-
void loadNamespaces(Map<String, String> namespacesMap, Map<String, String> urisMap) throws RepositoryException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -165,21 +165,6 @@
}
/**
- * Return
- *
- * @param nodeType
- * @return
- * @throws RepositoryException
- */
- @Deprecated
- public Set<String> getNodes(String uri) throws RepositoryException
- {
- validate();
-
- return indexSearcherHolder.getNodesByUri(uri);
- }
-
- /**
* {@inheritDoc}
*/
public String getPrefix(String uri) throws NamespaceException
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -103,33 +103,6 @@
rootNodeType = config.getInitializer().getParameterValue(WorkspaceInitializer.ROOT_NODETYPE_PARAMETER, null);
}
- if (config.getAutoInitializedRootNt() != null)
- {
- if (rootNodeType == null)
- {
- rootNodeType = config.getAutoInitializedRootNt();
- log.warn("[" + workspaceName + "] auto-init-root-nodetype (" + rootNodeType
- + ") parameter is DEPRECATED ! Use <initializer .../> instead.");
- }
- else
- {
- log.warn("[" + workspaceName + "] auto-init-root-nodetype parameter is DEPRECATED ! Skipped.");
- }
- }
- if (config.getAutoInitPermissions() != null)
- {
- if (rootPermissions == null)
- {
- rootPermissions = config.getAutoInitPermissions();
- log.warn("[" + workspaceName + "] auto-init-permissions (" + rootPermissions
- + ") parameter is DEPRECATED ! Use <initializer .../> instead.");
- }
- else
- {
- log.warn("[" + workspaceName + "] auto-init-permissions parameter is DEPRECATED ! Skipped.");
- }
- }
-
// default behaviour root-nodetype=nt:unstructured, root-permissions will be
// managed by
// AccessControlList class
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -1519,7 +1519,6 @@
public void commit(QPath path) throws RepositoryException, AccessDeniedException, ReferentialIntegrityException,
InvalidItemStateException, ItemExistsException
{
-
// validate all, throw an exception if validation failed
validate(path);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/AbstractSessionLockManager.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -116,22 +116,6 @@
/**
* {@inheritDoc}
*/
- public boolean isLockHolder(NodeData node) throws RepositoryException
- {
- //check is parent node also new
- if (transientManager.isNew(node.getIdentifier()) && transientManager.isNew(node.getParentIdentifier()))
- {
- return true;
- }
- else
- {
- return isPersistedLockHolder(node);
- }
- }
-
- /**
- * {@inheritDoc}
- */
public boolean isLocked(NodeData data) throws LockException
{
if (transientManager.isNew(data.getIdentifier()))
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManager.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/SessionLockManager.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -106,21 +106,6 @@
* Returns <code>true</code> if the specified session holds a lock on the given node; otherwise
* returns <code>false</code>. <p/> Note that <code>isLockHolder(session, node)==true</code>
* implies <code>holdsLock(node)==true</code>.
- *
- * @param session
- * session
- * @param node
- * node data
- * @return if the specified session holds a lock on the given node; otherwise returns
- * <code>false</code>
- * @deprecated
- */
- boolean isLockHolder(NodeData node) throws RepositoryException;
-
- /**
- * Returns <code>true</code> if the specified session holds a lock on the given node; otherwise
- * returns <code>false</code>. <p/> Note that <code>isLockHolder(session, node)==true</code>
- * implies <code>holdsLock(node)==true</code>.
*
* @param session
* session
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeManagerImpl.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/NodeTypeManagerImpl.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -280,27 +280,7 @@
/**
* {@inheritDoc}
- *
- * @return
- * @deprecated use registerNodeTypes(InputStream xml, int alreadyExistsBehaviour, String contentType)
*/
- @Deprecated
- public NodeTypeIterator registerNodeTypes(InputStream xml, int alreadyExistsBehaviour) throws RepositoryException
- {
-
- Collection<NodeTypeData> nts =
- typesManager.registerNodeTypes(xml, alreadyExistsBehaviour, NodeTypeDataManager.TEXT_XML);
- EntityCollection types = new EntityCollection();
- for (NodeTypeData ntdata : nts)
- {
- types.add(new NodeTypeImpl(ntdata, typesManager, this, locationFactory, valueFactory, dataManager));
- }
- return types;
- }
-
- /**
- * {@inheritDoc}
- */
public void unregisterNodeType(String name) throws UnsupportedRepositoryOperationException, NoSuchNodeTypeException,
RepositoryException
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/AbstractQueryHandler.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -209,22 +209,6 @@
}
/**
- * Sets the query handler idle time.
- * @deprecated
- * This parameter is not supported any more.
- * Please use 'maxIdleTime' in the repository configuration.
- *
- * @param idleTime the query handler idle time.
- */
- @Deprecated
- public void setIdleTime(String idleTime)
- {
- log.warn("Parameter 'idleTime' is not supported anymore. "
- + "Please use 'maxIdleTime' in the repository configuration.");
- this.idleTime = idleTime;
- }
-
- /**
* @return the query handler idle time.
*/
public String getIdleTime()
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/OrderQueryNode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/OrderQueryNode.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/OrderQueryNode.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -16,15 +16,15 @@
*/
package org.exoplatform.services.jcr.impl.core.query;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
+import org.exoplatform.services.jcr.datamodel.QPath;
+import org.exoplatform.services.jcr.datamodel.QPathEntry;
+
import java.util.ArrayList;
import java.util.List;
import javax.jcr.RepositoryException;
-import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.datamodel.QPathEntry;
-
/**
* Implements a query node that defines the order of nodes according to the
* values of properties.
@@ -186,17 +186,6 @@
}
/**
- * Returns the name of the property.
- *
- * @return the name of the property.
- * @deprecated use {@link #getPropertyPath()} instead.
- */
- public InternalQName getProperty()
- {
- return property.getName();
- }
-
- /**
* Returns the relative path of the property.
*
* @return the relative path of the property.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -139,33 +139,6 @@
}
/**
- * Returns the name of the property in this relation query node. Please
- * note that this method does not return the full relative path that
- * reference the property to match, but only the name of the final name
- * element of the path returned by {@link #getRelativePath()}.
- *
- * @return the name of the property in this relation query node.
- * @deprecated Use {@link #getRelativePath()} instead.
- */
- @Deprecated
- public InternalQName getProperty()
- {
- return relPath == null ? null : relPath.getName();
- }
-
- /**
- * Sets a new property name for this relation query node.
- *
- * @param name the new property name.
- * @deprecated Use {@link #setRelativePath(Path)} instead.
- */
- @Deprecated
- public void setProperty(InternalQName name)
- {
- this.relPath = new QPath(new QPathEntry[]{new QPathEntry(name, 0)});
- }
-
- /**
* @return the relative path that references the property in this relation.
*/
public QPath getRelativePath() {
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextFilter.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextFilter.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextFilter.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.exoplatform.services.jcr.impl.core.query;
-
-
-
-import java.util.Map;
-
-import javax.jcr.RepositoryException;
-
-import org.exoplatform.services.jcr.datamodel.PropertyData;
-
-/**
- * Defines an interface for extracting text out of binary properties according
- * to their mime-type.
- * </p>
- * {@link TextFilter} implementations are asked if they can handle a certain
- * mime type ({@link #canFilter(String)} and if one of them returns
- * <code>true</code> the text representation is created with
- * {@link #doFilter(PropertyState, String)}
- *
- * @deprecated use the {@link org.apache.jackrabbit.extractor.TextExtractor}
- * interface
- */
-public interface TextFilter {
-
- /**
- * Returns <code>true</code> if this <code>TextFilter</code> can index
- * content of <code>mimeType</code>; <code>false</code> otherwise.
- *
- * @param mimeType the mime type of the content to index.
- * @return whether this <code>TextFilter</code> can index content of
- * <code>mimeType</code>.
- */
- boolean canFilter(String mimeType);
-
- /**
- * Creates an text representation of a binary property <code>data</code>.
- * The returned map contains {@link java.io.Reader} values. Keys to the
- * reader values are <code>String</code>s that serve as field names.
- * <p/>
- * E.g. a TextFilter for a html document may extract multiple fields: one
- * for the title and one for the whole content.
- *
- * @param data the data property that contains the binary content.
- * @param encoding the encoding of the content or <code>null</code> if
- * <code>data</code> does not use encoding.
- * @return the extracted text.
- * @throws RepositoryException if an error occurs while reading from the
- * node or if the data is malformed.
- */
- Map doFilter(PropertyData data, String encoding)
- throws RepositoryException;
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextsearchQueryNode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextsearchQueryNode.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/TextsearchQueryNode.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -16,15 +16,14 @@
*/
package org.exoplatform.services.jcr.impl.core.query;
-import javax.jcr.RepositoryException;
-
-import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
+import javax.jcr.RepositoryException;
+
/**
* Implements a query node that defines a textsearch clause.
*/
@@ -91,31 +90,6 @@
}
/**
- * Returns a property name if the scope is limited to just a single property
- * or <code>null</code> if the scope is spawned across all properties of a
- * node. Please note that this method does not return the full relative path
- * that reference the item to match, but only the name of the final name
- * element of the path returned by {@link #getRelativePath()}.
- *
- * @return property name or <code>null</code>.
- * @deprecated Use {@link #getRelativePath()} instead.
- */
- public InternalQName getPropertyName() {
- return relPath == null ? null : relPath.getName();
- }
-
- /**
- * Sets a new name as the search scope for this fulltext query.
- *
- * @param property the name of the property.
- * @deprecated Use {@link #setRelativePath(Path)} instead.
- */
- public void setPropertyName(InternalQName property) {
- this.relPath = QPath.makeChildPath(relPath, property);
- this.propertyRef = true;
- }
-
- /**
* @return the relative path that references the item where the textsearch
* is performed. Returns <code>null</code> if the textsearch is
* performed on the context node.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -504,7 +504,7 @@
// never fulltext index jcr:uuid String
if (name.equals(Constants.JCR_UUID))
{
- addStringValue(doc, fieldName, val.getString(), false, false, DEFAULT_BOOST);
+ addStringValue(doc, fieldName, val.getString(), false, false, DEFAULT_BOOST, true);
}
else
{
@@ -696,21 +696,6 @@
doc.add(createFieldWithoutNorms(fieldName, pathString.toString(), PropertyType.PATH));
}
- /**
- * Adds the string value to the document both as the named field and for
- * full text indexing.
- *
- * @param doc The document to which to add the field
- * @param fieldName The name of the field to add
- * @param internalValue The value for the field to add to the document.
- * @deprecated Use {@link #addStringValue(Document, String, Object, boolean)
- * addStringValue(Document, String, Object, boolean)} instead.
- */
- @Deprecated
- protected void addStringValue(Document doc, String fieldName, Object internalValue)
- {
- addStringValue(doc, fieldName, internalValue, true, true, DEFAULT_BOOST);
- }
/**
* Adds the string value to the document both as the named field and
@@ -725,7 +710,7 @@
*/
protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized)
{
- addStringValue(doc, fieldName, internalValue, tokenized, true, DEFAULT_BOOST);
+ addStringValue(doc, fieldName, internalValue, tokenized, true, DEFAULT_BOOST, true);
}
/**
@@ -743,30 +728,6 @@
* tokenized and added to the node scope fulltext
* index.
* @param boost the boost value for this string field.
- * @deprecated use {@link #addStringValue(Document, String, Object, boolean, boolean, float, boolean)} instead.
- */
- @Deprecated
- protected void addStringValue(Document doc, String fieldName, Object internalValue, boolean tokenized,
- boolean includeInNodeIndex, float boost)
- {
- addStringValue(doc, fieldName, internalValue, tokenized, includeInNodeIndex, boost, true);
- }
-
- /**
- * Adds the string value to the document both as the named field and
- * optionally for full text indexing if <code>tokenized</code> is
- * <code>true</code>.
- *
- * @param doc The document to which to add the field
- * @param fieldName The name of the field to add
- * @param internalValue The value for the field to add to the
- * document.
- * @param tokenized If <code>true</code> the string is also
- * tokenized and fulltext indexed.
- * @param includeInNodeIndex If <code>true</code> the string is also
- * tokenized and added to the node scope fulltext
- * index.
- * @param boost the boost value for this string field.
* @param useInExcerpt If <code>true</code> the string may show up in
* an excerpt.
*/
@@ -826,19 +787,6 @@
* Creates a fulltext field for the string <code>value</code>.
*
* @param value the string value.
- * @return a lucene field.
- * @deprecated use {@link #createFulltextField(String, boolean, boolean)} instead.
- */
- @Deprecated
- protected Field createFulltextField(String value)
- {
- return createFulltextField(value, supportHighlighting, supportHighlighting);
- }
-
- /**
- * Creates a fulltext field for the string <code>value</code>.
- *
- * @param value the string value.
* @param store if the value of the field should be stored.
* @param withOffsets if a term vector with offsets should be stored.
* @return a lucene field.
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -35,10 +35,10 @@
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortComparatorSource;
import org.apache.lucene.search.SortField;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
@@ -139,16 +139,6 @@
public static final int DEFAULT_MAX_FIELD_LENGTH = 10000;
/**
- * The default value for property {@link #extractorPoolSize}.
- *
- * @deprecated this value is not used anymore. Instead the default value is
- * calculated as follows: 2 *
- * Runtime.getRuntime().availableProcessors().
- */
- @Deprecated
- public static final int DEFAULT_EXTRACTOR_POOL_SIZE = 0;
-
- /**
* The default value for property {@link #extractorBackLog}.
*/
public static final int DEFAULT_EXTRACTOR_BACK_LOG = Integer.MAX_VALUE;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -362,19 +362,6 @@
}
/**
- * Helper method to simplify operations that requires stringified data.
- *
- * @return String
- * @throws IOException
- * if read error
- */
- @Deprecated
- public String getString() throws IOException
- {
- return new String(getAsByteArray(), Constants.DEFAULT_ENCODING);
- }
-
- /**
* {@inheritDoc}
*/
@Override
@@ -460,64 +447,6 @@
}
/**
- * Spool ValueData InputStream to a temp File.
- */
- @Deprecated
- protected void spoolInputStreamAlways()
- {
-
- if (spooled || tmpStream == null) // already spooled
- return;
-
- byte[] tmpBuff = new byte[2048];
- OutputStream sfout = null;
- int read = 0;
-
- try
- {
- SpoolFile sf = SpoolFile.createTempFile("jcrvd", null, tempDirectory);
- sf.acquire(this);
- sfout = PrivilegedFileHelper.fileOutputStream(sf);
-
- while ((read = tmpStream.read(tmpBuff)) >= 0)
- sfout.write(tmpBuff, 0, read);
-
- this.spoolChannel = null;
- this.spoolFile = sf;
-
- this.data = null;
- this.spooled = true;
- }
- catch (IOException e)
- {
- throw new IllegalStateException(e);
- }
- finally
- {
- try
- {
- if (sfout != null)
- sfout.close();
- }
- catch (IOException e)
- {
- LOG.error("Error of spool output close.", e);
- }
-
- if (this.closeTmpStream)
- try
- {
- this.tmpStream.close();
- }
- catch (IOException e)
- {
- LOG.error("Error of source input close.", e);
- }
- this.tmpStream = null;
- }
- }
-
- /**
* Tell is this Value backed by bytes array before or after spooling.
*/
private boolean isByteArrayAfterSpool()
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionEventMatcher.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionEventMatcher.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/ext/action/SessionEventMatcher.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -49,12 +49,6 @@
*/
public static final String PATH_KEY = "paths";
- @Deprecated
- public static final String NODETYPE_KEY = "nodeType";
-
- @Deprecated
- public static final String PARENT_NODETYPES_KEY = "parentNodeTypes";
-
/**
* Key describe an InternalQName[] array of current node NodeType names.
*/
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/EntityCollection.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/EntityCollection.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/EntityCollection.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -20,7 +20,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -80,12 +79,6 @@
this.pos = 0;
}
- @Deprecated
- public void reverse()
- {
- Collections.reverse(list);
- }
-
/**
* @see NodeIterator#nextNode()
*/
@@ -237,20 +230,6 @@
iter = list.iterator();
}
- @Deprecated
- public void remove(Object obj)
- {
- pos = 0;
- list.remove(obj);
- iter = list.iterator();
- }
-
- @Deprecated
- public long size()
- {
- return getSize();
- }
-
/**
* For TESTs only.
*
@@ -260,5 +239,4 @@
{
return list;
}
-
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/resources/binding.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/resources/binding.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/resources/binding.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -32,8 +32,6 @@
<value name="lazy-read-threshold" field="lazyReadThreshold" style="attribute" usage="optional"
serializer="org.exoplatform.services.jcr.util.ConfigurationFormat.serializeInt"
deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseInt" />
- <value name="auto-init-root-nodetype" field="autoInitializedRootNt" style="attribute" usage="optional" />
- <value name="auto-init-permissions" field="autoInitPermissions" style="attribute" usage="optional" />
<structure name="container" field="container">
<value name="class" field="type" style="attribute" />
<collection name="properties" field="parameters" usage="optional"
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/MixinTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/MixinTest.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/core/query/MixinTest.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -18,16 +18,13 @@
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
-import org.exoplatform.services.jcr.impl.core.WorkspaceImpl;
-import javax.jcr.RepositoryException;
-import javax.jcr.Node;
-
-
-
import java.io.ByteArrayInputStream;
import java.util.Calendar;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
/**
* Tests if mixin types are queried correctly when using element test: element()
*/
@@ -43,7 +40,8 @@
+ "<supertypes>" + " <supertype>mix:referenceable</supertype>" + "</supertypes>" + "</nodeType>"
+ "</nodeTypes>";
- manager.registerNodeTypes(new ByteArrayInputStream(cnd.getBytes()), ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ manager.registerNodeTypes(new ByteArrayInputStream(cnd.getBytes()), ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
}
public void testBuiltInMixin() throws RepositoryException {
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/AbstractImportTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/AbstractImportTest.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/AbstractImportTest.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.JcrAPIBaseTest;
import org.exoplatform.services.jcr.core.ExtendedSession;
import org.exoplatform.services.jcr.core.ExtendedWorkspace;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
@@ -86,11 +87,14 @@
{
NodeTypeManagerImpl ntManager = (NodeTypeManagerImpl)session.getWorkspace().getNodeTypeManager();
InputStream is = TestDocumentViewImport.class.getResourceAsStream("/nodetypes/ext-registry-nodetypes.xml");
- ntManager.registerNodeTypes(is, 0);
+ ntManager.registerNodeTypes(is, 0, NodeTypeDataManager.TEXT_XML);
ntManager.registerNodeTypes(TestDocumentViewImport.class
- .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config.xml"), 0);
+ .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config.xml"), 0,
+ NodeTypeDataManager.TEXT_XML);
ntManager.registerNodeTypes(TestDocumentViewImport.class
- .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config-extended.xml"), 0);
+ .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config-extended.xml"), 0,
+ NodeTypeDataManager.TEXT_XML);
+
isInitialized = true;
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -26,7 +26,6 @@
import org.exoplatform.services.jcr.core.ExtendedNode;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
-import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.MembershipEntry;
import java.util.ArrayList;
@@ -134,11 +133,6 @@
AccessControlList expectedAcl = new AccessControlList();
try
{
- if (wsEntry.getAutoInitPermissions() != null)
- {
- expectedAcl.removePermissions(IdentityConstants.ANY);
- expectedAcl.addPermissions(wsEntry.getAutoInitPermissions());
- }
AccessControlList acl = ((ExtendedNode)session.getRootNode()).getACL();
assertTrue(expectedAcl.equals(acl));
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSVNodeDataOptimization.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSVNodeDataOptimization.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestSVNodeDataOptimization.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -16,6 +16,14 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.config.ContainerEntry;
+import org.exoplatform.services.jcr.config.QueryHandlerEntry;
+import org.exoplatform.services.jcr.config.SimpleParameterEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.config.WorkspaceInitializerEntry;
+import org.exoplatform.services.jcr.datamodel.NodeData;
+
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
@@ -25,14 +33,6 @@
import javax.jcr.Node;
import javax.jcr.NodeIterator;
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.config.ContainerEntry;
-import org.exoplatform.services.jcr.config.QueryHandlerEntry;
-import org.exoplatform.services.jcr.config.SimpleParameterEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-import org.exoplatform.services.jcr.config.WorkspaceInitializerEntry;
-import org.exoplatform.services.jcr.datamodel.NodeData;
-
/**
* Created by The eXo Platform SAS.
*
@@ -193,9 +193,8 @@
ws1back.setName(name);
ws1back.setUniqueName(((RepositoryImpl) ses.getRepository()).getName() + "_" + ws1back.getName());
+
ws1back.setAccessManager(ws1e.getAccessManager());
- ws1back.setAutoInitializedRootNt(ws1e.getAutoInitializedRootNt());
- ws1back.setAutoInitPermissions(ws1e.getAutoInitPermissions());
ws1back.setCache(ws1e.getCache());
ws1back.setContainer(ws1e.getContainer());
ws1back.setLockManager(ws1e.getLockManager());
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestExcerpt.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestExcerpt.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestExcerpt.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import java.io.InputStream;
@@ -79,11 +80,15 @@
{
ExtendedNodeTypeManager ntManager = (ExtendedNodeTypeManager)session.getWorkspace().getNodeTypeManager();
InputStream is = TestExcerpt.class.getResourceAsStream("/nodetypes/ext-registry-nodetypes.xml");
- ntManager.registerNodeTypes(is, ExtendedNodeTypeManager.REPLACE_IF_EXISTS);
+
+ ntManager.registerNodeTypes(is, ExtendedNodeTypeManager.REPLACE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
ntManager.registerNodeTypes(TestExcerpt.class
- .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config.xml"), 0);
+ .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config.xml"), 0,
+ NodeTypeDataManager.TEXT_XML);
ntManager.registerNodeTypes(TestExcerpt.class
- .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config-extended.xml"), 0);
+ .getResourceAsStream("/org/exoplatform/services/jcr/api/nodetypes/ecm/nodetypes-config-extended.xml"), 0,
+ NodeTypeDataManager.TEXT_XML);
+
isInitialized = true;
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/export/ExportWorkspaceSystemViewTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/export/ExportWorkspaceSystemViewTest.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/export/ExportWorkspaceSystemViewTest.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -100,8 +100,6 @@
ws1back.setUniqueName(((RepositoryImpl)session.getRepository()).getName() + "_" + ws1back.getName());
ws1back.setAccessManager(ws1e.getAccessManager());
- ws1back.setAutoInitializedRootNt(ws1e.getAutoInitializedRootNt());
- ws1back.setAutoInitPermissions(ws1e.getAutoInitPermissions());
ws1back.setCache(ws1e.getCache());
ws1back.setContainer(ws1e.getContainer());
ws1back.setLockManager(ws1e.getLockManager());
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegisterReferenced.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegisterReferenced.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/nodetypes/TestNodeTypeRegisterReferenced.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.usecases.nodetypes;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.impl.core.nodetype.NodeTypeManagerImpl;
import org.exoplatform.services.jcr.usecases.BaseUsecasesTest;
@@ -59,7 +60,7 @@
ByteArrayInputStream xmlInput = new ByteArrayInputStream(xmlData);
NodeTypeManagerImpl ntManager = (NodeTypeManagerImpl)session.getWorkspace().getNodeTypeManager();
- ntManager.registerNodeTypes(xmlInput, 0);
+ ntManager.registerNodeTypes(xmlInput, 0, NodeTypeDataManager.TEXT_XML);
String ntName = "exojcrtest:testNodeType__1";
assertNotNull(ntManager.getNodeType(ntName));
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryMixinNodeTypes.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryMixinNodeTypes.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/query/TestQueryMixinNodeTypes.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -18,6 +18,7 @@
package org.exoplatform.services.jcr.usecases.query;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.usecases.BaseUsecasesTest;
import java.io.ByteArrayInputStream;
@@ -98,32 +99,31 @@
private void registerNodetypes() throws Exception
{
-
registerNamespace("kfx", "http://www.exoplatform.com/jcr/kfx/1.1/");
registerNamespace("dc", "http://purl.org/dc/elements/1.1/");
InputStream xml =
this.getClass().getResourceAsStream("/org/exoplatform/services/jcr/usecases/query/ext-nodetypes-config.xml");
- repositoryService.getCurrentRepository().getNodeTypeManager().registerNodeTypes(xml,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getCurrentRepository().getNodeTypeManager()
+ .registerNodeTypes(xml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
InputStream xml1 =
this.getClass().getResourceAsStream("/org/exoplatform/services/jcr/usecases/query/nodetypes-config.xml");
- repositoryService.getCurrentRepository().getNodeTypeManager().registerNodeTypes(xml1,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getCurrentRepository().getNodeTypeManager()
+ .registerNodeTypes(xml1, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
InputStream xml2 =
this.getClass().getResourceAsStream(
"/org/exoplatform/services/jcr/usecases/query/nodetypes-config-extended.xml");
- repositoryService.getCurrentRepository().getNodeTypeManager().registerNodeTypes(xml2,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getCurrentRepository().getNodeTypeManager()
+ .registerNodeTypes(xml2, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
InputStream xml3 =
this.getClass().getResourceAsStream("/org/exoplatform/services/jcr/usecases/query/nodetypes-ecm.xml");
- repositoryService.getCurrentRepository().getNodeTypeManager().registerNodeTypes(xml3,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getCurrentRepository().getNodeTypeManager()
+ .registerNodeTypes(xml3, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
InputStream xml4 =
this.getClass().getResourceAsStream(
"/org/exoplatform/services/jcr/usecases/query/business-process-nodetypes.xml");
- repositoryService.getCurrentRepository().getNodeTypeManager().registerNodeTypes(xml4,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getCurrentRepository().getNodeTypeManager()
+ .registerNodeTypes(xml4, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
}
public void registerNamespace(String prefix, String uri)
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.ext.common.SessionProvider;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -370,8 +371,8 @@
try
{
- repositoryService.getRepository(repName).getNodeTypeManager().registerNodeTypes(xml,
- ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
+ repositoryService.getRepository(repName).getNodeTypeManager()
+ .registerNodeTypes(xml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS, NodeTypeDataManager.TEXT_XML);
}
finally
{
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/server/HTTPBackupAgentTest.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -2985,8 +2985,6 @@
ws1back.setUniqueName(repoNmae + "_" + wsName);
ws1back.setAccessManager(defWEntry.getAccessManager());
- ws1back.setAutoInitializedRootNt(defWEntry.getAutoInitializedRootNt());
- ws1back.setAutoInitPermissions(defWEntry.getAutoInitPermissions());
ws1back.setCache(defWEntry.getCache());
ws1back.setLockManager(defWEntry.getLockManager());
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/repository/RestRepositoryServiceTest.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -432,8 +432,6 @@
ws1back.setUniqueName(repoNmae + "_" + wsName);
ws1back.setAccessManager(defWEntry.getAccessManager());
- ws1back.setAutoInitializedRootNt(defWEntry.getAutoInitializedRootNt());
- ws1back.setAutoInitPermissions(defWEntry.getAutoInitPermissions());
ws1back.setCache(defWEntry.getCache());
ws1back.setLockManager(defWEntry.getLockManager());
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/resources/conf/standalone/test-jcr-ext-config.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -73,7 +73,7 @@
</properties>
</lock-manager>
</workspace>
-
+
<workspace name="ws1">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
@@ -111,8 +111,8 @@
</properties>
</lock-manager>
</workspace>
-
- <workspace name="ws2" auto-init-root-nodetype="nt:unstructured">
+
+ <workspace name="ws2">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr2" />
@@ -149,28 +149,28 @@
</properties>
</lock-manager>
</workspace>
-
- <workspace name="ws3" auto-init-root-nodetype="nt:unstructured">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="auto" />
- <property name="multi-db" value="true" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- </container>
- <cache enabled="true">
- <properties>
- <property name="max-size" value="5k" />
- <property name="live-time" value="1h" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/ws3" />
- </properties>
- </query-handler>
+
+ <workspace name="ws3">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="true" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ </container>
+ <cache enabled="true">
+ <properties>
+ <property name="max-size" value="5k" />
+ <property name="live-time" value="1h" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/ws3" />
+ </properties>
+ </query-handler>
<lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
<properties>
<property name="time-out" value="15m" />
@@ -186,9 +186,9 @@
<property name="jbosscache-shareable" value="true" />
</properties>
</lock-manager>
- </workspace>
-
- <workspace name="ws4" auto-init-root-nodetype="nt:unstructured">
+ </workspace>
+
+ <workspace name="ws4">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr4" />
@@ -225,8 +225,8 @@
</properties>
</lock-manager>
</workspace>
-
- <workspace name="ws5" auto-init-root-nodetype="nt:unstructured">
+
+ <workspace name="ws5">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr5" />
@@ -264,8 +264,8 @@
</lock-manager>
</workspace>
</workspaces>
- </repository>\
-
+ </repository>\
+
<repository name="db2" system-workspace="ws" default-workspace="ws">
<security-domain>exo-domain</security-domain>
<access-control>optional</access-control>
@@ -560,7 +560,7 @@
<properties>
<property name="index-dir" value="target/temp/index/db5_ws" />
</properties>
- </query-handler>
+ </query-handler>
<lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
<properties>
<property name="time-out" value="15m" />
@@ -577,7 +577,7 @@
</properties>
</lock-manager>
</workspace>
-
+
<workspace name="ws1">
<!-- for system storage -->
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
@@ -618,7 +618,7 @@
</workspace>
</workspaces>
</repository>
-
+
<repository name="db6" system-workspace="ws" default-workspace="ws">
<security-domain>exo-domain</security-domain>
<access-control>optional</access-control>
@@ -662,7 +662,7 @@
</properties>
</lock-manager>
</workspace>
-
+
<workspace name="ws1">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
@@ -700,7 +700,7 @@
</properties>
</lock-manager>
</workspace>
-
+
<workspace name="ws2">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
@@ -794,7 +794,7 @@
</properties>
</lock-manager>
</workspace>
-
+
<workspace name="ws1">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
@@ -843,6 +843,6 @@
</lock-manager>
</workspace>
</workspaces>
- </repository>
+ </repository>
</repositories>
</repository-service>
Modified: jcr/branches/1.15.x/exo.jcr.component.ftp/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ftp/src/test/resources/conf/standalone/test-jcr-config.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.ftp/src/test/resources/conf/standalone/test-jcr-config.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -25,7 +25,7 @@
<session-max-age>3600000</session-max-age><!-- 60min -->
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<!-- for system storage -->
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
@@ -63,8 +63,8 @@
</properties>
</lock-manager>
</workspace>
-
- <workspace name="ws2" auto-init-root-nodetype="nt:unstructured">
+
+ <workspace name="ws2">
<!-- for system storage -->
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavService.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavService.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavService.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -83,7 +83,7 @@
* @return the instance of javax.ws.rs.core.Response
*/
Response put(String repoName, String repoPath, String lockTokenHeader, String ifHeader, String fileNodeTypeHeader,
- String contentNodeTypeHeader, String mixinTypes, MediaType mediatype, InputStream inputStream);
+ String contentNodeTypeHeader, String mixinTypes, MediaType mediatype, InputStream inputStream, UriInfo uriInfo);
/**
* @param repoName repository name
@@ -119,7 +119,7 @@
* @return the instance of javax.ws.rs.core.Response
*/
Response mkcol(String repoName, String repoPath, String lockTokenHeader, String ifHeader, String nodeTypeHeader,
- String mixinTypesHeader);
+ String mixinTypesHeader, UriInfo uriInfo);
/**
* @param repoName repository name
Modified: jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/WebDavServiceImpl.java 2012-01-19 10:22:14 UTC (rev 5482)
@@ -859,16 +859,6 @@
/**
* {@inheritDoc}
*/
- @Deprecated
- public Response mkcol(String repoName, String repoPath, String lockTokenHeader, String ifHeader,
- String nodeTypeHeader, String mixinTypesHeader)
- {
- return mkcol(repoName, repoPath, lockTokenHeader, ifHeader, nodeTypeHeader, mixinTypesHeader, null);
- }
-
- /**
- * {@inheritDoc}
- */
@MKCOL
@Path("/{repoName}/{repoPath:.*}/")
public Response mkcol(@PathParam("repoName") String repoName, @PathParam("repoPath") String repoPath,
@@ -876,7 +866,6 @@
@HeaderParam(ExtHttpHeaders.CONTENT_NODETYPE) String nodeTypeHeader,
@HeaderParam(ExtHttpHeaders.CONTENT_MIXINTYPES) String mixinTypesHeader, @Context UriInfo uriInfo)
{
-
if (log.isDebugEnabled())
{
log.debug("MKCOL " + repoName + "/" + repoPath);
@@ -1151,18 +1140,6 @@
/**
* {@inheritDoc}
*/
- @Deprecated
- public Response put(String repoName, String repoPath, String lockTokenHeader, String ifHeader,
- String fileNodeTypeHeader, String contentNodeTypeHeader, String mixinTypes, MediaType mediatype,
- InputStream inputStream)
- {
- return put(repoName, repoPath, lockTokenHeader, ifHeader, fileNodeTypeHeader, contentNodeTypeHeader, mixinTypes,
- mediatype, inputStream, null);
- }
-
- /**
- * {@inheritDoc}
- */
@PUT
@Path("/{repoName}/{repoPath:.*}/")
public Response put(@PathParam("repoName") String repoName, @PathParam("repoPath") String repoPath,
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/exo-jcr-configuration.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -215,10 +215,6 @@
<para><emphasis role="bold">name</emphasis>: The name of a
workspace</para>
- <para><emphasis role="bold">auto-init-root-nodetype</emphasis>: DEPRECATED
- in JCR 1.9 (use initializer). The node type for root node
- initialization.</para>
-
<para><emphasis role="bold">container</emphasis>: Workspace data container
(physical storage) configuration.</para>
@@ -275,7 +271,7 @@
<entry>acl-bloomfilter-false-positive-probability</entry>
<entry>ACL Bloom-filter desired false positive probability. Range
- [0..1]. Default value 0.1d. (See the note below) </entry>
+ [0..1]. Default value 0.1d. (See the note below)</entry>
</row>
<row>
@@ -341,9 +337,7 @@
permissions and other users have only a 'read' permission.</para>
<para>Configurable initializer adds a capability to override workspace
- initial startup procedure (used for Clustering). Also it replaces
- workspace element parameters auto-init-root-nodetype and
- auto-init-permissions with root-nodetype and root-permissions.</para>
+ initial startup procedure (used for Clustering). </para>
</section>
<section>
Modified: jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -550,7 +550,7 @@
<parameter>ws1</parameter> - jdbcjcr1):</para>
<programlisting language="xml"><workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr"/>
@@ -588,7 +588,7 @@
</lock-manager>
</workspace>
- <workspace name="ws1" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws1">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr1"/>
@@ -722,7 +722,7 @@
<parameter>ws1</parameter> - jdbcjcr):</para>
<programlisting language="xml"><workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr"/>
@@ -759,7 +759,7 @@
</properties>
</lock-manager>
</workspace>
- <workspace name="ws1" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws1">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr"/>
@@ -826,7 +826,7 @@
use with JCR to prevent a database overload.</para>
</note>
- <programlisting language="xml"><workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <programlisting language="xml"><workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="dialect" value="hsqldb"/>
@@ -871,7 +871,7 @@
<classname>org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer</classname>:</para>
<programlisting language="xml"><workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
...
</workspace>
@@ -882,7 +882,7 @@
<classname>org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer</classname>:</para>
<programlisting language="xml"><workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
...
</workspace>
@@ -910,7 +910,7 @@
<para>To enable this option put next configuration property:</para>
- <programlisting language="xml"><workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <programlisting language="xml"><workspace name="ws">
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
<properties>
<property name="dialect" value="oracle"/>
Modified: jcr/branches/1.15.x/exo.jcr.framework.command/src/test/resources/conf/standalone/test-jcr-framework-config.xml
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.command/src/test/resources/conf/standalone/test-jcr-framework-config.xml 2012-01-18 15:39:22 UTC (rev 5481)
+++ jcr/branches/1.15.x/exo.jcr.framework.command/src/test/resources/conf/standalone/test-jcr-framework-config.xml 2012-01-19 10:22:14 UTC (rev 5482)
@@ -25,7 +25,7 @@
<access-control>disable</access-control>
<authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
<workspaces>
- <workspace name="ws" auto-init-root-nodetype="nt:unstructured">
+ <workspace name="ws">
<!-- for system storage -->
<container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
14 years, 3 months
exo-jcr SVN: r5481 - jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup.
by do-not-reply@jboss.org
Author: tolusha
Date: 2012-01-18 10:39:22 -0500 (Wed, 18 Jan 2012)
New Revision: 5481
Modified:
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
Log:
EXOJCR-1723: fix Test
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2012-01-18 13:30:06 UTC (rev 5480)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/backup/AbstractBackupTestCase.java 2012-01-18 15:39:22 UTC (rev 5481)
@@ -385,7 +385,7 @@
if (backLog.exists())
{
BackupChainLog bchLog = new BackupChainLog(backLog);
- backup.restore(bchLog, re.getName(), ws1back);
+ backup.restore(bchLog, re.getName(), ws1back, false);
// check
SessionImpl back1 = null;
14 years, 3 months
exo-jcr SVN: r5480 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel and 7 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-18 08:30:06 -0500 (Wed, 18 Jan 2012)
New Revision: 5480
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/name/TestPath.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/CliAppContext.java
jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/DisplayJCRContentServlet.java
Log:
EXOJCR-1723: Removed deprecated methods and classes
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/ManageableRepository.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -76,7 +76,6 @@
*
* @param workspaceName - name of workspace
* @param listener Item persistence listener
- * @deprecated
*/
void addItemPersistenceListener(String workspaceName, ItemsPersistenceListener listener);
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -400,33 +400,6 @@
}
/**
- * Makes child path from existed path and child name. Assumed that parent path belongs to node so
- * it should have some index. If not sets index=1 automatically.
- *
- * @param parent
- * path
- * @param name
- * child name
- * @return new InternalQPath
- */
- @Deprecated
- public static QPath makeChildPath(QPath parent, String name) throws IllegalPathException
- {
-
- QPathEntry[] parentEntries = parent.getEntries();
- QPathEntry[] names = new QPathEntry[parentEntries.length + 1];
- int index = 0;
- for (QPathEntry pname : parentEntries)
- {
- names[index++] = pname;
- }
-
- names[index] = parseEntry(name);
- QPath path = new QPath(names);
- return path;
- }
-
- /**
* Make child path using JCR internal QName and index 1. <br/>
*
* @param parent
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -55,13 +55,11 @@
/**
* Suffix for content file.
*/
- @Deprecated
public static final String CONTENT_FILE_SUFFIX = ".dump";
/**
* Suffix for content length file.
*/
- @Deprecated
public static final String CONTENT_LEN_FILE_SUFFIX = ".len";
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/RelationQueryNode.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -16,17 +16,17 @@
*/
package org.exoplatform.services.jcr.impl.core.query;
-import java.util.Date;
-
-import javax.jcr.RepositoryException;
-
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import java.util.Date;
+import javax.jcr.RepositoryException;
+
+
/**
* Implements a query node that defines property value relation.
*/
@@ -152,6 +152,7 @@
{
return relPath == null ? null : relPath.getName();
}
+
/**
* Sets a new property name for this relation query node.
*
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/name/TestPath.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/name/TestPath.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/name/TestPath.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -90,11 +90,10 @@
public void testMakeQPath() throws Exception
{
QPath root = QPath.parse(Constants.ROOT_URI);
- QPath path = QPath.makeChildPath(root, "[http://www.exoplatform.com/jcr/exo/1.0]test");
+ QPath path = QPath.makeChildPath(root, InternalQName.parse("[http://www.exoplatform.com/jcr/exo/1.0]test"));
assertEquals(1, path.getIndex());
assertEquals("test", path.getName().getName());
assertTrue(path.isDescendantOf(root, true));
assertEquals(root, path.makeParentPath());
}
-
}
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/BackupManager.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -181,29 +181,6 @@
* String, repository name
* @param workspaceEntry
* WorkspaceEntry, the workspace entry
- * @throws BackupOperationException
- * will be generate the exception BackupOperationException
- * @throws BackupConfigurationException
- * will be generate the exception BackupConfigurationException
- * @throws RepositoryException
- * will be generate the exception RepositoryException
- * @throws RepositoryConfigurationException
- * will be generate the exception RepositoryConfigurationException
- */
- @Deprecated
- void restore(BackupChainLog log, String repositoryName, WorkspaceEntry workspaceEntry)
- throws BackupOperationException, BackupConfigurationException, RepositoryException,
- RepositoryConfigurationException;
-
- /**
- * Restore from backup.
- *
- * @param log
- * BackupChainLog, the backup log
- * @param repositoryName
- * String, repository name
- * @param workspaceEntry
- * WorkspaceEntry, the workspace entry
* @param asynchronous
* boolean, in 'true' then asynchronous restore.
* @throws BackupOperationException
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/BackupManagerImpl.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -19,10 +19,10 @@
package org.exoplatform.services.jcr.ext.backup.impl;
import org.apache.commons.collections.map.HashedMap;
+import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.commons.utils.SecurityHelper;
-import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
@@ -643,68 +643,6 @@
return false;
}
- /**
- * {@inheritDoc}
- */
- @Deprecated
- public void restore(BackupChainLog log, String repositoryName, WorkspaceEntry workspaceEntry)
- throws BackupOperationException, RepositoryException, RepositoryConfigurationException,
- BackupConfigurationException
- {
- List<JobEntryInfo> list = log.getJobEntryInfos();
- BackupConfig config = log.getBackupConfig();
-
- String reposytoryName = (repositoryName == null ? config.getRepository() : repositoryName);
- String workspaceName = workspaceEntry.getName();
-
- // ws should be registered not created
- if (!workspaceAlreadyExist(reposytoryName, workspaceName))
- {
-
- for (int i = 0; i < list.size(); i++)
- {
- if (i == 0)
- {
- try
- {
- fullRestore(list.get(i).getURL().getPath(), reposytoryName, workspaceName, workspaceEntry);
- }
- catch (FileNotFoundException e)
- {
- throw new BackupOperationException("Restore of full backup file error " + e, e);
- }
- catch (IOException e)
- {
- throw new BackupOperationException("Restore of full backup file I/O error " + e, e);
- }
- }
- else
- {
- try
- {
- incrementalRestore(list.get(i).getURL().getPath(), reposytoryName, workspaceName);
- }
- catch (FileNotFoundException e)
- {
- throw new BackupOperationException("Restore of incremental backup file error " + e, e);
- }
- catch (IOException e)
- {
- throw new BackupOperationException("Restore of incremental backup file I/O error " + e, e);
- }
- catch (ClassNotFoundException e)
- {
- throw new BackupOperationException("Restore of incremental backup error " + e, e);
- }
- }
- }
- }
- else
- {
- throw new BackupConfigurationException("Workspace should exists " + workspaceName);
- }
- }
-
protected void restoreOverInitializer(BackupChainLog log, String repositoryName, WorkspaceEntry workspaceEntry)
throws BackupOperationException, RepositoryException, RepositoryConfigurationException,
BackupConfigurationException
Modified: jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/CliAppContext.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/CliAppContext.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/cli/CliAppContext.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -23,7 +23,6 @@
import java.util.List;
-import javax.jcr.Credentials;
import javax.jcr.Item;
import javax.naming.NamingException;
@@ -49,13 +48,6 @@
this.parametersKey = parametersKey;
}
- @Deprecated
- public CliAppContext(ManageableRepository rep, String parametersKey, Credentials cred) throws NamingException
- {
- super(rep);
- this.parametersKey = parametersKey;
- }
-
public String getUserName()
{
try
Modified: jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/DisplayJCRContentServlet.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/DisplayJCRContentServlet.java 2012-01-18 12:16:35 UTC (rev 5479)
+++ jcr/branches/1.15.x/exo.jcr.framework.web/src/main/java/org/exoplatform/frameworks/jcr/web/DisplayJCRContentServlet.java 2012-01-18 13:30:06 UTC (rev 5480)
@@ -43,7 +43,6 @@
* @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady Azarenkov</a>
* @version $Id: DisplayJCRContentServlet.java 14756 2008-05-26 14:47:15Z pnedonosko $
*/
-@Deprecated
public class DisplayJCRContentServlet extends HttpServlet
{
14 years, 3 months
exo-jcr SVN: r5479 - in jcr/branches/1.12.x: exo.jcr.docs/exo.jcr.docs.developer/en and 1 other directory.
by do-not-reply@jboss.org
Author: trang_vu
Date: 2012-01-18 07:16:35 -0500 (Wed, 18 Jan 2012)
New Revision: 5479
Modified:
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
jcr/branches/1.12.x/pom.xml
Log:
JCR-1705:Update doc-style version to build with maven 3
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2012-01-18 09:04:15 UTC (rev 5478)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/pom.xml 2012-01-18 12:16:35 UTC (rev 5479)
@@ -91,12 +91,12 @@
<formats>
<format>
<formatName>html</formatName>
- <stylesheetResource>classpath:/xslt/org/exojcr/xhtml.xsl</stylesheetResource>
+ <stylesheetResource>classpath:xslt/org/exojcr/xhtml.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>html_single</formatName>
- <stylesheetResource>classpath:/xslt/org/exojcr/xhtml-single.xsl</stylesheetResource>
+ <stylesheetResource>classpath:xslt/org/exojcr/xhtml-single.xsl</stylesheetResource>
<finalName>index.html</finalName>
</format>
<!--format>
Modified: jcr/branches/1.12.x/pom.xml
===================================================================
--- jcr/branches/1.12.x/pom.xml 2012-01-18 09:04:15 UTC (rev 5478)
+++ jcr/branches/1.12.x/pom.xml 2012-01-18 12:16:35 UTC (rev 5479)
@@ -45,7 +45,7 @@
<org.exoplatform.kernel.version>2.2.12-GA-SNAPSHOT</org.exoplatform.kernel.version>
<org.exoplatform.core.version>2.3.12-GA-SNAPSHOT</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.1.12-GA-SNAPSHOT</org.exoplatform.ws.version>
- <org.exoplatform.doc-style.version>1</org.exoplatform.doc-style.version>
+ <org.exoplatform.doc-style.version>2</org.exoplatform.doc-style.version>
<version.assembly.plugin>2.2.1</version.assembly.plugin>
</properties>
14 years, 3 months
exo-jcr SVN: r5478 - in jcr/branches/1.15.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access and 13 other directories.
by do-not-reply@jboss.org
Author: andrew.plotnikov
Date: 2012-01-18 04:04:15 -0500 (Wed, 18 Jan 2012)
New Revision: 5478
Removed:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/SystemIdentity.java
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/access/JAASAuthenticator.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/PermissionValue.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImport.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestProperty.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessChildNodes.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessUpdateMixin.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/TestExternalizabeItemData.java
jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
Log:
EXOJCR-1722: Remove deprecated SystemIdentity class
Modified: jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/developer-notes.txt 2012-01-18 09:04:15 UTC (rev 5478)
@@ -6,4 +6,5 @@
* If lock manager is not configured we will have RepositoryConfigurationException at startup
* Index JCR_XITEM_PARENT_NAME removed (JCR_IDX_MITEM_PN - for DB2)
* Index JCR_IDX_XITEM_PARENT_N_ORDER_NUM from MySQL scripts.
-* We will have RepositoryException when use Session or Node after session.logout
\ No newline at end of file
+* We will have RepositoryException when use Session or Node after session.logout
+* Removed SystemIdentity class
\ No newline at end of file
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessControlList.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -20,6 +20,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import java.io.Externalizable;
import java.io.IOException;
@@ -54,7 +55,7 @@
public AccessControlList()
{
- this(SystemIdentity.SYSTEM);
+ this(IdentityConstants.SYSTEM);
}
/**
@@ -69,7 +70,7 @@
this.accessList = new ArrayList<AccessControlEntry>();
for (String str : PermissionType.ALL)
{
- accessList.add(new AccessControlEntry(SystemIdentity.ANY, str));
+ accessList.add(new AccessControlEntry(IdentityConstants.ANY, str));
}
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/AccessManager.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -25,6 +25,7 @@
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
import java.util.ArrayList;
import java.util.HashMap;
@@ -106,7 +107,7 @@
String userId = user.getUserId();
- if (userId.equals(SystemIdentity.SYSTEM))
+ if (userId.equals(IdentityConstants.SYSTEM))
{
// SYSTEM has permission everywhere
return true;
@@ -116,9 +117,9 @@
// Current user is owner of node so has all privileges
return true;
}
- else if (userId.equals(SystemIdentity.ANONIM))
+ else if (userId.equals(IdentityConstants.ANONIM))
{
- List<String> anyPermissions = acl.getPermissions(SystemIdentity.ANY);
+ List<String> anyPermissions = acl.getPermissions(IdentityConstants.ANY);
if (anyPermissions.size() < permission.length)
return false;
@@ -182,7 +183,7 @@
if (ace.getPermission().equals(testPermission))
{
// match any
- if (ace.getIdentity().equals(SystemIdentity.ANY))
+ if (ace.getIdentity().equals(IdentityConstants.ANY))
return true;
else if (ace.getIdentity().indexOf(":") == -1)
{
Deleted: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/SystemIdentity.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/SystemIdentity.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/access/SystemIdentity.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.access;
-
-import org.exoplatform.services.security.IdentityConstants;
-
-/**
- * Created by The eXo Platform SAS.
- * Please use {@link IdentityConstants} instead.
- *
- * @author <a href="mailto:gennady.azarenkov@exoplatform.com">Gennady Azarenkov</a>
- * @version $Id: SystemIdentity.java 11907 2008-03-13 15:36:21Z ksm $
- */
-
-@Deprecated
-public class SystemIdentity extends IdentityConstants
-{
-
-}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedNode;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
@@ -65,6 +64,7 @@
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import java.io.IOException;
import java.io.InputStream;
@@ -581,7 +581,7 @@
List<AccessControlEntry> aces = new ArrayList<AccessControlEntry>();
for (String perm : PermissionType.ALL)
{
- AccessControlEntry ace = new AccessControlEntry(SystemIdentity.ANY, perm);
+ AccessControlEntry ace = new AccessControlEntry(IdentityConstants.ANY, perm);
aces.add(ace);
}
AccessControlList acl = new AccessControlList(getACL().getOwner(), aces);
@@ -2591,7 +2591,7 @@
// SystemIdentity.SYSTEM));
return (session.getLockManager().checkLocking(this.nodeData()) || session.getUserID().equals(
- SystemIdentity.SYSTEM));
+ IdentityConstants.SYSTEM));
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -21,7 +21,6 @@
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.access.AuthenticationPolicy;
import org.exoplatform.services.jcr.access.DynamicIdentity;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -46,6 +45,7 @@
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.MembershipEntry;
import org.picocontainer.ComponentAdapter;
@@ -88,7 +88,7 @@
/**
* SYSTEM credentials.
*/
- private static final CredentialsImpl SYSTEM_CREDENTIALS = new CredentialsImpl(SystemIdentity.SYSTEM,
+ private static final CredentialsImpl SYSTEM_CREDENTIALS = new CredentialsImpl(IdentityConstants.SYSTEM,
"".toCharArray());
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -22,7 +22,6 @@
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessControlPolicy;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -44,6 +43,7 @@
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import java.util.ArrayList;
import java.util.List;
@@ -198,7 +198,7 @@
if (rootPermissions != null)
{
- acl.removePermissions(SystemIdentity.ANY);
+ acl.removePermissions(IdentityConstants.ANY);
acl.addPermissions(rootPermissions);
}
@@ -327,15 +327,15 @@
// init version storage
AccessControlList acl = new AccessControlList();
- acl.removePermissions(SystemIdentity.ANY);
- acl.addPermissions(SystemIdentity.ANY, new String[]{PermissionType.READ});
+ acl.removePermissions(IdentityConstants.ANY);
+ acl.addPermissions(IdentityConstants.ANY, new String[]{PermissionType.READ});
for (AccessControlEntry entry : jcrSystem.getACL().getPermissionEntries())
{
String identity = entry.getIdentity();
String permission = entry.getPermission();
- if (!identity.equals(SystemIdentity.ANY) || !permission.equals(PermissionType.READ))
+ if (!identity.equals(IdentityConstants.ANY) || !permission.equals(PermissionType.READ))
{
acl.addPermissions(identity, new String[]{permission});
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/access/JAASAuthenticator.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/access/JAASAuthenticator.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/access/JAASAuthenticator.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,11 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.core.access;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.IdentityRegistry;
import org.exoplatform.services.security.MembershipEntry;
import org.exoplatform.services.security.jaas.BasicCallbackHandler;
@@ -76,9 +76,9 @@
"Credentials for the authentication should be CredentialsImpl or SimpleCredentials type");
// SYSTEM
- if (thisCredentials.getUserID().equals(SystemIdentity.SYSTEM))
+ if (thisCredentials.getUserID().equals(IdentityConstants.SYSTEM))
{
- Identity sid = new Identity(SystemIdentity.SYSTEM, new HashSet<MembershipEntry>());
+ Identity sid = new Identity(IdentityConstants.SYSTEM, new HashSet<MembershipEntry>());
return new ConversationState(sid);
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/QueryResultImpl.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,12 +18,12 @@
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.core.SessionDataManager;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.security.IdentityConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -188,7 +188,7 @@
this.docOrder = orderProps.length == 0 && documentOrder;
this.offset = offset;
this.limit = limit;
- this.isSystemSession = SystemIdentity.SYSTEM.equals(session.getUserID());
+ this.isSystemSession = IdentityConstants.SYSTEM.equals(session.getUserID());
}
/**
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/PermissionValue.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/PermissionValue.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/PermissionValue.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -20,10 +20,10 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
+import org.exoplatform.services.security.IdentityConstants;
import java.io.IOException;
import java.util.StringTokenizer;
@@ -96,7 +96,7 @@
}
else
{
- persArray[0] = SystemIdentity.ANY;
+ persArray[0] = IdentityConstants.ANY;
}
if (permissionString != null)
{
@@ -121,7 +121,7 @@
static protected String asString(String identity, String permission)
{
if (identity != null || permission != null) // SystemIdentity.ANY, PermissionType.ALL
- return (identity != null ? identity : SystemIdentity.ANY) + AccessControlEntry.DELIMITER
+ return (identity != null ? identity : IdentityConstants.ANY) + AccessControlEntry.DELIMITER
+ (permission != null ? permission : PermissionType.READ);
else
return "";
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/ItemDataRestoreVisitor.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -20,7 +20,6 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
@@ -47,6 +46,7 @@
import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import java.io.IOException;
import java.util.ArrayList;
@@ -490,7 +490,7 @@
ItemType.PROPERTY);
AccessControlList acl = new AccessControlList();
- acl.removePermissions(SystemIdentity.ANY);
+ acl.removePermissions(IdentityConstants.ANY);
for (ValueData value : aclData.getValues())
{
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -507,14 +507,11 @@
ImportPropertyData propertyData = null;
if (Constants.JCR_PRIMARYTYPE.equals(propertyInfo.getName()))
{
-
propertyData = endPrimaryType();
-
}
else if (Constants.JCR_MIXINTYPES.equals(propertyInfo.getName()))
{
propertyData = endMixinTypes();
-
}
else if (Constants.JCR_UUID.equals(propertyInfo.getName()))
{
@@ -527,14 +524,12 @@
|| Constants.JCR_BASEVERSION.equals(propertyInfo.getName()) || Constants.JCR_PREDECESSORS
.equals(propertyInfo.getName())))
{
-
propertyData = null;
endVersionable((ImportNodeData)getParent(), parseValues());
}
else
{
-
ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
List<ValueData> values = parseValues();
@@ -553,8 +548,9 @@
return null;
}
else
+ {
throw new RepositoryException("Property definition not found for " + propertyInfo.getName());
-
+ }
}
if (values.size() == 1)
@@ -580,7 +576,6 @@
new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()),
propertyInfo.getIndentifer(), -1, propertyInfo.getType(), currentNodeInfo.getIdentifier(), isMultivalue);
propertyData.setValues(values);
-
}
return propertyData;
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImport.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImport.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImport.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,6 +18,20 @@
*/
package org.exoplatform.services.jcr.api.importing;
+import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.access.AccessControlEntry;
+import org.exoplatform.services.jcr.access.AccessManager;
+import org.exoplatform.services.jcr.access.PermissionType;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.core.ExtendedNode;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.util.VersionHistoryImporter;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
+
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -44,22 +58,7 @@
import javax.jcr.query.QueryResult;
import javax.jcr.util.TraversingItemVisitor;
import javax.jcr.version.Version;
-import javax.jcr.version.VersionIterator;
-import org.exoplatform.services.jcr.BaseStandaloneTest;
-import org.exoplatform.services.jcr.access.AccessControlEntry;
-import org.exoplatform.services.jcr.access.AccessManager;
-import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
-import org.exoplatform.services.jcr.core.CredentialsImpl;
-import org.exoplatform.services.jcr.core.ExtendedNode;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
-import org.exoplatform.services.jcr.impl.core.SessionImpl;
-import org.exoplatform.services.jcr.util.VersionHistoryImporter;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.security.Identity;
-
/**
* Created by The eXo Platform SAS.
*
@@ -105,7 +104,7 @@
testRoot.setPermission(testRoot.getSession().getUserID(), PermissionType.ALL);
testRoot.setPermission("exo", new String[]{PermissionType.SET_PROPERTY});
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
session.save();
assertTrue(accessManager.hasPermission(testRoot.getACL(), PermissionType.SET_PROPERTY, new Identity("exo")));
assertFalse(accessManager.hasPermission(testRoot.getACL(), PermissionType.READ, new Identity("exo")));
@@ -150,7 +149,7 @@
testRoot.setPermission(testRoot.getSession().getUserID(), PermissionType.ALL);
testRoot.setPermission("exo", new String[]{PermissionType.SET_PROPERTY});
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
session.save();
assertTrue(accessManager.hasPermission(testRoot.getACL(), PermissionType.SET_PROPERTY, new Identity("exo")));
assertFalse(accessManager.hasPermission(testRoot.getACL(), PermissionType.READ, new Identity("exo")));
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestProperty.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestProperty.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/reading/TestProperty.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -21,6 +21,7 @@
import org.exoplatform.services.jcr.JcrAPIBaseTest;
import org.exoplatform.services.jcr.impl.core.PropertyImpl;
import org.exoplatform.services.jcr.impl.core.value.BinaryValue;
+import org.exoplatform.services.jcr.impl.xml.importing.dataflow.PropertyInfo;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -353,4 +354,11 @@
assertFalse(testProperty.equals(new Object()));
}
+
+ public void testPropertyInfoGetValuesSize()
+ {
+ PropertyInfo propertInfo = new PropertyInfo();
+
+ assertEquals(0, propertInfo.getValuesSize());
+ }
}
\ No newline at end of file
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccess.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -23,12 +23,12 @@
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.core.ExtendedNode;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.security.Identity;
+import org.exoplatform.services.security.IdentityConstants;
import java.io.InputStream;
import java.security.AccessControlException;
@@ -39,6 +39,7 @@
import javax.jcr.AccessDeniedException;
import javax.jcr.ImportUUIDBehavior;
import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
@@ -94,7 +95,7 @@
public void testNoAccessControllable() throws Exception
{
AccessControlList acl = ((ExtendedNode)root).getACL();
- assertEquals(SystemIdentity.SYSTEM, acl.getOwner());
+ assertEquals(IdentityConstants.SYSTEM, acl.getOwner());
assertEquals(PermissionType.ALL.length, acl.getPermissionEntries().size());
assertEquals(PermissionType.ALL[0], acl.getPermissionEntries().get(0).getPermission());
}
@@ -106,14 +107,12 @@
*/
public void testOwneable() throws Exception
{
-
ExtendedNode node = (ExtendedNode)session.getRootNode().addNode("testACNode");
node.addMixin("exo:owneable");
AccessControlList acl = node.getACL();
assertEquals(session.getUserID(), acl.getOwner());
assertEquals(PermissionType.ALL.length, acl.getPermissionEntries().size());
assertEquals(PermissionType.ALL[0], acl.getPermissionEntries().get(0).getPermission());
-
}
/**
@@ -123,11 +122,10 @@
*/
public void testPrivilegeable() throws Exception
{
-
ExtendedNode node = (ExtendedNode)session.getRootNode().addNode("testACNode");
node.addMixin("exo:privilegeable");
AccessControlList acl = node.getACL();
- assertEquals(SystemIdentity.SYSTEM, acl.getOwner());
+ assertEquals(IdentityConstants.SYSTEM, acl.getOwner());
assertEquals(PermissionType.ALL.length, acl.getPermissionEntries().size());
assertEquals(PermissionType.ALL[0], acl.getPermissionEntries().get(0).getPermission());
}
@@ -140,7 +138,6 @@
*/
public void testDefaultAccessControllable() throws Exception
{
-
ExtendedNode node = (ExtendedNode)session.getRootNode().addNode("testACNode");
// node.addMixin("exo:accessControllable");
node.addMixin("exo:owneable");
@@ -164,7 +161,6 @@
assertEquals(PermissionType.ALL.length, acl.getPermissionEntries().size());
assertEquals(PermissionType.ALL[0], acl.getPermissionEntries().get(0).getPermission());
-
}
/**
@@ -231,7 +227,6 @@
assertEquals("john", entries.get(0).getIdentity());
assertEquals(PermissionType.ADD_NODE, entries.get(0).getPermission());
assertEquals(PermissionType.READ, entries.get(1).getPermission());
-
}
/**
@@ -307,7 +302,6 @@
catch (AccessControlException e)
{
}
-
}
/**
@@ -366,7 +360,6 @@
catch (AccessDeniedException e)
{
}
-
}
public void testAddNode() throws Exception
@@ -427,7 +420,6 @@
{
session1.refresh(false);
}
-
}
public void testModifyAndReadItem() throws Exception
@@ -570,7 +562,6 @@
assertEquals(credentials.getUserID(), acl.getOwner());
assertEquals(PermissionType.ALL.length, acl.getPermissionEntries().size());
assertEquals(PermissionType.ALL[0], acl.getPermissionEntries().get(0).getPermission());
-
}
public void testPrivilegeableAddNode() throws Exception
@@ -595,7 +586,6 @@
{
fail("PathNotFoundException or AccessDenied should not have been thrown ");
}
-
}
public void testAddSaveAndRead() throws Exception
@@ -610,7 +600,6 @@
NodeImpl node1 = (NodeImpl)session1.getRootNode().getNode("accessTestRoot/testSetAndRemovePermission");
assertEquals(8, node1.getACL().getPermissionEntries().size());
assertEquals(node1.getACL().getOwner(), owner);
-
}
public void testSetAndRemovePermission() throws Exception
@@ -630,7 +619,6 @@
node.removePermission("john");
assertEquals(PermissionType.ALL.length + 1, node.getACL().getPermissionEntries().size());
-
}
/**
@@ -683,7 +671,7 @@
Session session1 = repository.login(new CredentialsImpl("mary", "exo".toCharArray()));
ExtendedNode testRemoveSpecifiedNode =
(ExtendedNode)session1.getRootNode().getNode("accessTestRoot").getNode("testRemoveSpecified");
- testRemoveSpecifiedNode.removePermission(SystemIdentity.ANY);
+ testRemoveSpecifiedNode.removePermission(IdentityConstants.ANY);
assertTrue(accessManager.hasPermission(testRemoveSpecifiedNode.getACL(), PermissionType.READ,
new Identity("john")));
@@ -708,7 +696,6 @@
public void testOperationsByOwner() throws Exception
{
-
Session session1 = repository.login(new CredentialsImpl("john", "exo".toCharArray()));
Node accessTestRoot1 = session1.getRootNode().getNode("accessTestRoot");
@@ -725,13 +712,13 @@
accessTestRoot.setPermission(accessTestRoot.getSession().getUserID(), PermissionType.ALL);
accessTestRoot.removePermission("john");
- accessTestRoot.removePermission(SystemIdentity.ANY);
+ accessTestRoot.removePermission(IdentityConstants.ANY);
accessTestRoot.setPermission("john", new String[]{PermissionType.READ});
ExtendedNode testByOwnerNodeSystem = (ExtendedNode)accessTestRoot.getNode("testByOwnerNode");
testByOwnerNodeSystem.setPermission(accessTestRoot.getSession().getUserID(), PermissionType.ALL);
testByOwnerNodeSystem.removePermission("john");
- testByOwnerNodeSystem.removePermission(SystemIdentity.ANY);
+ testByOwnerNodeSystem.removePermission(IdentityConstants.ANY);
testByOwnerNodeSystem.setPermission("john", new String[]{PermissionType.READ});
session.save();
@@ -767,7 +754,7 @@
testRoot.setPermission("john", new String[]{PermissionType.READ, PermissionType.ADD_NODE,
PermissionType.SET_PROPERTY});
testRoot.setPermission(accessTestRoot.getSession().getUserID(), PermissionType.ALL);
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
ExtendedNode subRoot = (ExtendedNode)testRoot.addNode("subroot");
accessTestRoot.getSession().save();
@@ -807,7 +794,7 @@
testNode.addMixin("exo:privilegeable");
session.save();
- Session anonimSession = repository.login(new CredentialsImpl(SystemIdentity.ANONIM, "".toCharArray()));
+ Session anonimSession = repository.login(new CredentialsImpl(IdentityConstants.ANONIM, "".toCharArray()));
// try {
// anonimSession.checkPermission(testNode.getPath(), PermissionType.READ);
// anonimSession.getRootNode().getNode("."+testNode.getPath());
@@ -818,7 +805,7 @@
// }
testNode.setPermission(testNode.getSession().getUserID(), PermissionType.ALL);
- testNode.removePermission(SystemIdentity.ANY);
+ testNode.removePermission(IdentityConstants.ANY);
session.save();
try
{
@@ -830,7 +817,7 @@
}
- testNode.setPermission(SystemIdentity.ANY, new String[]{PermissionType.READ});
+ testNode.setPermission(IdentityConstants.ANY, new String[]{PermissionType.READ});
session.save();
try
@@ -844,7 +831,7 @@
{
}
- testNode.removePermission(SystemIdentity.ANY);
+ testNode.removePermission(IdentityConstants.ANY);
session.save();
try
{
@@ -855,7 +842,7 @@
{
}
- testNode.setPermission(SystemIdentity.ANY, new String[]{PermissionType.READ, PermissionType.SET_PROPERTY,
+ testNode.setPermission(IdentityConstants.ANY, new String[]{PermissionType.READ, PermissionType.SET_PROPERTY,
PermissionType.REMOVE});
session.save();
@@ -891,7 +878,6 @@
{
}
-
}
public void testDualCheckPermissions() throws Exception
@@ -902,7 +888,7 @@
testRoot.setPermission("john", new String[]{PermissionType.READ, PermissionType.ADD_NODE,
PermissionType.SET_PROPERTY});
testRoot.setPermission(accessTestRoot.getSession().getUserID(), PermissionType.ALL);
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
accessTestRoot.save();
AccessManager accessManager = ((SessionImpl)accessTestRoot.getSession()).getAccessManager();
@@ -920,7 +906,6 @@
assertFalse(accessManager.hasPermission(testRoot.getACL(), new String[]{PermissionType.READ,
PermissionType.REMOVE}, session1.getUserState().getIdentity()));
-
}
/**
@@ -934,7 +919,7 @@
testRoot.addMixin("exo:privilegeable");
session.save();
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
try
{
@@ -962,7 +947,7 @@
testRoot2.addMixin("exo:privilegeable");
session.save();
- testRoot2.setPermission(SystemIdentity.ANY, new String[]{});
+ testRoot2.setPermission(IdentityConstants.ANY, new String[]{});
try
{
session.save();
@@ -985,7 +970,7 @@
testRoot.addMixin("exo:privilegeable");
session.save();
- testRoot.setPermission(SystemIdentity.ANY, PermissionType.ALL);
+ testRoot.setPermission(IdentityConstants.ANY, PermissionType.ALL);
session.save();
session.checkPermission(testRoot.getPath(), PermissionType.ADD_NODE);
@@ -1049,7 +1034,6 @@
Node testNodeAdmin = session.getRootNode().getNode("testNode");
testNodeAdmin.remove();
-
}
/**
@@ -1088,6 +1072,16 @@
session1.save();
}
+ public void testAccessControlEntryEquals() throws PathNotFoundException, RepositoryException
+ {
+ root.addNode("testNode");
+ ExtendedNode testNode = (ExtendedNode)session.getItem("/testNode");
+ AccessControlEntry perm = testNode.getACL().getPermissionEntries().get(0);
+
+ assertTrue(perm.equals(perm));
+ assertFalse(perm.equals(new Object()));
+ }
+
private void showPermissions(String path) throws RepositoryException
{
NodeImpl node = (NodeImpl)this.repository.getSystemSession().getRootNode().getNode(path);
@@ -1096,7 +1090,5 @@
{
log.debug("DUMP: " + acl.dump());
}
-
}
-
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessChildNodes.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessChildNodes.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessChildNodes.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,9 +18,9 @@
import org.exoplatform.services.jcr.BaseStandaloneTest;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.security.IdentityConstants;
import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
@@ -83,7 +83,7 @@
subNode.setPermission("mary", PermissionType.ALL);
subNode.removePermission("john");
- subNode.removePermission(SystemIdentity.ANY);
+ subNode.removePermission(IdentityConstants.ANY);
sessMary.save();
sessMary.logout();
@@ -123,7 +123,7 @@
sessMary = repository.login(new CredentialsImpl("mary", "exo".toCharArray()));
testRoot = sessMary.getRootNode().getNode("testRoot");
subNode = (NodeImpl)testRoot.getNode("subNode");
- subNode.setPermission(SystemIdentity.ANY, PermissionType.ALL);
+ subNode.setPermission(IdentityConstants.ANY, PermissionType.ALL);
sessMary.save();
sessMary.logout();
@@ -151,13 +151,13 @@
//set permissions
subNode.setPermission("mary", PermissionType.ALL);
subNode.removePermission("john");
- subNode.removePermission(SystemIdentity.ANY);
+ subNode.removePermission(IdentityConstants.ANY);
sessMary.save();
testRoot.setPermission("john", PermissionType.ALL);
testRoot.removePermission("mary");
testRoot.setPermission("mary", new String[]{PermissionType.READ});
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
sessMary.save();
sessMary.logout();
@@ -196,7 +196,7 @@
testRoot.removePermission("mary");
testRoot.setPermission("mary", new String[]{PermissionType.READ});
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
sessMary.save();
sessMary.logout();
@@ -231,7 +231,7 @@
testRoot.removePermission("mary");
testRoot.setPermission("mary", PermissionType.ALL);
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
sessMary.save();
sessMary.logout();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessUpdateMixin.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessUpdateMixin.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestAccessUpdateMixin.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,9 +18,9 @@
import org.exoplatform.services.jcr.BaseStandaloneTest;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.security.IdentityConstants;
import javax.jcr.AccessDeniedException;
import javax.jcr.Node;
@@ -79,10 +79,10 @@
testRoot.setPermission("mary", PermissionType.ALL);
testRoot.setPermission("john", PermissionType.ALL);
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
subNode.setPermission("mary", new String[]{PermissionType.READ, PermissionType.SET_PROPERTY});
- subNode.removePermission(SystemIdentity.ANY);
+ subNode.removePermission(IdentityConstants.ANY);
sessJohn.save();
sessJohn.logout();
@@ -118,10 +118,10 @@
testRoot.setPermission("mary", new String[]{PermissionType.READ});
testRoot.setPermission("john", PermissionType.ALL);
- testRoot.removePermission(SystemIdentity.ANY);
+ testRoot.removePermission(IdentityConstants.ANY);
subNode.setPermission("mary", PermissionType.ALL);
- subNode.removePermission(SystemIdentity.ANY);
+ subNode.removePermission(IdentityConstants.ANY);
sessJohn.save();
sessJohn.logout();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -20,13 +20,13 @@
import org.exoplatform.services.jcr.BaseStandaloneTest;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.version.VersionHistoryImpl;
import org.exoplatform.services.jcr.impl.core.version.VersionImpl;
+import org.exoplatform.services.security.IdentityConstants;
import java.util.ArrayList;
import java.util.List;
@@ -97,7 +97,7 @@
node.addMixin("exo:owneable");
node.setPermission("mary", new String[]{PermissionType.READ});
node.setPermission("admin", PermissionType.ALL);
- node.removePermission(SystemIdentity.ANY);
+ node.removePermission(IdentityConstants.ANY);
node.addNode("test");
sessionWS1.save();
@@ -312,18 +312,18 @@
node.getSession().save();
node.setPermission("admin", new String[]{"read", "add_node", "set_property", "remove"});
- node.removePermission(SystemIdentity.ANY);
+ node.removePermission(IdentityConstants.ANY);
NodeImpl subNode = (NodeImpl)node.addNode("subNode");
node.getSession().save();
node.checkin();
- node.setPermission(SystemIdentity.ANY, new String[]{"read"});
+ node.setPermission(IdentityConstants.ANY, new String[]{"read"});
node.getSession().save();
Credentials credentials = new CredentialsImpl("john", "exo".toCharArray());
SessionImpl sessionJohnWS1 = (SessionImpl)repositoryService.getRepository("db2").login(credentials, "ws1");
- Credentials anonCredentials = new CredentialsImpl(SystemIdentity.ANONIM, "".toCharArray());
+ Credentials anonCredentials = new CredentialsImpl(IdentityConstants.ANONIM, "".toCharArray());
SessionImpl anonSession = (SessionImpl)repositoryService.getRepository("db2").login(anonCredentials, "ws1");
try
{
@@ -380,7 +380,7 @@
node.clearACL();
node.setPermission("admin", new String[]{"read", "add_node", "set_property", "remove"});
- node.setPermission(SystemIdentity.ANY, new String[]{"read"});
+ node.setPermission(IdentityConstants.ANY, new String[]{"read"});
NodeImpl subNode = (NodeImpl)node.addNode("subNode");
node.getSession().save();
@@ -390,7 +390,7 @@
Credentials credentials = new CredentialsImpl("john", "exo".toCharArray());
SessionImpl sessionJohnWS1 = (SessionImpl)repositoryService.getRepository("db2").login(credentials, "ws1");
- Credentials anonCredentials = new CredentialsImpl(SystemIdentity.ANONIM, "".toCharArray());
+ Credentials anonCredentials = new CredentialsImpl(IdentityConstants.ANONIM, "".toCharArray());
SessionImpl anonSession = (SessionImpl)repositoryService.getRepository("db2").login(anonCredentials, "ws1");
try
{
@@ -454,7 +454,7 @@
sessionWS1.save();
assertEquals(node.getACL().getPermissions("mary").size(), 0);
- assertEquals(node.getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(node.getACL().getOwner(), IdentityConstants.SYSTEM);
// destination node has its own permissions and owner
node = (NodeImpl)sessionWS1.getRootNode().addNode("dstNode");
@@ -496,7 +496,7 @@
sessionWS1.save();
assertEquals(node.getACL().getPermissions("admin").size(), 4);
- assertEquals(node.getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(node.getACL().getOwner(), IdentityConstants.SYSTEM);
// move node to new destination with new ACL
sessionWS1.move("/srcNode", "/dstNode/newSrc");
@@ -517,7 +517,7 @@
sessionWS1.save();
assertEquals(node.getACL().getPermissions("mary").size(), 0);
- assertEquals(node.getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(node.getACL().getOwner(), IdentityConstants.SYSTEM);
// destination node has its own permissions and owner
node = (NodeImpl)sessionWS1.getRootNode().addNode("dstNode");
@@ -558,7 +558,7 @@
sessionWS1.save();
assertEquals(node.getACL().getPermissions("admin").size(), 4);
- assertEquals(node.getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(node.getACL().getOwner(), IdentityConstants.SYSTEM);
// move node to new destination with new ACL
sessionWS1.getWorkspace().copy("/srcNode", "/dstNode/newSrc");
@@ -587,7 +587,7 @@
Credentials johnCredentials = new CredentialsImpl("john", "exo".toCharArray());
SessionImpl johnSession = (SessionImpl)repositoryService.getRepository("db2").login(johnCredentials, "ws1");
- Credentials anonCredentials = new CredentialsImpl(SystemIdentity.ANONIM, "".toCharArray());
+ Credentials anonCredentials = new CredentialsImpl(IdentityConstants.ANONIM, "".toCharArray());
SessionImpl anonSession = (SessionImpl)repositoryService.getRepository("db2").login(anonCredentials, "ws1");
NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode(TESTNODE_NAME);
@@ -597,7 +597,7 @@
node.setPermission("*:/platform/administrators", PermissionType.ALL);
node.setPermission("mary",
new String[]{PermissionType.READ, PermissionType.SET_PROPERTY, PermissionType.ADD_NODE});
- node.removePermission(SystemIdentity.ANY);
+ node.removePermission(IdentityConstants.ANY);
sessionWS1.save();
// child node exo:privilegeable & exo:owneable
@@ -606,7 +606,7 @@
childNode1.addMixin("exo:owneable");
childNode1.setPermission("*:/platform/administrators", PermissionType.ALL);
childNode1.setPermission("mary", new String[]{PermissionType.READ, PermissionType.SET_PROPERTY});
- childNode1.removePermission(SystemIdentity.ANY);
+ childNode1.removePermission(IdentityConstants.ANY);
sessionWS1.save();
// child node all inherited from parent
@@ -626,7 +626,7 @@
childNode4.addMixin("exo:privilegeable");
childNode4.setPermission("*:/platform/administrators", PermissionType.ALL);
childNode4.setPermission("mary", new String[]{PermissionType.READ, PermissionType.SET_PROPERTY});
- childNode4.removePermission(SystemIdentity.ANY);
+ childNode4.removePermission(IdentityConstants.ANY);
sessionWS1.save();
// check what we have
@@ -788,7 +788,7 @@
node.setPermission("*:/platform/administrators", PermissionType.ALL);
node.setPermission("mary",
new String[]{PermissionType.READ, PermissionType.SET_PROPERTY, PermissionType.ADD_NODE});
- node.removePermission(SystemIdentity.ANY);
+ node.removePermission(IdentityConstants.ANY);
sessionWS1.save();
// check what we have
@@ -797,7 +797,7 @@
assertTrue(marysNode.hasPermission(PermissionType.SET_PROPERTY));
assertTrue(marysNode.hasPermission(PermissionType.ADD_NODE));
assertFalse(marysNode.hasPermission(PermissionType.REMOVE));
- assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), IdentityConstants.SYSTEM);
// v1
node.checkin();
@@ -819,7 +819,7 @@
assertTrue(marysNode.hasPermission(PermissionType.SET_PROPERTY));
assertTrue(marysNode.hasPermission(PermissionType.ADD_NODE));
assertFalse(marysNode.hasPermission(PermissionType.REMOVE));
- assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), SystemIdentity.SYSTEM);
+ assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), IdentityConstants.SYSTEM);
}
/**
@@ -837,7 +837,7 @@
// check what we have
NodeImpl marysNode = (NodeImpl)sessionMaryWS1.getRootNode().getNode(TESTNODE_NAME);
assertEquals(marysNode.getACL().getPermissionsSize(), 4);
- assertEquals(marysNode.getACL().getPermissions(SystemIdentity.ANY).size(), 4);
+ assertEquals(marysNode.getACL().getPermissions(IdentityConstants.ANY).size(), 4);
assertEquals(marysNode.getACL().getPermissions("mary").size(), 0);
assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), "admin");
@@ -858,7 +858,7 @@
// check what we have after restore
marysNode = (NodeImpl)sessionMaryWS1.getRootNode().getNode(TESTNODE_NAME);
assertEquals(marysNode.getACL().getPermissionsSize(), 4);
- assertEquals(marysNode.getACL().getPermissions(SystemIdentity.ANY).size(), 4);
+ assertEquals(marysNode.getACL().getPermissions(IdentityConstants.ANY).size(), 4);
assertEquals(marysNode.getACL().getPermissions("mary").size(), 0);
assertEquals(((NodeData)marysNode.getData()).getACL().getOwner(), "admin");
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestUserAccess.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -20,9 +20,9 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.MembershipEntry;
import java.security.AccessControlException;
@@ -83,7 +83,7 @@
maryNode.setPermission("mary", PermissionType.ALL);
maryNode.removePermission(session.getUserID());
}
- maryNode.removePermission(SystemIdentity.ANY);
+ maryNode.removePermission(IdentityConstants.ANY);
testRoot.save();
try
@@ -119,7 +119,7 @@
rootNode.setPermission("root", PermissionType.ALL);
rootNode.removePermission(session.getUserID());
}
- rootNode.removePermission(SystemIdentity.ANY);
+ rootNode.removePermission(IdentityConstants.ANY);
testRoot.save();
try
@@ -155,8 +155,8 @@
// set any to read only
rootNode.setPermission(session.getUserID(), PermissionType.ALL); // temp all for current user
- rootNode.removePermission(SystemIdentity.ANY);
- rootNode.setPermission(SystemIdentity.ANY, new String[]{PermissionType.READ});
+ rootNode.removePermission(IdentityConstants.ANY);
+ rootNode.setPermission(IdentityConstants.ANY, new String[]{PermissionType.READ});
rootNode.removePermission(session.getUserID()); // clean temp rights
testRoot.save();
@@ -195,7 +195,7 @@
maryNode.setPermission("mary", PermissionType.ALL);
maryNode.removePermission(session.getUserID());
}
- maryNode.removePermission(SystemIdentity.ANY);
+ maryNode.removePermission(IdentityConstants.ANY);
testRoot.save();
Session marySession =
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestInitRepository.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -21,12 +21,12 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.RepositoryService;
import org.exoplatform.services.jcr.access.AccessControlList;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ExtendedNode;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import org.exoplatform.services.security.MembershipEntry;
import java.util.ArrayList;
@@ -136,7 +136,7 @@
{
if (wsEntry.getAutoInitPermissions() != null)
{
- expectedAcl.removePermissions(SystemIdentity.ANY);
+ expectedAcl.removePermissions(IdentityConstants.ANY);
expectedAcl.addPermissions(wsEntry.getAutoInitPermissions());
}
AccessControlList acl = ((ExtendedNode)session.getRootNode()).getACL();
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/TestExternalizabeItemData.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/TestExternalizabeItemData.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/TestExternalizabeItemData.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -76,5 +76,4 @@
assertNotNull(idDest);
}
-
}
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/storage/JDBCStorageConnectionTest.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
@@ -38,6 +37,7 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
+import org.exoplatform.services.security.IdentityConstants;
import java.util.ArrayList;
import java.util.List;
@@ -177,7 +177,7 @@
new TransientValueData(Constants.EXO_PRIVILEGEABLE));
List<ValueData> vd = new ArrayList<ValueData>();
- vd.add(new TransientValueData(SystemIdentity.ANY + AccessControlEntry.DELIMITER + PermissionType.READ));
+ vd.add(new TransientValueData(IdentityConstants.ANY + AccessControlEntry.DELIMITER + PermissionType.READ));
vd.add(new TransientValueData("managers" + AccessControlEntry.DELIMITER + PermissionType.SET_PROPERTY));
@@ -198,9 +198,9 @@
(NodeData)dataManager.getItemData(root, new QPathEntry(InternalQName.parse("[]jdbcStorageConnectionTest"), 1),
ItemType.NODE);
- List<String> iperms = troot.getACL().getPermissions(SystemIdentity.ANY);
- assertEquals("Wrong permission for " + SystemIdentity.ANY, 1, iperms.size());
- assertEquals("Wrong permission for " + SystemIdentity.ANY, PermissionType.READ, iperms.get(0));
+ List<String> iperms = troot.getACL().getPermissions(IdentityConstants.ANY);
+ assertEquals("Wrong permission for " + IdentityConstants.ANY, 1, iperms.size());
+ assertEquals("Wrong permission for " + IdentityConstants.ANY, PermissionType.READ, iperms.get(0));
iperms = troot.getACL().getPermissions("managers");
assertEquals("Wrong permission for managers", 1, iperms.size());
@@ -223,7 +223,7 @@
TransientPropertyData.createPropertyData(testRoot, Constants.JCR_MIXINTYPES, PropertyType.NAME, true, mixvd);
List<ValueData> vd = new ArrayList<ValueData>();
- vd.add(new TransientValueData(SystemIdentity.ANY + AccessControlEntry.DELIMITER + PermissionType.READ));
+ vd.add(new TransientValueData(IdentityConstants.ANY + AccessControlEntry.DELIMITER + PermissionType.READ));
vd.add(new TransientValueData("managers" + AccessControlEntry.DELIMITER + PermissionType.SET_PROPERTY));
@@ -251,9 +251,9 @@
assertEquals("Owner is not valid", "exo", troot.getACL().getOwner());
- List<String> iperms = troot.getACL().getPermissions(SystemIdentity.ANY);
- assertEquals("Wrong permission for " + SystemIdentity.ANY, 1, iperms.size());
- assertEquals("Wrong permission for " + SystemIdentity.ANY, PermissionType.READ, iperms.get(0));
+ List<String> iperms = troot.getACL().getPermissions(IdentityConstants.ANY);
+ assertEquals("Wrong permission for " + IdentityConstants.ANY, 1, iperms.size());
+ assertEquals("Wrong permission for " + IdentityConstants.ANY, PermissionType.READ, iperms.get(0));
iperms = troot.getACL().getPermissions("managers");
assertEquals("Wrong permission for managers", 1, iperms.size());
Modified: jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java 2012-01-18 08:01:32 UTC (rev 5477)
+++ jcr/branches/1.15.x/exo.jcr.component.ext/src/test/java/org/exoplatform/services/jcr/ext/common/DynamicSessionProviderTest.java 2012-01-18 09:04:15 UTC (rev 5478)
@@ -18,12 +18,12 @@
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.PermissionType;
-import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.core.CredentialsImpl;
import org.exoplatform.services.jcr.ext.BaseStandaloneTest;
import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.exoplatform.services.security.IdentityConstants;
import java.util.ArrayList;
import java.util.List;
@@ -66,7 +66,7 @@
maryNode.setPermission("mary", PermissionType.ALL);
maryNode.removePermission(session.getUserID());
}
- maryNode.removePermission(SystemIdentity.ANY);
+ maryNode.removePermission(IdentityConstants.ANY);
testRoot.save();
Session marySession =
14 years, 3 months