exo-jcr SVN: r4415 - in jcr/branches/1.12.x: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 2 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-24 00:33:12 -0400 (Tue, 24 May 2011)
New Revision: 4415
Added:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1622/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java
Log:
JCR-1622
What is the problem to fix?
* Threads are not ended when the application is stopped/restarted
so after restart we have multiple instances of these threads ( org.exoplatform.container.StandaloneContainer-db1_cmis1_cacheWorker,
and the one for db1_system too and also HSQL Timer thread)
* test case to reproduce:
start tomcat with xcmis
go to Tomcat Manager
Stop xCMIS Application
Start xCMIS Application
With a jconsole you can see that you have several times the same threads.
How is the problem fixed?
* Make components to be Startable and on stop method shutdown working threads.
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java 2011-05-24 04:12:51 UTC (rev 4414)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/LockRemoverHolder.java 2011-05-24 04:33:12 UTC (rev 4415)
@@ -20,6 +20,7 @@
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.impl.proccess.WorkerService;
+import org.picocontainer.Startable;
/**
* LockRemoverHolder holds is a single per-repository LockRemover container.
@@ -27,7 +28,7 @@
* @author <a href="mailto:karpenko.sergiy@gmail.com">Karpenko Sergiy</a>
* @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z aheritier $
*/
-public class LockRemoverHolder
+public class LockRemoverHolder implements Startable
{
/**
@@ -80,4 +81,19 @@
return new LockRemover(workerService, lockManager, timeout);
}
+ /**
+ * @see org.picocontainer.Startable#start()
+ */
+ public void start()
+ {
+ }
+
+ /**
+ * @see org.picocontainer.Startable#stop()
+ */
+ public void stop()
+ {
+ workerService.stop();
+ }
+
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-05-24 04:12:51 UTC (rev 4414)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/LinkedWorkspaceStorageCacheImpl.java 2011-05-24 04:33:12 UTC (rev 4415)
@@ -33,6 +33,7 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
+import org.picocontainer.Startable;
import java.util.ArrayList;
import java.util.Calendar;
@@ -59,7 +60,7 @@
* @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
* @version $Id: LinkedWorkspaceStorageCacheImpl.java 34801 2009-07-31 15:44:50Z dkatayev $
*/
-public class LinkedWorkspaceStorageCacheImpl implements WorkspaceStorageCache
+public class LinkedWorkspaceStorageCacheImpl implements WorkspaceStorageCache, Startable
{
/**
@@ -763,28 +764,6 @@
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- try
- {
- workerTimer.cancel();
- }
- catch (Throwable e)
- {
- System.err.println(this.name + " cache, finalyze error " + e);
- }
-
- nodesCache.clear();
- propertiesCache.clear();
- cache.clear();
-
- super.finalize();
- }
-
private void scheduleTask(TimerTask task, int start, long period)
{
Calendar firstTime = Calendar.getInstance();
@@ -2000,4 +1979,33 @@
{
return true;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void start()
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void stop()
+ {
+ if (workerTimer != null)
+ {
+ try
+ {
+ workerTimer.cancel();
+ }
+ catch (Throwable e)
+ {
+ LOG.warn(this.name + " cache, stop error " + e);
+ }
+ }
+
+ nodesCache.clear();
+ propertiesCache.clear();
+ cache.clear();
+ }
}
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java 2011-05-24 04:12:51 UTC (rev 4414)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleanerHolder.java 2011-05-24 04:33:12 UTC (rev 4415)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
+import org.picocontainer.Startable;
+
/**
* Created by The eXo Platform SAS. <br/> per workspace container file cleaner holder object
*
@@ -25,7 +27,7 @@
* @version $Id: WorkspaceFileCleanerHolder.java 11907 2008-03-13 15:36:21Z ksm $
*/
-public class FileCleanerHolder
+public class FileCleanerHolder implements Startable
{
private final FileCleaner fileCleaner;
@@ -40,4 +42,19 @@
return fileCleaner;
}
+ /**
+ * @see org.picocontainer.Startable#start()
+ */
+ public void start()
+ {
+ }
+
+ /**
+ * @see org.picocontainer.Startable#stop()
+ */
+ public void stop()
+ {
+ fileCleaner.halt();
+ }
+
}
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1622/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1622/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1622/readme.txt 2011-05-24 04:33:12 UTC (rev 4415)
@@ -0,0 +1,76 @@
+Summary
+
+ Status: Thread not stopped when the application is stopped
+ CCP Issue: N/A, Product Jira Issue: JCR-1622.
+ Complexity: Medium
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+Threads are not ended when the application is stopped/restarted
+so after restart we have multiple instances of these threads ( org.exoplatform.container.StandaloneContainer-db1_cmis1_cacheWorker, and the one for db1_system too and also HSQL Timer thread)
+
+test case to reproduce:
+
+ start tomcat with xcmis
+ go to Tomcat Manager
+ Stop xCMIS Application
+ Start xCMIS Application
+ With a jconsole you can see that you have several times the same threads.
+
+Fix description
+
+How is the problem fixed?
+
+* Make components to be Startable and on stop method shutdown working threads.
+
+Patch information:
+JCR-1622.patch
+
+Tests to perform
+
+Reproduction test
+* Steps to reproduce:
+
+Tests performed at DevLevel
+ cf above
+
+Tests performed at QA/Support Level
+ cf above
+
+Documentation changes
+
+Documentation changes:
+ No
+
+Configuration changes
+
+Configuration changes:
+ No
+
+Will previous configuration continue to work?
+ Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ N/A
+
+Function or ClassName change
+ core/webui-explorer/src/main/java/org/exoplatform/ecm/webui/component/explorer/control/UIAddressBar.java
+
+Is there a performance risk/cost?
+ No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* PL review: patch validated
+
+Support Comment
+* Support review: patch validated
+
+QA Feedbacks
+*
+
13 years
exo-jcr SVN: r4414 - in ws/branches/2.1.x: patch/2.1.9-GA/WS-265 and 1 other directory.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-24 00:12:51 -0400 (Tue, 24 May 2011)
New Revision: 4414
Added:
ws/branches/2.1.x/patch/2.1.9-GA/WS-265/readme.txt
Modified:
ws/branches/2.1.x/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
Log:
WS-265
What is the problem to fix?
* Problem of WS-264
Patch StandaloneContainerInitializedListener to get it works with relative path configured as system property
exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
* Problem of WS-265
To be able to stop all the services, it is need to call container.stop on contextDestroyed of StandaloneContainerInitializedListener.
How is the problem fixed?
* Stop the StandaloneContainer on context destroyed
Allow to set configuration from relative path
Modified: ws/branches/2.1.x/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
===================================================================
--- ws/branches/2.1.x/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java 2011-05-24 02:09:14 UTC (rev 4413)
+++ ws/branches/2.1.x/exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java 2011-05-24 04:12:51 UTC (rev 4414)
@@ -19,7 +19,6 @@
package org.exoplatform.ws.frameworks.servlet;
import org.exoplatform.container.StandaloneContainer;
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -80,13 +79,25 @@
LOG.error("Error of configurationURL read", e);
}
+ // If no configuration in web.xml check system property.
+ if (configurationURL == null)
+ configurationURL = System.getProperty(CONF_URL_PARAMETER);
+
try
{
StandaloneContainer.addConfigurationURL(configurationURL);
}
catch (MalformedURLException e)
{
- LOG.error("Error of addConfigurationURL", e);
+ // Try to use path, we do not need have full path (file:/path/conf) to configuration. Any relative path is OK.
+ try
+ {
+ StandaloneContainer.addConfigurationPath(configurationURL);
+ }
+ catch (MalformedURLException e2)
+ {
+ LOG.error("Error of addConfiguration", e2);
+ }
}
try
@@ -116,6 +127,6 @@
*/
public void contextDestroyed(ServletContextEvent event)
{
- // container.stop();
+ container.stop();
}
}
Added: ws/branches/2.1.x/patch/2.1.9-GA/WS-265/readme.txt
===================================================================
--- ws/branches/2.1.x/patch/2.1.9-GA/WS-265/readme.txt (rev 0)
+++ ws/branches/2.1.x/patch/2.1.9-GA/WS-265/readme.txt 2011-05-24 04:12:51 UTC (rev 4414)
@@ -0,0 +1,71 @@
+Summary
+
+ Status: Stop the StandaloneContainer on context destroyed
+ CCP Issue: N/A, Product Jira Issue: WS-265 fixed also WS-264
+ Complexity: Low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+Problem of WS-264
+Patch StandaloneContainerInitializedListener to get it works with relative path configured as system property
+
+exo.ws.frameworks.servlet/src/main/java/org/exoplatform/ws/frameworks/servlet/StandaloneContainerInitializedListener.java
+
+Problem of WS-265
+To be able to stop all the services, it is need to call container.stop on contextDestroyed of StandaloneContainerInitializedListener.
+Fix description
+
+How is the problem fixed?
+
+* Stop the StandaloneContainer on context destroyed
+
+ Allow to set configuration from relative path
+
+Patch information:
+WS-265.patch
+
+Tests to perform
+
+Reproduction test
+ * No
+
+Tests performed at DevLevel
+ * Functional testing in ws project
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ * No
+
+Configuration changes
+
+Configuration changes:
+ * No
+
+Will previous configuration continue to work?
+ * Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ No
+
+Is there a performance risk/cost?
+ * No
+
+Validation (PM/Support/QA)
+
+PM Comment
+* PL review: Patch validated
+
+Support Comment
+* Support review: Patch validated
+
+QA Feedbacks
+*
+
13 years
exo-jcr SVN: r4413 - in jcr/branches/1.12.x: exo.jcr.component.core/src/test/resources/conf/standalone/cluster and 1 other directories.
by do-not-reply@jboss.org
Author: paristote
Date: 2011-05-23 22:09:14 -0400 (Mon, 23 May 2011)
New Revision: 4413
Added:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1629/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml
jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml
Log:
JCR-1629
What is the problem to fix?
* For indexing, JBC is used as the temporary/transactional/cluster aware memory such that if we add an eviction policy we could miss some nodes to index
moreover using eviction algorithm such as FIFO add some contention.
How is the problem fixed?
* Removing eviction policy from configuration
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml 2011-05-23 13:26:34 UTC (rev 4412)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml 2011-05-24 02:09:14 UTC (rev 4413)
@@ -9,12 +9,4 @@
<jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
- <property name="maxNodes" value="10000" />
- <property name="minTimeToLive" value="60000" />
- </default>
- </eviction>
-
</jbosscache>
Modified: jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml 2011-05-23 13:26:34 UTC (rev 4412)
+++ jcr/branches/1.12.x/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jbosscache-indexer.xml 2011-05-24 02:09:14 UTC (rev 4413)
@@ -11,12 +11,4 @@
<jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
- <property name="maxNodes" value="10000" />
- <property name="minTimeToLive" value="60000" />
- </default>
- </eviction>
-
</jbosscache>
Added: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1629/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1629/readme.txt (rev 0)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1629/readme.txt 2011-05-24 02:09:14 UTC (rev 4413)
@@ -0,0 +1,65 @@
+Summary
+
+ Status: No eviction policy is allowed in case of the cache for indexing
+ CCP Issue: N/A, Product Jira Issue: JCR-1629.
+ Complexity: Low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+For indexing, JBC is used as the temporary/transactional/cluster aware memory such that if we add an eviction policy we could miss some nodes to index moreover using eviction algorithm such as FIFO add some contention.
+Fix description
+
+How is the problem fixed?
+
+** *removing eviction policy from configuration
+
+
+
+Patch information:
+JCR-1629.patch
+
+Tests to perform
+
+Reproduction test
+ * No
+
+Tests performed at DevLevel
+ * functional testing in jcr-core project
+
+Tests performed at QA/Support Level
+*
+
+Documentation changes
+
+Documentation changes:
+ * No
+
+Configuration changes
+
+Configuration changes:
+ * Eviction policy is removed from cache index configuration
+
+Will previous configuration continue to work?
+ * Yes
+
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+ No
+
+Is there a performance risk/cost?
+ * No
+
+Validation (PM/Support/QA)
+
+PM Comment
+*
+
+Support Comment
+*
+
+QA Feedbacks
+*
+
13 years
exo-jcr SVN: r4412 - jcr/trunk/exo.jcr.component.webdav.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 09:26:34 -0400 (Mon, 23 May 2011)
New Revision: 4412
Modified:
jcr/trunk/exo.jcr.component.webdav/pom.xml
Log:
EXOJCR-945: Cleanup build
Modified: jcr/trunk/exo.jcr.component.webdav/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
+++ jcr/trunk/exo.jcr.component.webdav/pom.xml 2011-05-23 13:26:34 UTC (rev 4412)
@@ -106,7 +106,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<excludes>
<exclude>**/TestUtils.java</exclude>
<exclude>**/OrderPatchTest.java</exclude>
13 years
exo-jcr SVN: r4411 - in jcr/trunk: applications/exo.jcr.applications.jboss and 20 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 09:24:45 -0400 (Mon, 23 May 2011)
New Revision: 4411
Added:
jcr/trunk/applications/exo.jcr.ear/src/main/application/META-INF/jboss-app.xml
jcr/trunk/applications/product-patches/as/jboss/ds/
jcr/trunk/applications/product-patches/as/jboss/ds/jcr-ds.xml
jcr/trunk/exo.jcr.connectors.jca/
jcr/trunk/exo.jcr.connectors.jca/pom.xml
jcr/trunk/exo.jcr.connectors.jca/src/
jcr/trunk/exo.jcr.connectors.jca/src/main/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/adapter/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/adapter/SessionFactory.java
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionFactory.java
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionImpl.java
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/RepositoryResourceAdapter.java
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionFactoryImpl.java
jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionRequestInfo.java
jcr/trunk/exo.jcr.connectors.jca/src/main/rar/
jcr/trunk/exo.jcr.connectors.jca/src/main/rar/META-INF/
jcr/trunk/exo.jcr.connectors.jca/src/main/rar/META-INF/ra.xml
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/jca.xml
Removed:
jcr/trunk/exo.jcr.connectors.localadapter/
Modified:
jcr/trunk/applications/exo.jcr.applications.jboss/pom.xml
jcr/trunk/applications/exo.jcr.ear/pom.xml
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.xml
jcr/trunk/pom.xml
Log:
EXOJCR-1328: JCA support
Modified: jcr/trunk/applications/exo.jcr.applications.jboss/pom.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.jboss/pom.xml 2011-05-23 13:19:32 UTC (rev 4410)
+++ jcr/trunk/applications/exo.jcr.applications.jboss/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -120,6 +120,9 @@
<copy todir="${exo.projects.directory.working}/exo-jboss/server/default/conf/" verbose="true" overwrite="true">
<fileset dir="${basedir}/../product-patches/as/jboss/exoplatform.sar/META-INF/" includes="login*.xml" />
</copy>
+ <copy todir="${exo.projects.directory.working}/exo-jboss/server/default/deploy/" verbose="true" overwrite="true">
+ <fileset dir="${basedir}/../product-patches/as/jboss/ds/" includes="*.xml" />
+ </copy>
<copy todir="${exo.projects.directory.working}/exo-jboss/bin/" verbose="true" overwrite="true">
<fileset dir="${basedir}/../product-patches/as/jboss/bin/" includes="*.*" />
</copy>
Modified: jcr/trunk/applications/exo.jcr.ear/pom.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.ear/pom.xml 2011-05-23 13:19:32 UTC (rev 4410)
+++ jcr/trunk/applications/exo.jcr.ear/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -35,17 +35,67 @@
<dependencies>
<dependency>
<groupId>org.exoplatform.jcr</groupId>
- <artifactId>exo.jcr.connectors.localadapter</artifactId>
+ <artifactId>exo.jcr.connectors.jca</artifactId>
<scope>runtime</scope>
<type>rar</type>
</dependency>
<dependency>
<groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.component.core</artifactId>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.parsers</groupId>
+ <artifactId>jaxp-ri</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.component.ext</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.component.ftp</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.framework.command</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.framework.ftpclient</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.framework.web</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.ws</groupId>
+ <artifactId>exo.ws.frameworks.servlet</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.rest</artifactId>
<scope>runtime</scope>
<type>war</type>
</dependency>
<dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.jcr</groupId>
<artifactId>exo.jcr.applications.browser</artifactId>
<scope>runtime</scope>
@@ -79,8 +129,7 @@
<role-name>administrators</role-name>
</security-role>
</security>
- <!-- all deps jars inside the rar, so copy all jars in-self -->
- <defaultLibBundleDir>../APP-INF/lib</defaultLibBundleDir>
+ <defaultLibBundleDir>APP-INF/lib</defaultLibBundleDir>
<archive>
<manifest>
<addClasspath>true</addClasspath>
@@ -89,7 +138,7 @@
<modules>
<rarModule>
<groupId>org.exoplatform.jcr</groupId>
- <artifactId>exo.jcr.connectors.localadapter</artifactId>
+ <artifactId>exo.jcr.connectors.jca</artifactId>
<bundleFileName>exo-jcr.rar</bundleFileName>
</rarModule>
<webModule>
Added: jcr/trunk/applications/exo.jcr.ear/src/main/application/META-INF/jboss-app.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.ear/src/main/application/META-INF/jboss-app.xml (rev 0)
+++ jcr/trunk/applications/exo.jcr.ear/src/main/application/META-INF/jboss-app.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,25 @@
+<?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.
+
+-->
+<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">
+<jboss-app>
+<library-directory>APP-INF/lib</library-directory>
+</jboss-app>
\ No newline at end of file
Added: jcr/trunk/applications/product-patches/as/jboss/ds/jcr-ds.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jboss/ds/jcr-ds.xml (rev 0)
+++ jcr/trunk/applications/product-patches/as/jboss/ds/jcr-ds.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<connection-factories>
+
+ <tx-connection-factory>
+
+ <jndi-name>jcr/repository</jndi-name>
+
+ <xa-transaction/>
+
+ <rar-name>exo.jcr.ear.ear#exo-jcr.rar</rar-name>
+
+ <adapter-display-name>eXo JCR Adapter</adapter-display-name>
+ <connection-definition>org.exoplatform.connectors.jcr.adapter.SessionFactory</connection-definition>
+ <!--
+ <config-property name="PortalContainer" type="java.lang.String">portal</config-property>
+ -->
+ <config-property name="Repository" type="java.lang.String">repository</config-property>
+ </tx-connection-factory>
+
+</connection-factories>
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-05-23 13:19:32 UTC (rev 4410)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -140,10 +140,6 @@
<artifactId>picocontainer</artifactId>
</dependency>
<dependency>
- <groupId>javax.resource</groupId>
- <artifactId>connector-api</artifactId>
- </dependency>
- <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
Added: jcr/trunk/exo.jcr.connectors.jca/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/pom.xml (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>jcr-parent</artifactId>
+ <version>1.14.0-GA-SNAPSHOT</version>
+ </parent>
+ <artifactId>exo.jcr.connectors.jca</artifactId>
+ <packaging>rar</packaging>
+ <name>eXo JCR :: Connector :: JCA</name>
+ <description>JCA resource adapter for eXo JCR</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.exoplatform.jcr</groupId>
+ <artifactId>exo.jcr.component.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.resource</groupId>
+ <artifactId>connector-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/rar</directory>
+ <targetPath>${project.build.directory}</targetPath>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <!-- We manually ask to create the JAR and it is automatically included in the RAR -->
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-rar-plugin</artifactId>
+ <configuration>
+ <raXmlFile>${project.build.directory}/META-INF/ra.xml</raXmlFile>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/adapter/SessionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/adapter/SessionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/adapter/SessionFactory.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,73 @@
+/*
+ * 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.connectors.jcr.adapter;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.resource.cci.ConnectionFactory;
+
+/**
+ * The equivalent of a {@link ConnectionFactory} for the JCR
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public interface SessionFactory
+{
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the default workspace.
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession() throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the default workspace, using
+ * the given user name and password.
+ * @param userName the user name to use for the authentication
+ * @param password the password to use for the authentication
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String userName, String password) throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the given workspace.
+ * @param workspace the name of the expected workspace
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String workspace) throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the given workspace, using
+ * the given user name and password.
+ * @param workspace the name of the expected workspace
+ * @param userName the user name to use for the authentication
+ * @param password the password to use for the authentication
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String workspace, String userName, String password) throws RepositoryException;
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionFactory.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionFactory.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,342 @@
+/*
+ * 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.connectors.jcr.impl.adapter;
+
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
+import org.exoplatform.services.jcr.RepositoryService;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.PrintWriter;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.jcr.Credentials;
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+
+/**
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class ManagedSessionFactory implements ManagedConnectionFactory
+{
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID = 2298804451713956342L;
+
+ /**
+ * Logger
+ */
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.ManagedSessionFactory");
+
+ /**
+ * The default name of the portal container
+ */
+ private String portalContainer;
+
+ /**
+ * The name of the repository
+ */
+ private String repository;
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory()
+ */
+ public Object createConnectionFactory() throws ResourceException
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("createConnectionFactory()");
+ }
+ throw new NotSupportedException("Only managed environments are supported");
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#createConnectionFactory(javax.resource.spi.ConnectionManager)
+ */
+ public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("createConnectionFactory(" + cxManager + ")");
+ }
+ return new SessionFactoryImpl(cxManager, this);
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#createManagedConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
+ */
+ public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException
+ {
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("createManagedConnection(" + subject + "," + cxRequestInfo + ")");
+ }
+ if (!(cxRequestInfo instanceof SessionRequestInfo))
+ {
+ throw new ResourceException("The connection request info must be an instance of type SessionRequestInfo");
+ }
+ ExoContainer container = getContainer();
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("createManagedConnection: container = " + container.getContext().getName());
+ }
+ RepositoryService rs = (RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
+ if (rs == null)
+ {
+ throw new ResourceException("No RepositoryService could be found in the container "
+ + container.getContext().getName());
+ }
+ ManageableRepository mRepository = getRepository(rs);
+ SessionRequestInfo sri = (SessionRequestInfo)cxRequestInfo;
+ String workspaceName = sri.getWorkspace();
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("createManagedConnection: workspace = " + (workspaceName == null ? "'default'" : workspaceName));
+ }
+ Credentials credentials = getCredentials(subject, sri);
+ SessionImpl session = null;
+ try
+ {
+ session = (SessionImpl)mRepository.login(credentials, workspaceName);
+ }
+ catch (Exception e)
+ {
+ throw new ResourceException("Could not login to the workspace " + (workspaceName == null ? "'default'" : workspaceName), e);
+ }
+ return new ManagedSessionImpl(session);
+ }
+
+ /**
+ * Gets the credentials from the subject, if it cannot be found and the user name
+ * has been set in the {@link SessionRequestInfo}, we will use the credentials
+ * from the {@link SessionRequestInfo}, otherwise we will use the credentials
+ * defined in the configuration of the {@link ManagedSessionFactory}.
+ */
+ private Credentials getCredentials(final Subject subject, SessionRequestInfo sri) throws ResourceException
+ {
+ CredentialsImpl credentials = null;
+ if (subject != null)
+ {
+ credentials = AccessController.doPrivileged(new PrivilegedAction<CredentialsImpl>()
+ {
+ public CredentialsImpl run()
+ {
+ Iterator<Object> i = subject.getPrivateCredentials().iterator();
+ while (i.hasNext())
+ {
+ Object o = i.next();
+ if (o instanceof PasswordCredential)
+ {
+ PasswordCredential cred = (PasswordCredential)o;
+ if (cred.getManagedConnectionFactory().equals(ManagedSessionFactory.this))
+ {
+ return new CredentialsImpl(cred.getUserName(), cred.getPassword());
+ }
+ }
+ }
+ return null;
+ }
+ });
+ }
+ if (credentials == null && sri.getUserName() != null)
+ {
+ credentials =
+ new CredentialsImpl(sri.getUserName(), sri.getPassword() == null ? null : sri.getPassword()
+ .toCharArray());
+ }
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getCredentials: login = " + (credentials == null ? "undefined" : credentials.getUserID()));
+ }
+ return credentials;
+ }
+
+ /**
+ * Gets the repository corresponding to the given context, if a repository name
+ * has been defined in the configuration of the {@link ManagedSessionFactory}
+ * it will try to get it otherwise it will get the current repository
+ */
+ private ManageableRepository getRepository(RepositoryService rs) throws ResourceException
+ {
+ ManageableRepository mRepository = null;
+ try
+ {
+ mRepository = repository == null ? rs.getCurrentRepository() : rs.getRepository(repository);
+ }
+ catch (Exception e)
+ {
+ throw new ResourceException("Could not get the "
+ + (repository == null ? "current repository." : "repository '" + repository + "'"), e);
+ }
+ if (mRepository == null)
+ {
+ throw new ResourceException("Could not find the "
+ + (repository == null ? "current repository." : "repository '" + repository + "'"));
+ }
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getRepository: repository = " + (repository == null ? "current." : repository));
+ }
+
+ return mRepository;
+ }
+
+ /**
+ * Gets the container from the current context
+ */
+ private ExoContainer getContainer() throws ResourceException
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ if (container instanceof RootContainer)
+ {
+ String portalContainerName =
+ portalContainer == null ? PortalContainer.DEFAULT_PORTAL_CONTAINER_NAME : portalContainer;
+ container = RootContainer.getInstance().getPortalContainer(portalContainerName);
+ if (container == null)
+ {
+ throw new ResourceException("The eXo container is null, because the current container is a RootContainer "
+ + "and there is no PortalContainer with the name '" + portalContainerName + "'.");
+ }
+ }
+ else if (container == null)
+ {
+ throw new ResourceException("The eXo container is null, because the current container is null.");
+ }
+ return container;
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#getLogWriter()
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#matchManagedConnections(java.util.Set, javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
+ */
+ public ManagedConnection matchManagedConnections(@SuppressWarnings("rawtypes") Set connectionSet, Subject subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ throw new NotSupportedException("The JCR sessions are not shareable");
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnectionFactory#setLogWriter(java.io.PrintWriter)
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ }
+
+ /**
+ * @return the portalContainer
+ */
+ public String getPortalContainer()
+ {
+ return portalContainer;
+ }
+
+ /**
+ * @param portalContainer the portalContainer to set
+ */
+ public void setPortalContainer(String portalContainer)
+ {
+ this.portalContainer = portalContainer;
+ }
+
+ /**
+ * @return the repository
+ */
+ public String getRepository()
+ {
+ return repository;
+ }
+
+ /**
+ * @param repository the repository to set
+ */
+ public void setRepository(String repository)
+ {
+ this.repository = repository;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((portalContainer == null) ? 0 : portalContainer.hashCode());
+ result = prime * result + ((repository == null) ? 0 : repository.hashCode());
+ return result;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ManagedSessionFactory other = (ManagedSessionFactory)obj;
+ if (portalContainer == null)
+ {
+ if (other.portalContainer != null)
+ return false;
+ }
+ else if (!portalContainer.equals(other.portalContainer))
+ return false;
+ if (repository == null)
+ {
+ if (other.repository != null)
+ return false;
+ }
+ else if (!repository.equals(other.repository))
+ return false;
+ return true;
+ }
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionImpl.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/ManagedSessionImpl.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,205 @@
+/*
+ * 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.connectors.jcr.impl.adapter;
+
+import org.exoplatform.services.jcr.core.ExtendedSession;
+import org.exoplatform.services.jcr.core.SessionLifecycleListener;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.PrintWriter;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.resource.NotSupportedException;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ConnectionEventListener;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.LocalTransaction;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionMetaData;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
+/**
+ * The implementation of a {@link ManagedConnection} for eXo JCR.
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class ManagedSessionImpl implements ManagedConnection
+{
+
+ /**
+ * Logger
+ */
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.ManagedSessionImpl");
+
+ /**
+ * The corresponding JCR session
+ */
+ private final SessionImpl session;
+
+ /**
+ * The list of all the existing listeners
+ */
+ private final List<ConnectionEventListener> listeners;
+
+ ManagedSessionImpl(SessionImpl session)
+ {
+ this.session = session;
+ this.listeners = new CopyOnWriteArrayList<ConnectionEventListener>();
+ session.registerLifecycleListener(new SessionLifecycleListener()
+ {
+ public void onCloseSession(ExtendedSession session)
+ {
+ onConnectionClosed();
+ }
+ });
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#addConnectionEventListener(javax.resource.spi.ConnectionEventListener)
+ */
+ public void addConnectionEventListener(ConnectionEventListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#associateConnection(java.lang.Object)
+ */
+ public void associateConnection(Object connection) throws ResourceException
+ {
+ throw new NotSupportedException("The JCR sessions are not shareable");
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#cleanup()
+ */
+ public void cleanup() throws ResourceException
+ {
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#destroy()
+ */
+ public void destroy() throws ResourceException
+ {
+ session.logout();
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#getConnection(javax.security.auth.Subject, javax.resource.spi.ConnectionRequestInfo)
+ */
+ public Object getConnection(Subject subject, ConnectionRequestInfo cxRequestInfo) throws ResourceException
+ {
+ return session;
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#getLocalTransaction()
+ */
+ public LocalTransaction getLocalTransaction() throws ResourceException
+ {
+ throw new NotSupportedException("Local transactions are not supported");
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#getLogWriter()
+ */
+ public PrintWriter getLogWriter() throws ResourceException
+ {
+ return null;
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#getMetaData()
+ */
+ public ManagedConnectionMetaData getMetaData() throws ResourceException
+ {
+ return new ManagedConnectionMetaData()
+ {
+ public String getUserName() throws ResourceException
+ {
+ return session.getUserID();
+ }
+
+ public int getMaxConnections() throws ResourceException
+ {
+ return 0;
+ }
+
+ public String getEISProductVersion() throws ResourceException
+ {
+ return "1.14";
+ }
+
+ public String getEISProductName() throws ResourceException
+ {
+ return "eXo JCR";
+ }
+ };
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#getXAResource()
+ */
+ public XAResource getXAResource() throws ResourceException
+ {
+ return session.getXAResource();
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#removeConnectionEventListener(javax.resource.spi.ConnectionEventListener)
+ */
+ public void removeConnectionEventListener(ConnectionEventListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ /**
+ * @see javax.resource.spi.ManagedConnection#setLogWriter(java.io.PrintWriter)
+ */
+ public void setLogWriter(PrintWriter out) throws ResourceException
+ {
+ }
+
+ /**
+ * Broadcasts the connection closed event
+ */
+ private void onConnectionClosed()
+ {
+ ConnectionEvent evt = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
+ for (ConnectionEventListener listener : listeners)
+ {
+ try
+ {
+ listener.connectionClosed(evt);
+ }
+ catch (Exception e1)
+ {
+ LOG.warn("An error occurs while notifying the listener " + listener, e1);
+ }
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/RepositoryResourceAdapter.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/RepositoryResourceAdapter.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/RepositoryResourceAdapter.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,74 @@
+/*
+ * 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.connectors.jcr.impl.adapter;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.transaction.xa.XAResource;
+
+/**
+ * A dummy ResourceAdapter
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class RepositoryResourceAdapter implements ResourceAdapter
+{
+
+ /**
+ * @see javax.resource.spi.ResourceAdapter#endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)
+ */
+ public void endpointActivation(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws ResourceException
+ {
+ }
+
+ /**
+ * @see javax.resource.spi.ResourceAdapter#endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)
+ */
+ public void endpointDeactivation(MessageEndpointFactory endpointFactory, ActivationSpec spec)
+ {
+ }
+
+ /**
+ * @see javax.resource.spi.ResourceAdapter#getXAResources(javax.resource.spi.ActivationSpec[])
+ */
+ public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException
+ {
+ return new XAResource[0];
+ }
+
+ /**
+ * @see javax.resource.spi.ResourceAdapter#start(javax.resource.spi.BootstrapContext)
+ */
+ public void start(BootstrapContext ctx) throws ResourceAdapterInternalException
+ {
+ }
+
+ /**
+ * @see javax.resource.spi.ResourceAdapter#stop()
+ */
+ public void stop()
+ {
+ }
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionFactoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionFactoryImpl.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionFactoryImpl.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,135 @@
+/*
+ * 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.connectors.jcr.impl.adapter;
+
+import org.exoplatform.connectors.jcr.adapter.SessionFactory;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.ResourceException;
+import javax.resource.spi.ConnectionManager;
+
+/**
+ * The default implementation of the {@link SessionFactory}.
+ *
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class SessionFactoryImpl implements SessionFactory
+{
+
+ /**
+ * Logger
+ */
+ private static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.SessionFactoryImpl");
+
+ /**
+ * The serial version UID
+ */
+ private static final long serialVersionUID = 6643308860647346790L;
+
+ /**
+ * The reference
+ */
+ private Reference reference;
+
+ /**
+ * The connection manager
+ */
+ private final ConnectionManager cm;
+
+ /**
+ * The managed session factory
+ */
+ private final ManagedSessionFactory msf;
+
+ /**
+ * The default constructor
+ */
+ SessionFactoryImpl(ConnectionManager cm, ManagedSessionFactory msf)
+ {
+ this.cm = cm;
+ this.msf = msf;
+ }
+
+ /**
+ * @see javax.resource.Referenceable#setReference(javax.naming.Reference)
+ */
+ public void setReference(Reference reference)
+ {
+ this.reference = reference;
+ }
+
+ /**
+ * @see javax.naming.Referenceable#getReference()
+ */
+ public Reference getReference() throws NamingException
+ {
+ return reference;
+ }
+
+ /**
+ * @see org.exoplatform.connectors.jcr.adapter.SessionFactory#getSession()
+ */
+ public Session getSession() throws RepositoryException
+ {
+ return getSession(null);
+ }
+
+ /**
+ * @see org.exoplatform.connectors.jcr.adapter.SessionFactory#getSession(java.lang.String, java.lang.String)
+ */
+ public Session getSession(String userName, String password) throws RepositoryException
+ {
+ return getSession(null, userName, password);
+ }
+
+ /**
+ * @see org.exoplatform.connectors.jcr.adapter.SessionFactory#getSession(java.lang.String)
+ */
+ public Session getSession(String workspace) throws RepositoryException
+ {
+ return getSession(workspace, null, null);
+ }
+
+ /**
+ * @see org.exoplatform.connectors.jcr.adapter.SessionFactory#getSession(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public Session getSession(String workspace, String userName, String password) throws RepositoryException
+ {
+ SessionRequestInfo sri = new SessionRequestInfo(workspace, userName, password);
+ if (LOG.isDebugEnabled())
+ {
+ LOG.debug("getSession " + sri);
+ }
+ try
+ {
+ return (Session)cm.allocateConnection(msf, sri);
+ }
+ catch (ResourceException e)
+ {
+ throw new RepositoryException("Could not allocate a connection", e);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionRequestInfo.java
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionRequestInfo.java (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/java/org/exoplatform/connectors/jcr/impl/adapter/SessionRequestInfo.java 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,139 @@
+/*
+ * 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.connectors.jcr.impl.adapter;
+
+import javax.resource.spi.ConnectionRequestInfo;
+
+/**
+ * @author <a href="mailto:nfilotto@exoplatform.com">Nicolas Filotto</a>
+ * @version $Id$
+ *
+ */
+public class SessionRequestInfo implements ConnectionRequestInfo
+{
+
+ /**
+ * The name of the expected workspace
+ */
+ private final String workspace;
+
+ /**
+ * The user name to use for the authentication
+ */
+ private final String userName;
+
+ /**
+ * The password to use for the authentication
+ */
+ private final String password;
+
+ /**
+ * The default constructor
+ */
+ SessionRequestInfo(String workspace, String userName, String password)
+ {
+ this.workspace = workspace;
+ this.userName = userName;
+ this.password = password;
+ }
+
+ /**
+ * @return the workspace
+ */
+ public String getWorkspace()
+ {
+ return workspace;
+ }
+
+ /**
+ * @return the userName
+ */
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ /**
+ * @return the password
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return "SessionRequestInfo [workspace=" + workspace + ", userName=" + userName + ", password=" + password + "]";
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((workspace == null) ? 0 : workspace.hashCode());
+ result = prime * result + ((userName == null) ? 0 : userName.hashCode());
+ result = prime * result + ((password == null) ? 0 : password.hashCode());
+ return result;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SessionRequestInfo other = (SessionRequestInfo)obj;
+ if (workspace == null)
+ {
+ if (other.workspace != null)
+ return false;
+ }
+ else if (!workspace.equals(other.workspace))
+ return false;
+ if (userName == null)
+ {
+ if (other.userName != null)
+ return false;
+ }
+ else if (!userName.equals(other.userName))
+ return false;
+ if (password == null)
+ {
+ if (other.password != null)
+ return false;
+ }
+ else if (!password.equals(other.password))
+ return false;
+ return true;
+ }
+}
Added: jcr/trunk/exo.jcr.connectors.jca/src/main/rar/META-INF/ra.xml
===================================================================
--- jcr/trunk/exo.jcr.connectors.jca/src/main/rar/META-INF/ra.xml (rev 0)
+++ jcr/trunk/exo.jcr.connectors.jca/src/main/rar/META-INF/ra.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<connector xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+ http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
+ version="1.5">
+
+ <description>Resource Adapter for eXo JCR</description>
+ <display-name>eXo JCR ResourceAdapter</display-name>
+
+ <vendor-name>eXo Platform SAS</vendor-name>
+ <eis-type />
+ <resourceadapter-version>${project.version}</resourceadapter-version>
+ <license>
+ <license-required>false</license-required>
+ </license>
+
+ <resourceadapter>
+ <resourceadapter-class>org.exoplatform.connectors.jcr.impl.adapter.RepositoryResourceAdapter</resourceadapter-class>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <managedconnectionfactory-class>org.exoplatform.connectors.jcr.impl.adapter.ManagedSessionFactory</managedconnectionfactory-class>
+ <config-property>
+ <description>In case of the portal mode, if no portal container can be found in the context of the request, the adapter will use the value of this parameter to get the name of the expected portal container to create the JCR sessions. In case of a standalone mode, this parameter is not used. This parameter is optional, by default the default portal container will be used.</description>
+ <config-property-name>PortalContainer</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <config-property>
+ <description>The repository name used to create JCR sessions. This parameter is optional, by default the current repository will be used.</description>
+ <config-property-name>Repository</config-property-name>
+ <config-property-type>java.lang.String</config-property-type>
+ </config-property>
+ <connectionfactory-interface>org.exoplatform.connectors.jcr.adapter.SessionFactory</connectionfactory-interface>
+ <connectionfactory-impl-class>org.exoplatform.connectors.jcr.impl.adapter.SessionFactoryImpl</connectionfactory-impl-class>
+ <connection-interface>javax.jcr.Session</connection-interface>
+ <connection-impl-class>org.exoplatform.services.jcr.impl.core.SessionImpl</connection-impl-class>
+ </connection-definition>
+ <transaction-support>XATransaction</transaction-support>
+ <authentication-mechanism>
+ <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
+ <credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
+ </authentication-mechanism>
+ <reauthentication-support>false</reauthentication-support>
+ </outbound-resourceadapter>
+ </resourceadapter>
+</connector>
\ No newline at end of file
Added: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/jca.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/jca.xml (rev 0)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/jca.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="JCR.JCA">
+ <?dbhtml filename="ch-jca.html"?>
+
+ <title>The <emphasis>JCA</emphasis> Resource Adapter</title>
+
+ <section>
+ <title>Overview</title>
+
+ <para>eXo JCR supports <emphasis>J2EE Connector Architecture</emphasis>
+ 1.5, thus If you would like to delegate the JCR Session lifecycle to your
+ application server, you can use the JCA Resource Adapter for eXo JCR if
+ your application server supports JCA 1.5. This adapter only supports XA
+ Transaction, in other words you cannot use it for local transactions.
+ Since the JCR Sessions have not been designed to be shareable, the session
+ pooling is simply not covered by the adapter.</para>
+ </section>
+
+ <section>
+ <title>The <emphasis>SessionFactory</emphasis></title>
+
+ <para>The equivalent of the
+ <emphasis>javax.resource.cci.ConnectionFactory</emphasis> in JCA
+ terminology is
+ <emphasis>org.exoplatform.connectors.jcr.adapter.SessionFactory</emphasis>
+ in the context of eXo JCR, the resource that you will get thanks to a JNDI
+ lookup is of type <emphasis>SessionFactory</emphasis> and provides the
+ following methods:</para>
+
+ <programlisting> /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the default workspace.
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession() throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the default workspace, using
+ * the given user name and password.
+ * @param userName the user name to use for the authentication
+ * @param password the password to use for the authentication
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String userName, String password) throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the given workspace.
+ * @param workspace the name of the expected workspace
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String workspace) throws RepositoryException;
+
+ /**
+ * Get a JCR session corresponding to the repository
+ * defined in the configuration and the given workspace, using
+ * the given user name and password.
+ * @param workspace the name of the expected workspace
+ * @param userName the user name to use for the authentication
+ * @param password the password to use for the authentication
+ * @return a JCR session corresponding to the criteria
+ * @throws RepositoryException if the session could not be created
+ */
+ Session getSession(String workspace, String userName, String password) throws RepositoryException;</programlisting>
+ </section>
+
+ <section>
+ <title>Configuration</title>
+
+ <table>
+ <title>Configuration Properties</title>
+
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry><emphasis>PortalContainer</emphasis></entry>
+
+ <entry>In case of the portal mode, if no portal container can be
+ found in the context of the request, the adapter will use the
+ value of this parameter to get the name of the expected portal
+ container to create the JCR sessions. In case of a standalone
+ mode, this parameter is not used. This parameter is optional, by
+ default the default portal container will be used.</entry>
+ </row>
+
+ <row>
+ <entry><emphasis>Repository</emphasis></entry>
+
+ <entry>The repository name used to create JCR sessions. This
+ parameter is optional, by default the current repository will be
+ used.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Deployment</title>
+
+ <para>In case of the standalone mode where the JCR and its dependencies
+ are not provided, you will need to deploy the whole ear file corresponding
+ to the artifactId <emphasis>exo.jcr.ear</emphasis> and groupId
+ <emphasis>org.exoplatform.jcr</emphasis>, the rar file is embedded into
+ the ear file. In case the JCR and its dependencies are provided like when
+ you use it with gateIn for example, you will need to deploy only the rar
+ file corresponding to the artifactId
+ <emphasis>exo.jcr.connectors.jca</emphasis> and groupId
+ <emphasis>org.exoplatform.jcr</emphasis>.</para>
+
+ <para>Then you will need to configure the connector itself, for example
+ for JBoss AS, you need to create in your deploy directory a file of type
+ <emphasis>*-ds.xml</emphasis> (jcr-ds.xml for example) with the following
+ content:</para>
+
+ <programlisting><connection-factories>
+ <tx-connection-factory>
+ <jndi-name>jcr/repository</jndi-name>
+ <xa-transaction/>
+ <!-- The rar name will be exo.jcr.connectors.jca.X.Y.Z.rar in case you deploy only the rar file -->
+ <rar-name>exo.jcr.ear.ear#exo-jcr.rar</rar-name>
+ <adapter-display-name>eXo JCR Adapter</adapter-display-name>
+ <connection-definition>org.exoplatform.connectors.jcr.adapter.SessionFactory</connection-definition>
+ <!--
+ <config-property name="PortalContainer" type="java.lang.String">portal</config-property>
+ -->
+ <config-property name="Repository" type="java.lang.String">repository</config-property>
+ </tx-connection-factory>
+</connection-factories></programlisting>
+ </section>
+</chapter>
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.xml 2011-05-23 13:19:32 UTC (rev 4410)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -132,6 +132,9 @@
<xi:include href="jcr/jta.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="jcr/jca.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
<xi:include href="jcr/other/acl.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2011-05-23 13:19:32 UTC (rev 4410)
+++ jcr/trunk/pom.xml 2011-05-23 13:24:45 UTC (rev 4411)
@@ -191,7 +191,7 @@
</dependency>
<dependency>
<groupId>org.exoplatform.jcr</groupId>
- <artifactId>exo.jcr.connectors.localadapter</artifactId>
+ <artifactId>exo.jcr.connectors.jca</artifactId>
<type>rar</type>
<version>${project.version}</version>
</dependency>
@@ -473,7 +473,7 @@
<module>exo.jcr.component.ext</module>
<module>exo.jcr.component.ftp</module>
<module>exo.jcr.component.webdav</module>
- <module>exo.jcr.connectors.localadapter</module>
+ <module>exo.jcr.connectors.jca</module>
<module>exo.jcr.framework.command</module>
<module>exo.jcr.framework.web</module>
<module>exo.jcr.framework.ftpclient</module>
13 years
exo-jcr SVN: r4410 - jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1632.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 09:19:32 -0400 (Mon, 23 May 2011)
New Revision: 4410
Modified:
jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1632/JCR-1632.patch
Log:
JCR-1632: patch updated
Modified: jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1632/JCR-1632.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1632/JCR-1632.patch 2011-05-23 12:46:38 UTC (rev 4409)
+++ jcr/branches/1.12.x/patch/1.12.9-GA/JCR-1632/JCR-1632.patch 2011-05-23 13:19:32 UTC (rev 4410)
@@ -1,3 +1,15 @@
+Index: exo.jcr.component.webdav/pom.xml
+===================================================================
+--- exo.jcr.component.webdav/pom.xml (revision 4403)
++++ exo.jcr.component.webdav/pom.xml (working copy)
+@@ -107,6 +107,7 @@
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
++ <argLine>${env.MAVEN_OPTS} -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=${project.build.directory}</argLine>
+ <excludes>
+ <exclude>**/TestUtils.java</exclude>
+ <exclude>**/OrderPatchTest.java</exclude>
Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
===================================================================
--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java (revision 4403)
13 years
exo-jcr SVN: r4409 - jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 08:46:38 -0400 (Mon, 23 May 2011)
New Revision: 4409
Modified:
jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
Log:
EXOJCR-480: Managed transactions support
Modified: jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-05-23 12:42:27 UTC (rev 4408)
+++ jcr/trunk/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/fs/IncrementalBackupJob.java 2011-05-23 12:46:38 UTC (rev 4409)
@@ -235,7 +235,7 @@
*/
public boolean isTXAware()
{
- return true;
+ return false;
}
}
13 years
exo-jcr SVN: r4408 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/impl/dataflow/persistent and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 08:42:27 -0400 (Mon, 23 May 2011)
New Revision: 4408
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/WorkspacePersistentDataManager.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java
Log:
EXOJCR-480: Managed transactions support
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 2011-05-23 09:50:30 UTC (rev 4407)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java 2011-05-23 12:42:27 UTC (rev 4408)
@@ -713,19 +713,21 @@
private void doSave(final ItemStateChangesLog changesLog) throws RepositoryException
{
+ ChangesLogWrapper logWrapper = new ChangesLogWrapper(changesLog);
+
if (isTxAware())
{
if (txResourceManager != null && txResourceManager.isGlobalTxActive())
{
- super.save(changesLog);
- registerListener(changesLog);
+ super.save(logWrapper);
+ registerListener(logWrapper);
}
else
{
doBegin();
try
{
- super.save(changesLog);
+ super.save(logWrapper);
}
catch (Exception e)
{
@@ -741,16 +743,16 @@
}
doCommit();
// notify listeners after storage commit
- notifySaveItems(changesLog, false);
+ notifySaveItems(logWrapper.getChangesLog(), false);
}
}
else
{
// save normally
- super.save(changesLog);
+ super.save(logWrapper);
// notify listeners after storage commit
- notifySaveItems(changesLog, false);
+ notifySaveItems(logWrapper.getChangesLog(), false);
}
}
@@ -800,13 +802,13 @@
LOG.error("Rollback error ", e);
}
}
-
+
/**
* This will allow to notify listeners that are not TxAware once the Tx is committed
- * @param changesLog
+ * @param logWrapper
* @throws RepositoryException if any error occurs
*/
- private void registerListener(final ItemStateChangesLog changesLog) throws RepositoryException
+ private void registerListener(final ChangesLogWrapper logWrapper) throws RepositoryException
{
try
{
@@ -842,7 +844,7 @@
// 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
transactionManager.suspend();
- notifySaveItems(changesLog, false);
+ notifySaveItems(logWrapper.getChangesLog(), false);
// Since the resume method could cause issue with some TM at this stage, we don't resume the tx
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-05-23 09:50:30 UTC (rev 4407)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2011-05-23 12:42:27 UTC (rev 4408)
@@ -99,7 +99,7 @@
protected final List<MandatoryItemsPersistenceListener> mandatoryListeners;
/**
- * Persistent level liesteners filters.
+ * Persistent level listeners filters.
*/
protected final List<ItemsPersistenceListenerFilter> liestenerFilters;
@@ -112,8 +112,60 @@
* The resource manager
*/
private final TransactionableResourceManager txResourceManager;
-
+
/**
+ * Changes log wrapper adds possibility to replace changes log.
+ * Changes log contains transient data on save but listeners should be notifyed
+ * with persisted data only.
+ */
+ protected class ChangesLogWrapper implements ItemStateChangesLog
+ {
+ private ItemStateChangesLog log;
+
+ ChangesLogWrapper(ItemStateChangesLog log)
+ {
+ this.log = log;
+ }
+
+ /**
+ * Replace log with persisted data only.
+ */
+ protected void setLog(ItemStateChangesLog log)
+ {
+ this.log = log;
+ }
+
+ protected ItemStateChangesLog getChangesLog()
+ {
+ return log;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List<ItemState> getAllStates()
+ {
+ return log.getAllStates();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public int getSize()
+ {
+ return log.getSize();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String dump()
+ {
+ return log.dump();
+ }
+ }
+
+ /**
* WorkspacePersistentDataManager constructor.
*
* @param dataContainer
@@ -152,8 +204,10 @@
/**
* {@inheritDoc}
*/
- public void save(final ItemStateChangesLog changesLog) throws RepositoryException
+ public void save(final ChangesLogWrapper logWrapper) throws RepositoryException
{
+ final ItemStateChangesLog changesLog = logWrapper.getChangesLog();
+
// check if this workspace container is not read-only
if (readOnly && !(changesLog instanceof ReadOnlyThroughChanges))
{
@@ -191,6 +245,9 @@
// we don't support other types now... i.e. add else-if for that type here
throw new RepositoryException("Unsupported changes log class " + changesLog.getClass());
}
+ // replace log with persisted data only
+ logWrapper.setLog(persistedLog);
+
notifySaveItems(persistedLog, true);
onCommit(persister, mode);
failed = false;
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java 2011-05-23 09:50:30 UTC (rev 4407)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/dataflow/persistent/TestMultipleListenersNotifying.java 2011-05-23 12:42:27 UTC (rev 4408)
@@ -22,6 +22,9 @@
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.impl.storage.SystemDataContainerHolder;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+
/**
* Created by The eXo Platform SAS.
*
@@ -39,6 +42,13 @@
{
super(null, new SystemDataContainerHolder(null));
}
+
+ @Override
+ public void save(ItemStateChangesLog changes) throws InvalidItemStateException, UnsupportedOperationException,
+ RepositoryException
+ {
+ super.save(new ChangesLogWrapper(changes));
+ }
}
class Counter
13 years
exo-jcr SVN: r4407 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/core and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-05-23 05:50:30 -0400 (Mon, 23 May 2011)
New Revision: 4407
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/XASession.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/TrackedXASession.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java
Log:
EXOJCR-480: Managed transactions support
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/XASession.java
===================================================================
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/TrackedXASession.java
===================================================================
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/XASessionImpl.java
===================================================================
13 years