exo-jcr SVN: r888 - jcr/branches/1.12.0-JBC/applications.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-26 09:49:09 -0500 (Thu, 26 Nov 2009)
New Revision: 888
Modified:
jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jboss-ear.xml
jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jonas-ear.xml
jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-tomcat6.xml
Log:
EXOJCR-199 : The configuration to exo-application was changed.
Modified: jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jboss-ear.xml
===================================================================
--- jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jboss-ear.xml 2009-11-26 14:20:01 UTC (rev 887)
+++ jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jboss-ear.xml 2009-11-26 14:49:09 UTC (rev 888)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta03-SNAPSHOT</version>
+ <version>1.12.0-JBC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jonas-ear.xml
===================================================================
--- jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jonas-ear.xml 2009-11-26 14:20:01 UTC (rev 887)
+++ jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-jonas-ear.xml 2009-11-26 14:49:09 UTC (rev 888)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta03-SNAPSHOT</version>
+ <version>1.12.0-JBC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-tomcat6.xml
===================================================================
--- jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-tomcat6.xml 2009-11-26 14:20:01 UTC (rev 887)
+++ jcr/branches/1.12.0-JBC/applications/product-exo-jcr-as-tomcat6.xml 2009-11-26 14:49:09 UTC (rev 888)
@@ -22,7 +22,7 @@
<parent>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.config</artifactId>
- <version>1.12.0-Beta03-SNAPSHOT</version>
+ <version>1.12.0-JBC-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
16 years, 5 months
exo-jcr SVN: r887 - kernel/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-26 09:20:01 -0500 (Thu, 26 Nov 2009)
New Revision: 887
Modified:
kernel/trunk/pom.xml
Log:
EXOJCR-268 exo.kernel.component.ext.cache project excluded from build
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2009-11-26 14:17:46 UTC (rev 886)
+++ kernel/trunk/pom.xml 2009-11-26 14:20:01 UTC (rev 887)
@@ -53,7 +53,7 @@
<module>exo.kernel.component.common</module>
<module>exo.kernel.component.remote</module>
<module>exo.kernel.component.cache</module>
- <module>exo.kernel.component.ext.cache</module>
+ <!--module>exo.kernel.component.ext.cache</module-->
<module>exo.kernel.component.command</module>
<module>packaging/module</module>
</modules>
16 years, 5 months
exo-jcr SVN: r886 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-26 09:17:46 -0500 (Thu, 26 Nov 2009)
New Revision: 886
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-270: updateTreeACL - updated
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 14:10:48 UTC (rev 885)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 14:17:46 UTC (rev 886)
@@ -765,7 +765,7 @@
if (!prevData.getACL().equals(data.getACL()))
{
- updateTreeACL(node, data.getACL());
+ updateChildsACL(node, data.getACL());
}
}
@@ -878,58 +878,53 @@
* @param newACL - new ACL that must be inserted to node data.
* @throws RepositoryException on error state detected
*/
- protected void updateTreeACL(Node<Serializable, Object> node, AccessControlList newACL) throws RepositoryException
+ protected void updateChildsACL(Node<Serializable, Object> node, AccessControlList newACL) throws RepositoryException
{
- NodeData prevData = (NodeData)node.get(ITEM_DATA);
-
- // is exo:Privilegeable
- boolean isPrivilegeable = false;
- for (InternalQName mixin : prevData.getMixinTypeNames())
+ for (Node<Serializable, Object> child : node.getChildren())
{
- if (mixin.equals(Constants.EXO_PRIVILEGEABLE))
+ String childNodeId = (String)child.get(ITEM_ID);
+ if (childNodeId == null)
{
- isPrivilegeable = true;
- break;
+ throw new RepositoryException("FATAL Child Node Id key is null. Parent " + node.getFqn());
}
- }
- if (!isPrivilegeable || prevData.getACL().equals(newACL))
- {
- // do update NodeData
+ Node<Serializable, Object> childNode = nodesRoot.getChild(makeNodeFqn(childNodeId));
+ if (childNode == null)
+ {
+ throw new RepositoryException("FATAL Node record not found (" + childNodeId + "), but listed in childs of "
+ + node.getFqn());
+ }
- if (!prevData.getACL().equals(newACL))
+ NodeData prevData = (NodeData)childNode.get(ITEM_DATA);
+ // is exo:Privilegeable
+ boolean isPrivilegeable = false;
+ for (InternalQName mixin : prevData.getMixinTypeNames())
{
+ if (mixin.equals(Constants.EXO_PRIVILEGEABLE))
+ {
+ isPrivilegeable = true;
+ break;
+ }
+ }
+
+ if (!isPrivilegeable)
+ {
+ // do update NodeData
AccessControlList acl = new AccessControlList(prevData.getACL().getOwner(), newACL.getPermissionEntries());
TransientNodeData newData =
new TransientNodeData(prevData.getQPath(), prevData.getIdentifier(), prevData.getPersistedVersion(),
prevData.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getOrderNumber(), prevData
.getParentIdentifier(), acl);
- newData.addState(TransientPropertyData.TRANSITIVE_PATH_UPDATED);
- node.put(ITEM_DATA, newData);
- }
+ newData.addState(TransientPropertyData.TRANSITIVE_ACL_UPDATED);
+ childNode.put(ITEM_DATA, newData);
- // do update child nodes
-
- for (Node<Serializable, Object> child : node.getChildren())
- {
- String childNodeId = (String)child.get(ITEM_ID);
- if (childNodeId == null)
- {
- throw new RepositoryException("FATAL Child Node Id key is null. Parent " + prevData.getQPath());
- }
-
- Node<Serializable, Object> childNode = nodesRoot.getChild(makeNodeFqn(childNodeId));
- if (childNode == null)
- {
- throw new RepositoryException("FATAL Node record not found (" + childNodeId
- + "), but listed in childs of " + prevData.getQPath());
- }
-
- updateTreeACL(childNode, newACL);
+ // do update childs
+ updateChildsACL(childNode, newACL);
}
}
+
}
/**
16 years, 5 months
exo-jcr SVN: r885 - kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-26 09:10:48 -0500 (Thu, 26 Nov 2009)
New Revision: 885
Modified:
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
Log:
EXOJCR-268 Remove type from ExoCacheConfig since it is useless, Javadoc added to ExoCacheConfig
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java 2009-11-26 13:57:16 UTC (rev 884)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java 2009-11-26 14:10:48 UTC (rev 885)
@@ -19,28 +19,53 @@
package org.exoplatform.services.cache;
/**
+ * This class defines the main configuration properties of an {@link org.exoplatform.services.cache.ExoCache}
+ *
* @author Tuan Nguyen (tuan08(a)users.sourceforge.net)
* @since Feb 20, 2005
* @version $Id: ExoCacheConfig.java 5799 2006-05-28 17:55:42Z geaz $
*/
public class ExoCacheConfig implements Cloneable
{
+ /**
+ * The name of the cache.
+ */
private String name;
+ /**
+ * The label of the cache.
+ */
private String label;
+ /**
+ * The maximum numbers of elements in cache.
+ */
private int maxSize;
+ /**
+ * The amount of time (in milliseconds) an element is not written or
+ * read before it is evicted.
+ */
private long liveTime;
+ /**
+ * Indicates if the cache is distributed
+ */
private boolean distributed;
+ /**
+ * Indicates if the cache is replicated
+ */
private boolean replicated;
+ /**
+ * The full qualified name of the cache implementation to use
+ */
private String implementation;
- private String type;
-
+ /**
+ * Indicates if the log is enabled
+ */
private boolean logEnabled;
public String getName()
@@ -93,8 +118,6 @@
distributed = b;
}
- // public void setDistributed(String b) { distributed_ = "true".equals(b) ; }
-
public boolean isRepicated()
{
return replicated;
@@ -115,16 +138,6 @@
implementation = alg;
}
- public void setType(String type)
- {
- this.type = type;
- }
-
- public String getType()
- {
- return type;
- }
-
public boolean isLogEnabled()
{
return logEnabled;
16 years, 5 months
exo-jcr SVN: r884 - kernel/trunk.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-26 08:57:16 -0500 (Thu, 26 Nov 2009)
New Revision: 884
Modified:
kernel/trunk/pom.xml
Log:
EXOJCR-268 JBoss cache dependency management added
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2009-11-26 13:56:29 UTC (rev 883)
+++ kernel/trunk/pom.xml 2009-11-26 13:57:16 UTC (rev 884)
@@ -53,6 +53,7 @@
<module>exo.kernel.component.common</module>
<module>exo.kernel.component.remote</module>
<module>exo.kernel.component.cache</module>
+ <module>exo.kernel.component.ext.cache</module>
<module>exo.kernel.component.command</module>
<module>packaging/module</module>
</modules>
@@ -78,8 +79,13 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.remote</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.cache</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<version>1.1.3.4.O</version>
@@ -163,9 +169,14 @@
<dependency>
<groupId>jgroups</groupId>
<artifactId>jgroups</artifactId>
- <version>2.6.10.GA</version>
+ <version>2.6.12.GA</version>
</dependency>
- <dependency>
+ <dependency>
+ <groupId>org.jboss.cache</groupId>
+ <artifactId>jbosscache-core</artifactId>
+ <version>3.2.0.GA</version>
+ </dependency>
+ <dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-bind</artifactId>
<version>${jibx.plugin.version}</version>
16 years, 5 months
exo-jcr SVN: r883 - in kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache: impl and 1 other directory.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-11-26 08:56:29 -0500 (Thu, 26 Nov 2009)
New Revision: 883
Added:
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheFactory.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheInitException.java
Modified:
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
Log:
EXOJCR-268 Improve the CacheService to allow complex implementation of ExoCache
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java 2009-11-26 13:49:07 UTC (rev 882)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheConfig.java 2009-11-26 13:56:29 UTC (rev 883)
@@ -23,7 +23,7 @@
* @since Feb 20, 2005
* @version $Id: ExoCacheConfig.java 5799 2006-05-28 17:55:42Z geaz $
*/
-public class ExoCacheConfig
+public class ExoCacheConfig implements Cloneable
{
private String name;
@@ -33,14 +33,16 @@
private long liveTime;
- private boolean distributed = false;
+ private boolean distributed;
- private boolean replicated = false;
+ private boolean replicated;
private String implementation;
- private boolean logEnabled = false;
+ private String type;
+ private boolean logEnabled;
+
public String getName()
{
return name;
@@ -113,6 +115,16 @@
implementation = alg;
}
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
public boolean isLogEnabled()
{
return logEnabled;
@@ -122,4 +134,20 @@
{
this.logEnabled = enableLogging;
}
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public ExoCacheConfig clone() throws CloneNotSupportedException
+ {
+ try
+ {
+ return (ExoCacheConfig)super.clone();
+ }
+ catch (Exception e)
+ {
+ throw new AssertionError();
+ }
+ }
}
Added: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheFactory.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheFactory.java (rev 0)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheFactory.java 2009-11-26 13:56:29 UTC (rev 883)
@@ -0,0 +1,39 @@
+/*
+ * 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.cache;
+
+/**
+ * This class allows you to create a new instance of {@link org.exoplatform.services.cache.ExoCache}
+ *
+ * @author <a href="mailto:dmitry.kataev@exoplatform.com">Dmytro Katayev</a>
+ * @version $Id$
+ *
+ */
+public interface ExoCacheFactory
+{
+
+ /**
+ * Creates a new instance of {@link org.exoplatform.services.cache.ExoCache}
+ * @param config the cache to create
+ * @return the new instance of {@link org.exoplatform.services.cache.ExoCache}
+ * @exception ExoCacheInitException if an exception happens while initializing the cache
+ */
+ public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException;
+
+}
Property changes on: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheInitException.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheInitException.java (rev 0)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheInitException.java 2009-11-26 13:56:29 UTC (rev 883)
@@ -0,0 +1,61 @@
+/*
+ * 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.cache;
+
+/**
+ * An exception that represents any type of exception that prevent the initialization of
+ * the {@link org.exoplatform.services.cache.ExoCache}
+ *
+ * @author <a href="mailto:dmitry.kataev@exoplatform.com">Dmytro Katayev</a>
+ * @version $Id$
+ *
+ */
+public class ExoCacheInitException extends Exception
+{
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID = -5612051266167302943L;
+
+ /**
+ * {@inheritDoc}
+ */
+ public ExoCacheInitException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ExoCacheInitException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ExoCacheInitException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+}
Property changes on: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/ExoCacheInitException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2009-11-26 13:49:07 UTC (rev 882)
+++ kernel/trunk/exo.kernel.component.cache/src/main/java/org/exoplatform/services/cache/impl/CacheServiceImpl.java 2009-11-26 13:56:29 UTC (rev 883)
@@ -25,6 +25,8 @@
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.cache.ExoCacheConfig;
import org.exoplatform.services.cache.ExoCacheConfigPlugin;
+import org.exoplatform.services.cache.ExoCacheFactory;
+import org.exoplatform.services.cache.ExoCacheInitException;
import org.exoplatform.services.cache.SimpleExoCache;
import java.io.Serializable;
@@ -40,19 +42,29 @@
@ManagedBy(CacheServiceManaged.class)
public class CacheServiceImpl implements CacheService
{
- private HashMap<String, ExoCacheConfig> configs_ = new HashMap<String, ExoCacheConfig>();
+ private final HashMap<String, ExoCacheConfig> configs_ = new HashMap<String, ExoCacheConfig>();
private final ConcurrentHashMap<String, ExoCache<? extends Serializable, ?>> cacheMap_ =
new ConcurrentHashMap<String, ExoCache<? extends Serializable, ?>>();
- private ExoCacheConfig defaultConfig_;
+ private final ExoCacheConfig defaultConfig_;
- private LoggingCacheListener loggingListener_;
+ private final LoggingCacheListener loggingListener_;
+ private final ExoCacheFactory factory_;
+
CacheServiceManaged managed;
+ /**
+ *
+ */
public CacheServiceImpl(InitParams params) throws Exception
{
+ this(params, null);
+ }
+
+ public CacheServiceImpl(InitParams params, ExoCacheFactory factory) throws Exception
+ {
List<ExoCacheConfig> configs = params.getObjectParamValues(ExoCacheConfig.class);
for (ExoCacheConfig config : configs)
{
@@ -60,6 +72,7 @@
}
defaultConfig_ = configs_.get("default");
loggingListener_ = new LoggingCacheListener();
+ factory_ = factory == null ? new SimpleExoCacheFactory() : factory;
}
public void addExoCacheConfig(ComponentPlugin plugin)
@@ -111,40 +124,83 @@
ExoCacheConfig config = configs_.get(region);
if (config == null)
config = defaultConfig_;
- ExoCache<? extends Serializable, ?> cache;
- if (config.getImplementation() == null)
- {
- cache = new SimpleExoCache<Serializable, Object>();
- }
- else
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Class<ExoCache<? extends Serializable, ?>> clazz =
- (Class<ExoCache<? extends Serializable, ?>>)cl.loadClass(config.getImplementation());
- cache = clazz.newInstance();
- }
- cache.setName(region);
- cache.setLabel(config.getLabel());
- cache.setMaxSize(config.getMaxSize());
- cache.setLiveTime(config.getLiveTime());
- cache.setLogEnabled(config.isLogEnabled());
- if (cache.isLogEnabled())
- {
- cache.addCacheListener(loggingListener_);
- }
- //
+ // Ensure the configuration integrity
+ final ExoCacheConfig safeConfig = config.clone();
+ // Set the region as name
+ safeConfig.setName(region);
+ final ExoCache simple = factory_.createCache(safeConfig);
+
if (managed != null)
{
- managed.registerCache(cache);
+ managed.registerCache(simple);
}
-
- //
- return cache;
+ return simple;
}
public Collection<ExoCache<? extends Serializable, ?>> getAllCacheInstances()
{
return cacheMap_.values();
}
+
+ /**
+ * Default implementation of an {@link org.exoplatform.services.cache.ExoCacheFactory}
+ */
+ private class SimpleExoCacheFactory implements ExoCacheFactory
+ {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ExoCache createCache(ExoCacheConfig config) throws ExoCacheInitException
+ {
+ final ExoCache simple = createCacheInstance(config);
+ simple.setName(config.getName());
+ simple.setLabel(config.getLabel());
+ simple.setMaxSize(config.getMaxSize());
+ simple.setLiveTime(config.getLiveTime());
+ // simple.setReplicated(config.isRepicated());
+ // simple.setDistributed(config.isDistributed());
+ // if (simple.isDistributed()) {
+ // simple.addCacheListener(distrbutedListener_);
+ // }
+ simple.setLogEnabled(config.isLogEnabled());
+ if (simple.isLogEnabled())
+ {
+ simple.addCacheListener(loggingListener_);
+ }
+ return simple;
+ }
+
+ /**
+ * Create a new instance of ExoCache according to the given configuration
+ * @param config the ExoCache configuration
+ * @return a new instance of ExoCache
+ * @throws ExoCacheInitException if any exception happens while initializing the cache
+ */
+ @SuppressWarnings("unchecked")
+ private ExoCache createCacheInstance(ExoCacheConfig config) throws ExoCacheInitException
+ {
+ if (config.getImplementation() == null)
+ {
+ // No implementation has been defined
+ return new SimpleExoCache();
+ }
+ else
+ {
+ // An implementation has been defined
+ final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ final Class clazz = cl.loadClass(config.getImplementation());
+ return (ExoCache)clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new ExoCacheInitException("Cannot create instance of ExoCache of type "
+ + config.getImplementation(), e);
+ }
+ }
+ }
+ }
}
16 years, 5 months
exo-jcr SVN: r882 - jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-26 08:49:07 -0500 (Thu, 26 Nov 2009)
New Revision: 882
Modified:
jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ProxyWorkspaceDataReceiver.java
jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/WorkspaceDataManagerProxy.java
Log:
EXOJCR-199 : The calsess ProxyWorkspaceDataReciver and WorkspaceDataManagerProxy was fixed for build.
Modified: jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ProxyWorkspaceDataReceiver.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ProxyWorkspaceDataReceiver.java 2009-11-26 13:31:31 UTC (rev 881)
+++ jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/ProxyWorkspaceDataReceiver.java 2009-11-26 13:49:07 UTC (rev 882)
@@ -19,7 +19,6 @@
package org.exoplatform.services.jcr.ext.replication;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
@@ -42,12 +41,12 @@
* the LockManagerImpl
* @throws RepositoryConfigurationException
* will be generated RepositoryConfigurationException
- */
+ *//*
public ProxyWorkspaceDataReceiver(CacheableWorkspaceDataManager dataManager, LockManagerImpl lockManager)
throws RepositoryConfigurationException
{
this(dataManager, null, lockManager);
- }
+ }*/
/**
* ProxyWorkspaceDataReceiver constructor.
@@ -58,12 +57,12 @@
* the SearchManager
* @throws RepositoryConfigurationException
* will be generated RepositoryConfigurationException
- */
+ *//*
public ProxyWorkspaceDataReceiver(CacheableWorkspaceDataManager dataManager, SearchManager searchManager)
throws RepositoryConfigurationException
{
this(dataManager, searchManager, null);
- }
+ }*/
/**
* ProxyWorkspaceDataReceiver constructor.
@@ -75,7 +74,7 @@
*/
public ProxyWorkspaceDataReceiver(CacheableWorkspaceDataManager dataManager) throws RepositoryConfigurationException
{
- this(dataManager, null, null);
+ this(dataManager, null/*, null*/);
}
/**
@@ -90,9 +89,9 @@
* @throws RepositoryConfigurationException
* will be generated the RepositoryConfigurationException
*/
- public ProxyWorkspaceDataReceiver(CacheableWorkspaceDataManager dataManager, SearchManager searchManager,
- LockManagerImpl lockManager) throws RepositoryConfigurationException
+ public ProxyWorkspaceDataReceiver(CacheableWorkspaceDataManager dataManager, SearchManager searchManager/*,
+ LockManagerImpl lockManager*/) throws RepositoryConfigurationException
{
- dataKeeper = new WorkspaceDataManagerProxy(dataManager, searchManager, lockManager);
+ dataKeeper = new WorkspaceDataManagerProxy(dataManager, searchManager/*, lockManager*/);
}
}
Modified: jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/WorkspaceDataManagerProxy.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/WorkspaceDataManagerProxy.java 2009-11-26 13:31:31 UTC (rev 881)
+++ jcr/branches/1.12.0-JBC/component/ext/src/main/java/org/exoplatform/services/jcr/ext/replication/WorkspaceDataManagerProxy.java 2009-11-26 13:49:07 UTC (rev 882)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.dataflow.ItemDataKeeper;
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
-import org.exoplatform.services.jcr.impl.core.lock.LockManagerImpl;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
import org.exoplatform.services.log.ExoLogger;
@@ -63,18 +62,16 @@
* the CacheableWorkspaceDataManager
* @param searchIndex
* the SearchManager
- * @param lockManager
- * the LockManagerImpl
*/
- public WorkspaceDataManagerProxy(CacheableWorkspaceDataManager dataManager, SearchManager searchIndex,
- LockManagerImpl lockManager)
+ public WorkspaceDataManagerProxy(CacheableWorkspaceDataManager dataManager, SearchManager searchIndex/*,
+ LockManagerImpl lockManager*/)
{
this.listeners = new ArrayList<ItemsPersistenceListener>();
listeners.add(dataManager.getCache());
if (searchIndex != null)
listeners.add(searchIndex);
- if (lockManager != null)
- listeners.add(lockManager);
+ /*if (lockManager != null)
+ listeners.add(lockManager);*/
log.info("WorkspaceDataManagerProxy is instantiated");
}
16 years, 5 months
exo-jcr SVN: r881 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-26 08:31:31 -0500 (Thu, 26 Nov 2009)
New Revision: 881
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-270: updateTreeACL - updated
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 13:17:10 UTC (rev 880)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 13:31:31 UTC (rev 881)
@@ -896,14 +896,20 @@
if (!isPrivilegeable || prevData.getACL().equals(newACL))
{
- // do update NodeData
- TransientNodeData newData =
- new TransientNodeData(prevData.getQPath(), prevData.getIdentifier(), prevData.getPersistedVersion(),
- prevData.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getOrderNumber(), prevData
- .getParentIdentifier(), newACL);
- newData.addState(TransientPropertyData.TRANSITIVE_PATH_UPDATED);
- node.put(ITEM_DATA, newData);
+ // do update NodeData
+ if (!prevData.getACL().equals(newACL))
+ {
+ AccessControlList acl = new AccessControlList(prevData.getACL().getOwner(), newACL.getPermissionEntries());
+
+ TransientNodeData newData =
+ new TransientNodeData(prevData.getQPath(), prevData.getIdentifier(), prevData.getPersistedVersion(),
+ prevData.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getOrderNumber(), prevData
+ .getParentIdentifier(), acl);
+ newData.addState(TransientPropertyData.TRANSITIVE_PATH_UPDATED);
+ node.put(ITEM_DATA, newData);
+ }
+
// do update child nodes
for (Node<Serializable, Object> child : node.getChildren())
@@ -911,14 +917,14 @@
String childNodeId = (String)child.get(ITEM_ID);
if (childNodeId == null)
{
- throw new RepositoryException("FATAL Child Node Id key is null. Parent " + newData.getQPath());
+ throw new RepositoryException("FATAL Child Node Id key is null. Parent " + prevData.getQPath());
}
Node<Serializable, Object> childNode = nodesRoot.getChild(makeNodeFqn(childNodeId));
if (childNode == null)
{
throw new RepositoryException("FATAL Node record not found (" + childNodeId
- + "), but listed in childs of " + newData.getQPath());
+ + "), but listed in childs of " + prevData.getQPath());
}
updateTreeACL(childNode, newACL);
16 years, 5 months
exo-jcr SVN: r880 - jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-26 08:17:10 -0500 (Thu, 26 Nov 2009)
New Revision: 880
Modified:
jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
Log:
EXOJCR-221: test modified
Modified: jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java
===================================================================
--- jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-26 12:38:16 UTC (rev 879)
+++ jcr/branches/1.12.0-OPT/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/load/perf/TestGetNodesPerf.java 2009-11-26 13:17:10 UTC (rev 880)
@@ -47,11 +47,8 @@
private GetNodesThread[] threads = new GetNodesThread[sessionCount];
- private NodeIterator[][] nodes = new NodeIterator[sessionCount][tryCount];
-
public void testGetNodes() throws Exception
{
-
for (int i = 0; i < sessionCount; i++)
{
sessions[i] = (SessionImpl)repository.login(credentials, "ws");
@@ -77,24 +74,27 @@
long usedMemory = rt.totalMemory() - rt.freeMemory();
log.info("getting nodes...");
- for (int i = 0; i < sessionCount; i++)
+ for (int k = 0; k < tryCount; k++)
{
- threads[i] = new GetNodesThread(sessions[i], i);
- threads[i].start();
- }
-
- outer : while (true)
- {
for (int i = 0; i < sessionCount; i++)
{
- if (threads[i].isAlive())
+ threads[i] = new GetNodesThread(sessions[i]);
+ threads[i].start();
+ }
+
+ outer : while (true)
+ {
+ for (int i = 0; i < sessionCount; i++)
{
- Thread.sleep(1000);
- continue outer;
+ if (threads[i].isAlive())
+ {
+ Thread.sleep(1000);
+ continue outer;
+ }
}
- }
- break;
+ break;
+ }
}
log.info("Memory used: " + (rt.totalMemory() - rt.freeMemory() - usedMemory) / 1024 / 1024 + "Mb");
}
@@ -103,12 +103,11 @@
{
private final Session curSession;
- private final int sessionNumber;
+ private NodeIterator nodes;
- GetNodesThread(Session session, int sessionNumber)
+ GetNodesThread(Session session)
{
this.curSession = session;
- this.sessionNumber = sessionNumber;
}
@Override
@@ -118,14 +117,10 @@
{
Node testRoot = curSession.getRootNode().getNode(testName);
- for (int k = 0; k < tryCount; k++)
- {
- long startTime = System.currentTimeMillis();
- testRoot.getNodes();
- log.info("Total time: " + (System.currentTimeMillis() - startTime) / 1000 + "s");
+ long startTime = System.currentTimeMillis();
+ nodes = testRoot.getNodes();
+ log.info("Total time: " + (System.currentTimeMillis() - startTime) + "ms");
- Thread.sleep(30000);
- }
}
catch (Exception e)
{
16 years, 5 months
exo-jcr SVN: r879 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-26 07:38:16 -0500 (Thu, 26 Nov 2009)
New Revision: 879
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-270: updatetreeACL implemented
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 11:46:36 UTC (rev 878)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-26 12:38:16 UTC (rev 879)
@@ -18,12 +18,15 @@
*/
package org.exoplatform.services.jcr.impl.storage.jbosscache;
+import org.exoplatform.services.jcr.access.AccessControlList;
+import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
+import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
@@ -79,9 +82,10 @@
private boolean batchStarted = false;
private boolean isCommited = false;
-
- class NodesOrderComparator<N extends NodeData> implements Comparator<NodeData> {
+ class NodesOrderComparator<N extends NodeData> implements Comparator<NodeData>
+ {
+
/**
* {@inheritDoc}
*/
@@ -387,7 +391,7 @@
// TODO We have to order childs by orderNumber, as JBC returns childs in any order
Collections.sort(childs, new NodesOrderComparator<NodeData>());
-
+
return childs;
}
@@ -756,6 +760,14 @@
{
((TransientNodeData)data).addState(TransientNodeData.TRANSITIVE_MIXIN_UPDATED);
}
+
+ // do update ACL if needed
+
+ if (!prevData.getACL().equals(data.getACL()))
+ {
+ updateTreeACL(node, data.getACL());
+ }
+
}
/**
@@ -860,6 +872,61 @@
}
/**
+ * Update Nodes ACL with new ACL.
+ *
+ * @param node Node - cache node containing root of JCR subtree.
+ * @param newACL - new ACL that must be inserted to node data.
+ * @throws RepositoryException on error state detected
+ */
+ protected void updateTreeACL(Node<Serializable, Object> node, AccessControlList newACL) throws RepositoryException
+ {
+
+ NodeData prevData = (NodeData)node.get(ITEM_DATA);
+
+ // is exo:Privilegeable
+ boolean isPrivilegeable = false;
+ for (InternalQName mixin : prevData.getMixinTypeNames())
+ {
+ if (mixin.equals(Constants.EXO_PRIVILEGEABLE))
+ {
+ isPrivilegeable = true;
+ break;
+ }
+ }
+
+ if (!isPrivilegeable || prevData.getACL().equals(newACL))
+ {
+ // do update NodeData
+ TransientNodeData newData =
+ new TransientNodeData(prevData.getQPath(), prevData.getIdentifier(), prevData.getPersistedVersion(),
+ prevData.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getOrderNumber(), prevData
+ .getParentIdentifier(), newACL);
+ newData.addState(TransientPropertyData.TRANSITIVE_PATH_UPDATED);
+ node.put(ITEM_DATA, newData);
+
+ // do update child nodes
+
+ for (Node<Serializable, Object> child : node.getChildren())
+ {
+ String childNodeId = (String)child.get(ITEM_ID);
+ if (childNodeId == null)
+ {
+ throw new RepositoryException("FATAL Child Node Id key is null. Parent " + newData.getQPath());
+ }
+
+ Node<Serializable, Object> childNode = nodesRoot.getChild(makeNodeFqn(childNodeId));
+ if (childNode == null)
+ {
+ throw new RepositoryException("FATAL Node record not found (" + childNodeId
+ + "), but listed in childs of " + newData.getQPath());
+ }
+
+ updateTreeACL(childNode, newACL);
+ }
+ }
+ }
+
+ /**
* {@inheritDoc}
*/
public void update(NodeData data) throws RepositoryException, UnsupportedOperationException,
16 years, 5 months