exo-jcr SVN: r3107 - in jcr/trunk: applications/exo.jcr.applications.fckeditor/src/main/webapp/WEB-INF/classes/conf and 10 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-13 03:18:05 -0400 (Mon, 13 Sep 2010)
New Revision: 3107
Removed:
jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/organization-nodetypes.xml
jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/test/organization-nodetypes.xml
Modified:
jcr/trunk/applications/exo.jcr.applications.browser/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml
jcr/trunk/applications/exo.jcr.applications.fckeditor/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml
jcr/trunk/applications/exo.jcr.ear/src/main/application/APP-INF/classes/conf/exo-configuration.xml
jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml
jcr/trunk/applications/product-patches/as/jetty/exo-configuration.xml
jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml
jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml
jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/portal/configuration.xml
jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
Log:
EXOJCR-957: Remove organization nodetypes from projects where it not used
Modified: jcr/trunk/applications/exo.jcr.applications.browser/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.browser/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/exo.jcr.applications.browser/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -59,7 +59,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/exo.jcr.applications.fckeditor/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.applications.fckeditor/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/exo.jcr.applications.fckeditor/src/main/webapp/WEB-INF/classes/conf/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -61,7 +61,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/exo.jcr.ear/src/main/application/APP-INF/classes/conf/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/exo.jcr.ear/src/main/application/APP-INF/classes/conf/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/exo.jcr.ear/src/main/application/APP-INF/classes/conf/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -59,7 +59,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -88,7 +88,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/product-patches/as/jetty/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jetty/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/product-patches/as/jetty/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -88,7 +88,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -88,7 +88,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -88,7 +88,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/webdav-nodetypes.xml</value>
</values-param>
</init-params>
Deleted: jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/organization-nodetypes.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/organization-nodetypes.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/organization-nodetypes.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -1,237 +0,0 @@
-<?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.
-
--->
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
-
- <!-- JCR Organization service -->
-
- <nodeType name="exo:membershipType" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:description">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:userMembership" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:group">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:group" requiredType="Reference" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:membershipType" requiredType="Reference" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <!-- profile attributes -->
- <nodeType name="exo:profileAttributes" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="*" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:userProfile" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:attributes">
- <supertypes>
- <supertype>nt:unstructured</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:attributes" defaultPrimaryType="exo:profileAttributes" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:profileAttributes</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:user" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:lastName">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:firstName" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:lastName" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:password" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:email" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:createdDate" requiredType="Date" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:lastLoginTime" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:profile" defaultPrimaryType="exo:userProfile" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:userProfile</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:membership" defaultPrimaryType="exo:userMembership" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="true">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:userMembership</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:group" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:label">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:groupId" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:parentId" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:label" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:hierarchyGroup" isMixin="false" hasOrderableChildNodes="false">
- <supertypes>
- <supertype>exo:group</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:group</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
-
- <nodeType name="exo:organizationUsers" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:user" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:user</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationGroups" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:hierarchyGroup" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:group</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationMembershipTypes" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:membershipType" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:membershipType</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationStorage" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:users" defaultPrimaryType="exo:organizationUsers" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationUsers</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:groups" defaultPrimaryType="exo:organizationGroups" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationGroups</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:membershipTypes" defaultPrimaryType="exo:organizationMembershipTypes" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationMembershipTypes</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
-</nodeTypes>
Modified: jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/portal/configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/portal/configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/exo.jcr.component.ext/src/main/resources/conf/portal/configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -236,7 +236,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
</values-param>
</init-params>
</component-plugin>
Modified: jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/exo.jcr.component.ext/src/test/resources/conf/standalone/test-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -102,7 +102,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file</description>
<value>jar:/conf/ext-nodetypes-config.xml</value>
- <value>jar:/conf/organization-nodetypes.xml</value>
<value>jar:/conf/test/nodetypes-ext-test.xml</value>
</values-param>
</init-params>
Modified: jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/standalone/test-configuration.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -75,7 +75,6 @@
<name>autoCreatedInNewRepository</name>
<description>Node types configuration file for repository with name testInitNodeTypesRepositoryTest2</description>
<value>jar:/conf/test/webdav-nodetypes.xml</value>
- <value>jar:/conf/test/organization-nodetypes.xml</value>
<value>jar:/conf/test/ext-nodetypes-config.xml</value>
</values-param>
</init-params>
Deleted: jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/test/organization-nodetypes.xml
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/test/organization-nodetypes.xml 2010-09-13 06:25:03 UTC (rev 3106)
+++ jcr/trunk/exo.jcr.component.webdav/src/test/resources/conf/test/organization-nodetypes.xml 2010-09-13 07:18:05 UTC (rev 3107)
@@ -1,237 +0,0 @@
-<?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.
-
--->
-<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
-
- <!-- JCR Organization service -->
-
- <nodeType name="exo:membershipType" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:description">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:userMembership" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:group">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:group" requiredType="Reference" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:membershipType" requiredType="Reference" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <!-- profile attributes -->
- <nodeType name="exo:profileAttributes" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="*" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:userProfile" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:attributes">
- <supertypes>
- <supertype>nt:unstructured</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:attributes" defaultPrimaryType="exo:profileAttributes" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:profileAttributes</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:user" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:lastName">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:firstName" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:lastName" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:password" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:email" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:createdDate" requiredType="Date" autoCreated="false" mandatory="true" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:lastLoginTime" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:profile" defaultPrimaryType="exo:userProfile" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:userProfile</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:membership" defaultPrimaryType="exo:userMembership" autoCreated="false" mandatory="false"
- onParentVersion="COPY" protected="false" sameNameSiblings="true">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:userMembership</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:group" isMixin="false" hasOrderableChildNodes="false" primaryItemName="exo:label">
- <supertypes>
- <supertype>nt:base</supertype>
- <supertype>mix:referenceable</supertype>
- </supertypes>
- <propertyDefinitions>
- <propertyDefinition name="exo:groupId" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:parentId" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:label" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false"
- multiple="false">
- <valueConstraints />
- </propertyDefinition>
- <propertyDefinition name="exo:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" multiple="false">
- <valueConstraints />
- </propertyDefinition>
- </propertyDefinitions>
- </nodeType>
-
- <nodeType name="exo:hierarchyGroup" isMixin="false" hasOrderableChildNodes="false">
- <supertypes>
- <supertype>exo:group</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:group</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
-
- <nodeType name="exo:organizationUsers" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:user" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false"
- sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:user</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationGroups" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:hierarchyGroup" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:group</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationMembershipTypes" isMixin="false" hasOrderableChildNodes="true" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="*" defaultPrimaryType="exo:membershipType" autoCreated="false" mandatory="false" onParentVersion="COPY"
- protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:membershipType</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
- <nodeType name="exo:organizationStorage" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
- <supertypes>
- <supertype>nt:base</supertype>
- </supertypes>
- <childNodeDefinitions>
- <childNodeDefinition name="exo:users" defaultPrimaryType="exo:organizationUsers" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationUsers</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:groups" defaultPrimaryType="exo:organizationGroups" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationGroups</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- <childNodeDefinition name="exo:membershipTypes" defaultPrimaryType="exo:organizationMembershipTypes" autoCreated="false" mandatory="true"
- onParentVersion="COPY" protected="false" sameNameSiblings="false">
- <requiredPrimaryTypes>
- <requiredPrimaryType>exo:organizationMembershipTypes</requiredPrimaryType>
- </requiredPrimaryTypes>
- </childNodeDefinition>
- </childNodeDefinitions>
- </nodeType>
-
-</nodeTypes>
15 years, 8 months
exo-jcr SVN: r3106 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-13 02:25:03 -0400 (Mon, 13 Sep 2010)
New Revision: 3106
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerException.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
Log:
EXOJCR-939: DBCleanerService updated
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java 2010-09-10 17:05:02 UTC (rev 3105)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java 2010-09-13 06:25:03 UTC (rev 3106)
@@ -17,7 +17,13 @@
package org.exoplatform.services.jcr.impl.util.jdbc;
import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
/**
* The goal of this class is remove workspace data from database.
* Created by The eXo Platform SAS.
@@ -30,6 +36,8 @@
public class DBCleaner
{
+ protected final static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.DBCleaner");
+
protected String REMOVE_ITEMS;
protected String REMOVE_VALUES;
@@ -46,50 +54,175 @@
private final String containerName;
+ private final boolean isMultiDB;
+
/**
* Constructor.
*
* @param containerName - workspace name
* @param connection - SQL conneciton
*/
- public DBCleaner(Connection connection, String containerName)
+ public DBCleaner(Connection connection, String containerName, boolean isMulti)
{
this.connection = connection;
this.containerName = containerName;
+ this.isMultiDB = isMulti;
prepareQueries();
}
- protected void prepareQueries()
+ /**
+ * Remove workspace data from database.
+ * <ul>
+ * <li>If workspace uses multiDB data source - tables associated with this workspace
+ * will be dropped.
+ * <li>If workspace uses singleDB data source - all records of this workspace will
+ * be removed.
+ * </ul>
+ *
+ * <p>Connection used by this method will be closed at final.
+ *
+ * @throws DBCleanerException - if exception during data cleanup occures.
+ */
+ public void cleanWorkspace() throws DBCleanerException
{
-
+ try
+ {
+ // check is multi db
+ if (isMultiDB)
+ {
+ //remove table
+ dropWorkspace();
+ }
+ else
+ {
+ // clean up all record of this container
+ removeWorkspaceRecords();
+ }
+ connection.commit();
+ }
+ catch (SQLException e)
+ {
+
+ // TODO do we need rollback here?
+ try
+ {
+ connection.rollback();
+ }
+ catch (SQLException rollbackException)
+ {
+ LOG.error("Can not rollback changes after exception " + e.getMessage(), rollbackException);
+ }
+ throw new DBCleanerException(e.getMessage(), e);
+ }
+ finally
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("Error of a connection closing. " + e, e);
+ }
+ }
}
- public void removeWorkspace()
+ protected void prepareQueries()
{
-
- }
-
- public void cleanupWorkspace()
- {
//for single db support
REMOVE_ITEMS = "delete from JCR_SITEM where CONTAINER_NAME=?";
- REMOVE_VALUES = "delete from JCR_SVALUE where PROPERTY_ID=?";
- REMOVE_REFERENCES = "delete from JCR_SREF where PROPERTY_ID=?";
+ REMOVE_VALUES =
+ "delete from JCR_SVALUE V where exists "
+ + "( select * from JCR_SITEM I where I.ID=V.PROPERTY_ID and I.CONTAINER_NAME=? )";
+ //TODO R.PROPERTY_ID or R.NODE_ID?
+ REMOVE_REFERENCES =
+ "delete from JCR_SREF R where exists "
+ + "( select * from JCR_SITEM I where I.ID=R.PROPERTY_ID and I.CONTAINER_NAME=? )";
+
// for multi db support
+ //TODO do we need remove indexes?
+ //different databases may be configured to use different indexes
DROP_JCR_MITEM_TABLE = "DROP TABLE JCR_MITEM";
DROP_JCR_MVALUE_TABLE = "DROP TABLE JCR_MVALUE";
DROP_MREF_TABLE = "DROP TABLE JCR_MREF";
+ }
- // DROP TABLE orders;
- // DROP DATABASE mydatabase;
- // DROP VIEW viewname;
- // DROP INDEX orders.indexname;
- //
- // -- FOR USE WITH ALTER COMMANDS
- // DROP COLUMN column_name
- // DROP FOREIGN KEY (foreign_key_name)
+ protected void dropWorkspace() throws SQLException
+ {
+ final Statement statement = connection.createStatement();
+ connection.setAutoCommit(false);
+
+ try
+ {
+ // order of dropped tables is important
+ statement.executeUpdate(DROP_MREF_TABLE);
+ statement.executeUpdate(DROP_JCR_MVALUE_TABLE);
+ statement.executeUpdate(DROP_JCR_MITEM_TABLE);
+ }
+ finally
+ {
+ if (statement != null)
+ {
+ try
+ {
+ statement.close();
+ }
+ catch (SQLException e)
+ {
+ LOG.error("Can't close the Statement: " + e);
+ }
+ }
+ }
}
+ protected void removeWorkspaceRecords() throws SQLException
+ {
+ PreparedStatement statements = null;
+ try
+ {
+ statements = connection.prepareStatement(REMOVE_REFERENCES);
+ statements.setString(1, containerName);
+ statements.executeUpdate();
+ }
+ finally
+ {
+ if (statements != null)
+ {
+ statements.close();
+ statements = null;
+ }
+ }
+
+ try
+ {
+ statements = connection.prepareStatement(REMOVE_VALUES);
+ statements.setString(1, containerName);
+ statements.executeUpdate();
+ }
+ finally
+ {
+ if (statements != null)
+ {
+ statements.close();
+ statements = null;
+ }
+ }
+
+ try
+ {
+ statements = connection.prepareStatement(REMOVE_ITEMS);
+ statements.setString(1, containerName);
+ statements.executeUpdate();
+ }
+ finally
+ {
+ if (statements != null)
+ {
+ statements.close();
+ statements = null;
+ }
+ }
+ }
}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerException.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerException.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerException.java 2010-09-13 06:25:03 UTC (rev 3106)
@@ -0,0 +1,9 @@
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+public class DBCleanerException extends Exception
+{
+ public DBCleanerException(String message, Throwable e)
+ {
+ super(message, e);
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java 2010-09-10 17:05:02 UTC (rev 3105)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java 2010-09-13 06:25:03 UTC (rev 3106)
@@ -16,10 +16,6 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc;
-import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.RepositoryEntry;
-import org.exoplatform.services.jcr.config.WorkspaceEntry;
-
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -30,6 +26,12 @@
import javax.naming.NamingException;
import javax.sql.DataSource;
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
/**
* Created by The eXo Platform SAS.
*
@@ -40,6 +42,7 @@
*/
public class DBCleanerService
{
+ protected final static Log LOG = ExoLogger.getLogger("exo.jcr.component.core.DBCleanerService");
public static void removeWorkspaceData(WorkspaceEntry wsConfig) throws RepositoryConfigurationException,
NamingException, RepositoryException, IOException
@@ -54,7 +57,6 @@
ds != null ? ds.getConnection() : (wsJDBCConfig.getDbUserName() != null ? DriverManager.getConnection(
wsJDBCConfig.getDbUrl(), wsJDBCConfig.getDbUserName(), wsJDBCConfig.getDbPassword()) : DriverManager
.getConnection(wsJDBCConfig.getDbUrl()));
-
}
catch (SQLException e)
{
@@ -64,18 +66,13 @@
throw new RepositoryException(err, e);
}
- DBCleaner cleaner = new DBCleaner(conn, wsJDBCConfig.getContainerName());
- // check is multi db
- if (wsJDBCConfig.isMultiDb())
- {
- //remove table
- cleaner.removeWorkspace();
+ DBCleaner cleaner = new DBCleaner(conn, wsJDBCConfig.getContainerName(), wsJDBCConfig.isMultiDb());
+
+ try{
+ cleaner.cleanWorkspace();
+ }catch(DBCleanerException e){
+ throw new RepositoryException(e.getMessage(),e);
}
- else
- {
- // clean up all record of this container
- cleaner.cleanupWorkspace();
- }
}
public static void removeRepositoryData(RepositoryEntry repoConfig) throws RepositoryConfigurationException,
15 years, 8 months
exo-jcr SVN: r3105 - in kernel/trunk/exo.kernel.component.common/src: test/java/org/exoplatform/services/scheduler/test and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-10 13:05:02 -0400 (Fri, 10 Sep 2010)
New Revision: 3105
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobEnvironmentConfigListener.java
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobSchedulerServiceImpl.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java
kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/test-configuration.xml
Log:
EXOJCR-951: Review the code to allow multicontainer support
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobEnvironmentConfigListener.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobEnvironmentConfigListener.java 2010-09-10 15:19:42 UTC (rev 3104)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobEnvironmentConfigListener.java 2010-09-10 17:05:02 UTC (rev 3105)
@@ -18,11 +18,11 @@
*/
package org.exoplatform.services.scheduler.impl;
-import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.RootContainer;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.component.ComponentRequestLifecycle;
-import org.exoplatform.container.xml.PortalContainerInfo;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobListener;
@@ -33,26 +33,37 @@
* Created by The eXo Platform SAS Author : Hoa Pham hoapham(a)exoplatform.com Oct
* 5, 2005
*/
+@SuppressWarnings("unchecked")
public class JobEnvironmentConfigListener implements JobListener, ComponentPlugin
{
- private String containerName_;
+ static final String NAME = "JobContextConfigListener";
- public JobEnvironmentConfigListener(PortalContainerInfo pinfo)
- {
- containerName_ = pinfo.getContainerName();
- }
-
public void jobToBeExecuted(JobExecutionContext context)
{
- RootContainer rootContainer = RootContainer.getInstance();
- PortalContainer pcontainer = (PortalContainer)rootContainer.getComponentInstance(containerName_);
- PortalContainer.setInstance(pcontainer);
- List<ComponentRequestLifecycle> components =
- pcontainer.getComponentInstancesOfType(ComponentRequestLifecycle.class);
- for (ComponentRequestLifecycle component : components)
+ String containerName = extractContainerName(context);
+ ExoContainer container = null;
+ if (containerName != null)
{
- component.startRequest(pcontainer);
+ if (containerName.equals(JobSchedulerServiceImpl.STANDALONE_CONTAINER_NAME))
+ {
+ container = ExoContainerContext.getTopContainer();
+ }
+ else
+ {
+ RootContainer rootContainer = RootContainer.getInstance();
+ container = (ExoContainer)rootContainer.getComponentInstance(containerName);
+ }
}
+ if (container != null)
+ {
+ ExoContainerContext.setCurrentContainer(container);
+ List<ComponentRequestLifecycle> components =
+ container.getComponentInstancesOfType(ComponentRequestLifecycle.class);
+ for (ComponentRequestLifecycle component : components)
+ {
+ component.startRequest(container);
+ }
+ }
}
public void jobExecutionVetoed(JobExecutionContext context)
@@ -62,20 +73,35 @@
public void jobWasExecuted(JobExecutionContext context, JobExecutionException exception)
{
- RootContainer rootContainer = RootContainer.getInstance();
- PortalContainer pcontainer = (PortalContainer)rootContainer.getComponentInstance(containerName_);
- List<ComponentRequestLifecycle> components =
- pcontainer.getComponentInstancesOfType(ComponentRequestLifecycle.class);
- for (ComponentRequestLifecycle component : components)
+ String containerName = extractContainerName(context);
+ ExoContainer container = null;
+ if (containerName != null)
{
- component.endRequest(pcontainer);
+ if (containerName.equals(JobSchedulerServiceImpl.STANDALONE_CONTAINER_NAME))
+ {
+ container = ExoContainerContext.getTopContainer();
+ }
+ else
+ {
+ RootContainer rootContainer = RootContainer.getInstance();
+ container = (ExoContainer)rootContainer.getComponentInstance(containerName);
+ }
}
- PortalContainer.setInstance(null);
+ if (container != null)
+ {
+ List<ComponentRequestLifecycle> components =
+ container.getComponentInstancesOfType(ComponentRequestLifecycle.class);
+ for (ComponentRequestLifecycle component : components)
+ {
+ component.endRequest(container);
+ }
+ ExoContainerContext.setCurrentContainer(null);
+ }
}
public String getName()
{
- return "JobContextConfigListener";
+ return NAME;
}
public void setName(String s)
@@ -84,11 +110,25 @@
public String getDescription()
{
- return null;
+ return "This JobListener is used to setup the eXo environment properly";
}
public void setDescription(String s)
{
}
+ /**
+ * Extracts the container name from the {@link JobExecutionContext}.
+ * The container name is extracted from the group name
+ */
+ private static String extractContainerName(JobExecutionContext context)
+ {
+ String group = context.getJobDetail().getGroup();
+ if (group == null || (group = group.trim()).length() == 0)
+ {
+ return null;
+ }
+ int index = group.indexOf(':');
+ return index == -1 ? group : group.substring(0, index);
+ }
}
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobSchedulerServiceImpl.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobSchedulerServiceImpl.java 2010-09-10 15:19:42 UTC (rev 3104)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/JobSchedulerServiceImpl.java 2010-09-10 17:05:02 UTC (rev 3105)
@@ -20,6 +20,8 @@
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.xml.PortalContainerInfo;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.exoplatform.services.scheduler.CronJob;
import org.exoplatform.services.scheduler.JobInfo;
import org.exoplatform.services.scheduler.JobSchedulerService;
@@ -57,6 +59,10 @@
*/
public class JobSchedulerServiceImpl implements JobSchedulerService, Startable
{
+
+ private static final Log log = ExoLogger.getLogger("exo.kernel.component.common.JobSchedulerServiceImpl");
+
+ static final String STANDALONE_CONTAINER_NAME = "$Standalone";
private final Scheduler scheduler_;
private final String containerName_;
@@ -79,7 +85,7 @@
public JobSchedulerServiceImpl(QuartzSheduler quartzSchduler, QueueTasks qtasks)
{
scheduler_ = quartzSchduler.getQuartzSheduler();
- containerName_ = "Standalone";
+ containerName_ = STANDALONE_CONTAINER_NAME;
qtasks_ = qtasks;
}
@@ -155,7 +161,7 @@
JobInfo jobinfo = getJobInfo(jinfo);
CronTrigger trigger =
new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
- exp);
+ exp);
JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
job.setDescription(jobinfo.getDescription());
scheduler_.addJob(job, true);
@@ -174,7 +180,7 @@
JobInfo jobinfo = getJobInfo(jinfo);
CronTrigger trigger =
new CronTrigger(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJobName(), jobinfo.getGroupName(),
- exp);
+ exp);
JobDetail job = new JobDetail(jobinfo.getJobName(), jobinfo.getGroupName(), jobinfo.getJob());
job.setJobDataMap(jdatamap);
job.setDescription(jobinfo.getDescription());
@@ -205,8 +211,7 @@
public boolean removeJob(JobInfo jinfo) throws Exception
{
JobInfo jobinfo = getJobInfo(jinfo);
- boolean b = scheduler_.deleteJob(jobinfo.getJobName(), jobinfo.getGroupName());
- return b;
+ return scheduler_.deleteJob(jobinfo.getJobName(), jobinfo.getGroupName());
}
public List getAllExcutingJobs() throws Exception
@@ -236,16 +241,13 @@
public List getAllGlobalJobListener() throws Exception
{
- List globalListeners;
- globalListeners = scheduler_.getGlobalJobListeners();
- return globalListeners;
+ return scheduler_.getGlobalJobListeners();
}
public JobListener getGlobalJobListener(String name) throws Exception
{
- List listener;
JobListener jlistener;
- listener = scheduler_.getGlobalJobListeners();
+ List listener = scheduler_.getGlobalJobListeners();
ListIterator iterator = listener.listIterator();
while (iterator.hasNext())
{
@@ -261,8 +263,7 @@
public boolean removeGlobalJobListener(String name) throws Exception
{
JobListener jlistener = getGlobalJobListener(name);
- boolean b = scheduler_.removeGlobalJobListener(jlistener);
- return b;
+ return scheduler_.removeGlobalJobListener(jlistener);
}
public void addJobListener(ComponentPlugin plugin) throws Exception
@@ -290,8 +291,7 @@
public boolean removeJobListener(String name) throws Exception
{
- boolean b = scheduler_.removeJobListener(name);
- return b;
+ return scheduler_.removeJobListener(name);
}
public void addGlobalTriggerListener(ComponentPlugin plugin) throws Exception
@@ -301,16 +301,13 @@
public List getAllGlobalTriggerListener() throws Exception
{
- List listener;
- listener = scheduler_.getGlobalTriggerListeners();
- return listener;
+ return scheduler_.getGlobalTriggerListeners();
}
public TriggerListener getGlobalTriggerListener(String name) throws Exception
{
TriggerListener tlistener;
- List listener;
- listener = scheduler_.getGlobalTriggerListeners();
+ List listener = scheduler_.getGlobalTriggerListeners();
ListIterator iterator = listener.listIterator();
while (iterator.hasNext())
{
@@ -326,8 +323,7 @@
public boolean removeGlobaTriggerListener(String name) throws Exception
{
TriggerListener tlistener = getGlobalTriggerListener(name);
- boolean b = scheduler_.removeGlobalTriggerListener(tlistener);
- return b;
+ return scheduler_.removeGlobalTriggerListener(tlistener);
}
public void addTriggerListener(ComponentPlugin plugin) throws Exception
@@ -350,14 +346,12 @@
public TriggerListener getTriggerListener(String name) throws Exception
{
- TriggerListener tlistener = scheduler_.getTriggerListener(name);
- return tlistener;
+ return scheduler_.getTriggerListener(name);
}
public boolean removeTriggerListener(String name) throws Exception
{
- boolean b = scheduler_.removeTriggerListener(name);
- return b;
+ return scheduler_.removeTriggerListener(name);
}
private JobInfo getJobInfo(JobInfo jinfo) throws Exception
@@ -404,6 +398,17 @@
public void start()
{
+ try
+ {
+ // Ensure that only one JobEnvironmentConfigListener will be registered
+ while (removeGlobalJobListener(JobEnvironmentConfigListener.NAME));
+ // Add the unique instance of JobEnvironmentConfigListener
+ scheduler_.addGlobalJobListener(new JobEnvironmentConfigListener());
+ }
+ catch (Exception e)
+ {
+ log.warn("Could not remove the GlobalJobListener " + JobEnvironmentConfigListener.NAME, e);
+ }
}
public void stop()
@@ -424,7 +429,7 @@
}
catch (Exception ex)
{
- ex.printStackTrace();
+ log.warn("Could not interrupt all the current jobs properly", ex);
}
}
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java 2010-09-10 15:19:42 UTC (rev 3104)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java 2010-09-10 17:05:02 UTC (rev 3105)
@@ -18,9 +18,12 @@
*/
package org.exoplatform.services.scheduler.test;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.BaseContainerLifecyclePlugin;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.PortalContainer;
+import org.exoplatform.container.RootContainer;
import org.exoplatform.services.scheduler.JobInfo;
import org.exoplatform.services.scheduler.JobSchedulerService;
import org.exoplatform.services.scheduler.PeriodInfo;
@@ -61,6 +64,7 @@
assertEquals(Boolean.TRUE, component.getResult());
}
+
public void testSeviceWithGlobalListener() throws Exception
{
assertTrue("JobScheduler is not deployed correctly", service_ != null);
@@ -272,6 +276,64 @@
System.out.println("-------------------End Test Non Global Listener---------");
}
+ public void testMultiplePortalContainers() throws Exception
+ {
+ ExoContainer oldContainer = ExoContainerContext.getCurrentContainerIfPresent();
+ MyComponent component;
+ PortalContainer container = null;
+ MyComponent component2;
+ PortalContainer container2 = null;
+ String oldProfileList = System.getProperty(PropertyManager.RUNTIME_PROFILES);
+ try
+ {
+ try
+ {
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "MultiplePortalContainers");
+ component = (MyComponent)(container = RootContainer.getInstance().getPortalContainer("portal-container")).getComponentInstanceOfType(MyComponent.class);
+ }
+ finally
+ {
+ ExoContainerContext.setCurrentContainer(oldContainer);
+ }
+ try
+ {
+ PropertyManager.setProperty(PropertyManager.RUNTIME_PROFILES, "MultiplePortalContainers,portal-container2");
+ component2 = (MyComponent)(container2 = RootContainer.getInstance().getPortalContainer("portal-container2")).getComponentInstanceOfType(MyComponent.class);
+ Thread.sleep(2000);
+ }
+ finally
+ {
+ ExoContainerContext.setCurrentContainer(oldContainer);
+ }
+ }
+ finally
+ {
+ if (oldProfileList == null)
+ {
+ System.clearProperty(PropertyManager.RUNTIME_PROFILES);
+ }
+ else
+ {
+ System.setProperty(PropertyManager.RUNTIME_PROFILES, oldProfileList);
+ }
+ PropertyManager.refresh();
+ if (container != null)
+ {
+ container.stop();
+ }
+
+ if (container2 != null)
+ {
+ container2.stop();
+ }
+ }
+ assertEquals("myJob1", component.name);
+ assertEquals(container, component.container);
+ assertEquals("myJob2", component2.name);
+ assertEquals(container2, component2.container);
+
+ }
+
public static class MyContainerLifecyclePlugin extends BaseContainerLifecyclePlugin
{
@@ -286,6 +348,8 @@
public static class MyComponent
{
+ public ExoContainer container;
+ public String name;
public boolean started;
public final CountDownLatch doneSignal = new CountDownLatch(1);
public Boolean result;
@@ -314,9 +378,19 @@
{
public void execute(JobExecutionContext context) throws JobExecutionException
- {
+ {
MyComponent component = (MyComponent)PortalContainer.getInstance().getComponentInstanceOfType(MyComponent.class);
component.doSomething();
}
}
+ public static class MyJobMultiplePortalContainers implements Job
+ {
+
+ public void execute(JobExecutionContext context) throws JobExecutionException
+ {
+ MyComponent component = (MyComponent)PortalContainer.getInstance().getComponentInstanceOfType(MyComponent.class);
+ component.name = context.getJobDetail().getName();
+ component.container = PortalContainer.getInstance();
+ }
+ }
}
Modified: kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/test-configuration.xml
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/test-configuration.xml 2010-09-10 15:19:42 UTC (rev 3104)
+++ kernel/trunk/exo.kernel.component.common/src/test/resources/conf/portal/test-configuration.xml 2010-09-10 17:05:02 UTC (rev 3105)
@@ -222,5 +222,26 @@
</properties-param>
</init-params>
</component-plugin>
+ <component-plugin profiles="MultiplePortalContainers">
+ <name>AddJob</name>
+ <set-method>addPeriodJob</set-method>
+ <type>org.exoplatform.services.scheduler.PeriodJob</type>
+ <description>add a job to the JobSchedulerService</description>
+ <init-params>
+ <properties-param>
+ <name>job.info</name>
+ <description>Test QueueTaks</description>
+ <property name="jobName" value="myJob1" />
+ <property profiles="portal-container2" name="jobName" value="myJob2" />
+ <property name="groupName" value="group2" />
+ <property name="job" value="org.exoplatform.services.scheduler.test.TestSchedulerService$MyJobMultiplePortalContainers" />
+
+ <property name="repeatCount" value="-1" />
+ <property name="period" value="500" />
+ <property name="startTime" value="" />
+ <property name="endTime" value="" />
+ </properties-param>
+ </init-params>
+ </component-plugin>
</external-component-plugins>
</configuration>
15 years, 8 months
exo-jcr SVN: r3104 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-09-10 11:19:42 -0400 (Fri, 10 Sep 2010)
New Revision: 3104
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/JDBCConfiguration.java
Log:
EXOJCR-939: DBCleanerService added
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleaner.java 2010-09-10 15:19:42 UTC (rev 3104)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import java.sql.Connection;
+
+/**
+ * The goal of this class is remove workspace data from database.
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: DBCleaner.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class DBCleaner
+{
+
+ protected String REMOVE_ITEMS;
+
+ protected String REMOVE_VALUES;
+
+ protected String REMOVE_REFERENCES;
+
+ protected String DROP_JCR_MITEM_TABLE;
+
+ protected String DROP_JCR_MVALUE_TABLE;
+
+ protected String DROP_MREF_TABLE;
+
+ private final Connection connection;
+
+ private final String containerName;
+
+ /**
+ * Constructor.
+ *
+ * @param containerName - workspace name
+ * @param connection - SQL conneciton
+ */
+ public DBCleaner(Connection connection, String containerName)
+ {
+ this.connection = connection;
+ this.containerName = containerName;
+ prepareQueries();
+ }
+
+ protected void prepareQueries()
+ {
+
+ }
+
+ public void removeWorkspace()
+ {
+
+ }
+
+ public void cleanupWorkspace()
+ {
+ //for single db support
+ REMOVE_ITEMS = "delete from JCR_SITEM where CONTAINER_NAME=?";
+
+ REMOVE_VALUES = "delete from JCR_SVALUE where PROPERTY_ID=?";
+ REMOVE_REFERENCES = "delete from JCR_SREF where PROPERTY_ID=?";
+
+ // for multi db support
+ DROP_JCR_MITEM_TABLE = "DROP TABLE JCR_MITEM";
+ DROP_JCR_MVALUE_TABLE = "DROP TABLE JCR_MVALUE";
+ DROP_MREF_TABLE = "DROP TABLE JCR_MREF";
+
+ // DROP TABLE orders;
+ // DROP DATABASE mydatabase;
+ // DROP VIEW viewname;
+ // DROP INDEX orders.indexname;
+ //
+ // -- FOR USE WITH ALTER COMMANDS
+ // DROP COLUMN column_name
+ // DROP FOREIGN KEY (foreign_key_name)
+ }
+
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBCleanerService.java 2010-09-10 15:19:42 UTC (rev 3104)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.RepositoryEntry;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: DBCleanerService.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class DBCleanerService
+{
+
+ public static void removeWorkspaceData(WorkspaceEntry wsConfig) throws RepositoryConfigurationException,
+ NamingException, RepositoryException, IOException
+ {
+ JDBCConfiguration wsJDBCConfig = new JDBCConfiguration(wsConfig);
+
+ DataSource ds = (DataSource)new InitialContext().lookup(wsJDBCConfig.getDbSourceName());
+ Connection conn = null;
+ try
+ {
+ conn =
+ ds != null ? ds.getConnection() : (wsJDBCConfig.getDbUserName() != null ? DriverManager.getConnection(
+ wsJDBCConfig.getDbUrl(), wsJDBCConfig.getDbUserName(), wsJDBCConfig.getDbPassword()) : DriverManager
+ .getConnection(wsJDBCConfig.getDbUrl()));
+
+ }
+ catch (SQLException e)
+ {
+ String err =
+ "Error of JDBC connection open. SQLException: " + e.getMessage() + ", SQLState: " + e.getSQLState()
+ + ", VendorError: " + e.getErrorCode();
+ throw new RepositoryException(err, e);
+ }
+
+ DBCleaner cleaner = new DBCleaner(conn, wsJDBCConfig.getContainerName());
+ // check is multi db
+ if (wsJDBCConfig.isMultiDb())
+ {
+ //remove table
+ cleaner.removeWorkspace();
+ }
+ else
+ {
+ // clean up all record of this container
+ cleaner.cleanupWorkspace();
+ }
+ }
+
+ public static void removeRepositoryData(RepositoryEntry repoConfig) throws RepositoryConfigurationException,
+ NamingException, RepositoryException, IOException
+ {
+ for (WorkspaceEntry wsEntry : repoConfig.getWorkspaceEntries())
+ {
+ removeWorkspaceData(wsEntry);
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/JDBCConfiguration.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/JDBCConfiguration.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/JDBCConfiguration.java 2010-09-10 15:19:42 UTC (rev 3104)
@@ -0,0 +1,289 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.impl.util.jdbc;
+
+import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
+import org.exoplatform.services.jcr.config.WorkspaceEntry;
+import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
+import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+import javax.jcr.RepositoryException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: JDBCConfiguration.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class JDBCConfiguration
+{
+
+ protected static final Log LOG = ExoLogger.getLogger("exo.jcr.component.core.JDBCConfiguration");
+
+ public final static String SOURCE_NAME = "source-name";
+
+ public final static String MULTIDB = "multi-db";
+
+ public final static String SINGLEDB = "single-db";
+
+ /**
+ * Describe which type of RDBMS will be used (DB creation metadata etc.)
+ */
+ public final static String DB_DIALECT = "dialect";
+
+ public final static String DB_DRIVER = "driverClassName";
+
+ public final static String DB_URL = "url";
+
+ public final static String DB_USERNAME = "username";
+
+ public final static String DB_PASSWORD = "password";
+
+ public final static String DB_FORCE_QUERY_HINTS = "force.query.hints";
+
+ protected final String containerName;
+
+ protected final String dbSourceName;
+
+ protected final boolean multiDb;
+
+ protected final String dbDriver;
+
+ protected final String dbDialect;
+
+ protected final String dbUrl;
+
+ protected final String dbUserName;
+
+ protected final String dbPassword;
+
+ public JDBCConfiguration(WorkspaceEntry wsConfig) throws RepositoryConfigurationException, NamingException,
+ RepositoryException, IOException
+ {
+ this.containerName = wsConfig.getName();
+ this.multiDb = Boolean.parseBoolean(wsConfig.getContainer().getParameterValue(MULTIDB));
+
+ // ------------- Database config ------------------
+ String pDbDialect = null;
+ try
+ {
+ pDbDialect = validateDialect(wsConfig.getContainer().getParameterValue(DB_DIALECT));
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ pDbDialect = DBConstants.DB_DIALECT_GENERIC;
+ }
+
+ String pDbDriver = null;
+ String pDbUrl = null;
+ String pDbUserName = null;
+ String pDbPassword = null;
+ try
+ {
+ pDbDriver = wsConfig.getContainer().getParameterValue(DB_DRIVER);
+
+ // username/passwd may not pesent
+ try
+ {
+ pDbUserName = wsConfig.getContainer().getParameterValue(DB_USERNAME);
+ pDbPassword = wsConfig.getContainer().getParameterValue(DB_PASSWORD);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ pDbUserName = pDbPassword = null;
+ }
+
+ pDbUrl = wsConfig.getContainer().getParameterValue(DB_URL); // last here!
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ }
+
+ if (pDbUrl != null)
+ {
+ this.dbDriver = pDbDriver;
+ this.dbUrl = pDbUrl;
+ this.dbUserName = pDbUserName;
+ this.dbPassword = pDbPassword;
+ this.dbSourceName = null;
+ LOG.info("Connect to JCR database as user '" + this.dbUserName + "'");
+
+ if (pDbDialect == DBConstants.DB_DIALECT_GENERIC || DBConstants.DB_DIALECT_AUTO.equalsIgnoreCase(pDbDialect))
+ {
+ // try to detect via JDBC metadata
+ Connection jdbcConn = null;
+ try
+ {
+ jdbcConn =
+ dbUserName != null ? DriverManager.getConnection(dbUrl, dbUserName, dbPassword) : DriverManager
+ .getConnection(dbUrl);
+
+ this.dbDialect = DialectDetecter.detect(jdbcConn.getMetaData());
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ if (jdbcConn != null)
+ {
+ try
+ {
+ jdbcConn.close();
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+ }
+ }
+ else
+ {
+ this.dbDialect = pDbDialect;
+ }
+ }
+ else
+ {
+ this.dbDriver = null;
+ this.dbUrl = null;
+ this.dbUserName = null;
+ this.dbPassword = null;
+
+ String sn;
+ try
+ {
+ sn = wsConfig.getContainer().getParameterValue(SOURCE_NAME);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ sn = wsConfig.getContainer().getParameterValue("sourceName"); // TODO for backward comp,
+ // remove in rel.2.0
+ }
+ this.dbSourceName = sn;
+
+ if (pDbDialect == DBConstants.DB_DIALECT_GENERIC)
+ {
+ // try to detect via JDBC metadata
+ DataSource ds = (DataSource)new InitialContext().lookup(dbSourceName);
+ if (ds != null)
+ {
+ Connection jdbcConn = null;
+ try
+ {
+ jdbcConn = ds.getConnection();
+ this.dbDialect = DialectDetecter.detect(jdbcConn.getMetaData());
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ finally
+ {
+ if (jdbcConn != null)
+ {
+ try
+ {
+ jdbcConn.close();
+ }
+ catch (SQLException e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+ }
+ }
+ else
+ {
+ throw new RepositoryException("Datasource '" + dbSourceName + "' is not bound in this context.");
+ }
+ }
+ else
+ {
+ this.dbDialect = pDbDialect;
+ }
+ }
+ LOG.info("Using a dialect '" + this.dbDialect + "'");
+ }
+
+ public String getContainerName()
+ {
+ return containerName;
+ }
+
+ public String getDbSourceName()
+ {
+ return dbSourceName;
+ }
+
+ public boolean isMultiDb()
+ {
+ return multiDb;
+ }
+
+ public String getDbDriver()
+ {
+ return dbDriver;
+ }
+
+ public String getDbDialect()
+ {
+ return dbDialect;
+ }
+
+ public String getDbUrl()
+ {
+ return dbUrl;
+ }
+
+ public String getDbUserName()
+ {
+ return dbUserName;
+ }
+
+ public String getDbPassword()
+ {
+ return dbPassword;
+ }
+
+ protected String validateDialect(String confParam)
+ {
+ for (String dbType : DBConstants.DB_DIALECTS)
+ {
+ if (dbType.equalsIgnoreCase(confParam))
+ {
+ return dbType;
+ }
+ }
+
+ return DBConstants.DB_DIALECT_GENERIC; // by default
+ }
+
+}
15 years, 8 months
exo-jcr SVN: r3103 - in kernel/trunk/exo.kernel.component.common/src: test/java/org/exoplatform/services/scheduler/test and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-10 07:21:11 -0400 (Fri, 10 Sep 2010)
New Revision: 3103
Modified:
kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java
kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java
Log:
EXOJCR-950: The scheduler is put in "standby" mode during the whole ExoContainer creation to ensure that no Jobs are launched too early even when the scheduler is launched by an external application
Modified: kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java 2010-09-10 10:51:52 UTC (rev 3102)
+++ kernel/trunk/exo.kernel.component.common/src/main/java/org/exoplatform/services/scheduler/impl/QuartzSheduler.java 2010-09-10 11:21:11 UTC (rev 3103)
@@ -44,6 +44,9 @@
{
SchedulerFactory sf = new StdSchedulerFactory();
scheduler_ = sf.getScheduler();
+ // If the scheduler has already been started, it is necessary to put the scheduler
+ // in standby mode to ensure that the jobs of the ExoContainer won't launched too early
+ scheduler_.standby();
// This will launch the scheduler when all the components will be started
ctx.getContainer().addContainerLifecylePlugin(new BaseContainerLifecyclePlugin()
{
Modified: kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java
===================================================================
--- kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java 2010-09-10 10:51:52 UTC (rev 3102)
+++ kernel/trunk/exo.kernel.component.common/src/test/java/org/exoplatform/services/scheduler/test/TestSchedulerService.java 2010-09-10 11:21:11 UTC (rev 3103)
@@ -279,6 +279,7 @@
public void startContainer(ExoContainer container) throws Exception
{
MyComponent component = (MyComponent)container.getComponentInstanceOfType(MyComponent.class);
+ component.doneSignal.await(2, TimeUnit.SECONDS);
component.started = true;
}
}
@@ -286,7 +287,7 @@
public static class MyComponent
{
public boolean started;
- private final CountDownLatch doneSignal = new CountDownLatch(1);
+ public final CountDownLatch doneSignal = new CountDownLatch(1);
public Boolean result;
public void doSomething()
15 years, 8 months
exo-jcr SVN: r3102 - jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-10 06:51:52 -0400 (Fri, 10 Sep 2010)
New Revision: 3102
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
Log:
EXOJCR-830: code review
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-10 09:38:16 UTC (rev 3101)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/BufferedISPNCache.java 2010-09-10 10:51:52 UTC (rev 3102)
@@ -711,10 +711,14 @@
}
/**
+ * Put object in cache.
*
* @param key
+ * cache key
* @param value
+ * cache value
* @return
+ * always returns null
*/
public Object put(CacheKey key, Object value)
{
@@ -722,7 +726,7 @@
changesContainer.add(new PutObjectContainer(key, value, parentCache, changesContainer.getHistoryIndex(), local
.get(), allowLocalChanges));
- return parentCache.get(key);
+ return null;
}
/**
@@ -749,7 +753,9 @@
CompressedISPNChangesBuffer changesContainer = getChangesBufferSafe();
changesContainer.add(new RemoveObjectContainer((CacheKey)key, parentCache, changesContainer.getHistoryIndex(),
local.get(), allowLocalChanges));
- return parentCache.get(key);
+
+ // return null as we never used result
+ return null;
}
/**
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-10 09:38:16 UTC (rev 3101)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-10 10:51:52 UTC (rev 3102)
@@ -590,6 +590,8 @@
{
if (node.getParentIdentifier() != null)
{
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
+
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new CacheNodesId(node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
@@ -598,7 +600,6 @@
}
}
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
return (ItemData)cache.put(new CacheId(node.getIdentifier()), node);
}
@@ -606,6 +607,8 @@
{
if (node.getParentIdentifier() != null)
{
+ cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
+
// if MODIFY and List present OR FORCE_MODIFY, then write
if ((modifyListsOfChild == ModifyChildOption.MODIFY && cache.get(new CacheNodesId(node.getParentIdentifier())) != null)
|| modifyListsOfChild == ModifyChildOption.FORCE_MODIFY)
@@ -614,7 +617,6 @@
}
}
- cache.putInBuffer(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
return (ItemData)cache.putInBuffer(new CacheId(node.getIdentifier()), node);
}
@@ -641,13 +643,14 @@
{
cache.remove(new CacheId(item.getIdentifier()));
cache.remove(new CacheQPath(item.getParentIdentifier(), item.getQPath()));
- cache.remove(new CacheNodesId(item.getIdentifier()));
- cache.remove(new CachePropsId(item.getIdentifier()));
if (item.getParentIdentifier() != null)
{
if (item.isNode())
{
+ cache.remove(new CacheNodesId(item.getIdentifier()));
+ cache.remove(new CachePropsId(item.getIdentifier()));
+
cache.removeFromList(new CacheNodesId(item.getParentIdentifier()), item.getIdentifier());
}
else
@@ -693,10 +696,7 @@
CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath());
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
- if (cache.remove(new CacheQPath(prevNode.getParentIdentifier(), prevNode.getQPath())) != null)
- {
- LOG.debug("Node not extists as a child but update asked " + node.getQPath().getAsString());
- }
+ cache.remove(prevKey);
}
// update childs paths if index changed
15 years, 8 months
exo-jcr SVN: r3101 - jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-10 05:38:16 -0400 (Fri, 10 Sep 2010)
New Revision: 3101
Modified:
jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
Log:
EXOJCR-830: code review
Modified: jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
===================================================================
--- jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-09 16:41:35 UTC (rev 3100)
+++ jcr/branches/1.14-ISPN/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java 2010-09-10 09:38:16 UTC (rev 3101)
@@ -665,7 +665,6 @@
protected void updateMixin(NodeData node)
{
NodeData prevData = (NodeData)cache.put(new CacheId(node.getIdentifier()), node);
- cache.put(new CacheQPath(node.getParentIdentifier(), node.getQPath()), node.getIdentifier());
if (prevData != null)
{
@@ -691,8 +690,8 @@
*/
protected void updateInBuffer(final NodeData node, final NodeData prevNode)
{
-
- if (node.getIdentifier().equals(prevNode.getIdentifier()))
+ CacheQPath prevKey = new CacheQPath(node.getParentIdentifier(), prevNode.getQPath());
+ if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
if (cache.remove(new CacheQPath(prevNode.getParentIdentifier(), prevNode.getQPath())) != null)
{
15 years, 8 months
exo-jcr SVN: r3100 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr: impl/dataflow/persistent/jbosscache and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-09-09 12:41:35 -0400 (Thu, 09 Sep 2010)
New Revision: 3100
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
Log:
EXOJCR-942: Applied the following changes
CacheableLockManagerImpl: we evict the root node instead of stopping the cache in the method stop() since the cache could be shared
JBossCacheWorkspaceStorageCache: The method getSize() has been reviewed
ExoJBossCacheFactory: Only a part of the default EvictionRegionConfig was used to defined the EvictionRegionConfig of the new created Region, which caused a memory leak since the evictionActionPolicyClassName was not set
ParentNodeEvictionActionPolicy: Javadoc updated to indicate that the region id has been added to the path
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-09 13:24:12 UTC (rev 3099)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-09-09 16:41:35 UTC (rev 3100)
@@ -817,8 +817,8 @@
lockRemover.halt();
lockRemover.interrupt();
sessionLockManagers.clear();
-
- PrivilegedCacheHelper.stop(cache);
+ // The cache cannot be stopped since it cans be shared so we evict the root node instead
+ cache.evict(lockRoot);
}
/**
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-09 13:24:12 UTC (rev 3099)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/JBossCacheWorkspaceStorageCache.java 2010-09-09 16:41:35 UTC (rev 3100)
@@ -132,6 +132,8 @@
protected final Fqn<String> childPropsList;
+ protected final Fqn<String> rootFqn;
+
/**
* Node order comparator for getChildNodes().
*/
@@ -306,7 +308,7 @@
LOG.info("Using BufferedJBossCache compatible with Expiration algorithm.");
}
- Fqn<String> rootFqn = Fqn.fromElements(wsConfig.getUniqueName());
+ this.rootFqn = Fqn.fromElements(wsConfig.getUniqueName());
parentCache = ExoJBossCacheFactory.getUniqueInstance(CacheType.JCR_CACHE, rootFqn, parentCache);
// if expiration is used, set appropriate factory with with timeout set via configuration (or default one 15minutes)
@@ -726,10 +728,26 @@
public long getSize()
{
// Total number of JBC nodes in the cache - the total amount of resident nodes
- return cache.getNumberOfNodes() - 5 * cache.getRoot().getChildrenNames().size();
+ return numNodes(cache.getNode(rootFqn)) - 6;
}
/**
+ * Evaluates the total amount of sub-nodes that the given node contains
+ */
+ private static long numNodes(Node<Serializable, Object> n)
+ {
+ long count = 1;// for n
+ if (n != null)
+ {
+ for (Node<Serializable, Object> child : n.getChildren())
+ {
+ count += numNodes(child);
+ }
+ }
+ return count;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isEnabled()
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2010-09-09 13:24:12 UTC (rev 3099)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/jbosscache/ParentNodeEvictionActionPolicy.java 2010-09-09 16:41:35 UTC (rev 3100)
@@ -73,8 +73,8 @@
if (parentFqn.get(1).equals(JBossCacheWorkspaceStorageCache.CHILD_NODES)
|| parentFqn.get(1).equals(JBossCacheWorkspaceStorageCache.CHILD_PROPS))
{
- // The expected data structure is of type $CHILD_NODES/${node-id}/${sub-node-name} or
- // $CHILD_PROPS/${node-id}/${sub-property-name}
+ // The expected data structure is of type ${ws-id}/$CHILD_NODES/${node-id}/${sub-node-name} or
+ // ${ws-id}/$CHILD_PROPS/${node-id}/${sub-property-name}
// We use the method getChildrenNamesDirect to avoid going through
// the intercepter chain (EXOJCR-460)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-09 13:24:12 UTC (rev 3099)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/jbosscache/ExoJBossCacheFactory.java 2010-09-09 16:41:35 UTC (rev 3100)
@@ -221,11 +221,10 @@
EvictionConfig ec = cfg.getEvictionConfig();
// Create the region and set the config
Region region = cache.getRegion(fqn, true);
- if (ec != null && ec.getDefaultEvictionRegionConfig() != null
- && ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig() != null)
+ if (ec != null && ec.getDefaultEvictionRegionConfig() != null)
{
- EvictionRegionConfig erc =
- new EvictionRegionConfig(fqn, ec.getDefaultEvictionRegionConfig().getEvictionAlgorithmConfig());
+ EvictionRegionConfig erc = new EvictionRegionConfig(fqn);
+ erc.setDefaults(ec.getDefaultEvictionRegionConfig());
region.setEvictionRegionConfig(erc);
}
}
15 years, 8 months
exo-jcr SVN: r3099 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-09 09:24:12 -0400 (Thu, 09 Sep 2010)
New Revision: 3099
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
Log:
EXOJCR-940: special method for removing system workspace
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-09-09 13:21:59 UTC (rev 3098)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-09-09 13:24:12 UTC (rev 3099)
@@ -181,17 +181,7 @@
*/
public boolean canRemoveWorkspace(String workspaceName) throws NoSuchWorkspaceException
{
- if (repositoryContainer.getWorkspaceEntry(workspaceName) == null)
- throw new NoSuchWorkspaceException("No such workspace " + workspaceName);
-
- if (workspaceName.equals(config.getSystemWorkspaceName()))
- return false;
-
- SessionRegistry sessionRegistry =
- (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
-
- return sessionRegistry != null && !sessionRegistry.isInUse(workspaceName);
-
+ return canRemoveWorkspace(workspaceName, false);
}
/**
@@ -637,13 +627,7 @@
*/
public void removeWorkspace(String workspaceName) throws RepositoryException
{
- if (!canRemoveWorkspace(workspaceName))
-
- throw new RepositoryException("Workspace " + workspaceName + " in use. If you want to "
- + " remove workspace close all open sessions");
-
- internalRemoveWorkspace(workspaceName);
- config.getWorkspaceEntries().remove(repositoryContainer.getWorkspaceEntry(workspaceName));
+ removeWorkspace(workspaceName, false);
}
/**
@@ -654,23 +638,7 @@
*/
protected void removeSystemWorkspace() throws RepositoryException
{
-
- //check system workspace
- String sysWSName = config.getSystemWorkspaceName();
- if (repositoryContainer.getWorkspaceEntry(sysWSName) == null)
- throw new NoSuchWorkspaceException("No system workspace " + sysWSName);
-
- SessionRegistry sessionRegistry =
- (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
-
- if (sessionRegistry != null && !sessionRegistry.isInUse(sysWSName))
- {
- throw new RepositoryException("Workspace " + sysWSName + " in use. If you want to "
- + " remove workspace close all open sessions");
- }
-
- internalRemoveWorkspace(sysWSName);
- config.getWorkspaceEntries().remove(repositoryContainer.getWorkspaceEntry(sysWSName));
+ removeWorkspace(config.getSystemWorkspaceName(), true);
}
/**
@@ -735,6 +703,55 @@
}
}
+ /**
+ * Remove workspace.
+ *
+ * @param workspaceName
+ * workspace name
+ * @param allowRemoveSystemWorkspacew
+ * allow to remove system workspace
+ * @throws RepositoryException
+ * if any Exception is occurred
+ */
+ private void removeWorkspace(String workspaceName, boolean allowRemoveSystemWorkspacew) throws RepositoryException
+ {
+ if (!canRemoveWorkspace(workspaceName, allowRemoveSystemWorkspacew))
+
+ throw new RepositoryException("Workspace " + workspaceName + " in use. If you want to "
+ + " remove workspace close all open sessions");
+
+ internalRemoveWorkspace(workspaceName);
+ config.getWorkspaceEntries().remove(repositoryContainer.getWorkspaceEntry(workspaceName));
+ }
+
+ /**
+ * Indicates if specific workspace can be removed.
+ *
+ * @param workspaceName
+ * workspace name
+ * @param allowRemoveSystemWorkspace
+ * allow to remove system workspacw
+ * @return
+ * true if workspace can be removed or false in ather case
+ * @throws NoSuchWorkspaceException
+ * if any Exception is occured
+ */
+ private boolean canRemoveWorkspace(String workspaceName, boolean allowRemoveSystemWorkspace)
+ throws NoSuchWorkspaceException
+ {
+ if (repositoryContainer.getWorkspaceEntry(workspaceName) == null)
+ throw new NoSuchWorkspaceException("No such workspace " + workspaceName);
+
+ if (!allowRemoveSystemWorkspace && workspaceName.equals(config.getSystemWorkspaceName()))
+ return false;
+
+ SessionRegistry sessionRegistry =
+ (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
+
+ return sessionRegistry != null && !sessionRegistry.isInUse(workspaceName);
+
+ }
+
@Override
public String toString()
{
15 years, 8 months
exo-jcr SVN: r3098 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-09-09 09:21:59 -0400 (Thu, 09 Sep 2010)
New Revision: 3098
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
Log:
EXOJCR-941: special method for removing default repository
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-09-09 12:58:23 UTC (rev 3097)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-09-09 13:21:59 UTC (rev 3098)
@@ -31,7 +31,6 @@
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
-import org.exoplatform.services.jcr.impl.core.AddNamespacePluginHolder;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.log.ExoLogger;
@@ -46,10 +45,7 @@
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
import javax.jcr.RepositoryException;
/**
@@ -107,33 +103,12 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean canRemoveRepository(String name) throws RepositoryException
{
- RepositoryImpl repo = (RepositoryImpl)getRepository(name);
- try
- {
- RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
-
- for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
- {
- // Check non system workspaces
- if (!repo.getSystemWorkspaceName().equals(wsEntry.getName()) && !repo.canRemoveWorkspace(wsEntry.getName()))
- return false;
- }
- // check system workspace
- RepositoryContainer repositoryContainer = repositoryContainers.get(name);
- SessionRegistry sessionRegistry =
- (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
- if (sessionRegistry == null || sessionRegistry.isInUse(repo.getSystemWorkspaceName()))
- return false;
-
- }
- catch (RepositoryConfigurationException e)
- {
- throw new RepositoryException(e);
- }
-
- return true;
+ return canRemoveRepository(name, false);
}
/**
@@ -222,34 +197,12 @@
return (ManageableRepository)repositoryContainer.getComponentInstanceOfType(ManageableRepository.class);
}
+ /**
+ * {@inheritDoc}
+ */
public void removeRepository(String name) throws RepositoryException
{
- if (!canRemoveRepository(name))
- throw new RepositoryException("Repository " + name + " in use. If you want to "
- + " remove repository close all open sessions");
-
- try
- {
- RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
- RepositoryImpl repo = (RepositoryImpl)getRepository(name);
- for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
- {
- repo.internalRemoveWorkspace(wsEntry.getName());
- }
- repconfig.getWorkspaceEntries().clear();
- RepositoryContainer repositoryContainer = repositoryContainers.get(name);
- repositoryContainer.stop();
- repositoryContainers.remove(name);
- config.getRepositoryConfigurations().remove(repconfig);
- }
- catch (RepositoryConfigurationException e)
- {
- throw new RepositoryException(e);
- }
- catch (Exception e)
- {
- throw new RepositoryException(e);
- }
+ removeRepository(name, false);
}
public void setCurrentRepositoryName(String repositoryName) throws RepositoryConfigurationException
@@ -303,6 +256,17 @@
managerStartChanges.cleanup();
}
+ /**
+ * Remove default repository.
+ *
+ * @throws RepositoryException
+ * if any Exception occurred during removing
+ */
+ protected void removeDefaultRepository() throws RepositoryException
+ {
+ removeRepository(config.getDefaultRepositoryName(), true);
+ }
+
private void init(ExoContainer container) throws RepositoryConfigurationException, RepositoryException
{
this.parentContainer = container;
@@ -350,7 +314,7 @@
log.debug("Node types is registered from xml-file " + nodeTypeFilesName);
}
}
-
+
List<String> defaultNodeTypesFiles = plugin.getNodeTypesFiles(repositoryName);
if (defaultNodeTypesFiles != null && defaultNodeTypesFiles.size() > 0)
{
@@ -365,7 +329,7 @@
{
throw new RepositoryException(e);
}
-
+
log.info("Trying register node types (" + repositoryName + ") from xml-file " + nodeTypeFilesName);
ntManager.registerNodeTypes(inXml, ExtendedNodeTypeManager.IGNORE_IF_EXISTS);
log.info("Node types is registered (" + repositoryName + ") from xml-file " + nodeTypeFilesName);
@@ -376,6 +340,92 @@
}
/**
+ * Remove repository with specific name.
+ *
+ * @param name
+ * repository name
+ * @param allowRemoveDefaultRepository
+ * allow to remove default repository
+ * @throws RepositoryException
+ * if any Exception occurred
+ */
+ private void removeRepository(String name, boolean allowRemoveDefaultRepository) throws RepositoryException
+ {
+ if (!canRemoveRepository(name, allowRemoveDefaultRepository))
+ throw new RepositoryException("Repository " + name + " in use. If you want to "
+ + " remove repository close all open sessions");
+
+ try
+ {
+ RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
+ RepositoryImpl repo = (RepositoryImpl)getRepository(name);
+ for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
+ {
+ repo.internalRemoveWorkspace(wsEntry.getName());
+ }
+ repconfig.getWorkspaceEntries().clear();
+ RepositoryContainer repositoryContainer = repositoryContainers.get(name);
+ repositoryContainer.stop();
+ repositoryContainers.remove(name);
+ config.getRepositoryConfigurations().remove(repconfig);
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ throw new RepositoryException(e);
+ }
+ catch (Exception e)
+ {
+ throw new RepositoryException(e);
+ }
+ }
+
+ /**
+ * Indicates if repository with specific name can be removed.
+ *
+ * @param name
+ * repository name
+ * @param allowRemoveDefaultRepository
+ * allow to remove default repository
+ * @return
+ * true if repository can be removed or false in other case
+ * @throws RepositoryException
+ * if any Exception occurred
+ */
+ private boolean canRemoveRepository(String name, boolean allowRemoveDefaultRepository) throws RepositoryException
+ {
+ if (!allowRemoveDefaultRepository && name.equals(config.getDefaultRepositoryName()))
+ {
+ return false;
+ }
+
+ RepositoryImpl repo = (RepositoryImpl)getRepository(name);
+ try
+ {
+ RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
+
+ for (WorkspaceEntry wsEntry : repconfig.getWorkspaceEntries())
+ {
+ // Check non system workspaces
+ if (!repo.getSystemWorkspaceName().equals(wsEntry.getName()) && !repo.canRemoveWorkspace(wsEntry.getName()))
+ return false;
+ }
+ // check system workspace
+ RepositoryContainer repositoryContainer = repositoryContainers.get(name);
+ SessionRegistry sessionRegistry =
+ (SessionRegistry)repositoryContainer.getComponentInstance(SessionRegistry.class);
+ if (sessionRegistry == null || sessionRegistry.isInUse(repo.getSystemWorkspaceName()))
+ return false;
+
+ }
+ catch (RepositoryConfigurationException e)
+ {
+ throw new RepositoryException(e);
+ }
+
+ return true;
+ }
+
+ /**
* Manager start changes plugins.
*/
public class ManagerStartChanges
@@ -478,6 +528,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public boolean equals(Object o)
{
StorageKey k = (StorageKey)o;
@@ -489,6 +540,7 @@
/**
* {@inheritDoc}
*/
+ @Override
public int hashCode()
{
return repositoryName.hashCode() ^ workspaceName.hashCode() ^ listenerClassName.hashCode();
15 years, 8 months