exo-jcr SVN: r914 - in jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc: db and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-12-02 12:13:15 -0500 (Wed, 02 Dec 2009)
New Revision: 914
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
Log:
EXOJCR-246: has reference query fixed
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-12-02 16:48:44 UTC (rev 913)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2009-12-02 17:13:15 UTC (rev 914)
@@ -230,7 +230,7 @@
/**
* FIND_REFERENCE
*/
- protected String FIND_REFERENCE;
+ protected String HAS_REFERENCE;
/**
* FIND_REFERENCED_NODES
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-12-02 16:48:44 UTC (rev 913)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/MultiDbJDBCConnection.java 2009-12-02 17:13:15 UTC (rev 914)
@@ -128,7 +128,7 @@
protected PreparedStatement renameNode;
- protected PreparedStatement findReference;
+ protected PreparedStatement hasReference;
protected PreparedStatement findAllReferencedNodes;
@@ -199,7 +199,7 @@
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_MREF R, JCR_MITEM P"
+ " where R.NODE_ID=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
- FIND_REFERENCE = "select P.ID from JCR_MREF R, JCR_MITEM P where R.NODE_ID=? and R.PROPERTY_ID=?";
+ HAS_REFERENCE = "select count(PROPERTY_ID) from JCR_MREF where NODE_ID=? and PROPERTY_ID=?";
FIND_REFERENCED_NODES = "select N.ID from JCR_MREF R, JCR_MITEM N where N.ID=R.NODE_ID";
@@ -727,16 +727,16 @@
protected boolean hasReferenceRecord(String nodeIdentifier, String refPropertyIdentifier) throws SQLException
{
// TODO make query
- if (findReference == null)
- findReference = dbConnection.prepareStatement(FIND_REFERENCE);
+ if (hasReference == null)
+ hasReference = dbConnection.prepareStatement(HAS_REFERENCE);
else
- findReference.clearParameters();
+ hasReference.clearParameters();
- findReference.setString(1, nodeIdentifier);
- findReference.setString(1, refPropertyIdentifier);
- ResultSet result = findReference.executeQuery();
-
- return result.next();
+ hasReference.setString(1, nodeIdentifier);
+ hasReference.setString(2, refPropertyIdentifier);
+ ResultSet result = hasReference.executeQuery();
+ result.next();
+ return (result.getInt(1) == 1);
}
@Override
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-12-02 16:48:44 UTC (rev 913)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/SingleDbJDBCConnection.java 2009-12-02 17:13:15 UTC (rev 914)
@@ -127,7 +127,7 @@
protected PreparedStatement renameNode;
- protected PreparedStatement findReference;
+ protected PreparedStatement hasReference;
protected PreparedStatement findAllReferencedNodes;
@@ -205,8 +205,7 @@
"select P.ID, P.PARENT_ID, P.VERSION, P.P_TYPE, P.P_MULTIVALUED, P.NAME" + " from JCR_SREF R, JCR_SITEM P"
+ " where R.NODE_ID=? and P.CONTAINER_NAME=? and P.ID=R.PROPERTY_ID and P.I_CLASS=2";
- FIND_REFERENCE =
- "select P.ID from JCR_SREF R, JCR_SITEM P where R.NODE_ID=? and R.PROPERTY_ID=? and P.ID = R.PROPERTY_ID";
+ HAS_REFERENCE = "select count(PROPERTY_ID) from JCR_SREF where NODE_ID=? and PROPERTY_ID=?";
FIND_REFERENCED_NODES = "select N.ID from JCR_SREF R, JCR_SITEM N where N.ID=R.NODE_ID";
@@ -744,16 +743,16 @@
protected boolean hasReferenceRecord(String nodeIdentifier, String refPropertyIdentifier) throws SQLException
{
// TODO check queries
- if (findReference == null)
- findReference = dbConnection.prepareStatement(FIND_REFERENCE);
+ if (hasReference == null)
+ hasReference = dbConnection.prepareStatement(HAS_REFERENCE);
else
- findReference.clearParameters();
+ hasReference.clearParameters();
- findReference.setString(1, nodeIdentifier);
- findReference.setString(1, refPropertyIdentifier);
- ResultSet result = findReference.executeQuery();
-
- return result.next();
+ hasReference.setString(1, nodeIdentifier);
+ hasReference.setString(2, refPropertyIdentifier);
+ ResultSet result = hasReference.executeQuery();
+ result.next();
+ return (result.getInt(1) == 1);
}
@Override
16 years, 7 months
exo-jcr SVN: r913 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-02 11:48:44 -0500 (Wed, 02 Dec 2009)
New Revision: 913
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java
Log:
EXOJCR-243: Fixed: LockData was not properly cleaned on Node removing.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java 2009-12-02 10:15:13 UTC (rev 912)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/JBossCacheWorkspaceDataManager.java 2009-12-02 16:48:44 UTC (rev 913)
@@ -252,7 +252,7 @@
// This is the case, when locked node is deleted
if (item.getQName().equals(Constants.JCR_LOCKISDEEP))
{
- con.removeLockData(item.getIdentifier());
+ con.removeLockData(item.getParentIdentifier());
}
}
}
16 years, 7 months
exo-jcr SVN: r912 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/client/http.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2009-12-02 05:15:13 -0500 (Wed, 02 Dec 2009)
New Revision: 912
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/client/http/ClientTypeMap.java
Log:
EXOJCR-304 NPE risk fixed
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/client/http/ClientTypeMap.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/client/http/ClientTypeMap.java 2009-12-01 15:30:21 UTC (rev 911)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/client/http/ClientTypeMap.java 2009-12-02 10:15:13 UTC (rev 912)
@@ -94,7 +94,7 @@
String preferredMimeType = (String)preferredMimeTypeExp.evaluate(node, XPathConstants.STRING);
String renderer = (String)rendererExp.evaluate(node, XPathConstants.STRING);
HttpClientType clientInfo;
- if (renderer != null || renderer.length() > 0)
+ if (renderer != null && renderer.length() > 0)
{
clientInfo = new HttpClientType(name, userAgentPattern, preferredMimeType, renderer);
}
16 years, 7 months
exo-jcr SVN: r911 - kernel/branches/mc-int-branch/exo.kernel.mc-int.
by do-not-reply@jboss.org
Author: mstruk
Date: 2009-12-01 10:30:21 -0500 (Tue, 01 Dec 2009)
New Revision: 911
Added:
kernel/branches/mc-int-branch/exo.kernel.mc-int/README.txt
Log:
Added README.txt for a quick start
Added: kernel/branches/mc-int-branch/exo.kernel.mc-int/README.txt
===================================================================
--- kernel/branches/mc-int-branch/exo.kernel.mc-int/README.txt (rev 0)
+++ kernel/branches/mc-int-branch/exo.kernel.mc-int/README.txt 2009-12-01 15:30:21 UTC (rev 911)
@@ -0,0 +1,114 @@
+
+
+MC-INTEGRATION QUICK START
+
+
+
+
+== How to use ==
+
+
+MC integration adds two capabilities to exo-kernel. One is JBoss AOP, the other is support for mc-kernel injections, that can be used to inject mc beans deployed in JBossAS into exo-kernel deployed service objects. MC integration only works when deployed in JBossAS5. In Tomcat everything still works, no additional jars are needed, and MC integration is off.
+
+To enable a component for any of these two capabilities the component must first be marked with @InterceptMC annotation. A straight-forward way to do this is by putting the annotation on your service class. See https://svn.jboss.org/repos/exo-jcr/kernel/branches/mc-int-branch/exo.ker...
+
+Another way to do this is to apply the annotation to a specific component instance through mc-int-beans.xml configuration file.
+See https://svn.jboss.org/repos/exo-jcr/kernel/branches/mc-int-branch/exo.ker...
+
+Here 'bean' element's 'name' attribute refers to 'component' element's 'key' attribute in configuration.xml.
+See https://svn.jboss.org/repos/exo-jcr/kernel/branches/mc-int-branch/exo.ker...
+
+Annotation configuration in mc-int-beans.xml overrides any compiled annotations on classes. That means, every instance of the same service class can be specifically targeted for AOP/Injection, and any existing hardwired class annotation can be nullified through configuration.
+
+When a component is marked with @InterceptMC annotation it will have its mc-kernel injection annotations process by mc-kernel, as part of mc-kernel integration. To enable AOP, @InterceptMC's 'enableAOP' attribute has to be set to true.
+
+When AOP is enabled, a service object will be wrapped into an AOP proxy. To implement and activate some specific AOP interception, mc-beans.xml configuration file has to be used to configure AOP interception points and map concrete interceptor classes to them.
+See https://svn.jboss.org/repos/exo-jcr/kernel/branches/mc-int-branch/exo.ker...
+
+
+We obviously have to deal with several configuration files here. Let's describe what each of them is for:
+
+conf/configuration.xml ... that's eXo kernel configuration file, with eXo configurator specific syntax, used to configure DI performed by eXo kernel when configuring and instantiating service components. All gatein services are configured through this.
+
+conf/mc-int-beans.xml ... that's mc-integration configuration file that uses mc-kernel configuration library to describe annotation overrides. This configuration is read and applied by mc-integration code.
+This configuration essentially enhances configuration.xml, so even though it looks like jboss-beans configuration, its function is to additionally describe services in configuration.xml, and therefore has specific semantics.
+
+conf/mc-beans.xml ... that's mc-kernel configuration file that can be used for AOP configuration, and mc bean instantiations. It has exactly the same semantics as jboss-beans.xml, but is not supposed
+to be picked up by JBossAS deployers, because it needs to be applied by mc-integration code to mc-integration specific mc-kernel controller instance - that's why it's not called jboss-beans.xml
+
+
+
+
+== Limitations of the current AOP solution ==
+
+
+Because proxy mechanism is used to do AOP, there is a requirement that a class to be AOP-ed needs to have a public or protected zero-args constructor.
+
+Service objects that make up exo-kernel and gatein mostly use constructor based DI, and only have constructors that take some injected parameters. In order to make these eligible for AOP, we would have to make sure they all have a protected zero-args constructor.
+
+Also, when AOP is activated, field injection doesn't work even if it's turned on. This is again a limitation of proxy mechanism and inability to intercept set-field operations in java.
+
+As a rule of thumb:
+ - Always put protected or public zero-arg constructor on your service objects
+ - Don't use MC field injections - only use method injections
+
+That way your service object can be AOP-ed without side-effects.
+
+
+
+
+== Trying it out ==
+
+
+(CONSOLE 1 - exo-kernel)
+cd $REPO/exo-jcr/kernel/branches
+svn co https://svn.jboss.org/repos/exo-jcr/kernel/branches/mc-int-branch
+cd mc-int-branch
+mvn install
+
+(CONSOLE 2 - packager)
+cd $REPO/gatein/tools/packager/branches
+svn co https://svn.jboss.org/repos/gatein/tools/packager/branches/mc-integration
+cd mc-integration
+mvn install
+
+(CONSOLE 3 - portal)
+cd $REPO/gatein/portal/branches
+svn co https://svn.jboss.org/repos/gatein/portal/branches/mc-integration
+cd mc-integration
+mvn install -Dmaven.test.skip=true -Dgatein.checkout.dir=$REPO/gatein/portal/branches/mc-integration
+
+cd packaging/pkg
+
+
+
+FOR JBOSSAS:
+
+ mvn install -Ppkg-jbossas-tests -Dexo.projects.directory.dependencies=REPLACE_WITH_YOUR_OWN_DIRECTORY -Dgatein.checkout.dir=$REPO/gatein/portal/branches/mc-integration
+
+ (CONSOLE 4 - run packaged jboss)
+ cd $REPO/gatein/portal/branches/mc-integration/packaging/pkg/target/jboss/bin
+ run
+
+FOR TOMCAT:
+
+ mvn install -Ppkg-tomcat-tests -Dexo.projects.directory.dependencies=REPLACE_WITH_YOUR_OWN_DIRECTORY -Dgatein.checkout.dir=$REPO/gatein/portal/branches/mc-integration
+
+ (CONSOLE 4 - run packaged tomcat)
+ cd $REPO/gatein/portal/branches/mc-integration/packaging/pkg/target/tomcat/bin
+ gatein run
+
+
+
+(CONSOLE 1 - run integration tests)
+cd exo.kernel.tests/integration-tests
+mvn -Ptests
+
+If you run your server on non-default IP:port use something like:
+mvn -Ptests -DforkMode=none -Dserver.host=127.0.0.1 -Dserver.port=8000
+
+(Don't forget -DforkMode=none otherwise system properties won't get propagated to the test class)
+
+
+
+(eof)
\ No newline at end of file
16 years, 7 months
exo-jcr SVN: r910 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2009-12-01 03:26:27 -0500 (Tue, 01 Dec 2009)
New Revision: 910
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
Log:
EXOJCR-243: small update of TransactionableDataManager as for the locks
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-12-01 08:07:29 UTC (rev 909)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableDataManager.java 2009-12-01 08:26:27 UTC (rev 910)
@@ -24,7 +24,6 @@
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.LockPlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
-import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
@@ -272,7 +271,7 @@
*/
public LockData getLockData(String identifier) throws RepositoryException
{
- LockData lockData = null;
+ LockData lockData = storageDataManager.getLockData(identifier);
if (txStarted())
{
// This is a transaction. Check if the node was locked inside this transaction
@@ -300,7 +299,7 @@
}
}
}
- return lockData == null ? storageDataManager.getLockData(identifier) : lockData;
+ return lockData;
}
/**
16 years, 7 months
exo-jcr SVN: r909 - 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: nzamosenchuk
Date: 2009-12-01 03:07:29 -0500 (Tue, 01 Dec 2009)
New Revision: 909
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
Log:
EXOJCR-243: reimplemented addLockData() method using Node.replace() instead of put() to prevent concurrency race situation.
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-30 16:41:43 UTC (rev 908)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-12-01 08:07:29 UTC (rev 909)
@@ -1353,15 +1353,19 @@
if (oldLockData != null)
{
// if LockData already present with different lock token, then node has already been locked!
- if (oldLockData.getTokenHash() != lockData.getTokenHash())
+ if (!oldLockData.getTokenHash().equals(lockData.getTokenHash()))
{
- throw new LockException("Unable to write lock data. Node [" + lockData.getNodeIdentifier()
+ throw new LockException("Unable to write LockData. Node [" + lockData.getNodeIdentifier()
+ "] already has LockData!");
}
else
{
// token is the same, then Lock is just refreshed. Putting new LockData.
- node.put(JBossCacheStorage.LOCK_DATA, lockData);
+ if (!node.replace(JBossCacheStorage.LOCK_DATA, oldLockData, lockData))
+ {
+ throw new LockException("Unable to re-write LockData. Possibly LockData for the Node[" + lockData.getNodeIdentifier()
+ + "] has just been changed!");
+ }
}
}
}
16 years, 7 months