exo-jcr SVN: r3370 - jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-10-29 11:43:22 -0400 (Fri, 29 Oct 2010)
New Revision: 3370
Modified:
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-data.xml
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/udp-mux.xml
Log:
EXOJCR-1028: configs updated
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-data.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-data.xml 2010-10-29 12:05:06 UTC (rev 3369)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-data.xml 2010-10-29 15:43:22 UTC (rev 3370)
@@ -6,22 +6,16 @@
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
<!-- Eviction configuration -->
<eviction wakeUpInterval="5000">
- <!-- default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
+ <default algorithmClass="org.jboss.cache.eviction.ExpirationAlgorithm"
actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
eventQueueSize="1000000">
<property name="maxNodes" value="1000000" />
<property name="warnNoExpirationKey" value="false" />
- </default -->
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
- actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy" eventQueueSize="1000000">
- <property name="maxNodes" value="50000" />
- <property name="timeToLive" value="60000" />
</default>
</eviction>
</jbosscache>
\ No newline at end of file
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml 2010-10-29 12:05:06 UTC (rev 3369)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-indexer.xml 2010-10-29 15:43:22 UTC (rev 3370)
@@ -3,10 +3,11 @@
<locking useLockStriping="false" concurrencyLevel="500" lockParentForChildInsertRemove="false"
lockAcquisitionTimeout="20000" />
+ <!-- Configure the TransactionManager -->
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
<!-- Eviction configuration -->
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml 2010-10-29 12:05:06 UTC (rev 3369)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/jbosscache-lock.xml 2010-10-29 15:43:22 UTC (rev 3370)
@@ -6,14 +6,14 @@
<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
<stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
<sync />
</clustering>
<loaders passivation="false" shared="true">
- <preload>
- <node fqn="/" />
- </preload>
+ <!-- All the data of the JCR locks needs to be loaded at startup -->
+ <preload>
+ <node fqn="/" />
+ </preload>
<!--
For another cache-loader class you should use another template with
cache-loader specific parameters
@@ -33,7 +33,5 @@
cache.jdbc.datasource=${jbosscache-cl-cache.jdbc.datasource}
</properties>
</loader>
-
</loaders>
-
</jbosscache>
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/udp-mux.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/udp-mux.xml 2010-10-29 12:05:06 UTC (rev 3369)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/cluster/udp-mux.xml 2010-10-29 15:43:22 UTC (rev 3370)
@@ -1,33 +1,65 @@
-<protocol_stacks>
- <stack name="jcr.stack">
- <config>
- <UDP mcast_addr="228.10.10.10" mcast_port="45588" tos="8" ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000" loopback="false"
- discard_incompatible_packets="true" max_bundle_size="64000" max_bundle_timeout="30"
- use_incoming_packet_handler="true" ip_ttl="2" enable_bundling="true" enable_diagnostics="true"
- thread_naming_pattern="cl" use_concurrent_stack="true" thread_pool.enabled="true" thread_pool.min_threads="2"
- thread_pool.max_threads="8" thread_pool.keep_alive_time="5000" thread_pool.queue_enabled="true"
- thread_pool.queue_max_size="1000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true"
- oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8" oob_thread_pool.keep_alive_time="5000"
- oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="Run" />
+<config>
+ <UDP
+ singleton_name="JCR-cluster"
+ mcast_addr="${jgroups.udp.mcast_addr:228.10.10.10}"
+ mcast_port="${jgroups.udp.mcast_port:45588}"
+ tos="8"
+ ucast_recv_buf_size="20000000"
+ ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000"
+ mcast_send_buf_size="640000"
+ loopback="false"
+ discard_incompatible_packets="true"
+ max_bundle_size="64000"
+ max_bundle_timeout="30"
+ use_incoming_packet_handler="true"
+ ip_ttl="${jgroups.udp.ip_ttl:2}"
+ enable_bundling="false"
+ enable_diagnostics="true"
+ thread_naming_pattern="cl"
- <PING timeout="2000" num_initial_members="3" />
- <MERGE2 max_interval="30000" min_interval="10000" />
- <FD_SOCK />
- <FD timeout="10000" max_tries="5" shun="true" />
- <VERIFY_SUSPECT timeout="1500" />
- <BARRIER />
- <pbcast.NAKACK use_stats_for_retransmission="false" exponential_backoff="150" use_mcast_xmit="true"
- gc_lag="0" retransmit_timeout="50,300,600,1200" discard_delivered_msgs="true" />
- <UNICAST timeout="300,600,1200" />
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="1000000" />
- <VIEW_SYNC avg_send_interval="60000" />
- <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="false" view_bundling="true" />
- <FC max_credits="500000" min_threshold="0.20" />
- <FRAG2 frag_size="60000" />
- <!--pbcast.STREAMING_STATE_TRANSFER /-->
- <pbcast.STATE_TRANSFER />
- <!-- pbcast.FLUSH /-->
- </config>
- </stack>
-</protocol_stacks>
+ use_concurrent_stack="true"
+
+ thread_pool.enabled="true"
+ thread_pool.min_threads="2"
+ thread_pool.max_threads="8"
+ thread_pool.keep_alive_time="5000"
+ thread_pool.queue_enabled="true"
+ thread_pool.queue_max_size="1000"
+ thread_pool.rejection_policy="discard"
+
+ oob_thread_pool.enabled="true"
+ oob_thread_pool.min_threads="1"
+ oob_thread_pool.max_threads="8"
+ oob_thread_pool.keep_alive_time="5000"
+ oob_thread_pool.queue_enabled="false"
+ oob_thread_pool.queue_max_size="100"
+ oob_thread_pool.rejection_policy="Run" />
+
+ <PING timeout="2000"
+ num_initial_members="3"/>
+ <MERGE2 max_interval="30000"
+ min_interval="10000"/>
+ <FD_SOCK />
+ <FD timeout="10000" max_tries="5" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" />
+ <BARRIER />
+ <pbcast.NAKACK use_stats_for_retransmission="false"
+ exponential_backoff="150"
+ use_mcast_xmit="true" gc_lag="0"
+ retransmit_timeout="50,300,600,1200"
+ discard_delivered_msgs="true"/>
+ <UNICAST timeout="300,600,1200" />
+ <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
+ max_bytes="1000000"/>
+ <VIEW_SYNC avg_send_interval="60000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ shun="false"
+ view_bundling="true"/>
+ <FC max_credits="500000"
+ min_threshold="0.20"/>
+ <FRAG2 frag_size="60000" />
+ <!--pbcast.STREAMING_STATE_TRANSFER /-->
+ <pbcast.STATE_TRANSFER />
+ <!-- pbcast.FLUSH /-->
+</config>
13 years, 7 months
exo-jcr SVN: r3369 - jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 08:05:06 -0400 (Fri, 29 Oct 2010)
New Revision: 3369
Modified:
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml
Log:
JCR-1485: fix sjdbc configuration
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-10-29 11:45:18 UTC (rev 3368)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration-sjdbc.xml 2010-10-29 12:05:06 UTC (rev 3369)
@@ -289,6 +289,33 @@
<init-params>
<value-param>
<name>bind-name</name>
+ <value>jdbcjcrdb2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portaldb2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
<value>jdbcjcrtck</value>
</value-param>
<value-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml 2010-10-29 11:45:18 UTC (rev 3368)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config-sjdbc.xml 2010-10-29 12:05:06 UTC (rev 3369)
@@ -295,6 +295,126 @@
</workspaces>
</repository>
+ <repository name="db2" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrdb2" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="false" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wsdb2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wsdb2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db2_ws" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db2_ws_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcrdb2" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrdb2" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="false" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1db2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1db2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;any add_node;any set_property;any remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws1" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db2_ws1" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db2_ws1_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcrdb2" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+ </workspaces>
+ </repository>
+
<repository name="db1tck" system-workspace="ws" default-workspace="ws">
<security-domain>exo-domain</security-domain>
<!-- access-control>optional</access-control -->
13 years, 7 months
exo-jcr SVN: r3368 - in jcr/trunk/exo.jcr.component.core: src/main/java/org/exoplatform/services/jcr/core/security and 8 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 07:45:18 -0400 (Fri, 29 Oct 2010)
New Revision: 3368
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy
Log:
JCR-1485: Unknown error and strange behavior when mary edits a webcontent
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-29 11:45:18 UTC (rev 3368)
@@ -727,7 +727,6 @@
<exclude>org/exoplatform/services/jcr/**/impl/**/TestDBCleanerService.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestSaveConfiguration.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/ValueStoragePluginTest.java</exclude>
- <exclude>org/exoplatform/services/jcr/**/impl/**/TestWorkspaceRestore.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestSessionCleaner.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/Base*.java</exclude>
<exclude>org/exoplatform/services/jcr/**/impl/**/TestJCRSerializationStream.java</exclude>
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -27,6 +27,8 @@
public static final RuntimePermission CREATE_SYSTEM_SESSION_PERMISSION = new RuntimePermission("createSystemSession");
+ public static final RuntimePermission INVOKE_INTERNAL_API_PERMISSION = new RuntimePermission("invokeInternalAPI");
+
public static final RuntimePermission MANAGE_REPOSITORY_PERMISSION = new RuntimePermission("manageRepository");
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceDataPersister.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -352,12 +352,13 @@
if (addACL)
{
- AccessControlList acl = new AccessControlList();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
exoNamespaces =
TransientNodeData.createNodeData(nsSystem, Constants.EXO_NAMESPACES, Constants.NT_UNSTRUCTURED, mixins);
+ AccessControlList acl = exoNamespaces.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(exoNamespaces, Constants.JCR_PRIMARYTYPE, PropertyType.NAME,
false, new TransientValueData(exoNamespaces.getPrimaryTypeName()));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -395,6 +395,12 @@
public void cancelMerge(Version version) throws VersionException, InvalidItemStateException,
UnsupportedRepositoryOperationException, RepositoryException
{
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: cancel merge operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
checkValid();
@@ -445,6 +451,13 @@
{
checkValid();
+
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
@@ -491,7 +504,7 @@
dataManager.getTransactManager().save(changesLog);
- VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(verIdentifier, true);
+ VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(verIdentifier, true, false);
session.getActionHandler().postCheckin(this);
return version;
@@ -505,6 +518,13 @@
checkValid();
+ if (!session.getAccessManager().hasPermission(getACL(), new String[]{PermissionType.SET_PROPERTY},
+ session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: checkout operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
+
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException(
@@ -670,6 +690,13 @@
UnsupportedRepositoryOperationException, RepositoryException
{
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: done merge operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
+
PlainChangesLog changesLog = new PlainChangesLogImpl(session.getId());
VersionImpl base = (VersionImpl)getBaseVersion();
@@ -747,7 +774,8 @@
ItemType.PROPERTY);
try
{
- return (Version)session.getNodeByUUID(ValueDataConvertor.readString(bvProp.getValues().get(0)));
+ return (Version)dataManager.getItemByIdentifier(ValueDataConvertor.readString(bvProp.getValues().get(0)),
+ true, false);
}
catch (IOException e)
{
@@ -1552,7 +1580,7 @@
new InternalQName[]{Constants.NT_BASE}, null, false);
return;
}
-
+
if (parent == null)
{
parent = (NodeData)dataManager.getItemData(getParentIdentifier());
@@ -1685,6 +1713,13 @@
checkValid();
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
+
if (session.hasPendingChanges())
{
throw new InvalidItemStateException("Session has pending changes ");
@@ -1917,6 +1952,13 @@
checkValid();
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: restore operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
+
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException("Node is not versionable " + getPath());
@@ -1967,6 +2009,13 @@
// restore at relPath
checkValid();
+ if (!session.getAccessManager().hasPermission(getACL(),
+ new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ + session.getUserID() + " item owner " + getACL().getOwner());
+ }
+
if (session.hasPendingChanges())
{
throw new InvalidItemStateException("Session has pending changes ");
@@ -2520,7 +2569,7 @@
try
{
return (VersionHistoryImpl)dataManager.getItemByIdentifier(new String(vhProp.getValues().get(0)
- .getAsByteArray()), pool);
+ .getAsByteArray()), pool, false);
}
catch (IOException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ScratchWorkspaceInitializer.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -139,9 +139,6 @@
: Constants.NT_UNSTRUCTURED;
this.dataManager = dataManager;
- // this.nsPersister = nsPersister;
- // this.ntRegistry = ntRegistry;
-
}
public NodeData initWorkspace() throws RepositoryException
@@ -273,13 +270,14 @@
if (addACL)
{
- AccessControlList acl = new AccessControlList();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
jcrSystem =
TransientNodeData.createNodeData(root, Constants.JCR_SYSTEM, Constants.NT_UNSTRUCTURED, mixins,
Constants.SYSTEM_UUID);
+ AccessControlList acl = jcrSystem.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrSystem, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrSystem.getPrimaryTypeName()));
@@ -340,15 +338,6 @@
dataManager.save(new TransactionChangesLog(changesLog));
- //nsPersister.initStorage(jcrSystem, addACL, NamespaceRegistryImpl.DEF_NAMESPACES);
- // nodeTypes save
- // changesLog = new PlainChangesLogImpl();
- // changesLog.addAll(ntPersister.initNodetypesRoot(jcrSystem,
- // addACL).getAllStates());
- // changesLog.addAll(ntPersister.initStorage(nodeTypeDataManager.getAllNodeTypes()).getAllStates());
- // ntPersister.saveChanges(changesLog);
-
- // nodeTypeDataManager.initDefaultNodeTypes(addACL);
return jcrSystem;
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -22,6 +22,7 @@
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.access.PermissionType;
import org.exoplatform.services.jcr.core.nodetype.ItemDefinitionData;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.dataflow.ItemState;
@@ -334,6 +335,35 @@
public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType)
throws RepositoryException
{
+ return getItem(parent, name, pool, itemType, true);
+ }
+
+ /**
+ * For internal use, required privileges. Return Item by parent NodeDada and the name of searched item.
+ *
+ * @param parent
+ * - parent of the searched item
+ * @param name
+ * - item name
+ * @param itemType
+ * - item type
+ * @param pool
+ * - indicates does the item fall in pool
+ * @param apiRead
+ * - if true will call postRead Action and check permissions
+ * @return existed item or null if not found
+ * @throws RepositoryException
+ */
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, ItemType itemType, boolean apiRead)
+ throws RepositoryException
+ {
+ // Need privileges
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.INVOKE_INTERNAL_API_PERMISSION);
+ }
+
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
{
@@ -343,7 +373,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(parent, name, itemType), pool);
+ return item = readItem(getItemData(parent, name, itemType), parent, pool, apiRead);
}
finally
{
@@ -542,7 +572,7 @@
* @param pool boolean, if true will reload pooled ItemImpl
* @param apiRead boolean, if true will call postRead Action and check permissions
* @return ItemImpl
- * @throws RepositoryException if errro occurs
+ * @throws RepositoryException if error occurs
*/
protected ItemImpl readItem(ItemData itemData, NodeData parent, boolean pool, boolean apiRead)
throws RepositoryException
@@ -592,6 +622,30 @@
*/
public ItemImpl getItemByIdentifier(String identifier, boolean pool) throws RepositoryException
{
+ return getItemByIdentifier(identifier, pool, true);
+ }
+
+ /**
+ * For internal use, required privileges. Return item by identifier in this transient storage then in workspace container.
+ *
+ * @param identifier
+ * - identifier of searched item
+ * @param pool
+ * - indicates does the item fall in pool
+ * @param apiRead
+ * - if true will call postRead Action and check permissions
+ * @return existed item data or null if not found
+ * @throws RepositoryException
+ */
+ public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException
+ {
+ // Need privileges
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.INVOKE_INTERNAL_API_PERMISSION);
+ }
+
long start = System.currentTimeMillis();
if (log.isDebugEnabled())
{
@@ -601,7 +655,7 @@
ItemImpl item = null;
try
{
- return item = readItem(getItemData(identifier), pool);
+ return item = readItem(getItemData(identifier), null, pool, apiRead);
}
finally
{
@@ -765,7 +819,7 @@
if (accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.READ}, session.getUserState()
.getIdentity()))
{
- PropertyImpl item = (PropertyImpl)readItem(data, null, true, false);
+ PropertyImpl item = (PropertyImpl)readItem(data, parent, true, false);
refs.add(item);
session.getActionHandler().postRead(item);
@@ -1139,12 +1193,17 @@
*/
public void delete(ItemData itemData) throws RepositoryException
{
- delete(itemData, itemData.getQPath());
+ delete(itemData, itemData.getQPath(), false);
}
public void delete(ItemData itemData, QPath ancestorToSave) throws RepositoryException
{
+ delete(itemData, ancestorToSave, false);
+ }
+ protected void delete(ItemData itemData, QPath ancestorToSave, boolean isInternall) throws RepositoryException
+ {
+
List<? extends ItemData> list = mergeList(itemData, transactionableManager, true, MERGE_ITEMS);
List<ItemState> deletes = new ArrayList<ItemState>();
@@ -1169,7 +1228,8 @@
{
rootAdded = true;
}
- deletes.add(new ItemState(data, ItemState.DELETED, fireEvent, ancestorToSave, false));
+
+ deletes.add(new ItemState(data, ItemState.DELETED, fireEvent, ancestorToSave, isInternall));
// if subnode contains JCR_VERSIONHISTORY property
// we should remove version storage manually
if (checkRemoveChildVersionStorages && !data.isNode()
@@ -1202,7 +1262,7 @@
// 4 add item itself if not added
if (!rootAdded)
{
- deletes.add(new ItemState(itemData, ItemState.DELETED, fireEvent, ancestorToSave, false));
+ deletes.add(new ItemState(itemData, ItemState.DELETED, fireEvent, ancestorToSave, isInternall));
ItemImpl pooled = itemsPool.remove(itemData.getIdentifier());
if (pooled != null)
@@ -1322,7 +1382,7 @@
vhnode.accept(cvremover);
// remove VH
- delete(vhnode, ancestorToSave);
+ delete(vhnode, ancestorToSave, true);
}
/**
@@ -1636,6 +1696,17 @@
+ parent.getACL().getOwner());
}
}
+ else if (changedItem.isMixinChanged())
+ {
+ if (!accessManager.hasPermission(parent.getACL(), new String[]{PermissionType.ADD_NODE,
+ PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
+ {
+ throw new AccessDeniedException("Access denied: ADD_NODE or SET_PROPERTY"
+ + changedItem.getData().getQPath().getAsString() + " for: " + session.getUserID() + " item owner "
+ + parent.getACL().getOwner());
+ }
+ }
+
}
else if (changedItem.isAdded() || changedItem.isUpdated())
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/JCRNodeTypeDataPersister.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -155,13 +155,14 @@
if (addACL)
{
- AccessControlList acl = new AccessControlList();
InternalQName[] mixins = new InternalQName[]{Constants.EXO_OWNEABLE, Constants.EXO_PRIVILEGEABLE};
jcrNodetypes =
TransientNodeData.createNodeData(nsSystem, Constants.JCR_NODETYPES, Constants.NT_UNSTRUCTURED, mixins,
Constants.NODETYPESROOT_UUID);
+ AccessControlList acl = jcrNodetypes.getACL();
+
TransientPropertyData primaryType =
TransientPropertyData.createPropertyData(jcrNodetypes, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(jcrNodetypes.getPrimaryTypeName()));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionHistoryImpl.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -191,7 +191,7 @@
JCRName jcrVersionName = locationFactory.parseJCRName(versionName);
VersionImpl version =
(VersionImpl)dataManager.getItem(nodeData(), new QPathEntry(jcrVersionName.getInternalName(), 1), pool,
- ItemType.NODE);
+ ItemType.NODE, false);
if (version == null)
{
throw new VersionException("There are no version with name '" + versionName + "' in the version history "
@@ -214,7 +214,7 @@
throw new RepositoryException("There are no label '" + label + "' in the version history " + getPath());
}
- VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(versionData.getIdentifier(), true);
+ VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(versionData.getIdentifier(), true, false);
if (version == null)
{
@@ -377,7 +377,7 @@
for (ValueData pvalue : predecessorsData.getValues())
{
String pidentifier = new String(pvalue.getAsByteArray());
- VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(pidentifier, false);
+ VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(pidentifier, false, false);
// actually predecessor is V2's successor
if (predecessor != null)
{// V2's successor
@@ -415,7 +415,7 @@
for (ValueData svalue : successorsData.getValues())
{
String sidentifier = new String(svalue.getAsByteArray());
- VersionImpl successor = (VersionImpl)dataManager.getItemByIdentifier(sidentifier, false);
+ VersionImpl successor = (VersionImpl)dataManager.getItemByIdentifier(sidentifier, false, false);
if (successor != null)
{
// case of VH graph merge
@@ -611,7 +611,7 @@
{
throw new RepositoryException(e);
}
- VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(new String(pib), false);
+ VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(new String(pib), false, false);
predecessor.addSuccessor(versionData.getIdentifier(), changesLog);
predecessorsNew.add(new TransientValueData(pib));
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/version/VersionImpl.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -161,7 +161,7 @@
for (int i = 0; i < predecessorsValues.size(); i++)
{
String videntifier = new String(predecessorsValues.get(i).getAsByteArray());
- VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(videntifier, false);
+ VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(videntifier, false, false);
if (version != null)
{
predecessors[i] = version;
@@ -446,7 +446,7 @@
checkValid();
VersionHistoryImpl vhistory =
- (VersionHistoryImpl)dataManager.getItemByIdentifier(nodeData().getParentIdentifier(), true);
+ (VersionHistoryImpl)dataManager.getItemByIdentifier(nodeData().getParentIdentifier(), true, false);
if (vhistory == null)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/version/VersionHistoryDataHelper.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -335,19 +335,19 @@
// update all
QPath vpath = versionable.getQPath();
- changes.add(new ItemState(versionHistory, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(vhPrimaryType, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(vhUuid, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(vhVersionableUuid, ItemState.ADDED, true, vpath));
+ changes.add(new ItemState(versionHistory, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(vhPrimaryType, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(vhUuid, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(vhVersionableUuid, ItemState.ADDED, true, vpath, true));
- changes.add(new ItemState(vhVersionLabels, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(vlPrimaryType, ItemState.ADDED, true, vpath));
+ changes.add(new ItemState(vhVersionLabels, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(vlPrimaryType, ItemState.ADDED, true, vpath, true));
- changes.add(new ItemState(rootVersionData, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(rvPrimaryType, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(rvMixinTypes, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(rvUuid, ItemState.ADDED, true, vpath));
- changes.add(new ItemState(rvCreated, ItemState.ADDED, true, vpath));
+ changes.add(new ItemState(rootVersionData, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(rvPrimaryType, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(rvMixinTypes, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(rvUuid, ItemState.ADDED, true, vpath, true));
+ changes.add(new ItemState(rvCreated, ItemState.ADDED, true, vpath, true));
changes.add(ItemState.createAddedState(vh));
changes.add(ItemState.createAddedState(bv));
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/access/TestPermissions.java 2010-10-29 11:45:18 UTC (rev 3368)
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.access;
+
+import org.exoplatform.services.jcr.BaseStandaloneTest;
+import org.exoplatform.services.jcr.access.PermissionType;
+import org.exoplatform.services.jcr.access.SystemIdentity;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.version.Version;
+
+/**
+ * Test is run on special repository db2.<br>
+ * System workspace 'ws' has permissions configuration: <br>
+ * <br>
+ * *:/platform/administrators read;*:/platform/administrators add_node;
+ * *:/platform/administrators set_property;*:/platform/administrators remove
+ * <br><br>
+ * Workspace 'ws1' has permissions configuration:<br>
+ * <br>
+ * any read;any add_node;any set_property;any remove
+ *
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
+ * @version $Id: TestRemoveSysteNode.java 111 2010-11-11 11:11:11Z tolusha $
+ */
+public class TestPermissions extends BaseStandaloneTest
+{
+
+ protected SessionImpl sessionMaryWS;
+
+ protected SessionImpl sessionMaryWS1;
+
+ protected SessionImpl sessionWS;
+
+ protected SessionImpl sessionWS1;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getRepositoryName()
+ {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+
+ Repository repository = repositoryService.getRepository("db2");
+ Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
+ sessionWS = (SessionImpl)repository.login(credentials, "ws");
+ sessionWS1 = (SessionImpl)repository.login(credentials, "ws1");
+
+ repository = repositoryService.getRepository("db2");
+ credentials = new CredentialsImpl("mary", "exo".toCharArray());
+ sessionMaryWS = (SessionImpl)repository.login(credentials, "ws");
+ sessionMaryWS1 = (SessionImpl)repository.login(credentials, "ws1");
+
+ // add node with only read permission for mary
+ NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("MARY-ReadOnly");
+ node.addMixin("exo:privilegeable");
+ node.addMixin("exo:owneable");
+ node.setPermission("mary", new String[]{PermissionType.READ});
+ node.setPermission("admin", PermissionType.ALL);
+ node.removePermission(SystemIdentity.ANY);
+ node.addNode("test");
+ sessionWS1.save();
+
+ sessionWS1.getRootNode().addNode("MARY-ReadWrite");
+ sessionWS1.save();
+ }
+
+ @Override
+ public void tearDown() throws Exception
+ {
+ sessionMaryWS.logout();
+ sessionMaryWS1.logout();
+ sessionWS.logout();
+ sessionWS1.logout();
+
+ super.tearDown();
+ }
+
+ /**
+ * Test if Mary can read root node of system workspace.
+ */
+ public void testGetRootNodeWSFailed() throws Exception
+ {
+ try
+ {
+ sessionMaryWS.getRootNode();
+
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+
+ /**
+ * Test if Mary can perform versions operations in workspace where she has all right
+ * and in same time she has not rights in system workspace.
+ */
+ public void testCheckinCheckoutWS1Success() throws Exception
+ {
+ NodeImpl node = (NodeImpl)sessionMaryWS1.getRootNode().getNode("MARY-ReadWrite");
+ node.addMixin("mix:versionable");
+ sessionMaryWS1.save();
+
+ node.checkin();
+ node.checkout();
+
+ Version version = node.getVersionHistory().getVersion("1");
+ version.getPredecessors();
+ version.getSuccessors();
+ version.getContainingHistory();
+
+ node.restore("1", true);
+
+ node.remove();
+ sessionMaryWS1.save();
+ }
+
+ /**
+ * Test if Mary can add mixin on node with only read permission.
+ */
+ public void testAddMixinWS1Failed() throws Exception
+ {
+ NodeImpl node = (NodeImpl)sessionMaryWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+
+ try
+ {
+ node.addMixin("mix:versionable");
+ sessionMaryWS1.save();
+
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+
+ /**
+ * Test if Mary can remove mixin on node with only read permission.
+ */
+ public void testRemoveMixinWS1Failed() throws Exception
+ {
+ NodeImpl node = (NodeImpl)sessionWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+
+ node = (NodeImpl)sessionMaryWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+
+ try
+ {
+ node.removeMixin("mix:versionable");
+ sessionMaryWS1.save();
+
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+
+ /**
+ * Test if Mary can checkin on node with only read permission.
+ */
+ public void testCheckinWS1Failed() throws Exception
+ {
+ Node node = sessionWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+
+ node = sessionMaryWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+
+ try
+ {
+ node.checkin();
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+
+ /**
+ * Test if Mary can checkout on node with only read permission.
+ */
+ public void testCheckoutWS1Failed() throws Exception
+ {
+ Node node = sessionWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+
+ node.checkin();
+
+ node = sessionMaryWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+
+ try
+ {
+ node.checkout();
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+
+ /**
+ * Test if Mary can restore on node with only read permission.
+ */
+ public void testRestoreWS1Failed() throws Exception
+ {
+ Node node = sessionWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+ node.addMixin("mix:versionable");
+ sessionWS1.save();
+
+ node.checkin();
+ node.checkout();
+
+ node = sessionMaryWS1.getRootNode().getNode("MARY-ReadOnly").getNode("test");
+
+ try
+ {
+ node.restore("1", true);
+ fail("Exception should be thrown.");
+ }
+ catch (AccessDeniedException e)
+ {
+ }
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-configuration.xml 2010-10-29 11:45:18 UTC (rev 3368)
@@ -370,6 +370,60 @@
<init-params>
<value-param>
<name>bind-name</name>
+ <value>jdbcjcrdb2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portaldb2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1db2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrdb2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
<value>jdbcjcrtck</value>
</value-param>
<value-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/cluster/test-jcr-config.xml 2010-10-29 11:45:18 UTC (rev 3368)
@@ -328,6 +328,153 @@
</workspaces>
</repository>
+ <repository name="db2" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrdb2" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wsdb2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wsdb2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws" />
+ <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
+ <property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1db2" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1db2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1db2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions"
+ value="any read;any add_node;any set_property;any remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="test-jbosscache-data.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-data" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws1" />
+ <property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
+ <property name="jbosscache-configuration" value="test-jbosscache-indexer.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="test-jbosscache-lock.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="false" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-locks" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+ </workspaces>
+ </repository>
+
<repository name="db1tck" system-workspace="ws" default-workspace="ws">
<security-domain>exo-domain</security-domain>
<!-- access-control>optional</access-control -->
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-configuration.xml 2010-10-29 11:45:18 UTC (rev 3368)
@@ -255,7 +255,7 @@
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -336,7 +336,7 @@
</properties-param>
</init-params>
</component-plugin>
- <component-plugin>
+ <component-plugin>
<name>bind.datasource</name>
<set-method>addPlugin</set-method>
<type>org.exoplatform.services.naming.BindReferencePlugin</type>
@@ -370,6 +370,60 @@
<init-params>
<value-param>
<name>bind-name</name>
+ <value>jdbcjcrdb2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/portaldb2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
+ <value>jdbcjcr1db2</value>
+ </value-param>
+ <value-param>
+ <name>class-name</name>
+ <value>javax.sql.DataSource</value>
+ </value-param>
+ <value-param>
+ <name>factory</name>
+ <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
+ </value-param>
+ <properties-param>
+ <name>ref-addresses</name>
+ <description>ref-addresses</description>
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:file:target/temp/data/jcrdb2"/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </properties-param>
+ </init-params>
+ </component-plugin>
+ <component-plugin>
+ <name>bind.datasource</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.naming.BindReferencePlugin</type>
+ <init-params>
+ <value-param>
+ <name>bind-name</name>
<value>jdbcjcrtck</value>
</value-param>
<value-param>
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/conf/standalone/test-jcr-config.xml 2010-10-29 11:45:18 UTC (rev 3368)
@@ -207,94 +207,204 @@
</workspace>
<workspace name="ws3">
- <!-- for system storage -->
- <container
- class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr3" />
- <property name="dialect" value="auto" />
- <property name="multi-db" value="true" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="target/temp/swap/ws3" />
- </properties>
- <value-storages>
- <!--
- This storage is used to check whether properties are removed
- correctly from each value-storage
- (TestRemoveFromValueStorage.java)
- -->
- <value-storage id="ws3_big"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3_big" />
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1024K" />
- </filters>
- </value-storage>
- <value-storage id="ws3"
- class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws3" />
- <property name="digest-algo" value="MD5" />
- <property name="vcas-type"
- value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
- <property name="jdbc-source-name" value="jdbcjcr" />
- </properties>
- <filters>
- <filter property-type="Binary" />
- </filters>
- </value-storage>
- </value-storages>
- </container>
- <initializer
- class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
- <properties>
- <property name="root-nodetype" value="nt:unstructured" />
- </properties>
- </initializer>
- <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
- <properties>
- <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
- <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
- </properties>
- </cache>
- <query-handler
- class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="target/temp/index/db1/ws3" />
- <property name="synonymprovider-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
- <property name="synonymprovider-config-path" value="../../synonyms.properties" />
- <property name="support-highlighting" value="true" />
- <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
- <property name="query-class"
- value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
- <property name="spellchecker-class"
- value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
- </properties>
- </query-handler>
- <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
- <properties>
- <property name="time-out" value="15m" />
- <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws3" />
- <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
- <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
- <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws3_pk" />
- <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
- <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
- <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
- <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr3" />
- <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
- </properties>
- </lock-manager>
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K" />
+ </filters>
+ </value-storage>
+ <value-storage id="ws3" class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3" />
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type" value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl" />
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path" value="../../indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db1_ws3" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db1_ws3_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr3" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+ </workspaces>
+ </repository>
- </workspace>
+ <repository name="db2" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <!-- access-control>optional</access-control -->
+ <!-- access-control>disable</access-control -->
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="ws">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcrdb2" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/wsdb2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/wsdb2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="*:/platform/administrators read;*:/platform/administrators add_node;*:/platform/administrators set_property;*:/platform/administrators remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db2_ws" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db2_ws_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcrdb2" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="ws1">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr1db2" />
+ <property name="dialect" value="auto" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="target/temp/swap/ws1db2" />
+ </properties>
+ <value-storages>
+ <value-storage id="ws1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws1db2" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="100K" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured" />
+ <property name="root-permissions" value="any read;any add_node;any set_property;any remove" />
+ </properties>
+ </initializer>
+ <cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
+ <properties>
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-config.xml" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="target/temp/index/db2/ws1" />
+ </properties>
+ </query-handler>
+ <lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
+ <properties>
+ <property name="time-out" value="15m" />
+ <property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock.xml" />
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_db2_ws1" />
+ <property name="jbosscache-cl-cache.jdbc.table.create" value="true" />
+ <property name="jbosscache-cl-cache.jdbc.table.drop" value="false" />
+ <property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_db2_ws1_pk" />
+ <property name="jbosscache-cl-cache.jdbc.fqn.column" value="fqn" />
+ <property name="jbosscache-cl-cache.jdbc.node.column" value="node" />
+ <property name="jbosscache-cl-cache.jdbc.parent.column" value="parent" />
+ <property name="jbosscache-cl-cache.jdbc.datasource" value="jdbcjcr1db2" />
+ <property name="jbosscache-shareable" value="${jbosscache-shareable}" />
+ </properties>
+ </lock-manager>
+ </workspace>
</workspaces>
</repository>
-
+
<repository name="db1tck" system-workspace="ws" default-workspace="ws">
<security-domain>exo-domain</security-domain>
<!-- access-control>optional</access-control -->
Modified: jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy 2010-10-29 11:35:39 UTC (rev 3367)
+++ jcr/trunk/exo.jcr.component.core/src/test/resources/test.policy 2010-10-29 11:45:18 UTC (rev 3368)
@@ -9,4 +9,6 @@
grant codeBase "@TEST_CLASSES@-"{
permission java.lang.RuntimePermission "createSystemSession";
permission java.lang.RuntimePermission "manageRepository";
+ permission java.lang.RuntimePermission "invokeInternalAPI";
};
+
13 years, 7 months
exo-jcr SVN: r3367 - core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 07:35:39 -0400 (Fri, 29 Oct 2010)
New Revision: 3367
Added:
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/TestScript.java
Removed:
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
Modified:
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/JarJarTest.java
Log:
EXOJCR-986: Enable the security manager by default in all the projects, fix bug
Modified: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/JarJarTest.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/JarJarTest.java 2010-10-29 10:10:09 UTC (rev 3366)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/JarJarTest.java 2010-10-29 11:35:39 UTC (rev 3367)
@@ -39,7 +39,7 @@
super(s);
}
- private void testTop(Script script)
+ private void testTop(TestScript script)
{
Mapping m1 = new Mapping();
m1.addMapping("a", "b");
@@ -55,12 +55,12 @@
public void testTopClassLitteral() throws Exception
{
- testTop(new Script("classlitteral1.groovy"));
- testTop(new Script("classlitteral_1.groovy"));
- testTop(new Script("import1.groovy"));
+ testTop(new TestScript("classlitteral1.groovy"));
+ testTop(new TestScript("classlitteral_1.groovy"));
+ testTop(new TestScript("import1.groovy"));
}
- private void testPrefix(Script script) throws Exception
+ private void testPrefix(TestScript script) throws Exception
{
Mapping m1 = new Mapping();
m1.addMapping("prefix1", "prefix2");
@@ -86,8 +86,8 @@
public void testPrefixClassLitteral() throws Exception
{
- testPrefix(new Script("classlitteral2.groovy"));
- testPrefix(new Script("classlitteral_2.groovy"));
- testPrefix(new Script("import2.groovy"));
+ testPrefix(new TestScript("classlitteral2.groovy"));
+ testPrefix(new TestScript("classlitteral_2.groovy"));
+ testPrefix(new TestScript("import2.groovy"));
}
}
Deleted: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 10:10:09 UTC (rev 3366)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 11:35:39 UTC (rev 3367)
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.script.groovy.jarjar;
-
-import groovy.lang.GroovyCodeSource;
-import groovy.lang.GroovyObject;
-import junit.framework.Assert;
-import junit.framework.AssertionFailedError;
-
-import org.codehaus.groovy.control.CompilationFailedException;
-import org.exoplatform.commons.utils.PrivilegedSystemHelper;
-import org.exoplatform.commons.utils.SecurityHelper;
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class Script
-{
-
- /** . */
- private final String name;
-
- public Script(String name)
- {
- this.name = name;
- }
-
- public Object execute(Mapping mapping)
- {
-
- //
- final JarJarClassLoader loader =
- JarJarClassLoader.createJarJarClassLoaderInPrivilegedMode(Thread.currentThread().getContextClassLoader());
-
- //
- mapping.configure(loader);
-
- // Obtain script class
- URL url = PrivilegedSystemHelper.getResource("jarjar/" + name);
- Assert.assertNotNull(url);
- GroovyCodeSource gcs;
- try
- {
- gcs = new GroovyCodeSource(url);
- }
- catch (IOException e)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(e);
- throw err;
- }
-
- Class testClass;
- try
- {
- final GroovyCodeSource gGcs = gcs;
- testClass = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Class>()
- {
- public Class run() throws Exception
- {
- return loader.parseClass(gGcs);
- }
- });
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof CompilationFailedException)
- {
- throw (CompilationFailedException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
-
- // Instantiate script
- GroovyObject testObject;
- try
- {
- testObject = (GroovyObject)testClass.newInstance();
- }
- catch (Exception e)
- {
- AssertionFailedError err = new AssertionFailedError();
- err.initCause(e);
- throw err;
- }
-
- // Invoke finally
- return testObject.invokeMethod("run", new Object[0]);
- }
-}
Copied: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/TestScript.java (from rev 3366, core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java)
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/TestScript.java (rev 0)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/TestScript.java 2010-10-29 11:35:39 UTC (rev 3367)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.script.groovy.jarjar;
+
+import groovy.lang.GroovyCodeSource;
+import groovy.lang.GroovyObject;
+import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
+
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestScript
+{
+
+ /** . */
+ private final String name;
+
+ public TestScript(String name)
+ {
+ this.name = name;
+ }
+
+ public Object execute(Mapping mapping)
+ {
+
+ //
+ JarJarClassLoader loader =
+ JarJarClassLoader.createJarJarClassLoaderInPrivilegedMode(Thread.currentThread().getContextClassLoader());
+
+ //
+ mapping.configure(loader);
+
+ // Obtain script class
+ URL url = PrivilegedSystemHelper.getResource("jarjar/" + name);
+ Assert.assertNotNull(url);
+ GroovyCodeSource gcs;
+ try
+ {
+ gcs = new GroovyCodeSource(url);
+ }
+ catch (IOException e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+
+ Class testClass = loader.parseClass(gcs);;
+
+ // Instantiate script
+ GroovyObject testObject;
+ try
+ {
+ testObject = (GroovyObject)testClass.newInstance();
+ }
+ catch (Exception e)
+ {
+ AssertionFailedError err = new AssertionFailedError();
+ err.initCause(e);
+ throw err;
+ }
+
+ // Invoke finally
+ return testObject.invokeMethod("run", new Object[0]);
+ }
+}
13 years, 7 months
exo-jcr SVN: r3366 - core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 06:10:09 -0400 (Fri, 29 Oct 2010)
New Revision: 3366
Modified:
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
Log:
EXOJCR-986: Enable SecurityManager by default: fix
Modified: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 09:30:37 UTC (rev 3365)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 10:10:09 UTC (rev 3366)
@@ -23,10 +23,14 @@
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
+import org.codehaus.groovy.control.CompilationFailedException;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import java.io.IOException;
import java.net.URL;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
/**
* @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
@@ -47,7 +51,7 @@
{
//
- JarJarClassLoader loader =
+ final JarJarClassLoader loader =
JarJarClassLoader.createJarJarClassLoaderInPrivilegedMode(Thread.currentThread().getContextClassLoader());
//
@@ -67,8 +71,36 @@
err.initCause(e);
throw err;
}
- Class testClass = loader.parseClass(gcs);
+ Class testClass;
+ try
+ {
+ final GroovyCodeSource gGcs = gcs;
+ testClass = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Class>()
+ {
+ public Class run() throws Exception
+ {
+ return loader.parseClass(gGcs);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof CompilationFailedException)
+ {
+ throw (CompilationFailedException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+
// Instantiate script
GroovyObject testObject;
try
13 years, 7 months
exo-jcr SVN: r3365 - in core/trunk: exo.core.component.database/src/main/java/org/exoplatform/services/database/creator and 33 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 05:30:37 -0400 (Fri, 29 Oct 2010)
New Revision: 3365
Added:
core/trunk/exo.core.component.database/src/test/resources/test.policy
core/trunk/exo.core.component.ldap/src/test/resources/test.policy
core/trunk/exo.core.component.organization.api/src/test/resources/test.policy
core/trunk/exo.core.component.organization.jdbc/src/test/resources/test.policy
core/trunk/exo.core.component.organization.ldap/src/test/resources/test.policy
core/trunk/exo.core.component.script.groovy/src/test/resources/TestSimpleXMLGenerator.groovy
core/trunk/exo.core.component.script.groovy/src/test/resources/test.policy
core/trunk/exo.core.component.web.css/src/test/resources/
core/trunk/exo.core.component.web.css/src/test/resources/test.policy
core/trunk/exo.core.component.xml-processing/src/test/resources/test.policy
Removed:
core/trunk/exo.core.component.script.groovy/src/test/resources/SimpleXMLGenerator.groovy
Modified:
core/trunk/exo.core.component.database/pom.xml
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/creator/DBCreator.java
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
core/trunk/exo.core.component.document/pom.xml
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSExcelDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSWordDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXExcelDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXPPTDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXWordDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/OpenOfficeDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/XMLDocumentReader.java
core/trunk/exo.core.component.document/src/test/resources/test.policy
core/trunk/exo.core.component.ldap/pom.xml
core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
core/trunk/exo.core.component.organization.api/pom.xml
core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/UserProfileData.java
core/trunk/exo.core.component.organization.jdbc/pom.xml
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/SimpleHibernateUserListAccess.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.ldap/pom.xml
core/trunk/exo.core.component.script.groovy/pom.xml
core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/GroovyScriptInstantiator.java
core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/jarjar/JarJarClassLoader.java
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/GroovyInstantiatorTest.java
core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
core/trunk/exo.core.component.security.core/pom.xml
core/trunk/exo.core.component.security.core/src/test/resources/test.policy
core/trunk/exo.core.component.web.css/pom.xml
core/trunk/exo.core.component.xml-processing/pom.xml
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/resolving/impl/XMLResolver.java
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/TransformerBase.java
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/html/TidyTransformerImpl.java
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTransformerImpl.java
Log:
EXOJCR-986: Enable SecurityManager by default
Modified: core/trunk/exo.core.component.database/pom.xml
===================================================================
--- core/trunk/exo.core.component.database/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.database/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -61,6 +61,11 @@
<artifactId>exo.kernel.component.cache</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.resource</groupId>
<artifactId>connector-api</artifactId>
<scope>test</scope>
@@ -120,18 +125,54 @@
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/DBCreatorTest.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <excludes>
+ <exclude>**/DBCreatorTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
</build>
</project>
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/creator/DBCreator.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/creator/DBCreator.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/creator/DBCreator.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,14 +18,16 @@
*/
package org.exoplatform.services.database.creator;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.configuration.ConfigurationException;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.security.PrivilegedExceptionAction;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -197,15 +199,13 @@
{
Class.forName(driver);
- // Properties props = new java.util.Properties();
- // props.put("user", adminName);
- // props.put("password", adminPwd);
- // if (internal_logon != null)
- // {
- // props.put("internal_logon", internal_logon);
- // }
- // conn = DriverManager.getConnection(serverUrl, props);
- conn = DriverManager.getConnection(serverUrl, adminName, adminPwd);
+ conn = SecurityHelper.doPriviledgedSQLExceptionAction(new PrivilegedExceptionAction<Connection>()
+ {
+ public Connection run() throws Exception
+ {
+ return DriverManager.getConnection(serverUrl, adminName, adminPwd);
+ }
+ });
}
catch (SQLException e)
{
@@ -219,7 +219,14 @@
String dbProductName;
try
{
- dbProductName = conn.getMetaData().getDatabaseProductName();
+ final Connection connection = conn;
+ dbProductName = SecurityHelper.doPriviledgedSQLExceptionAction(new PrivilegedExceptionAction<String>()
+ {
+ public String run() throws Exception
+ {
+ return connection.getMetaData().getDatabaseProductName();
+ }
+ });
if (dbProductName.startsWith("Microsoft SQL Server") || dbProductName.startsWith("Adaptive Server Anywhere")
|| dbProductName.equals("Sybase SQL Server") || dbProductName.equals("Adaptive Server Enterprise"))
@@ -334,7 +341,7 @@
*/
protected String readScriptResource(String path) throws IOException
{
- InputStream is = new FileInputStream(path);
+ InputStream is = PrivilegedFileHelper.fileInputStream(path);
InputStreamReader isr = new InputStreamReader(is);
try
{
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -19,6 +19,8 @@
package org.exoplatform.services.database.impl;
import org.exoplatform.commons.exception.ObjectNotFoundException;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.component.ComponentRequestLifecycle;
@@ -39,6 +41,7 @@
import java.io.Serializable;
import java.net.URL;
+import java.security.PrivilegedAction;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
@@ -79,8 +82,14 @@
{
threadLocal_ = new ThreadLocal<Session>();
PropertiesParam param = initParams.getPropertiesParam("hibernate.properties");
- HibernateSettingsFactory settingsFactory = new HibernateSettingsFactory(new ExoCacheProvider(cacheService));
- conf_ = new HibernateConfigurationImpl(settingsFactory);
+ final HibernateSettingsFactory settingsFactory = new HibernateSettingsFactory(new ExoCacheProvider(cacheService));
+ conf_ = SecurityHelper.doPriviledgedAction(new PrivilegedAction<HibernateConfigurationImpl>()
+ {
+ public HibernateConfigurationImpl run()
+ {
+ return new HibernateConfigurationImpl(settingsFactory);
+ }
+ });
Iterator properties = param.getPropertyIterator();
while (properties.hasNext())
{
@@ -108,7 +117,8 @@
String connectionURL = conf_.getProperty("hibernate.connection.url");
if (connectionURL != null)
{
- connectionURL = connectionURL.replace("${java.io.tmpdir}", System.getProperty("java.io.tmpdir"));
+ connectionURL =
+ connectionURL.replace("${java.io.tmpdir}", PrivilegedSystemHelper.getProperty("java.io.tmpdir"));
conf_.setProperty("hibernate.connection.url", connectionURL);
}
@@ -280,8 +290,15 @@
{
if (sessionFactory_ == null)
{
- sessionFactory_ = conf_.buildSessionFactory();
- new SchemaUpdate(conf_).execute(false, true);
+ sessionFactory_ = SecurityHelper.doPriviledgedAction(new PrivilegedAction<SessionFactory>()
+ {
+ public SessionFactory run()
+ {
+ SessionFactory factory = conf_.buildSessionFactory();
+ new SchemaUpdate(conf_).execute(false, true);
+ return factory;
+ }
+ });
}
return sessionFactory_;
}
Added: core/trunk/exo.core.component.database/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.database/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.database/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,15 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
+
+
+
+
+
Modified: core/trunk/exo.core.component.document/pom.xml
===================================================================
--- core/trunk/exo.core.component.document/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -104,9 +104,6 @@
<artifactId>tika-parsers</artifactId>
</dependency>
-
-
-
</dependencies>
<build>
<testResources>
@@ -140,7 +137,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!--argLine>-Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine-->
+ <argLine>-Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<!--property>
<name>jcr.test.configuration.file</name>
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSExcelDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSExcelDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSExcelDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -24,10 +24,12 @@
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedAction;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
@@ -67,7 +69,7 @@
throw new NullPointerException("InputStream is null.");
}
- StringBuilder builder = new StringBuilder("");
+ final StringBuilder builder = new StringBuilder("");
SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
@@ -101,7 +103,7 @@
int lastcell = row.getLastCellNum();
for (int k = 0; k < lastcell; k++)
{
- HSSFCell cell = row.getCell((short)k);
+ final HSSFCell cell = row.getCell((short)k);
if (cell != null)
{
switch (cell.getCellType())
@@ -121,16 +123,44 @@
break;
}
case HSSFCell.CELL_TYPE_FORMULA :
- builder.append(cell.getCellFormula().toString()).append(" ");
+ SecurityHelper.doPriviledgedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ builder.append(cell.getCellFormula().toString()).append(" ");
+ return null;
+ }
+ });
break;
case HSSFCell.CELL_TYPE_BOOLEAN :
- builder.append(cell.getBooleanCellValue()).append(" ");
+ SecurityHelper.doPriviledgedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ builder.append(cell.getBooleanCellValue()).append(" ");
+ return null;
+ }
+ });
break;
case HSSFCell.CELL_TYPE_ERROR :
- builder.append(cell.getErrorCellValue()).append(" ");
+ SecurityHelper.doPriviledgedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ builder.append(cell.getErrorCellValue()).append(" ");
+ return null;
+ }
+ });
break;
case HSSFCell.CELL_TYPE_STRING :
- builder.append(cell.getStringCellValue().toString()).append(" ");
+ SecurityHelper.doPriviledgedAction(new PrivilegedAction<Void>()
+ {
+ public Void run()
+ {
+ builder.append(cell.getStringCellValue().toString()).append(" ");
+ return null;
+ }
+ });
break;
default :
break;
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSWordDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSWordDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSWordDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -20,10 +20,12 @@
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.usermodel.Range;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
/**
@@ -52,7 +54,7 @@
* @param is an input stream with .doc file content.
* @return The string only with text from file content.
*/
- public String getContentAsText(InputStream is) throws IOException, DocumentReadException
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
if (is == null)
{
@@ -69,7 +71,13 @@
HWPFDocument doc;
try
{
- doc = new HWPFDocument(is);
+ doc = SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<HWPFDocument>()
+ {
+ public HWPFDocument run() throws Exception
+ {
+ return new HWPFDocument(is);
+ }
+ });
}
catch (IOException e)
{
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXExcelDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXExcelDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXExcelDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -25,10 +25,12 @@
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
@@ -60,7 +62,7 @@
* @param is an input stream with .xls file content.
* @return The string only with text from file content.
*/
- public String getContentAsText(InputStream is) throws IOException, DocumentReadException
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
if (is == null)
{
@@ -80,7 +82,13 @@
XSSFWorkbook wb;
try
{
- wb = new XSSFWorkbook(is);
+ wb = SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<XSSFWorkbook>()
+ {
+ public XSSFWorkbook run() throws Exception
+ {
+ return new XSSFWorkbook(is);
+ }
+ });
}
catch (IOException e)
{
@@ -173,10 +181,18 @@
* @see org.exoplatform.services.document.DocumentReader#getProperties(java.io.
* InputStream)
*/
- public Properties getProperties(InputStream is) throws IOException, DocumentReadException
+ public Properties getProperties(final InputStream is) throws IOException, DocumentReadException
{
POIPropertiesReader reader = new POIPropertiesReader();
- reader.readDCProperties(new XSSFWorkbook(is));
+ reader.readDCProperties(SecurityHelper
+ .doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<XSSFWorkbook>()
+ {
+ public XSSFWorkbook run() throws Exception
+ {
+ return new XSSFWorkbook(is);
+ }
+ }));
+
return reader.getProperties();
}
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXPPTDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXPPTDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXPPTDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -25,10 +25,14 @@
import org.apache.poi.xslf.XSLFSlideShow;
import org.apache.poi.xslf.extractor.XSLFPowerPointExtractor;
import org.apache.xmlbeans.XmlException;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
/**
@@ -56,7 +60,7 @@
* @param is an input stream with .pptx file content.
* @return The string only with text from file content.
*/
- public String getContentAsText(InputStream is) throws IOException, DocumentReadException
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
if (is == null)
{
@@ -69,28 +73,52 @@
return "";
}
- XSLFPowerPointExtractor ppe;
+ final XSLFPowerPointExtractor ppe;
try
{
- ppe = new XSLFPowerPointExtractor(OPCPackage.open(is));
+ ppe = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<XSLFPowerPointExtractor>()
+ {
+ public XSLFPowerPointExtractor run() throws Exception
+ {
+ return new XSLFPowerPointExtractor(OPCPackage.open(is));
+ }
+ });
}
- catch (IOException e)
+ catch (PrivilegedActionException pae)
{
- throw new DocumentReadException("Can't open presentation.", e);
+ Throwable cause = pae.getCause();
+ if (cause instanceof IOException)
+ {
+ throw new DocumentReadException("Can't open presentation.", cause);
+ }
+ else if (cause instanceof OpenXML4JRuntimeException)
+ {
+ throw new DocumentReadException("Can't open presentation.", cause);
+ }
+ else if (cause instanceof OpenXML4JException)
+ {
+ throw new DocumentReadException("Can't open presentation.", cause);
+ }
+ else if (cause instanceof XmlException)
+ {
+ throw new DocumentReadException("Can't open presentation.", cause);
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
- catch (OpenXML4JRuntimeException e)
+ return SecurityHelper.doPriviledgedAction(new PrivilegedAction<String>()
{
- throw new DocumentReadException("Can't open presentation.", e);
- }
- catch (OpenXML4JException e)
- {
- throw new DocumentReadException("Can't open presentation.", e);
- }
- catch (XmlException e)
- {
- throw new DocumentReadException("Can't open presentation.", e);
- }
- return ppe.getText(true, true);
+ public String run()
+ {
+ return ppe.getText(true, true);
+ }
+ });
}
finally
{
@@ -119,25 +147,44 @@
* @see org.exoplatform.services.document.DocumentReader#getProperties(java.io.
* InputStream)
*/
- public Properties getProperties(InputStream is) throws IOException, DocumentReadException
+ public Properties getProperties(final InputStream is) throws IOException, DocumentReadException
{
- POIPropertiesReader reader = new POIPropertiesReader();
+ final POIPropertiesReader reader = new POIPropertiesReader();
try
{
- reader.readDCProperties(new XSLFSlideShow(OPCPackage.open(is)));
+ SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws Exception
+ {
+ reader.readDCProperties(new XSLFSlideShow(OPCPackage.open(is)));
+ return null;
+ }
+ });
}
- catch (InvalidFormatException e)
+ catch (PrivilegedActionException pae)
{
- throw new DocumentReadException("Can't read properties from OOXML document", e);
+ Throwable cause = pae.getCause();
+ if (cause instanceof InvalidFormatException)
+ {
+ throw new DocumentReadException("Can't read properties from OOXML document", cause);
+ }
+ else if (cause instanceof OpenXML4JException)
+ {
+ throw new DocumentReadException("Can't read properties from OOXML document", cause);
+ }
+ else if (cause instanceof XmlException)
+ {
+ throw new DocumentReadException("Can't read properties from OOXML document", cause);
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
- catch (OpenXML4JException e)
- {
- throw new DocumentReadException("Can't read properties from OOXML document", e);
- }
- catch (XmlException e)
- {
- throw new DocumentReadException("Can't read properties from OOXML document", e);
- }
return reader.getProperties();
}
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXWordDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXWordDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/MSXWordDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -21,10 +21,13 @@
import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
/**
@@ -53,7 +56,7 @@
* @param is an input stream with .docx file content.
* @return The string only with text from file content.
*/
- public String getContentAsText(InputStream is) throws IOException, DocumentReadException
+ public String getContentAsText(final InputStream is) throws IOException, DocumentReadException
{
if (is == null)
{
@@ -70,7 +73,13 @@
XWPFDocument doc;
try
{
- doc = new XWPFDocument(is);
+ doc = SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<XWPFDocument>()
+ {
+ public XWPFDocument run() throws Exception
+ {
+ return new XWPFDocument(is);
+ }
+ });
}
catch (IOException e)
{
@@ -81,8 +90,14 @@
throw new DocumentReadException("Can't open message.", e);
}
- XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
- text = extractor.getText();
+ final XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
+ text = SecurityHelper.doPriviledgedAction(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return extractor.getText();
+ }
+ });
}
finally
{
@@ -112,10 +127,18 @@
/**
* @see org.exoplatform.services.document.DocumentReader#getProperties(java.io.InputStream)
*/
- public Properties getProperties(InputStream is) throws IOException, DocumentReadException
+ public Properties getProperties(final InputStream is) throws IOException, DocumentReadException
{
POIPropertiesReader reader = new POIPropertiesReader();
- reader.readDCProperties(new XWPFDocument(is));
+ reader.readDCProperties(SecurityHelper
+ .doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<XWPFDocument>()
+ {
+ public XWPFDocument run() throws Exception
+ {
+ return new XWPFDocument(is);
+ }
+ }));
+
return reader.getProperties();
}
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/OpenOfficeDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/OpenOfficeDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/OpenOfficeDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -19,6 +19,7 @@
package org.exoplatform.services.document.impl;
import org.exoplatform.commons.utils.QName;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DCMetaData;
import org.exoplatform.services.document.DocumentReadException;
import org.xml.sax.Attributes;
@@ -29,6 +30,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -73,11 +75,19 @@
}
try
{
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setValidating(false);
- SAXParser saxParser;
- saxParser = saxParserFactory.newSAXParser();
+ SAXParser saxParser =
+ SecurityHelper
+ .doPriviledgedParserConfigurationOrSAXExceptionAction(new PrivilegedExceptionAction<SAXParser>()
+ {
+ public SAXParser run() throws Exception
+ {
+ return saxParserFactory.newSAXParser();
+ }
+ });
+
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/validation", false);
@@ -160,10 +170,18 @@
{
try
{
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setValidating(false);
- SAXParser saxParser = saxParserFactory.newSAXParser();
-
+ SAXParser saxParser =
+ SecurityHelper
+ .doPriviledgedParserConfigurationOrSAXExceptionAction(new PrivilegedExceptionAction<SAXParser>()
+ {
+ public SAXParser run() throws Exception
+ {
+ return saxParserFactory.newSAXParser();
+ }
+ });
+
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setFeature("http://xml.org/sax/features/validation", false);
@@ -234,6 +252,7 @@
return content.toString();
}
+ @Override
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts)
throws SAXException
{
@@ -243,6 +262,7 @@
}
}
+ @Override
public void characters(char[] ch, int start, int length) throws SAXException
{
if (appendChar)
@@ -251,6 +271,7 @@
}
}
+ @Override
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
throws SAXException
{
@@ -278,6 +299,7 @@
return props;
}
+ @Override
public void startElement(String namespaceURI, String localName, String rawName, Attributes atts)
throws SAXException
{
@@ -287,6 +309,7 @@
}
}
+ @Override
public void characters(char[] ch, int start, int length) throws SAXException
{
if (curPropertyName != null)
@@ -295,6 +318,7 @@
}
}
+ @Override
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
throws SAXException
{
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/PDFDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -24,6 +24,7 @@
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFTextStripper;
import org.exoplatform.commons.utils.ISO8601;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DCMetaData;
import org.exoplatform.services.document.DocumentReadException;
import org.exoplatform.services.log.ExoLogger;
@@ -207,28 +208,49 @@
* @throws DocumentReadException
* @throws Exception if extracting fails
*/
- protected Properties getPropertiesFromMetadata(byte[] metadata) throws IOException, DocumentReadException
+ protected Properties getPropertiesFromMetadata(final byte[] metadata) throws IOException, DocumentReadException
{
Properties props = null;
// parse xml
-
Document doc;
try
{
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = dbf.newDocumentBuilder();
- doc = docBuilder.parse(new ByteArrayInputStream(metadata));
+ final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ doc = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Document>()
+ {
+ public Document run() throws Exception
+ {
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ return docBuilder.parse(new ByteArrayInputStream(metadata));
+ }
+ });
}
- catch (SAXException e)
+ catch (PrivilegedActionException pae)
{
- throw new DocumentReadException(e.getMessage(), e);
+ Throwable cause = pae.getCause();
+ if (cause instanceof SAXException)
+ {
+ throw new DocumentReadException(cause.getMessage(), cause);
+ }
+ else if (cause instanceof ParserConfigurationException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else if (cause instanceof IOException)
+ {
+ throw (IOException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw new DocumentReadException(cause.getMessage(), cause);
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
- catch (ParserConfigurationException e)
- {
- throw new DocumentReadException(e.getMessage(), e);
- }
// Check is there PDF/A-1 XMP
String version = "";
Modified: core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/XMLDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/XMLDocumentReader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/XMLDocumentReader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.document.impl;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.document.DocumentReadException;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
@@ -26,6 +27,7 @@
import java.io.InputStream;
import java.io.StringWriter;
import java.io.Writer;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
import javax.xml.parsers.ParserConfigurationException;
@@ -120,7 +122,7 @@
*/
private String parse(InputStream is)
{
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
// saxParserFactory.setNamespaceAware(true);
// saxParserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
SAXParser saxParser;
@@ -129,7 +131,15 @@
DefaultHandler dh = new WriteOutContentHandler(writer);
try
{
- saxParser = saxParserFactory.newSAXParser();
+ saxParser =
+ SecurityHelper
+ .doPriviledgedParserConfigurationOrSAXExceptionAction(new PrivilegedExceptionAction<SAXParser>()
+ {
+ public SAXParser run() throws Exception
+ {
+ return saxParserFactory.newSAXParser();
+ }
+ });
saxParser.parse(is, dh);
}
catch (SAXException e)
Modified: core/trunk/exo.core.component.document/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.document/src/test/resources/test.policy 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.document/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -7,6 +7,9 @@
};
grant codeBase "@TEST_CLASSES@-"{
- permission java.lang.RuntimePermission "createSystemSession";
- permission java.lang.RuntimePermission "manageRepository";
};
+
+
+
+
+
Modified: core/trunk/exo.core.component.ldap/pom.xml
===================================================================
--- core/trunk/exo.core.component.ldap/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.ldap/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -51,6 +51,11 @@
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>com.novell.ldap</groupId>
<artifactId>jldap</artifactId>
<scope>test</scope>
@@ -58,20 +63,56 @@
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/TestLDAPService.java</exclude>
- <exclude>**/TestNovellLDAPAPI.java</exclude>
- <exclude>**/TestStandardLDAPAPI.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <excludes>
+ <exclude>**/TestLDAPService.java</exclude>
+ <exclude>**/TestNovellLDAPAPI.java</exclude>
+ <exclude>**/TestStandardLDAPAPI.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
</build>
</project>
Modified: core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.ldap/src/main/java/org/exoplatform/services/ldap/impl/LDAPServiceImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.ldap.impl;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.component.ComponentRequestLifecycle;
@@ -76,7 +77,7 @@
{
String keystore = System.getProperty("java.home");
keystore += File.separator + "lib" + File.separator + "security" + File.separator + "cacerts";
- System.setProperty("javax.net.ssl.trustStore", keystore);
+ PrivilegedSystemHelper.setProperty("javax.net.ssl.trustStore", keystore);
}
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
Added: core/trunk/exo.core.component.ldap/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.ldap/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.ldap/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,10 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
Modified: core/trunk/exo.core.component.organization.api/pom.xml
===================================================================
--- core/trunk/exo.core.component.organization.api/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.api/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -39,6 +39,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.cache</artifactId>
</dependency>
<dependency>
@@ -91,6 +96,13 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -114,7 +126,39 @@
<goal>run</goal>
</goals>
</execution>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
</executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</build>
Modified: core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/UserProfileData.java
===================================================================
--- core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/UserProfileData.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.api/src/main/java/org/exoplatform/services/organization/impl/UserProfileData.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -21,6 +21,10 @@
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.XppDriver;
+import org.exoplatform.commons.utils.SecurityHelper;
+
+import java.security.PrivilegedAction;
+
/**
* Created by The eXo Platform SAS . Author : Tuan Nguyen
* tuan08(a)users.sourceforge.net Date: Jun 14, 2003 Time: 1:12:22 PM
@@ -77,8 +81,14 @@
public org.exoplatform.services.organization.UserProfile getUserProfile()
{
- XStream xstream = getXStream();
- UserProfileImpl up = (UserProfileImpl)xstream.fromXML(profile);
+ final XStream xstream = getXStream();
+ UserProfileImpl up = SecurityHelper.doPriviledgedAction(new PrivilegedAction<UserProfileImpl>()
+ {
+ public UserProfileImpl run()
+ {
+ return (UserProfileImpl)xstream.fromXML(profile);
+ }
+ });
return up;
}
@@ -89,17 +99,29 @@
profile = "";
return;
}
- UserProfileImpl impl = (UserProfileImpl)up;
+ final UserProfileImpl impl = (UserProfileImpl)up;
userName = up.getUserName();
- XStream xstream = getXStream();
- profile = xstream.toXML(impl);
+ final XStream xstream = getXStream();
+ profile = SecurityHelper.doPriviledgedAction(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return xstream.toXML(impl);
+ }
+ });
}
static private XStream getXStream()
{
if (xstream_ == null)
{
- xstream_ = new XStream(new XppDriver());
+ xstream_ = SecurityHelper.doPriviledgedAction(new PrivilegedAction<XStream>()
+ {
+ public XStream run()
+ {
+ return new XStream(new XppDriver());
+ }
+ });
xstream_.alias("user-profile", UserProfileImpl.class);
}
return xstream_;
Added: core/trunk/exo.core.component.organization.api/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.organization.api/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.organization.api/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,17 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.security.core/-"{
+ permission java.security.AllPermission;
+};
+
+
+
Modified: core/trunk/exo.core.component.organization.jdbc/pom.xml
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.jdbc/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -52,6 +52,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
@@ -114,7 +119,54 @@
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
-
</dependencies>
-
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/SimpleHibernateUserListAccess.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/SimpleHibernateUserListAccess.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/SimpleHibernateUserListAccess.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -37,11 +37,13 @@
*/
package org.exoplatform.services.organization.hibernate;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.database.HibernateService;
import org.exoplatform.services.organization.User;
import org.hibernate.Query;
import org.hibernate.Session;
+import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -93,9 +95,16 @@
* {@inheritDoc}
*/
@Override
- protected int getSize(Session session) throws Exception
+ protected int getSize(final Session session) throws Exception
{
- Query query = session.createQuery(countQuery);
+ Query query = SecurityHelper.doPriviledgedAction(new PrivilegedAction<Query>()
+ {
+ public Query run()
+ {
+ return session.createQuery(countQuery);
+ }
+ });
+
bindFields(query);
List l = query.list();
@@ -108,7 +117,7 @@
* {@inheritDoc}
*/
@Override
- protected User[] load(Session session, int index, int length) throws Exception
+ protected User[] load(final Session session, int index, int length) throws Exception
{
if (index < 0)
throw new IllegalArgumentException("Illegal index: index must be a positive number");
@@ -118,7 +127,13 @@
User[] users = new User[length];
- Query query = session.createQuery(findQuery);
+ Query query = SecurityHelper.doPriviledgedAction(new PrivilegedAction<Query>()
+ {
+ public Query run()
+ {
+ return session.createQuery(findQuery);
+ }
+ });
bindFields(query);
Iterator<Object> results = query.iterate();
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -20,15 +20,21 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.database.HibernateService;
import org.exoplatform.services.database.ObjectQuery;
-import org.exoplatform.services.organization.*;
+import org.exoplatform.services.organization.Query;
+import org.exoplatform.services.organization.User;
+import org.exoplatform.services.organization.UserEventListener;
+import org.exoplatform.services.organization.UserEventListenerHandler;
+import org.exoplatform.services.organization.UserHandler;
import org.exoplatform.services.organization.impl.UserImpl;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -80,9 +86,16 @@
{
if (broadcast)
preSave(user, true);
- Session session = service_.openSession();
- Transaction transaction = session.beginTransaction();
+ final Session session = service_.openSession();
+ Transaction transaction = SecurityHelper.doPriviledgedAction(new PrivilegedAction<Transaction>()
+ {
+ public Transaction run()
+ {
+ return session.beginTransaction();
+ }
+ });
+
UserImpl userImpl = (UserImpl)user;
userImpl.setId(user.getUserName());
session.save(user);
Added: core/trunk/exo.core.component.organization.jdbc/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.organization.jdbc/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,21 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.database/-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.organization.api/-"{
+ permission java.security.AllPermission;
+};
+
+
+
Modified: core/trunk/exo.core.component.organization.ldap/pom.xml
===================================================================
--- core/trunk/exo.core.component.organization.ldap/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.organization.ldap/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -44,6 +44,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
@@ -66,18 +71,55 @@
</dependencies>
<build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>**/TestOrganizationService.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <excludes>
+ <exclude>**/TestOrganizationService.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
</build>
</project>
\ No newline at end of file
Added: core/trunk/exo.core.component.organization.ldap/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.organization.ldap/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.organization.ldap/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,29 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.ldap/-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.database/-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.organization.api/-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@../../../exo.core.component.organization.jdbc/-"{
+ permission java.security.AllPermission;
+};
+
+
+
Modified: core/trunk/exo.core.component.script.groovy/pom.xml
===================================================================
--- core/trunk/exo.core.component.script.groovy/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -43,8 +43,62 @@
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
Modified: core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/GroovyScriptInstantiator.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/GroovyScriptInstantiator.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/GroovyScriptInstantiator.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -22,6 +22,7 @@
import groovy.lang.GroovyCodeSource;
import org.codehaus.groovy.control.CompilationFailedException;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.ComponentPlugin;
@@ -35,6 +36,9 @@
import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -128,13 +132,26 @@
GroovyClassLoader loader;
if (mapping.size() > 0)
{
- JarJarClassLoader jarjarLoader = new JarJarClassLoader();
+ JarJarClassLoader jarjarLoader = SecurityHelper.doPriviledgedAction(new PrivilegedAction<JarJarClassLoader>()
+ {
+ public JarJarClassLoader run()
+ {
+ return new JarJarClassLoader();
+ }
+ });
+
jarjarLoader.addMapping(mapping);
loader = jarjarLoader;
}
else
{
- loader = new GroovyClassLoader();
+ loader = SecurityHelper.doPriviledgedAction(new PrivilegedAction<GroovyClassLoader>()
+ {
+ public GroovyClassLoader run()
+ {
+ return new GroovyClassLoader();
+ }
+ });
}
return instantiateScript(stream, name, loader);
}
@@ -152,7 +169,8 @@
* @throws IOException if stream can't be parsed or object can't be created
* cause to illegal content of stream
*/
- public Object instantiateScript(InputStream stream, String name, GroovyClassLoader loader) throws IOException
+ public Object instantiateScript(final InputStream stream, final String name, GroovyClassLoader loader)
+ throws IOException
{
if (loader == null)
{
@@ -161,19 +179,39 @@
Class<?> clazz = null;
try
{
- if (name != null && name.length() > 0)
+ final GroovyClassLoader fLoader = loader;
+ clazz = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Class<?>>()
{
- clazz = loader.parseClass(stream, name);
+ public Class<?> run() throws Exception
+ {
+ if (name != null && name.length() > 0)
+ {
+ return fLoader.parseClass(stream, name);
+ }
+ else
+ {
+ return fLoader.parseClass(stream);
+ }
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof CompilationFailedException)
+ {
+ throw new IOException("Error occurs when parse stream, compiler error:\n " + cause.getMessage());
}
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
else
{
- clazz = loader.parseClass(stream);
+ throw new RuntimeException(cause);
}
}
- catch (CompilationFailedException e)
- {
- throw new IOException("Error occurs when parse stream, compiler error:\n " + e.getMessage());
- }
+
try
{
return createObject(clazz);
Modified: core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/jarjar/JarJarClassLoader.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/jarjar/JarJarClassLoader.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/src/main/java/org/exoplatform/services/script/groovy/jarjar/JarJarClassLoader.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -29,8 +29,10 @@
import org.codehaus.groovy.control.CompilerConfiguration;
import org.codehaus.groovy.control.Phases;
import org.codehaus.groovy.control.SourceUnit;
+import org.exoplatform.commons.utils.SecurityHelper;
import java.security.CodeSource;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
@@ -92,15 +94,22 @@
}
@Override
- protected CompilationUnit createCompilationUnit(CompilerConfiguration compilerConfiguration, CodeSource codeSource)
+ protected CompilationUnit createCompilationUnit(final CompilerConfiguration compilerConfiguration,
+ final CodeSource codeSource)
{
-
//
- final CompilationUnit unit = super.createCompilationUnit(compilerConfiguration, codeSource);
+ final CompilationUnit unit = SecurityHelper.doPriviledgedAction(new PrivilegedAction<CompilationUnit>()
+ {
+ public CompilationUnit run()
+ {
+ return JarJarClassLoader.super.createCompilationUnit(compilerConfiguration, codeSource);
+ }
+ });
//
unit.addPhaseOperation(new CompilationUnit.PrimaryClassNodeOperation()
{
+ @Override
public void call(SourceUnit sourceUnit, GeneratorContext generatorContext, ClassNode classNode)
throws CompilationFailedException
{
@@ -136,4 +145,15 @@
return unit;
}
+
+ static protected JarJarClassLoader createJarJarClassLoaderInPrivilegedMode(final ClassLoader classLoader)
+ {
+ return SecurityHelper.doPriviledgedAction(new PrivilegedAction<JarJarClassLoader>()
+ {
+ public JarJarClassLoader run()
+ {
+ return new JarJarClassLoader(classLoader);
+ }
+ });
+ }
}
Modified: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/GroovyInstantiatorTest.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/GroovyInstantiatorTest.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/GroovyInstantiatorTest.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -79,7 +79,8 @@
public void testGroovyScriptInstantiatorXML() throws Exception
{
- String url = Thread.currentThread().getContextClassLoader().getResource("SimpleXMLGenerator.groovy").toString();
+ String url =
+ Thread.currentThread().getContextClassLoader().getResource("TestSimpleXMLGenerator.groovy").toString();
GroovyObject groovyObject = (GroovyObject)groovyScriptInstantiator.instantiateScript(url);
groovyObject.invokeMethod("generateXML", new Object[]{new Book()});
}
Modified: core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/src/test/java/org/exoplatform/services/script/groovy/jarjar/Script.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -23,6 +23,8 @@
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+
import java.io.IOException;
import java.net.URL;
@@ -45,13 +47,14 @@
{
//
- JarJarClassLoader loader = new JarJarClassLoader(Thread.currentThread().getContextClassLoader());
+ JarJarClassLoader loader =
+ JarJarClassLoader.createJarJarClassLoaderInPrivilegedMode(Thread.currentThread().getContextClassLoader());
//
mapping.configure(loader);
// Obtain script class
- URL url = Thread.currentThread().getContextClassLoader().getResource("jarjar/" + name);
+ URL url = PrivilegedSystemHelper.getResource("jarjar/" + name);
Assert.assertNotNull(url);
GroovyCodeSource gcs;
try
Deleted: core/trunk/exo.core.component.script.groovy/src/test/resources/SimpleXMLGenerator.groovy
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/resources/SimpleXMLGenerator.groovy 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.script.groovy/src/test/resources/SimpleXMLGenerator.groovy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -1,18 +0,0 @@
-package org.exoplatform.script.groovy.test
-
-import groovy.xml.MarkupBuilder
-import org.exoplatform.services.script.groovy.Book
-public class SimpleXMLGenerator {
-
- public void generateXML (Book b) {
- def xmlBuilder = new MarkupBuilder()
- xmlBuilder.books() {
- book() {
- title(b.getTitle())
- author(b.getAuthor())
- price(b.getPrice())
- ISDN(b.getIsdn())
- }
- }
- }
-}
\ No newline at end of file
Added: core/trunk/exo.core.component.script.groovy/src/test/resources/TestSimpleXMLGenerator.groovy
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/resources/TestSimpleXMLGenerator.groovy (rev 0)
+++ core/trunk/exo.core.component.script.groovy/src/test/resources/TestSimpleXMLGenerator.groovy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,18 @@
+package org.exoplatform.script.groovy.test
+
+import groovy.xml.MarkupBuilder
+import org.exoplatform.services.script.groovy.Book
+public class SimpleXMLGenerator {
+
+ public void generateXML (Book b) {
+ def xmlBuilder = new MarkupBuilder()
+ xmlBuilder.books() {
+ book() {
+ title(b.getTitle())
+ author(b.getAuthor())
+ price(b.getPrice())
+ ISDN(b.getIsdn())
+ }
+ }
+ }
+}
\ No newline at end of file
Added: core/trunk/exo.core.component.script.groovy/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.script.groovy/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.script.groovy/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,10 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
Modified: core/trunk/exo.core.component.security.core/pom.xml
===================================================================
--- core/trunk/exo.core.component.security.core/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.security.core/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -38,6 +38,11 @@
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
@@ -57,9 +62,46 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
<testResources>
<testResource>
Modified: core/trunk/exo.core.component.security.core/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.security.core/src/test/resources/test.policy 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.security.core/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -1,5 +1,12 @@
-// configure static permissions here
-grant {
- permission java.security.AllPermission;
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
};
-
\ No newline at end of file
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+ permission java.lang.RuntimePermission "modifyIdentity";
+ permission java.lang.RuntimePermission "modifyConversationState";
+};
Modified: core/trunk/exo.core.component.web.css/pom.xml
===================================================================
--- core/trunk/exo.core.component.web.css/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.web.css/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -47,5 +47,59 @@
<groupId>batik</groupId>
<artifactId>batik-css</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: core/trunk/exo.core.component.web.css/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.web.css/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.web.css/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,10 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
Modified: core/trunk/exo.core.component.xml-processing/pom.xml
===================================================================
--- core/trunk/exo.core.component.xml-processing/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/pom.xml 2010-10-29 09:30:37 UTC (rev 3365)
@@ -38,6 +38,11 @@
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>jtidy</groupId>
<artifactId>jtidy</artifactId>
</dependency>
@@ -97,5 +102,51 @@
</includes>
</testResource>
</testResources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>${env.MAVEN_OPTS} -Djava.security.manager=org.exoplatform.commons.test.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-policy</id>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <tasks>
+ <echo>Creating Access Policy for tests</echo>
+ <makeurl file="${settings.localRepository}" property="localRepositoryURL" />
+ <makeurl file="${project.build.outputDirectory}" property="outputDirectoryURL" />
+ <makeurl file="${project.build.testOutputDirectory}" property="testOutputDirectoryURL" />
+ <copy todir="${project.build.testOutputDirectory}" overwrite="true">
+ <fileset dir="${project.basedir}/src/test/resources/">
+ <include name="test.policy" />
+ </fileset>
+ <filterset>
+ <filter token="MAVEN_REPO" value="${localRepositoryURL}" />
+ <filter token="MAIN_CLASSES" value="${outputDirectoryURL}" />
+ <filter token="TEST_CLASSES" value="${testOutputDirectoryURL}" />
+ </filterset>
+ </copy>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-optional</artifactId>
+ <version>1.5.3-1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
</build>
</project>
\ No newline at end of file
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/resolving/impl/XMLResolver.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/resolving/impl/XMLResolver.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/resolving/impl/XMLResolver.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.xml.resolving.impl;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -66,11 +67,10 @@
entity = publicIDs_.get(publicId);
if (entity != null)
{
- if (Thread.currentThread().getContextClassLoader().getResource(entity) != null)
+ if (PrivilegedSystemHelper.getResource(entity) != null)
{
- InputSource src =
- new InputSource(Thread.currentThread().getContextClassLoader().getResourceAsStream(entity));
- src.setSystemId(Thread.currentThread().getContextClassLoader().getResource(entity).getPath());
+ InputSource src = new InputSource(PrivilegedSystemHelper.getResourceAsStream(entity));
+ src.setSystemId(PrivilegedSystemHelper.getResource(entity).getPath());
return src;
}
}
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/TransformerBase.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/TransformerBase.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/TransformerBase.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.xml.transform.impl;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.xml.resolving.XMLResolvingService;
@@ -31,6 +33,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.security.PrivilegedExceptionAction;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
@@ -60,7 +63,7 @@
public TransformerBase()
{
log.debug("Current javax.xml.parsers.SAXParserFactory sys property [ "
- + System.getProperty("javax.xml.parsers.SAXParserFactory", "-Not set-") + "]");
+ + PrivilegedSystemHelper.getProperty("javax.xml.parsers.SAXParserFactory", "-Not set-") + "]");
tSAXFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
}
@@ -70,7 +73,13 @@
*/
static public XMLReader getXMLReader() throws SAXException
{
- return XMLReaderFactory.createXMLReader();
+ return SecurityHelper.doPriviledgedSAXExceptionAction(new PrivilegedExceptionAction<XMLReader>()
+ {
+ public XMLReader run() throws Exception
+ {
+ return XMLReaderFactory.createXMLReader();
+ }
+ });
}
public void setResolvingService(XMLResolvingService r)
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/html/TidyTransformerImpl.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/html/TidyTransformerImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/html/TidyTransformerImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.xml.transform.impl.html;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.xml.transform.EncodingMap;
import org.exoplatform.services.xml.transform.NotSupportedIOTypeException;
import org.exoplatform.services.xml.transform.html.HTMLTransformer;
@@ -96,6 +97,7 @@
log.debug("Transform from temp output to " + getResult().getClass().getName() + " complete");
}
+ @Override
protected void internalTransform(Source source) throws NotSupportedIOTypeException, TransformerException,
IllegalStateException
{
@@ -150,7 +152,7 @@
protected String getCurrentIANAEncoding() throws UnsupportedEncodingException
{
EncodingMap encodingMap = new EncodingMapImpl();
- String ianaEncoding = encodingMap.convertJava2IANA(System.getProperty("file.encoding"));
+ String ianaEncoding = encodingMap.convertJava2IANA(PrivilegedSystemHelper.getProperty("file.encoding"));
if (ianaEncoding == null)
{
throw new UnsupportedEncodingException("Can't find corresponding type of encoding for : "
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTemplatesServiceImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.xml.transform.impl.trax;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -116,11 +117,11 @@
String xsltSchema = m.get(key);
try
{
- if (Thread.currentThread().getContextClassLoader().getResource(xsltSchema) != null)
+ if (PrivilegedSystemHelper.getResource(xsltSchema) != null)
{
LOGGER.info("XSLT schema found by relative path: " + xsltSchema);
- addTRAXTemplates(key, traxTransformerService_.getTemplates(new StreamSource(Thread.currentThread()
- .getContextClassLoader().getResourceAsStream(xsltSchema))));
+ addTRAXTemplates(key, traxTransformerService_.getTemplates(new StreamSource(PrivilegedSystemHelper
+ .getResourceAsStream(xsltSchema))));
}
else
LOGGER.error("XSLT schema not found: " + xsltSchema);
Modified: core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTransformerImpl.java
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTransformerImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
+++ core/trunk/exo.core.component.xml-processing/src/main/java/org/exoplatform/services/xml/transform/impl/trax/TRAXTransformerImpl.java 2010-10-29 09:30:37 UTC (rev 3365)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.xml.transform.impl.trax;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.xml.transform.NotSupportedIOTypeException;
import org.exoplatform.services.xml.transform.impl.TransformerBase;
import org.exoplatform.services.xml.transform.trax.TRAXTransformer;
@@ -28,6 +29,8 @@
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
import java.util.Properties;
import javax.xml.transform.ErrorListener;
@@ -70,10 +73,35 @@
tHandler = saxTFactory.newTransformerHandler();
}
- public TRAXTransformerImpl(Source source) throws TransformerConfigurationException
+ public TRAXTransformerImpl(final Source source) throws TransformerConfigurationException
{
- SAXTransformerFactory saxTFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
- tHandler = saxTFactory.newTransformerHandler(source);
+ final SAXTransformerFactory saxTFactory = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
+ try
+ {
+ tHandler = SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<TransformerHandler>()
+ {
+ public TransformerHandler run() throws Exception
+ {
+ return saxTFactory.newTransformerHandler(source);
+ }
+ });
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof TransformerConfigurationException)
+ {
+ throw (TransformerConfigurationException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
}
public TRAXTransformerImpl(Templates templates) throws TransformerConfigurationException
@@ -82,6 +110,7 @@
tHandler = saxTFactory.newTransformerHandler(templates);
}
+ @Override
protected void internalTransform(Source source) throws TransformerException, NotSupportedIOTypeException,
IllegalStateException
{
@@ -126,21 +155,43 @@
{
throw new NotSupportedIOTypeException(source);
}
+
try
{
- xmlReader.parse(inputSource);
+ final XMLReader fXMLReader = xmlReader;
+ final InputSource fInputSource = inputSource;
+ SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws Exception
+ {
+ fXMLReader.parse(fInputSource);
+ return null;
+ }
+ });
}
- catch (SAXException ex)
+ catch (PrivilegedActionException pae)
{
- throw new TransformerException(ex);
+ Throwable cause = pae.getCause();
+ if (cause instanceof SAXException)
+ {
+ throw new TransformerException(cause);
+ }
+ else if (cause instanceof IOException)
+ {
+ throw new TransformerException(cause);
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
}
- catch (IOException ex)
- {
- throw new TransformerException(ex);
- }
-
}
+ @Override
protected void afterInitResult()
{
tHandler.setResult(getResult());
Added: core/trunk/exo.core.component.xml-processing/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.xml-processing/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.xml-processing/src/test/resources/test.policy 2010-10-29 09:30:37 UTC (rev 3365)
@@ -0,0 +1,10 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+};
13 years, 7 months
exo-jcr SVN: r3364 - in kernel/trunk: exo.kernel.commons/src/main/java/org/exoplatform/commons/utils and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-29 05:00:31 -0400 (Fri, 29 Oct 2010)
New Revision: 3364
Modified:
kernel/trunk/exo.kernel.commons/pom.xml
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedFileHelper.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedSystemHelper.java
kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/util/PrivilegedCacheHelper.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
Log:
EXOJCR-986: Enable SecurityManager by default
Modified: kernel/trunk/exo.kernel.commons/pom.xml
===================================================================
--- kernel/trunk/exo.kernel.commons/pom.xml 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.commons/pom.xml 2010-10-29 09:00:31 UTC (rev 3364)
@@ -60,7 +60,6 @@
<directory>src/test/resources</directory>
<includes>
<include>**/*.properties</include>
- <include>**/test.policy</include>
</includes>
</testResource>
</testResources>
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedFileHelper.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedFileHelper.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedFileHelper.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -394,9 +394,9 @@
*/
public static void deleteOnExit(final File file)
{
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public Object run()
+ public Void run()
{
file.deleteOnExit();
return null;
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedSystemHelper.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedSystemHelper.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/PrivilegedSystemHelper.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.commons.utils;
+import java.io.InputStream;
+import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties;
@@ -74,9 +76,9 @@
*/
public static void setProperty(final String key, final String value)
{
- PrivilegedAction<String> action = new PrivilegedAction<String>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public String run()
+ public Void run()
{
System.setProperty(key, value);
return null;
@@ -103,4 +105,43 @@
};
return AccessController.doPrivileged(action);
}
+
+ /**
+ * Get resource in privileged mode.
+ *
+ * @param key
+ * @param def
+ * @return
+ */
+ public static URL getResource(final String name)
+ {
+ PrivilegedAction<URL> action = new PrivilegedAction<URL>()
+ {
+ public URL run()
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+
+ /**
+ * Get resource as stream in privileged mode.
+ *
+ * @param key
+ * @param def
+ * @return
+ */
+ public static InputStream getResourceAsStream(final String name)
+ {
+ PrivilegedAction<InputStream> action = new PrivilegedAction<InputStream>()
+ {
+ public InputStream run()
+ {
+ return Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
+ }
+ };
+ return AccessController.doPrivileged(action);
+ }
+
}
Modified: kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
===================================================================
--- kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -18,13 +18,18 @@
*/
package org.exoplatform.commons.utils;
+import org.xml.sax.SAXException;
+
import java.io.IOException;
+import java.net.MalformedURLException;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.sql.SQLException;
+import javax.xml.parsers.ParserConfigurationException;
+
/**
* Helps running code in privileged
*
@@ -100,6 +105,108 @@
}
/**
+ * Launches action in privileged mode. Can throw only ParserConfigurationException, SAXException.
+ *
+ * @param <E>
+ * @param action
+ * @return
+ * @throws IOException
+ */
+ public static <E> E doPriviledgedParserConfigurationOrSAXExceptionAction(PrivilegedExceptionAction<E> action)
+ throws ParserConfigurationException, SAXException
+ {
+ try
+ {
+ return AccessController.doPrivileged(action);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof ParserConfigurationException)
+ {
+ throw (ParserConfigurationException)cause;
+ }
+ else if (cause instanceof SAXException)
+ {
+ throw (SAXException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+ }
+
+ /**
+ * Launches action in privileged mode. Can throw only SAXException.
+ *
+ * @param <E>
+ * @param action
+ * @return
+ * @throws IOException
+ */
+ public static <E> E doPriviledgedSAXExceptionAction(PrivilegedExceptionAction<E> action) throws SAXException
+ {
+ try
+ {
+ return AccessController.doPrivileged(action);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof SAXException)
+ {
+ throw (SAXException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+ }
+
+ /**
+ * Launches action in privileged mode. Can throw only SAXException.
+ *
+ * @param <E>
+ * @param action
+ * @return
+ * @throws IOException
+ */
+ public static <E> E doPriviledgedMalformedURLExceptionAction(PrivilegedExceptionAction<E> action)
+ throws MalformedURLException
+ {
+ try
+ {
+ return AccessController.doPrivileged(action);
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof MalformedURLException)
+ {
+ throw (MalformedURLException)cause;
+ }
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
+ }
+
+ /**
* Launches action in privileged mode. Can throw only runtime exceptions.
*
* @param <E>
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/util/PrivilegedCacheHelper.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/util/PrivilegedCacheHelper.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/util/PrivilegedCacheHelper.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -45,9 +45,9 @@
*/
public static <K, V> void start(final Cache<K, V> cache)
{
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public Object run()
+ public Void run()
{
cache.start();
return null;
@@ -63,9 +63,9 @@
*/
public static <K, V> void stop(final Cache<K, V> cache)
{
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public Object run()
+ public Void run()
{
cache.stop();
return null;
@@ -81,9 +81,9 @@
*/
public static <K, V> void create(final Cache<K, V> cache)
{
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public Object run()
+ public Void run()
{
cache.create();
return null;
@@ -99,9 +99,9 @@
*/
public static <K, V> void endBatch(final Cache<K, V> cache, final boolean successful)
{
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
+ PrivilegedAction<Void> action = new PrivilegedAction<Void>()
{
- public Object run()
+ public Void run()
{
cache.endBatch(successful);
return null;
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/StandaloneContainer.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -19,6 +19,7 @@
package org.exoplatform.container;
import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.configuration.ConfigurationException;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.configuration.ConfigurationManagerImpl;
@@ -35,6 +36,7 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.PrivilegedExceptionAction;
import java.util.List;
/**
@@ -199,11 +201,19 @@
* @param path, path to configuration file
* @throws MalformedURLException if path is wrong
*/
- public static void addConfigurationPath(String path) throws MalformedURLException
+ public static void addConfigurationPath(final String path) throws MalformedURLException
{
if ((path == null) || (path.length() == 0))
return;
- URL confURL = new File(path).toURI().toURL();
+
+ URL confURL = SecurityHelper.doPriviledgedMalformedURLExceptionAction(new PrivilegedExceptionAction<URL>()
+ {
+ public URL run() throws Exception
+ {
+ return new File(path).toURI().toURL();
+ }
+ });
+
configurationURL = fileExists(confURL) ? confURL : null;
}
@@ -305,11 +315,18 @@
return smanager_;
}
- private static boolean fileExists(URL url)
+ private static boolean fileExists(final URL url)
{
try
{
- url.openStream().close();
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws Exception
+ {
+ url.openStream().close();
+ return null;
+ }
+ });
return true;
}
catch (Exception e)
@@ -331,16 +348,29 @@
// or
if (configurationURL == null)
{
- J2EEServerInfo env = new J2EEServerInfo();
+ final J2EEServerInfo env = new J2EEServerInfo();
// (2) exo-configuration.xml in AS (standalone) home directory
- configurationURL = (new File(env.getServerHome() + "/exo-configuration.xml")).toURI().toURL();
+ configurationURL =
+ SecurityHelper.doPriviledgedMalformedURLExceptionAction(new PrivilegedExceptionAction<URL>()
+ {
+ public URL run() throws Exception
+ {
+ return (new File(env.getServerHome() + "/exo-configuration.xml")).toURI().toURL();
+ }
+ });
// (3) AS_HOME/conf/exo-conf (JBossAS usecase)
if (!fileExists(configurationURL))
{
configurationURL =
- (new File(env.getExoConfigurationDirectory() + "/exo-configuration.xml")).toURI().toURL();
+ SecurityHelper.doPriviledgedMalformedURLExceptionAction(new PrivilegedExceptionAction<URL>()
+ {
+ public URL run() throws Exception
+ {
+ return (new File(env.getExoConfigurationDirectory() + "/exo-configuration.xml")).toURI().toURL();
+ }
+ });
}
// (4) conf/exo-configuration.xml in war/ear(?)
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/configuration/MockConfigurationManagerImpl.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -55,8 +55,7 @@
else if (uri.startsWith("classpath:"))
{
String path = removePrefix("classpath:/", uri);
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- return cl.getResource(path);
+ return PrivilegedSystemHelper.getResource(path);
}
else if (uri.startsWith("war:"))
{
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2010-10-29 07:11:50 UTC (rev 3363)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2010-10-29 09:00:31 UTC (rev 3364)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.container.jmx;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.component.ComponentLifecycle;
import org.exoplatform.container.component.ComponentPlugin;
@@ -31,6 +32,7 @@
import org.picocontainer.defaults.AbstractComponentAdapter;
import java.lang.reflect.Method;
+import java.security.PrivilegedExceptionAction;
import java.util.List;
/**
@@ -134,7 +136,7 @@
return instance_;
}
- private void addComponentPlugin(boolean debug, Object component,
+ private void addComponentPlugin(boolean debug, final Object component,
List<org.exoplatform.container.xml.ComponentPlugin> plugins, ExoContainer container) throws Exception
{
if (plugins == null)
@@ -150,15 +152,24 @@
cplugin.setDescription(plugin.getDescription());
Class clazz = component.getClass();
- Method m = getSetMethod(clazz, plugin.getSetMethod(), pluginClass);
+ final Method m = getSetMethod(clazz, plugin.getSetMethod(), pluginClass);
if (m == null)
{
log.error("Cannot find the method '" + plugin.getSetMethod() + "' that has only one parameter of type '"
+ pluginClass.getName() + "' in the class '" + clazz.getName() + "'.");
continue;
}
- Object[] params = {cplugin};
- m.invoke(component, params);
+ final Object[] params = {cplugin};
+
+ SecurityHelper.doPriviledgedExceptionAction(new PrivilegedExceptionAction<Void>()
+ {
+ public Void run() throws Exception
+ {
+ m.invoke(component, params);
+ return null;
+ }
+ });
+
if (debug)
log.debug("==> add component plugin: " + cplugin);
13 years, 7 months
exo-jcr SVN: r3363 - in ws/branches/2.1.x/exo.ws.rest.core/src: test/java/org/exoplatform/services/rest/impl/provider and 1 other directory.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-10-29 03:11:50 -0400 (Fri, 29 Oct 2010)
New Revision: 3363
Modified:
ws/branches/2.1.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java
ws/branches/2.1.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java
Log:
WS-256 : Applied patch. Allow to use a String as entity for a JSON response
Modified: ws/branches/2.1.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java
===================================================================
--- ws/branches/2.1.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java 2010-10-29 07:04:16 UTC (rev 3362)
+++ ws/branches/2.1.x/exo.ws.rest.core/src/main/java/org/exoplatform/services/rest/impl/provider/JsonEntityProvider.java 2010-10-29 07:11:50 UTC (rev 3363)
@@ -30,17 +30,26 @@
import org.exoplatform.ws.frameworks.json.impl.JsonWriterImpl;
import org.exoplatform.ws.frameworks.json.value.JsonValue;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import javax.activation.DataSource;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.ext.Provider;
+import javax.xml.bind.JAXBElement;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
/**
* @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a>
@@ -59,13 +68,31 @@
// Or probably enough check only content type 'application/json'
// and if this content type set trust it and try parse/write
+ /** Do not process via JSON "known" JAX-RS types and some more. */
+ private static final Class<?>[] IGNORED =
+ new Class<?>[]{byte[].class, char[].class, DataSource.class, DOMSource.class, File.class, InputStream.class,
+ OutputStream.class, JAXBElement.class, MultivaluedMap.class, Reader.class, Writer.class, SAXSource.class,
+ StreamingOutput.class, StreamSource.class, String.class};
+
+ private static boolean isIgnored(Class<?> type)
+ {
+ for (Class<?> c : IGNORED)
+ {
+ if (c.isAssignableFrom(type))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* {@inheritDoc}
*/
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
{
- // say as support all objects, see _TODO_ above
- return Object.class.isAssignableFrom(type);
+ //return Object.class.isAssignableFrom(type);
+ return !isIgnored(type);
}
/**
@@ -104,8 +131,8 @@
*/
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
{
- // say as support all objects, see _TODO_ above
- return Object.class.isAssignableFrom(type);
+ //return Object.class.isAssignableFrom(type);
+ return !isIgnored(type);
}
/**
Modified: ws/branches/2.1.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java
===================================================================
--- ws/branches/2.1.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java 2010-10-29 07:04:16 UTC (rev 3362)
+++ ws/branches/2.1.x/exo.ws.rest.core/src/test/java/org/exoplatform/services/rest/impl/provider/JsonEntityTest.java 2010-10-29 07:11:50 UTC (rev 3363)
@@ -29,7 +29,9 @@
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
/**
* @author <a href="mailto:andrew00x@gmail.com">Andrey Parfonov</a>
@@ -77,13 +79,42 @@
}
}
+ @Path("/")
+ public static class ResourceString
+ {
+ @POST
+ @Consumes("application/json")
+ public void m1(String b)
+ {
+ assertEquals(jsonBook, b);
+ }
+ }
+
+ @Path("/")
+ public static class ResourceString2
+ {
+ @GET
+ @Produces("application/json")
+ public String m1()
+ {
+ return jsonBook;
+ }
+
+ @POST
+ public Response m2()
+ {
+ return Response.ok(jsonBook).type(MediaType.APPLICATION_JSON).build();
+ }
+ }
+
+ private static String jsonBook = "{\"title\":\"Hamlet\", \"author\":\"William Shakespeare\", \"sendByPost\":true}";
+
private byte[] jsonData;
public void setUp() throws Exception
{
super.setUp();
- jsonData =
- ("{\"title\":\"Hamlet\"," + "\"author\":\"William Shakespeare\"," + "\"sendByPost\":true}").getBytes("UTF-8");
+ jsonData = jsonBook.getBytes("UTF-8");
}
public void testJsonEntityParameter() throws Exception
@@ -125,8 +156,44 @@
assertEquals("Hamlet\n", book.getTitle());
assertEquals("William Shakespeare\n", book.getAuthor());
assertFalse(book.isSendByPost());
-// writer = new ByteArrayContainerResponseWriter();
+ // writer = new ByteArrayContainerResponseWriter();
unregistry(r2);
}
+ public void testJsonEntityString() throws Exception
+ {
+ ResourceString r1 = new ResourceString();
+ registry(r1);
+ MultivaluedMap<String, String> h = new MultivaluedMapImpl();
+ h.putSingle("content-type", "application/json");
+ h.putSingle("content-length", "" + jsonData.length);
+ assertEquals(204, service("POST", "/", "", h, jsonData).getStatus());
+ unregistry(r1);
+ }
+
+ public void testJsonReturnString() throws Exception
+ {
+ ResourceString2 r2 = new ResourceString2();
+ registry(r2);
+ MultivaluedMap<String, String> h = new MultivaluedMapImpl();
+ h.putSingle("accept", "application/json");
+ ByteArrayContainerResponseWriter writer = new ByteArrayContainerResponseWriter();
+
+ // ResourceString2#m1()
+ ContainerResponse response = service("GET", "/", "", h, null, writer);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString());
+ assertEquals(jsonBook, response.getEntity());
+ //System.out.println("string: " + new String(writer.getBody()));
+
+ // ResourceString2#m2()
+ writer.reset();
+ response = service("POST", "/", "", h, null, writer);
+ assertEquals(200, response.getStatus());
+ assertEquals("application/json", response.getContentType().toString());
+ assertEquals(jsonBook, response.getEntity());
+ //System.out.println("string: " + new String(writer.getBody()));
+
+ unregistry(r2);
+ }
}
13 years, 7 months
exo-jcr SVN: r3362 - in jcr/branches/1.12.x: applications/exo.jcr.applications.backupconsole/src/main/assemblies and 2 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2010-10-29 03:04:16 -0400 (Fri, 29 Oct 2010)
New Revision: 3362
Added:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java
Modified:
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
Log:
JCR-1481 : Adding support form authentication in backup console
Added: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh (rev 0)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/bin/test_form.sh 2010-10-29 07:04:16 UTC (rev 3362)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+./jcrbackup.sh http://127.0.0.1:8080/portal/rest form POST "/portal/login?username=root&password=gtn" info
+#!/bin/sh
+
+./jcrbackup.sh http://127.0.0.1:8080/portal/rest form POST "/portal/login?username=root&password=gtn" info
\ No newline at end of file
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml 2010-10-28 13:02:02 UTC (rev 3361)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/assemblies/binary-assembly.xml 2010-10-29 07:04:16 UTC (rev 3362)
@@ -46,7 +46,6 @@
<exclude>javax.portlet:portlet-api</exclude>
<exclude>javax.faces:jsf-api</exclude>
<exclude>javax.servlet:servlet-api</exclude>
- <exclude>picocontainer:picocontainer</exclude>
<exclude>jmock:jmock</exclude>
<exclude>xstream:xstream</exclude>
<exclude>commons-beanutils:commons-beanutils</exclude>
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupClientImpl.java 2010-10-29 07:04:16 UTC (rev 3362)
@@ -81,27 +81,37 @@
private final String path;
/**
- * User login.
+ * Form authentication parameters.
*/
- private final String userName;
+ private FormAuthentication formAuthentication;;
/**
- * User password.
+ * Constructor.
+ *
+ * @param transport ClientTransport implementation.
+ * @param urlPath url path.
*/
- private final String pass;
+ public BackupClientImpl(ClientTransport transport, String urlPath)
+ {
+ this.transport = transport;
+ if (urlPath == null)
+ path = "/rest";
+ else
+ path = urlPath;
+ }
+
/**
* Constructor.
*
* @param transport ClientTransport implementation.
* @param login user login.
* @param pass user password.
+ * @param urlPath url path.
*/
public BackupClientImpl(ClientTransport transport, String login, String pass, String urlPath)
{
this.transport = transport;
- this.userName = login;
- this.pass = pass;
if (urlPath == null)
path = "/rest";
@@ -110,6 +120,19 @@
}
/**
+ * Constructor.
+ *
+ * @param transport ClientTransport implementation.
+ * @param formAuthentication form authentication.
+ * @param urlPath url path.
+ */
+ public BackupClientImpl(ClientTransport transport, FormAuthentication formAuthentication, String urlPath)
+ {
+ this(transport, urlPath);
+ this.formAuthentication = formAuthentication;
+ }
+
+ /**
* {@inheritDoc}
*/
public String startBackUp(String repositoryName, String workspaceName, String backupDir) throws IOException,
@@ -327,8 +350,9 @@
+ info.getWorkspaceName() + "\n")
+ "\t\tbackup type : "
+ (configBean.getBackupType() == BackupManager.FULL_AND_INCREMENTAL ? "full + incremetal"
- : "full only") + "\n" + "\t\tfull backup state : " + getState(info
- .getState()))
+ : "full only") + "\n" + "\t\tfull backup state : " + (info
+ .getWorkspaceName().equals("") ? getRepositoryBackupToFullState(info.getState())
+ : getState(info.getState())))
+ "\n"
+ (info.getBackupType() == BackupManager.FULL_BACKUP_ONLY ? ""
: "\t\tincremental backup state : " + "working" + "\n")
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-28 13:02:02 UTC (rev 3361)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/BackupConsole.java 2010-10-29 07:04:16 UTC (rev 3362)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
/**
* Created by The eXo Platform SAS. <br/>Date:
@@ -57,7 +58,15 @@
* Help string.
*/
private static final String HELP_INFO =
- "Help info:\n" + " <url> <cmd> \n" + " <url> : http(s)//login:password@host:port/<context> \n"
+ "Help info:\n"
+ + " <url_basic_authentication>|<url form authentication> <cmd> \n"
+ + " <url_basic_authentication> : http(s)//login:password@host:port/<context> \n\n"
+ + " <url form authentication> : http(s)//host:port/<context> \"<form auth parm>\" \n"
+ + " <form auth parm> : form <method> <form path>\n"
+ + " <method> : POST or GET\n"
+ + " <form path> : /path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...\n"
+ + " Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST /portal/login?username=root&password=gtn\n\n"
+
+ " <cmd> : start <repo[/ws]> <backup_dir> [<incr>] \n"
+ " stop <backup_id> \n"
+ " status <backup_id> \n"
@@ -65,7 +74,7 @@
+ " restore <repo[/ws]> <backup_id> <pathToConfigFile> \n"
+ " list [completed] \n"
+ " info \n"
- + " drop [force-close-session] <repo[/ws]> \n"
+ + " drop [force-close-session] <repo[/ws]> \n"
+ " help \n\n"
+ " start - start backup of repositpry or workspace \n"
@@ -79,7 +88,7 @@
+ " drop - delete the repository or workspace \n"
+ " help - print help information about backup console \n\n"
- + " <repo[/ws]> - /<reponsitory-name>[/<workspace-name>] the repository or workspace \n"
+ + " <repo[/ws]> - /<reponsitory-name>[/<workspace-name>] the repository or workspace \n"
+ " <backup_dir> - path to folder for backup on remote server \n"
+ " <backup_id> - the identifier for backup \n"
+ " <incr> - incemental job period \n"
@@ -128,25 +137,116 @@
if (!("".equals(url.getPath())))
urlPath = url.getPath();
+ // try form
+ String form = null;
+ if (curArg < args.length)
+ {
+ if (args[curArg].equals("form"))
+ {
+ form = args[curArg++];
+
+ if (url.getUserInfo() != null)
+ {
+ System.out.println(INCORRECT_PARAM + "Parameters Login:Password should not be specified in url parameter to form authentication - " + sUrl);
+ return;
+ }
+ }
+ }
+
// login:password
String login = url.getUserInfo();
- if (login == null)
+
+ FormAuthentication formAuthentication = null;
+ if (form != null && form.equals("form"))
{
- System.out.println(INCORRECT_PARAM + "There is no specific Login:Password in url parameter - " + sUrl);
- return;
+ //check POST or GET
+ if (curArg == args.length)
+ {
+ System.out.println(INCORRECT_PARAM + "No specified POST or GET parameter to form parameter.");
+ return;
+ }
+ String method = args[curArg++];
+
+ if (!method.equalsIgnoreCase("GET") && !method.equalsIgnoreCase("POST"))
+ {
+ System.out.println(INCORRECT_PARAM + "Method to form authentication shulde be GET or POST to form parameter - " + method);
+ return;
+ }
+
+ //url to form authentication
+ if (curArg == args.length)
+ {
+ System.out.println(INCORRECT_PARAM + "No specified url and form properties to form parameter.");
+ return;
+ }
+ String[] params = args[curArg++].split("[?]");
+
+ if (params.length != 2)
+ {
+ System.out.println(INCORRECT_PARAM + "From parameters is not spacified to form parameter - " + args[curArg]);
+ return;
+ }
+ String formUrl = params[0];
+
+ // parameters to form
+ String[] formParams = params[1].split("&");
+
+ if (formParams.length < 2)
+ {
+ System.out.println(INCORRECT_PARAM
+ + "From parameters shoulde be conatains at least two (for login and for pasword) parameters - "
+ + params[1]);
+ return;
+ }
+
+ HashMap<String, String> mapFormParams = new HashMap<String, String>();
+
+ for (String fParam : formParams)
+ {
+ String[] para = fParam.split("=");
+
+ if (para.length != 2)
+ {
+ System.out.println(INCORRECT_PARAM + "From parameters is incorect, shoulde be as \"name=value\" - " + fParam);
+ return;
+ }
+
+ mapFormParams.put(para[0], para[1]);
+ }
+
+ formAuthentication = new FormAuthentication(method, formUrl, mapFormParams);
}
- else if (!login.matches("[^:]+:[^:]+"))
+ else
{
- System.out.println(INCORRECT_PARAM + "There is incorrect Login:Password parameter - " + login);
- return;
+ if (login == null)
+ {
+ System.out.println(INCORRECT_PARAM + "There is no specific Login:Password in url parameter - " + sUrl);
+ return;
+ }
+ else if (!login.matches("[^:]+:[^:]+"))
+ {
+ System.out.println(INCORRECT_PARAM + "There is incorrect Login:Password parameter - " + login);
+ return;
+ }
}
String host = url.getHost() + ":" + url.getPort();
// initialize transport and backup client
- String[] lp = login.split(LOGIN_PASS_SPLITTER);
- ClientTransport transport = new ClientTransportImpl(lp[0], lp[1], host, url.getProtocol());
- BackupClient client = new BackupClientImpl(transport, lp[0], lp[1], urlPath);
+ ClientTransport transport;
+ BackupClient client;
+
+ if (formAuthentication != null)
+ {
+ transport = new ClientTransportImpl(formAuthentication, host, url.getProtocol());
+ client = new BackupClientImpl(transport, formAuthentication, urlPath);
+ }
+ else
+ {
+ String[] lp = login.split(LOGIN_PASS_SPLITTER);
+ transport = new ClientTransportImpl(lp[0], lp[1], host, url.getProtocol());
+ client = new BackupClientImpl(transport, urlPath);
+ }
// commands
if (curArg == args.length)
@@ -155,7 +255,6 @@
return;
}
String command = args[curArg++];
-
try
{
if (command.equalsIgnoreCase("start"))
@@ -376,6 +475,8 @@
System.out.println("ERROR: " + e.getMessage());
e.printStackTrace();
}
+
+ System.exit(0);
}
/**
Modified: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/ClientTransportImpl.java 2010-10-29 07:04:16 UTC (rev 3362)
@@ -18,6 +18,11 @@
*/
package org.exoplatform.jcr.backupconsole;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.ws.rs.core.Response;
+
import org.exoplatform.common.http.client.AuthorizationHandler;
import org.exoplatform.common.http.client.AuthorizationInfo;
import org.exoplatform.common.http.client.CookieModule;
@@ -26,9 +31,6 @@
import org.exoplatform.common.http.client.ModuleException;
import org.exoplatform.common.http.client.NVPair;
-import java.io.IOException;
-import java.net.URL;
-
/**
* Created by The eXo Platform SAS. <br/>Date:
*
@@ -67,6 +69,11 @@
* Realm to connection
*/
private String realm;
+
+ /**
+ * Form authentication parameters.
+ */
+ private FormAuthentication formAuthentication;
/**
* Constructor.
@@ -74,7 +81,6 @@
* @param login Login string.
* @param password Password string.
* @param host host string.
- * @param isSSL isSSL flag.
*/
public ClientTransportImpl(String login, String password, String host, String protocol)
{
@@ -85,6 +91,20 @@
}
/**
+ * Constructor.
+
+ * @param formAuthentication form authentication parameters.
+ * @param login Login string.
+ * @param password Password string.
+ * @param host host string.
+ */
+ public ClientTransportImpl(FormAuthentication formAuthentication, String host, String protocol)
+ {
+ this(null, null, host, protocol);
+ this.formAuthentication = formAuthentication;
+ }
+
+ /**
* Get realm by URL.
*
* @param sUrl URL string.
@@ -132,16 +152,53 @@
URL url = new URL(complURL);
HTTPConnection connection = new HTTPConnection(url);
- connection.removeModule(CookieModule.class);
+ connection.setAllowUserInteraction(false);
- if (!isRealmGet)
+ //authentication
+ if (formAuthentication != null)
{
- realm = getRealm(complURL);
- isRealmGet = true;
+ //form authentication
+ HTTPResponse respLogin;
+
+ URL urlLogin = new URL(protocol + "://" + host + formAuthentication.getFormPath());
+
+ HTTPConnection connectionLogin = new HTTPConnection(urlLogin);
+ connectionLogin.setAllowUserInteraction(false);
+
+ NVPair[] formParams = new NVPair[formAuthentication.getFormParams().size()];
+ int pairCount = 0;
+ for (String key : formAuthentication.getFormParams().keySet())
+ {
+ formParams[pairCount++] = new NVPair(key, formAuthentication.getFormParams().get(key));
+ }
+
+ if ("POST".equalsIgnoreCase(formAuthentication.getMethod()))
+ {
+ respLogin = connectionLogin.Post(urlLogin.getFile(), formParams);
+ }
+ else
+ {
+ respLogin = connectionLogin.Get(urlLogin.getFile(), formParams);
+ }
+
+ if (Response.Status.OK.getStatusCode() != respLogin.getStatusCode())
+ {
+ System.out.println("Form authentication is fail, status code : " + respLogin.getStatusCode());
+ System.exit(0);
+ }
}
-
- connection.addBasicAuthorization(realm, login, password);
+ else
+ {
+ // basic authorization
+ if (!isRealmGet)
+ {
+ realm = getRealm(complURL);
+ isRealmGet = true;
+ }
+ connection.addBasicAuthorization(realm, login, password);
+ }
+
HTTPResponse resp;
if (postData == null)
{
@@ -173,21 +230,58 @@
{
try
{
- // execute the POST
+ // execute the GET
String complURL = protocol + "://" + host + sURL;
URL url = new URL(complURL);
HTTPConnection connection = new HTTPConnection(url);
- connection.removeModule(CookieModule.class);
+ connection.setAllowUserInteraction(false);
- if (!isRealmGet)
+ //authentication
+ if (formAuthentication != null)
{
- realm = getRealm(complURL);
- isRealmGet = true;
+ //form authentication
+ HTTPResponse respLogin;
+
+ URL urlLogin = new URL(protocol + "://" + host + formAuthentication.getFormPath());
+
+ HTTPConnection connectionLogin = new HTTPConnection(urlLogin);
+ connectionLogin.setAllowUserInteraction(false);
+
+ NVPair[] formParams = new NVPair[formAuthentication.getFormParams().size()];
+ int pairCount = 0;
+ for (String key : formAuthentication.getFormParams().keySet())
+ {
+ formParams[pairCount++] = new NVPair(key, formAuthentication.getFormParams().get(key));
+ }
+
+ if ("POST".equalsIgnoreCase(formAuthentication.getMethod()))
+ {
+ respLogin = connectionLogin.Post(urlLogin.getFile(), formParams);
+ }
+ else
+ {
+ respLogin = connectionLogin.Get(urlLogin.getFile(), formParams);
+ }
+
+ if (Response.Status.OK.getStatusCode() != respLogin.getStatusCode())
+ {
+ System.out.println("Form authentication is fail, status code : " + respLogin.getStatusCode());
+ System.exit(0);
+ }
}
-
- connection.addBasicAuthorization(realm, login, password);
+ else
+ {
+ // basic authorization
+ if (!isRealmGet)
+ {
+ realm = getRealm(complURL);
+ isRealmGet = true;
+ }
+ connection.addBasicAuthorization(realm, login, password);
+ }
+
HTTPResponse resp = connection.Get(url.getFile());
BackupAgentResponse responce = new BackupAgentResponse(resp.getData(), resp.getStatusCode());
Added: jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java
===================================================================
--- jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java (rev 0)
+++ jcr/branches/1.12.x/applications/exo.jcr.applications.backupconsole/src/main/java/org/exoplatform/jcr/backupconsole/FormAuthentication.java 2010-10-29 07:04:16 UTC (rev 3362)
@@ -0,0 +1,59 @@
+/*
+ * 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.jcr.backupconsole;
+
+import java.util.HashMap;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2010
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id: FormAuthntication.java 111 2010-11-11 11:11:11Z rainf0x $
+ */
+public class FormAuthentication
+{
+ private String method;
+
+ private String formPath;
+
+ private HashMap<String, String> formParams;
+
+ public FormAuthentication(String method, String formPath, HashMap<String, String> formParams)
+ {
+ this.method = method;
+ this.formPath = formPath;
+ this.formParams = formParams;
+ }
+
+ public String getMethod()
+ {
+ return method;
+ }
+
+ public String getFormPath()
+ {
+ return formPath;
+ }
+
+ public HashMap<String, String> getFormParams()
+ {
+ return formParams;
+ }
+
+}
Modified: jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml
===================================================================
--- jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-28 13:02:02 UTC (rev 3361)
+++ jcr/branches/1.12.x/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/backup/backup-client.xml 2010-10-29 07:04:16 UTC (rev 3362)
@@ -16,6 +16,15 @@
configuration'</link> .</para>
</warning>
+ <highlights>
+ <para>GateIn uses context /portal/rest, therefore you need to use
+ http://host:port/portal/rest/ instread of http://host:port/rest/</para>
+
+ <para>GateIn uses form authentication, so first you need to login (url to
+ form authentication is http://host:port/portal/login) and then perform
+ requests.</para>
+ </highlights>
+
<section>
<title>Introduction</title>
@@ -911,6 +920,10 @@
</component>
<component>
+ <type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
+</component>
+
+<component>
<key>org.exoplatform.services.jcr.ext.backup.BackupManager</key>
<type>org.exoplatform.services.jcr.ext.backup.impl.BackupManagerImpl</type>
<init-params>
@@ -923,12 +936,55 @@
</properties-param>
</init-params>
</component></programlisting>
+
+ <para>In case, if you will restore backup in same workspace (so you will
+ drop previous workspace), you need configure
+ RepositoryServiceConfiguration in order to save the changes of the
+ repository configuration. For example</para>
+
+ <programlisting><component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR repositories configuration file</description>
+ <value>jar:/conf/portal/exo-jcr-config.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="hsqldb" />
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
+ </properties-param>
+ </init-params>
+</component></programlisting>
+
+ <para>See the <link
+ linkend="JCR.eXoJCRconfiguration.PortalAndStandaloneConfiguration">eXo
+ JCR Configuration article at chapter '2 Portal and Standalone
+ configuration'</link> for details.</para>
</section>
</section>
<section>
<title>Backup Client</title>
+ <highlights>
+ <para>For GateIn should use context "/portal/rest". GateIn uses form
+ authentication, so first you need to login (url to form authentication
+ is http://host:port/portal/login) and then perform requests.</para>
+
+ <para></para>
+
+ <para>Backup client is support form authentication. For example call
+ command "info" with form authentication to GateIn :</para>
+
+ <para>./jcrbackup.sh http://127.0.0.1:8080/portal/rest form POST
+ "/portal/login?username=root&password=gtn" info</para>
+ </highlights>
+
<para>Backup client is console application.</para>
<para>The backup client is http client for HTTPBackupAgent.</para>
@@ -936,19 +992,26 @@
<para>Command signature:</para>
<programlisting>Help info:
- <url> <cmd>
- <url> : http(s)//login:password@host:port/<context>
+ <url_basic_authentication>|<url form authentication> <cmd>
+ <url_basic_authentication> : http(s)//login:password@host:port/<context>
+
+ <url form authentication> : http(s)//host:port/<context> "<form auth parm>"
+ <form auth parm> : form <method> <form path>
+ <method> : POST or GET
+ <form path> : /path/path?<paramName1>=<paramValue1>&<paramName2>=<paramValue2>...
+ Example to <url form authentication> : http://127.0.0.1:8080/portal/rest form POST /portal/login?username=root&password=gtn
+
<cmd> : start <repo[/ws]> <backup_dir> [<incr>]
stop <backup_id>
status <backup_id>
restores <repo[/ws]>
- restore <repo[/ws]> <backup_id> <pathToConfigFile>
+ restore <repo[/ws]> <backup_id> <pathToConfigFile>
list [completed]
info
- drop [force-close-session] <repo[/ws]>
+ drop [force-close-session] <repo[/ws]>
help
- start - start backup of repository or workspace
+ start - start backup of repositpry or workspace
stop - stop backup
status - information about the current or completed backup by 'backup_id'
restores - information about the last restore on specific repository or workspace
@@ -959,12 +1022,12 @@
drop - delete the repository or workspace
help - print help information about backup console
- <repo[/ws]> - /<reponsitory-name>[/<workspace-name>] the repository or workspace
+ <repo[/ws]> - /<reponsitory-name>[/<workspace-name>] the repository or workspace
<backup_dir> - path to folder for backup on remote server
<backup_id> - the identifier for backup
<incr> - incemental job period
<pathToConfigFile> - path (local) to repository or workspace configuration
- force-close-session - close opened sessions on repositpry or workspace</programlisting>
+ force-close-session - close opened sessions on repositpry or workspace.</programlisting>
</section>
<section>
@@ -977,10 +1040,7 @@
<listitem>
<para>Go to folder of "backup client" <emphasis
role="bold">${JCR-SRC-HOME}/applications/exo.jcr.applications.backupconsole</emphasis>
- . - build the application :<programlisting>
- mvn clean install -P deploy
-
-</programlisting></para>
+ . - build the application :<programlisting>mvn clean install -P deploy</programlisting></para>
</listitem>
<listitem>
@@ -1001,8 +1061,8 @@
<itemizedlist>
<listitem>
- <para>Run jar<programlisting>java -jar exo.jcr.applications.backupconsole-binary.jar <command>
-</programlisting>or use jcrbackup.cmd (or .sh);</para>
+ <para>Run jar<programlisting>java -jar exo.jcr.applications.backupconsole-binary.jar <command></programlisting>or
+ use jcrbackup.cmd (or .sh);</para>
</listitem>
</itemizedlist>
</section>
@@ -1233,12 +1293,9 @@
<listitem>
<para>Delete/clean the database for workspace <emphasis
role="bold">"backup"</emphasis> : When we use "single-db", then we
- will run the SQL queries for clean database :<programlisting>
- delete from JCR_SREF where NODE_ID in (select ID from JCR_SITEM where CONTAINER_NAME = 'backup')
- delete from JCR_SVALUE where PROPERTY_ID in (select ID from JCR_SITEM where CONTAINER_NAME = 'backup')
- delete from JCR_SITEM where CONTAINER_NAME='backup'
-
-</programlisting></para>
+ will run the SQL queries for clean database :<programlisting>delete from JCR_SREF where NODE_ID in (select ID from JCR_SITEM where CONTAINER_NAME = 'backup')
+delete from JCR_SVALUE where PROPERTY_ID in (select ID from JCR_SITEM where CONTAINER_NAME = 'backup')
+delete from JCR_SITEM where CONTAINER_NAME='backup'</programlisting></para>
</listitem>
<listitem>
@@ -1250,8 +1307,7 @@
status code = 200</programlisting>The
/home/rainf0x/java/exo-working/JCR-839/exo-jcr-config_backup.xml
content the configuration for restored workspace <emphasis
- role="bold">"backup"</emphasis> :<programlisting>
-<repository-service default-repository="repository">
+ role="bold">"backup"</emphasis> :<programlisting><repository-service default-repository="repository">
<repositories>
<repository name="repository" system-workspace="production" default-workspace="production">
<security-domain>exo-domain</security-domain>
@@ -1329,6 +1385,16 @@
<title>Full example about creating backup and restoring it for repository
'repository'</title>
+ <note>
+ <para>If delete default repository that should be restored repository
+ with name as default repository.</para>
+ </note>
+
+ <para>This usecase needs RestRepositoryService enabled. (Deleting the
+ repository needs it)<programlisting><component>
+ <type>org.exoplatform.services.jcr.ext.repository.RestRepositoryService</type>
+</component></programlisting></para>
+
<section>
<title>Creating backup</title>
@@ -1382,7 +1448,7 @@
</section>
<section>
- <title>Restoring the workspace "backup"</title>
+ <title>Restoring the repository "repository"</title>
<itemizedlist>
<listitem>
@@ -1404,7 +1470,7 @@
</listitem>
<listitem>
- <para>Restore:<programlisting>jcrbackup http://root:exo@127.0.0.1:8080 restore /repository/backup 9a6dba327f000001325dfb228a181b07 /home/rainf0x/exo-jcr-config_backup.xml</programlisting>Return
+ <para>Restore:<programlisting>jcrbackup http://root:exo@127.0.0.1:8080 restore /repository 9a6dba327f000001325dfb228a181b07 /home/rainf0x/exo-jcr-config_backup.xml</programlisting>Return
:<programlisting>Successful :
status code = 200</programlisting>The
/home/rainf0x/exo-jcr-config_backup.xml content the configuration
13 years, 7 months
exo-jcr SVN: r3361 - in jcr/trunk: exo.jcr.component.core and 27 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-10-28 09:02:02 -0400 (Thu, 28 Oct 2010)
New Revision: 3361
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/SecurityHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedCacheHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedFileHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedSystemHelper.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/serialization/SerializationConstants.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
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/ControllerCacheLoader.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrIndexSearcher.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/TextExtractorJob.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataReader.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataWriter.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SpoolFile.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/DBCleanHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/WorkspaceDBCleaner.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
jcr/trunk/pom.xml
Log:
EXOJCR-986: Enable SecurityManager by default
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-10-28 13:02:02 UTC (rev 3361)
@@ -64,6 +64,10 @@
<artifactId>exo.kernel.component.cache</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.organization.api</artifactId>
</dependency>
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/TemplateConfigurationHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,8 +18,8 @@
*/
package org.exoplatform.services.jcr.config;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/serialization/SerializationConstants.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/serialization/SerializationConstants.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/dataflow/serialization/SerializationConstants.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.dataflow.serialization;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import java.io.File;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/RepositoryServiceConfigurationImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,13 +18,13 @@
*/
package org.exoplatform.services.jcr.impl.config;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.services.jcr.config.ConfigurationPersister;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryServiceConfiguration;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.naming.InitialContextInitializer;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -40,8 +42,6 @@
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.storage.JCRItemExistsException;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionFactory.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,12 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.impl.dataflow.session.TransactionableResourceManager;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.exoplatform.services.security.ConversationState;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,6 +19,8 @@
package org.exoplatform.services.jcr.impl.core;
import org.apache.ws.commons.util.Base64;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.access.AccessManager;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
@@ -43,8 +45,6 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.CacheableWorkspaceDataManager;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/FileSystemLockPersister.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.lock;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.access.SystemIdentity;
import org.exoplatform.services.jcr.config.LockPersisterEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -35,7 +36,6 @@
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
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-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -21,6 +21,7 @@
import org.exoplatform.management.annotations.ManagedDescription;
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
+import org.exoplatform.services.cache.impl.jboss.util.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.config.MappedParametrizedObjectEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.SimpleParameterEntry;
@@ -50,7 +51,6 @@
import org.exoplatform.services.jcr.impl.storage.JCRInvalidItemStateException;
import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.jcr.observation.ExtendedEvent;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/ControllerCacheLoader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/ControllerCacheLoader.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/ControllerCacheLoader.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,7 +16,7 @@
*/
package org.exoplatform.services.jcr.impl.core.lock.jbosscache;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.CacheStatus;
import org.jboss.cache.Fqn;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ErrorLog.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -17,8 +17,8 @@
package org.exoplatform.services.jcr.impl.core.query;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.core.query.jbosscache;
import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.services.cache.impl.jboss.util.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
@@ -27,7 +28,6 @@
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory;
import org.exoplatform.services.jcr.jbosscache.ExoJBossCacheFactory.CacheType;
import org.exoplatform.services.jcr.util.IdGenerator;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexInfos.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,12 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+import org.exoplatform.services.cache.impl.jboss.util.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListener;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexInfos;
import org.exoplatform.services.jcr.impl.core.query.lucene.MultiIndex;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexUpdateMonitor.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,13 +18,13 @@
*/
package org.exoplatform.services.jcr.impl.core.query.jbosscache;
+import org.exoplatform.services.cache.impl.jboss.util.PrivilegedCacheHelper;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListener;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexInfos;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitor;
import org.exoplatform.services.jcr.impl.core.query.lucene.IndexUpdateMonitorListener;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedCacheHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -25,7 +25,7 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.Directory;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ConsistencyCheck.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -17,9 +17,9 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.document.Document;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.NodeData;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/FileBasedNamespaceMappings.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,8 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.core.query.lucene;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexInfos.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -17,9 +17,9 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.store.Directory;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexOutputStream;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import java.io.DataInputStream;
import java.io.DataOutputStream;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueue.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,7 +19,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/IndexingQueueStore.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -17,8 +17,8 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.store.Directory;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrIndexSearcher.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrIndexSearcher.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrIndexSearcher.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -20,11 +20,11 @@
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.InternalQName;
import org.exoplatform.services.jcr.impl.core.SessionImpl;
import org.exoplatform.services.jcr.impl.core.query.lucene.constraint.EvaluationContext;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -20,6 +20,7 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
import org.exoplatform.services.jcr.datamodel.ItemData;
import org.exoplatform.services.jcr.datamodel.NodeData;
@@ -29,7 +30,6 @@
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListener;
import org.exoplatform.services.jcr.impl.core.query.IndexingTree;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.DirectoryManager;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -36,7 +36,6 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +43,8 @@
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Calendar;
@@ -228,15 +229,33 @@
addPropertyName(doc, prop.getQPath().getName());
}
- SecurityHelper.doPriviledgedRepositoryExceptionAction(new PrivilegedExceptionAction<Object>()
+ try
{
- public Object run() throws Exception
+ AccessController.doPrivileged((new PrivilegedExceptionAction<Object>()
{
- addValues(doc, prop);
- return null;
+ public Object run() throws Exception
+ {
+ addValues(doc, prop);
+ return null;
+ }
+ }));
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof RepositoryException)
+ {
+ throw (RepositoryException)cause;
}
- });
-
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
}
// now add fields that are not used in excerpt (must go at the end)
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/PersistentIndex.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -23,8 +23,8 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.DirectoryManager;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import java.io.IOException;
import java.security.PrivilegedExceptionAction;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/RedoLog.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -17,9 +17,9 @@
package org.exoplatform.services.jcr.impl.core.query.lucene;
import org.apache.lucene.store.Directory;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexInputStream;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.IndexOutputStream;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -35,6 +35,9 @@
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortComparatorSource;
import org.apache.lucene.search.SortField;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.configuration.ConfigurationManager;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
@@ -59,9 +62,6 @@
import org.exoplatform.services.jcr.impl.core.query.SearchIndexConfigurationHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.DirectoryManager;
import org.exoplatform.services.jcr.impl.core.query.lucene.directory.FSDirectoryManager;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
@@ -71,7 +71,9 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.security.AccessController;
import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
@@ -502,20 +504,40 @@
if (path != null)
{
indexDirectory = new File(path);
- SecurityHelper.doPriviledgedRepositoryExceptionAction(new PrivilegedExceptionAction<Object>()
+
+ try
{
- public Object run() throws Exception
+ AccessController.doPrivileged((new PrivilegedExceptionAction<Object>()
{
- if (!indexDirectory.exists())
+ public Object run() throws Exception
{
- if (!indexDirectory.mkdirs())
+ if (!indexDirectory.exists())
{
- throw new RepositoryException("fail to create index dir " + path);
+ if (!indexDirectory.mkdirs())
+ {
+ throw new RepositoryException("fail to create index dir " + path);
+ }
}
+ return null;
}
- return null;
+ }));
+ }
+ catch (PrivilegedActionException pae)
+ {
+ Throwable cause = pae.getCause();
+ if (cause instanceof RepositoryException)
+ {
+ throw (RepositoryException)cause;
}
- });
+ else if (cause instanceof RuntimeException)
+ {
+ throw (RuntimeException)cause;
+ }
+ else
+ {
+ throw new RuntimeException(cause);
+ }
+ }
}
else
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/TextExtractorJob.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/TextExtractorJob.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/TextExtractorJob.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,8 +19,8 @@
import EDU.oswego.cs.dl.util.concurrent.Callable;
import EDU.oswego.cs.dl.util.concurrent.FutureResult;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.document.DocumentReader;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/Util.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -21,11 +21,11 @@
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.Query;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/directory/FSDirectoryManager.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,9 +19,9 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.NativeFSLockFactory;
+import org.exoplatform.commons.utils.SecurityHelper;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.File;
import java.io.FileFilter;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -26,13 +26,13 @@
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.NativeFSLockFactory;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.core.query.QueryHandler;
import org.exoplatform.services.jcr.impl.core.query.QueryRootNode;
import org.exoplatform.services.jcr.impl.core.query.RelationQueryNode;
import org.exoplatform.services.jcr.impl.core.query.TraversingQueryNodeVisitor;
import org.exoplatform.services.jcr.impl.core.query.lucene.FieldNames;
import org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/value/ValueFactoryImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core.value;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.ExtendedPropertyType;
import org.exoplatform.services.jcr.datamodel.Identifier;
@@ -30,7 +31,6 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.log.ExoLogger;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,8 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.datamodel.Identifier;
import org.exoplatform.services.jcr.datamodel.InternalQName;
@@ -27,7 +28,6 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.FilePersistedValueData;
import org.exoplatform.services.jcr.impl.util.JCRDateFormat;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CleanableFilePersistedValueData.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SwapFile;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,10 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.AbstractPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.Externalizable;
import java.io.File;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,8 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.jcr.impl.util.io.SwapFile;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/FileObjectReaderImpl.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,10 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.serialization;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.dataflow.serialization.ObjectReader;
import org.exoplatform.services.jcr.dataflow.serialization.SerializationConstants;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.EOFException;
import java.io.File;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataReader.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataReader.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataReader.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.serialization;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.dataflow.serialization.ObjectReader;
import org.exoplatform.services.jcr.dataflow.serialization.SerializationConstants;
import org.exoplatform.services.jcr.dataflow.serialization.UnknownClassIdException;
@@ -25,7 +26,6 @@
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import java.io.File;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataWriter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataWriter.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/serialization/PersistedValueDataWriter.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,12 +18,12 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.serialization;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.dataflow.serialization.ObjectWriter;
import org.exoplatform.services.jcr.dataflow.serialization.SerializationConstants;
import org.exoplatform.services.jcr.impl.dataflow.AbstractPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.FilePersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import java.io.FileInputStream;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.access.AccessControlEntry;
import org.exoplatform.services.jcr.access.AccessControlList;
import org.exoplatform.services.jcr.dataflow.ItemState;
@@ -41,7 +42,6 @@
import org.exoplatform.services.jcr.impl.storage.value.ValueStorageNotFoundException;
import org.exoplatform.services.jcr.impl.storage.value.fs.operations.ValueFileIOHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.SwapFile;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueIOChannel;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.config.RepositoryEntry;
import org.exoplatform.services.jcr.config.WorkspaceEntry;
@@ -35,8 +37,6 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.update.StorageUpdateManager;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBMultiDbJDBCConnection.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,9 +16,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/db/HSQLDBSingleDbJDBCConnection.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,9 +16,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.db;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBMultiDbJDBCConnection.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,11 +16,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/db/HSQLDBSingleDbJDBCConnection.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,11 +16,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.datamodel.IllegalNameException;
import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPath;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileDigestOutputStream.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import java.io.File;
import java.io.IOException;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/FileValueStorage.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,10 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.jcr.storage.value.ValueStoragePlugin;
import org.exoplatform.services.log.ExoLogger;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/SimpleFileIOChannel.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.File;
import java.io.FileFilter;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFile.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,8 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/TreeFileIOChannel.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.File;
import java.io.IOException;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/CASableWriteValue.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
@@ -27,7 +28,6 @@
import org.exoplatform.services.jcr.impl.storage.value.fs.CASableIOSupport;
import org.exoplatform.services.jcr.impl.storage.value.fs.FileDigestOutputStream;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.jcr.util.IdGenerator;
import java.io.File;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/DeleteValues.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,9 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.File;
import java.io.IOException;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,11 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.ByteArrayPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.FilePersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.persistent.StreamPersistedValueData;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileOperation.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,11 +18,11 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.storage.value.ValueOperation;
import org.exoplatform.services.jcr.impl.storage.value.fs.FileLockException;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/WriteValue.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,10 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.storage.value.fs.operations;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.storage.value.ValueDataResourceHolder;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
import java.io.File;
import java.io.IOException;
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/SecurityHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/SecurityHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/SecurityHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.util;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.sql.SQLException;
-
-import javax.jcr.RepositoryException;
-
-/**
- * Helps running code in privileged
- *
- * @author <a href="mailto:nikolazius@gmail.com">Nikolay Zamosenchuk</a>
- * @version $Id: SecurityHelper.java 34360 2009-07-22 23:58:59Z nzamosenchuk $
- *
- */
-public class SecurityHelper
-{
-
- /**
- * Launches action in privileged mode. Can throw only IO exception.
- *
- * @param <E>
- * @param action
- * @return
- * @throws IOException
- */
- public static <E> E doPriviledgedIOExceptionAction(PrivilegedExceptionAction<E> action) throws IOException
- {
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IOException)
- {
- throw (IOException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Launches action in privileged mode. Can throw only IO exception.
- *
- * @param <E>
- * @param action
- * @return
- * @throws IOException
- */
- public static <E> E doPriviledgedSQLExceptionAction(PrivilegedExceptionAction<E> action) throws SQLException
- {
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof SQLException)
- {
- throw (SQLException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Launches action in privileged mode. Can throw only repository exception.
- *
- * @param <E>
- * @param action
- * @return
- * @throws RepositoryException
- */
- public static <E> E doPriviledgedRepositoryExceptionAction(PrivilegedExceptionAction<E> action)
- throws RepositoryException
- {
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof RepositoryException)
- {
- throw (RepositoryException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Launches action in privileged mode. Can throw only runtime exceptions.
- *
- * @param <E>
- * @param action
- * @return
- * @throws IOException
- */
- public static <E> E doPriviledgedAction(PrivilegedAction<E> action)
- {
- return AccessController.doPrivileged(action);
- }
-
-}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleaner.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/FileCleaner.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.jcr.impl.proccess.WorkerThread;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedCacheHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedCacheHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedCacheHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.util.io;
-
-import org.jboss.cache.Cache;
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-
-import java.io.Serializable;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
- * @version $Id: PrivilegedCacheHelper.java 111 2010-11-11 11:11:11Z tolusha $
- *
- */
-public class PrivilegedCacheHelper
-{
- /**
- * Start cache in privileged mode.
- *
- * @param cache
- */
- public static void start(final Cache<Serializable, Object> cache)
- {
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
- {
- public Object run()
- {
- cache.start();
- return null;
- }
- };
- AccessController.doPrivileged(action);
- }
-
- /**
- * Stop cache in privileged mode.
- *
- * @param cache
- */
- public static void stop(final Cache<Serializable, Object> cache)
- {
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
- {
- public Object run()
- {
- cache.stop();
- return null;
- }
- };
- AccessController.doPrivileged(action);
- }
-
- /**
- * Create cache in privileged mode.
- *
- * @param cache
- */
- public static void create(final Cache<Serializable, Object> cache)
- {
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
- {
- public Object run()
- {
- cache.create();
- return null;
- }
- };
- AccessController.doPrivileged(action);
- }
-
- /**
- * Put in cache in privileged mode.
- *
- * @param cache
- */
- public static Object put(final Cache<Serializable, Object> cache, final String fqn, final Serializable key,
- final Object value) throws CacheException
- {
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- return cache.put(fqn, key, value);
-
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof CacheException)
- {
- throw (CacheException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Put in cache in privileged mode.
- *
- * @param cache
- */
- public static Object put(final Cache<Serializable, Object> cache, final Fqn fqn, final Serializable key,
- final Object value) throws CacheException
- {
- PrivilegedExceptionAction<Object> action = new PrivilegedExceptionAction<Object>()
- {
- public Object run() throws Exception
- {
- return cache.put(fqn, key, value);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof CacheException)
- {
- throw (CacheException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedFileHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedFileHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedFileHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -1,591 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.util.io;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
- * @version $Id: SecurityFileHelper.java 111 2010-11-11 11:11:11Z tolusha $
- *
- * Class helper need for perform privileged file operations.
- */
-public class PrivilegedFileHelper
-{
-
- /**
- * Create FileOutputStream in privileged mode.
- *
- * @param file
- * @return
- * @throws FileNotFoundException
- */
- public static FileOutputStream fileOutputStream(final File file) throws FileNotFoundException
- {
- PrivilegedExceptionAction<FileOutputStream> action = new PrivilegedExceptionAction<FileOutputStream>()
- {
- public FileOutputStream run() throws Exception
- {
- return new FileOutputStream(file);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create FileOutputStream in privileged mode.
- *
- * @param name
- * @return
- * @throws FileNotFoundException
- */
- public static FileOutputStream fileOutputStream(final String name) throws FileNotFoundException
- {
- PrivilegedExceptionAction<FileOutputStream> action = new PrivilegedExceptionAction<FileOutputStream>()
- {
- public FileOutputStream run() throws Exception
- {
- return new FileOutputStream(name);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create FileOutputStream in privileged mode.
- *
- * @param file
- * @param append
- * @return
- * @throws FileNotFoundException
- */
- public static FileOutputStream fileOutputStream(final File file, final boolean append) throws FileNotFoundException
- {
- PrivilegedExceptionAction<FileOutputStream> action = new PrivilegedExceptionAction<FileOutputStream>()
- {
- public FileOutputStream run() throws Exception
- {
- return new FileOutputStream(file, append);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create FileInputStream in privileged mode.
- *
- * @param file
- * @return
- * @throws FileNotFoundException
- */
- public static FileInputStream fileInputStream(final File file) throws FileNotFoundException
- {
- PrivilegedExceptionAction<FileInputStream> action = new PrivilegedExceptionAction<FileInputStream>()
- {
- public FileInputStream run() throws Exception
- {
- return new FileInputStream(file);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create FileInputStream in privileged mode.
- *
- * @param name
- * @return
- * @throws FileNotFoundException
- */
- public static FileInputStream fileInputStream(final String name) throws FileNotFoundException
- {
- PrivilegedExceptionAction<FileInputStream> action = new PrivilegedExceptionAction<FileInputStream>()
- {
- public FileInputStream run() throws Exception
- {
- return new FileInputStream(name);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create temporary file in privileged mode.
- *
- * @param prefix
- * @param suffix
- * @param directory
- * @return
- * @throws IllegalArgumentException
- * @throws IOException
- */
- public static File createTempFile(final String prefix, final String suffix, final File directory)
- throws IllegalArgumentException, IOException
- {
- PrivilegedExceptionAction<File> action = new PrivilegedExceptionAction<File>()
- {
- public File run() throws Exception
- {
- return File.createTempFile(prefix, suffix, directory);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IllegalArgumentException)
- {
- throw (IllegalArgumentException)cause;
- }
- else if (cause instanceof IOException)
- {
- throw (IOException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create teamporary file in privileged mode.
- *
- *
- * @param prefix
- * @param suffix
- * @return
- * @throws IllegalArgumentException
- * @throws IOException
- */
- public static File createTempFile(final String prefix, final String suffix) throws IllegalArgumentException,
- IOException
- {
- PrivilegedExceptionAction<File> action = new PrivilegedExceptionAction<File>()
- {
- public File run() throws Exception
- {
- return File.createTempFile(prefix, suffix);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IllegalArgumentException)
- {
- throw (IllegalArgumentException)cause;
- }
- else if (cause instanceof IOException)
- {
- throw (IOException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Create RandomAccessFile in privileged mode.
- *
- * @param file
- * @param mode
- * @return
- * @throws IllegalArgumentException
- * @throws IOException
- */
- public static RandomAccessFile randomAccessFile(final File file, final String mode) throws IllegalArgumentException,
- IOException
- {
- PrivilegedExceptionAction<RandomAccessFile> action = new PrivilegedExceptionAction<RandomAccessFile>()
- {
- public RandomAccessFile run() throws Exception
- {
- return new RandomAccessFile(file, mode);
- }
- };
- try
- {
- return AccessController.doPrivileged(action);
- }
- catch (PrivilegedActionException pae)
- {
- Throwable cause = pae.getCause();
- if (cause instanceof IllegalArgumentException)
- {
- throw (IllegalArgumentException)cause;
- }
- else if (cause instanceof FileNotFoundException)
- {
- throw (FileNotFoundException)cause;
- }
- else if (cause instanceof RuntimeException)
- {
- throw (RuntimeException)cause;
- }
- else
- {
- throw new RuntimeException(cause);
- }
- }
- }
-
- /**
- * Get file length in privileged mode.
- *
- * @param file
- * @return
- */
- public static long length(final File file)
- {
- PrivilegedAction<Long> action = new PrivilegedAction<Long>()
- {
- public Long run()
- {
- return new Long(file.length());
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Requests in privileged mode that the file or directory denoted by this abstract
- * pathname be deleted when the virtual machine terminates.
- *
- * @param file
- */
- public static void deleteOnExit(final File file)
- {
- PrivilegedAction<Object> action = new PrivilegedAction<Object>()
- {
- public Object run()
- {
- file.deleteOnExit();
- return null;
- }
- };
- AccessController.doPrivileged(action);
- }
-
- /**
- * Get file absolute path in privileged mode.
- *
- * @param file
- * @return
- */
- public static String getAbsolutePath(final File file)
- {
- PrivilegedAction<String> action = new PrivilegedAction<String>()
- {
- public String run()
- {
- return file.getAbsolutePath();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Delete file in privileged mode.
- *
- * @param file
- * @return
- */
- public static boolean delete(final File file)
- {
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return file.delete();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Tests in privileged mode whether the file denoted by this abstract pathname is a
- * directory.
- *
- * @param file
- * @return
- */
- public static boolean isDirectory(final File file)
- {
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return file.isDirectory();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Tests in privileged mode whether the file or directory denoted by this abstract pathname
- * exists.
- *
- * @param file
- * @return
- */
- public static boolean exists(final File file)
- {
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return file.exists();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Creates the directory in privileged mode.
- *
- * @param file
- * @return
- */
- public static boolean mkdirs(final File file)
- {
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return file.mkdirs();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Rename File in privileged mode.
- *
- * @param srcFile
- * @param dstfile
- * @return
- */
- public static boolean renameTo(final File srcFile, final File dstfile)
- {
- PrivilegedAction<Boolean> action = new PrivilegedAction<Boolean>()
- {
- public Boolean run()
- {
- return new Boolean(srcFile.renameTo(dstfile));
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Get file's list in privileged mode.
- *
- * @param file
- * @return
- */
- public static String[] list(final File file)
- {
- PrivilegedAction<String[]> action = new PrivilegedAction<String[]>()
- {
- public String[] run()
- {
- return file.list();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Get file's list in privileged mode.
- *
- * @param file
- * @return
- */
- public static String[] list(final File file, final FilenameFilter filter)
- {
- PrivilegedAction<String[]> action = new PrivilegedAction<String[]>()
- {
- public String[] run()
- {
- return file.list(filter);
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Get file's list in privileged mode.
- *
- * @param file
- * @return
- */
- public static File[] listFiles(final File file)
- {
- PrivilegedAction<File[]> action = new PrivilegedAction<File[]>()
- {
- public File[] run()
- {
- return file.listFiles();
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Get file's list in privileged mode.
- *
- * @param file
- * @return
- */
- public static File[] listFiles(final File file, final FileFilter filter)
- {
- PrivilegedAction<File[]> action = new PrivilegedAction<File[]>()
- {
- public File[] run()
- {
- return file.listFiles(filter);
- }
- };
- return AccessController.doPrivileged(action);
- }
-
-}
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedSystemHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedSystemHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/PrivilegedSystemHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.impl.util.io;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
- * @version $Id: PrivilegedSystemHelper.java 111 2010-11-11 11:11:11Z tolusha $
- *
- */
-public class PrivilegedSystemHelper
-{
-
- /**
- * Gets system property in privileged mode.
- *
- * @param key
- * @return
- */
- public static String getProperty(final String key)
- {
- PrivilegedAction<String> action = new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(key);
- }
- };
- return AccessController.doPrivileged(action);
- }
-
- /**
- * Gets system property in privileged mode.
- *
- * @param key
- * @param def
- * @return
- */
- public static String getProperty(final String key, final String def)
- {
- PrivilegedAction<String> action = new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(key, def);
- }
- };
- return AccessController.doPrivileged(action);
- }
-}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SpoolFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SpoolFile.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SpoolFile.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/SwapFile.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,6 +18,8 @@
*/
package org.exoplatform.services.jcr.impl.util.io;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+
import java.io.File;
import java.io.IOException;
import java.security.AccessController;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/DBCleanHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/DBCleanHelper.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/DBCleanHelper.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,8 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc.cleaner;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/WorkspaceDBCleaner.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/WorkspaceDBCleaner.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/cleaner/WorkspaceDBCleaner.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,8 +16,8 @@
*/
package org.exoplatform.services.jcr.impl.util.jdbc.cleaner;
+import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
-import org.exoplatform.services.jcr.impl.util.SecurityHelper;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializer;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/BufferedDecoder.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -19,7 +19,7 @@
package org.exoplatform.services.jcr.impl.xml;
import org.apache.ws.commons.util.Base64;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -16,6 +16,8 @@
*/
package org.exoplatform.services.jcr.statistics;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.management.ManagementContext;
@@ -25,8 +27,6 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.management.rest.annotations.RESTEndpoint;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedFileHelper;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceDataContainer.java 2010-10-28 13:02:02 UTC (rev 3361)
@@ -18,7 +18,7 @@
*/
package org.exoplatform.services.jcr.storage;
-import org.exoplatform.services.jcr.impl.util.io.PrivilegedSystemHelper;
+import org.exoplatform.commons.utils.PrivilegedSystemHelper;
import java.util.Calendar;
Modified: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2010-10-28 12:56:43 UTC (rev 3360)
+++ jcr/trunk/pom.xml 2010-10-28 13:02:02 UTC (rev 3361)
@@ -81,6 +81,11 @@
<version>${org.exoplatform.kernel.version}</version>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.ext.cache.impl.jboss.v3</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.exoplatform.core</groupId>
<artifactId>exo.core.component.document</artifactId>
<version>${org.exoplatform.core.version}</version>
13 years, 7 months