exo-jcr SVN: r2646 - jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-06-17 04:34:18 -0400 (Thu, 17 Jun 2010)
New Revision: 2646
Added:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container-howto.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container.xml
Log:
=EXOJCR-742: adding doc about data container
Added: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container-howto.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container-howto.xml (rev 0)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container-howto.xml 2010-06-17 08:34:18 UTC (rev 2646)
@@ -0,0 +1,111 @@
+<?xml version='1.0' ?><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+ <chapter id="HowtoimplementWorkspaceDataContainer">
+ <title>How-to implement Workspace Data Container</title>
+ <section id="ShortintrointoWorkspacedatacontainerimplementationpractices">
+ <title>Short intro into Workspace data container implementation practices:</title>
+ <orderedlist>
+ <listitem>
+ <para>Read a bit about the <link linkend="JCRWorkspaceDataContainerarchitecturecontract">contract</link>.</para>
+ </listitem>
+ <listitem>
+ <para>Start new implementation project pom.xml with org.exoplatform.jcr parent. (optional, but will makes the development easy)</para>
+ </listitem>
+ <listitem>
+ <para>Update sources of JCR Core and read JavaDoc on
+ <emphasis role="bold">org.exoplatform.services.jcr.storage.WorkspaceDataContainer</emphasis> and
+ <emphasis role="bold">org.exoplatform.services.jcr.storage.WorkspaceStorageConnection</emphasis> interfaces. This two are main part for the implemenation.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Look at
+ <emphasis role="bold">org.exoplatform.services.jcr.impl.dataflow.persistent.WorkspacePersistentDataManager</emphasis> sourcecode, check how data meneger uses container and its connections (see in save() method)
+ </para>
+ </listitem>
+ <listitem>
+ <para>Create
+ <emphasis role="bold">WorkspaceStorageConnection</emphasis> dummy implementation class. It's freeform class, but to be close to the eXo JCR, check how implemented JDBC or SimpleDB containers (
+ <emphasis role="bold">org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection</emphasis> and
+ <emphasis role="bold">org.exoplatform.services.jcr.aws.storage.sdb.SDBWorkspaceStorageConnection</emphasis>). Take in account usage of
+ <emphasis role="bold">ValueStoragePluginProvider</emphasis> in both implementations.Value storage is an useful option for production versions. But leave it to the end of implementation work.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Create the connection implementation unit tests to play TTD. (optional, but takes many benefits for the process)</para>
+ </listitem>
+ <listitem>
+ <para>Implement CRUD starting from the read to write etc. Test the methods using external to the implementation ways of data read/write in your backend.</para>
+ </listitem>
+ <listitem>
+ <para>When all methods of the connection done start
+ <emphasis role="bold">WorkspaceDataContainer</emphasis>. Container class very simple, it's like a factory for the connections only.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Care about container reuseConnection(WorkspaceStorageConnection) method logic. For some backends it cab be same as openConnection(), but for some others it's important to reuse physical backend connection, e.g. to be in same transaction - see JDBC container.</para>
+ </listitem>
+ <listitem>
+ <para>It's almost ready for use in data manager. Start another test and go on.</para>
+ </listitem>
+ </orderedlist>
+ <para>When the container will be ready for run as JCR persistence storage (e.g. for this level testing) it should be configured in Repository configuration.</para>
+ <para>Assuming that our new implementation class name is
+ <emphasis role="bold">org.project.jcr.impl.storage.MyWorkspaceDataContainer</emphasis>.
+ </para>
+ <programlisting> <repository-service default-repository="repository">
+ <repositories>
+ <repository name="repository" system-workspace="production" default-workspace="production">
+ .............
+ <workspaces>
+ <workspace name="production">
+ <container class="org.project.jcr.impl.storage.MyWorkspaceDataContainer">
+ <properties>
+ <property name="propertyName1" value="propertyValue1" />
+ <property name="propertyName2" value="propertyValue2" />
+ .......
+ <property name="propertyNameN" value="propertyValueN" />
+ </properties>
+ <value-storages>
+ .......
+ </value-storages>
+ </container>
+
+</programlisting>
+ <para>Container can be configured using set properties.</para>
+ </section>
+ <section id="Valuestorageusagenotes">
+ <title>Value storage usage notes:</title>
+ <para>Value storages pluggable to the container but if it used the container implementation should respect set of interfaces and external storage usage principles.</para>
+ <para>If the container have
+ <emphasis role="bold">ValueStoragePluginProvider</emphasis> (e.g. via constructor) it's just few methods to manipulate external Values data.
+ </para>
+ <programlisting>// get channel for ValueData write (add or update)
+ValueIOChannel channel = valueStorageProvider.getApplicableChannel(data, i);
+if (channel == null) {
+ // write
+ channel.write(data.getIdentifier(), vd);
+ // obtain storage id, id can be used for linkage of external ValueData and PropertyData in main backend
+ String storageId = channel.getStorageId();
+}
+
+....
+
+// delete all Property Values in external storage
+ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
+channel.delete(propertyData.getIdentifier());
+
+....
+
+// read ValueData from external storage
+ValueIOChannel channel = valueStorageProvider.getChannel(storageId);
+ValueData vdata = channel.read(propertyData.getIdentifier(), orderNumber, maxBufferSize);
+
+</programlisting>
+ <important>
+ <title>Important</title>
+ <para>After a sequence of write and/or delete operations on the storage channel, the channel should be committed (or rolled back on an error). See
+ <emphasis role="bold">ValueIOChannel.commit()</emphasis> and
+ <emphasis role="bold">ValueIOChannel.rollback()</emphasis> and how those methods used in JDBC container.
+ </para>
+ </important>
+ </section>
+ </chapter>
Added: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container.xml (rev 0)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr/data-container.xml 2010-06-17 08:34:18 UTC (rev 2646)
@@ -0,0 +1,391 @@
+<?xml version='1.0' ?><!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter id="JCRWorkspaceDataContainerarchitecturecontract">
+ <title>JCR Workspace Data Container (architecture contract)</title>
+ <section id="Goals">
+ <title>Goals</title>
+ <itemizedlist>
+ <listitem>
+ <para>Cover Workspace Data Container implementation requirements</para>
+ </listitem>
+ <listitem>
+ <para>Describe container life cycle</para>
+ </listitem>
+ <listitem>
+ <para>Describe relations between container and high-level DataManagers</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="Concepts">
+ <title>Concepts</title>
+ <section id="Containerandconnection">
+ <title>Container and connection</title>
+ <para>Workspace Data Container (container) serves Repository Workspace persistent storage.
+ WorkspacePersistentDataManager (data manager) uses container to perform CRUD operation on the persistent
+ storage.
+ Access to the storage in data manager makes via storage connection obtained from the container (WorkspaceDataContainer
+ interface implemenatiton). Each connection represents a transaction on the storage. Storage Connection
+ (connection) should be an implementation of WorkspaceStorageConnection.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Container acts as a factory of a new storage connections. Usually this method is designed to be
+ synchronized, to avoid possible concurrent issues.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>WorkspaceStorageConnection openConnection() throws RepositoryException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Open read-only WorkspaceStorageConnection. Read-only connections can be potentially a bit faster in
+ some cases.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException;
+</programlisting>
+ <note>
+ <title>*EXPERIMENTAL*</title>
+ <para>Read-only WorkspaceStorageConnection is experimental feature and not currently handled in JCR.
+ Actually such connections didn't prove their performance, so JCR Core doesn't use them.</para>
+ </note>
+ <itemizedlist>
+ <listitem>
+ <para>Storage connection might be reused also. Reuse of the connection means reuse of physical resource
+ (e.g. JDBC Connection) allocated by one connection in another. This feature used in data manager for
+ saving ordinary and system changes on the system Workspace. But the reuse is an optional feature and
+ it works only if possible, otherwise the new connection opens.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>WorkspaceStorageConnection reuseConnection(WorkspaceStorageConnection original) throws RepositoryException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>When checking Same-Name Siblings (SNS) existence, JCR Core can use new connection or not. This is
+ defined via Workspace Data Container configuration and retrieved using special method.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>boolean isCheckSNSNewConnection();
+</programlisting>
+ <important>
+ <title>New connection for SNS</title>
+ <para> Sometimes there is a need of checking if there are some nodes with equal names. Usually new Workspace
+ Storage Connection is used for purpose. The improvement came from JDBC Workspace Data Container, which
+ shows better performance on Oracle RDBMS when using new connection for checking SNS existence. But later
+ this led to deadlocks on Sybase RDBMS, so feature was made as an optional and configurable.</para>
+ </important>
+ <para>Container initialization based on a configuration only. After the container created it's not possible to
+ change parameters. Configuration consists of implementation class and set of properties and Value Storages
+ configuration.</para>
+ </section>
+ <section id="Valuestorages">
+ <title>Value storages</title>
+ <para>Container provides optional special mechanism for Value storing. It's possible to configure external
+ Value Storages via container configuration (available only via configuration).
+ Value Storage works as fully independent pluggable storage. All required parameters storage obtains from its
+ configuration. Some storages are possible for one container.
+ Configuration describes such parameters as ValueStoragePluginimplementation class, set of implementation specific properties and
+ filters. The filters declares criteria for Value matching to the storage. Only matched Property Values will
+ be stored. So, in common case, the storage might contains only the part of the Workspace content.
+ Value Storages are very useful for BLOB storing. E.g. storing on the File System instead of a database.</para>
+ <para>Container obtains Values Storages from ValueStoragePluginProvider component. Provider acts as a factory
+ of Value channels (ValueIOChannel). Channel provides all CRUD operation for Value Storage respecting the
+ transaction manner of work (how it can be possible due to implementation specifics of the storages).</para>
+ </section>
+ <section id="Lifecycle">
+ <title>Lifecycle</title>
+ <para>Container used by data manager for read and write operations.
+ Read operations (getters) uses connection once and close it on the finally.
+ Write operations performs in commit method as a sequence of create/update calls and final commit (or rollback on error).
+ Writes uses one connection (or two - another for system workspace) per commit call. One connection
+ guaranties transaction support for write operations.
+ Commit or rollback should free/clean all resources consumed by the container (connection).</para>
+ </section>
+ <section id="Valuestoragelifecycle">
+ <title>Value storage lifecycle</title>
+ <para>Value storage used from the container inside. Reads are related to a container reads. Writes are commit
+ related.
+ Container (connection) implementation should use transaction capabilities of the storages in same way as for other
+ operations.</para>
+ </section>
+ </section>
+ <section id="Requirements">
+ <title>Requirements</title>
+ <para>Connection create and reuse should be a thread safe operation.
+ Connection provides CRUD operations support on the storage.</para>
+ <section id="Readoperations">
+ <title>Read operations</title>
+ <itemizedlist>
+ <listitem>
+ <para>Reads ItemData from the storage by item identifier.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>ItemData getItemData(String identifier) throws RepositoryException, IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Reads ItemData from the storage using item's parent and name relative the parent location.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>ItemData getItemData(NodeData parentData, QPathEntry name) throws RepositoryException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Reads List of NodeData from the storage using item's parent location.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>List<NodeData> getChildNodesData(NodeData parent) throws RepositoryException, IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Reads List of PropertyData from the storage using item's parent location</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>List<PropertyData> getChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Reads List of PropertyData with empty ValueData from the storage using item's parent location.</para>
+ </listitem>
+ </itemizedlist>
+ <para>This methiod specially dedicated for non-content modification operations (e.g. Items delete).</para>
+ <programlisting>List<PropertyData> listChildPropertiesData(NodeData parent) throws RepositoryException, IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Reads List of PropertyData from the storage using item's parent location.</para>
+ </listitem>
+ </itemizedlist>
+ <para>It's REFERENCE type Properties referencing Node with given nodeIdentifier. See more in javax.jcr.Node.getReferences()</para>
+ <programlisting>List<PropertyData> getReferencesData(String nodeIdentifier) throws RepositoryException,IllegalStateException,UnsupportedOperationException;
+</programlisting>
+ </section>
+ <section id="Writeoperations">
+ <title>Write operations</title>
+ <itemizedlist>
+ <listitem>
+ <para>Adds single NodeData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void add(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Adds single PropertyData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void add(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Updates NodeData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void update(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Updates PropertyData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void update(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Renames NodeData using Node identifier and new name and index from the data.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void rename(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Deletes NodeData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void delete(NodeData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Deletes PropertyData.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void delete(PropertyData data) throws RepositoryException,UnsupportedOperationException,InvalidItemStateException,IllegalStateException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Persist changes and closes connection. It can be database transaction commit for instance etc.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void commit() throws IllegalStateException, RepositoryException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Refuses persistent changes and closes connection. It can be database transaction rollback for instance etc.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void rollback() throws IllegalStateException, RepositoryException;
+</programlisting>
+ <para>All methods throws IllegalStateException if connection is closed.
+ UnsupportedOperationException if the method is not supported (e.g. JCR Level 1 implementation etc).
+ RepositoryException if some error occurs during preparation, validation or persistence.</para>
+ </section>
+ <section id="Stateoperations">
+ <title>State operations</title>
+ <itemizedlist>
+ <listitem>
+ <para>Returns true if connection can be used.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>boolean isOpened();
+</programlisting>
+ </section>
+ <section id="Validationofwriteoperations">
+ <title>Validation of write operations</title>
+ <para>Container have to care about storage consistency (JCR constraints) on write operations:
+ (InvalidItemStateException should be thrown according the spec)
+ At least following checks should be performed:</para>
+ <itemizedlist>
+ <listitem>
+ <para>On ADD errors</para>
+ <itemizedlist>
+ <listitem>
+ <para>Parent not found. Condition: Parent ID (Item with ID is not exists).</para>
+ </listitem>
+ <listitem>
+ <para>Item already exists. Condition: ID (Item with ID already exists).</para>
+ </listitem>
+ <listitem>
+ <para>Item already exists. Condition: Parent ID, Name, Index (Item with parent ID, name and index already exists).</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>On DELETE errors</para>
+ <itemizedlist>
+ <listitem>
+ <para>Item not found. Condition ID.</para>
+ </listitem>
+ <listitem>
+ <para>Can not delete parent till children exists.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <listitem>
+ <para>On UPDATE errors</para>
+ <itemizedlist>
+ <listitem>
+ <para>Item not found. Condition ID.</para>
+ </listitem>
+ <listitem>
+ <para>Item already exists with higher Version. Condition: ID, Version (Some Session had updated Item with ID prior this update).</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="Consistencyofsave">
+ <title>Consistency of save</title>
+ <para>The container (connection) should implement consistency of Commit (Rollback) in
+ <emphasis role="bold">transaction manner</emphasis>.
+ I.e. if set of operations were performed
+ <emphasis role="bold">before</emphasis> the future
+ <emphasis role="bold">Commit</emphasis> and another next operation
+ <emphasis role="bold">fails</emphasis>.
+ <emphasis role="bold">It should be possible to</emphasis> rollback applied changes using
+ <emphasis role="bold">Rollback</emphasis> command.
+ </para>
+ </section>
+ </section>
+ <section id="ValuestoragesAPI">
+ <title>Value storages API</title>
+ <section id="Storagesprovider">
+ <title>Storages provider:</title>
+ <para>Container implementation obtains Values Storages option via ValueStoragePluginProvider component. Provider acts as a factory of Value channels (ValueIOChannel) and has two methods for this purpose:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Return ValueIOChannel matched this property and valueOrderNumer. Null will be returned if no channel matches.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>ValueIOChannel getApplicableChannel(PropertyData property, int valueOrderNumer) throws IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Return ValueIOChannel associated with given storageId.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>ValueIOChannel getChannel(String storageId) throws IOException, ValueStorageNotFoundException;
+</programlisting>
+ <para>There is also method for consistency check, but this method doesn't used anywhere and storage implementations has it empty.</para>
+ </section>
+ <section id="Valuestorageplugin">
+ <title>Value storage plugin</title>
+ <para>Provider implementation should use ValueStoragePlugin abstract class as a base for all storage implementations.
+ Plugin provides support for provider implementation methods. Plugin's methods should be implemented:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Initialize this plugin. Used at start time in ValueStoragePluginProvider.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>public abstract void init(Properties props, ValueDataResourceHolder resources) throws RepositoryConfigurationException, IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Open ValueIOChannel.Used in ValueStoragePluginProvider.getApplicableChannel(PropertyData, int) and getChannel(String)</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>public abstract ValueIOChannel openIOChannel() throws IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Return true if this storage has same storageId.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>public abstract boolean isSame(String valueDataDescriptor);
+</programlisting>
+ </section>
+ <section id="ValueIOchannel">
+ <title>Value I/O channel</title>
+ <para>Channel should implement ValueIOChannel interface. CRUD operation for Value Storage:</para>
+ <itemizedlist>
+ <listitem>
+ <para>Read Property value.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>ValueData read(String propertyId, int orderNumber, int maxBufferSize) throws IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Add or update Property value.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void write(String propertyId, ValueData data) throws IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Delete Property all values.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void delete(String propertyId) throws IOException;
+</programlisting>
+ </section>
+ <section id="Transactionsupportviachannel">
+ <title>Transaction support via channel</title>
+ <para>Modification operations should be applied only on commit. Rollback is required for data created cleanup.</para>
+ <itemizedlist>
+ <listitem>
+ <para>Commit channel changes.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void commit() throws IOException;
+</programlisting>
+ <itemizedlist>
+ <listitem>
+ <para>Rollback channel changes.</para>
+ </listitem>
+ </itemizedlist>
+ <programlisting>void rollback() throws IOException;
+</programlisting>
+ </section>
+ </section>
+ </chapter>
13 years, 11 months
exo-jcr SVN: r2645 - jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-06-17 04:33:47 -0400 (Thu, 17 Jun 2010)
New Revision: 2645
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr.xml
Log:
=EXOJCR-742: adding doc about data container
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr.xml 2010-06-17 08:29:27 UTC (rev 2644)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jcr.xml 2010-06-17 08:33:47 UTC (rev 2645)
@@ -55,5 +55,14 @@
<!-- statistics configs -->
<xi:include href="jcr/statistics.xml"
- xmlns:xi="http://www.w3.org/2001/XInclude" />
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <!-- data container configs -->
+
+ <xi:include href="jcr/data-container.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+ <xi:include href="jcr/data-container-howto.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
</part>
13 years, 11 months
exo-jcr SVN: r2644 - in kernel/branches/2.2.x/exo.kernel.container/src: main/java/org/exoplatform/container/definition and 1 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2010-06-17 04:29:27 -0400 (Thu, 17 Jun 2010)
New Revision: 2644
Modified:
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java
kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
Log:
EXOJCR-795: Unexpected behavior of the method PortalContainer.isScopeValid()
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-06-17 07:49:10 UTC (rev 2643)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2010-06-17 08:29:27 UTC (rev 2644)
@@ -77,7 +77,7 @@
return Collections.unmodifiableSet(profiles);
}
- Log log = ExoLogger.getLogger("exo.kernel.container.ExoContainer");
+ static Log log = ExoLogger.getLogger("exo.kernel.container.ExoContainer");
private Map<String, ComponentLifecyclePlugin> componentLifecylePlugin_ =
new HashMap<String, ComponentLifecyclePlugin>();
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java 2010-06-17 07:49:10 UTC (rev 2643)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/PortalContainer.java 2010-06-17 08:29:27 UTC (rev 2644)
@@ -428,6 +428,12 @@
return null;
}
String portalContainerName = CONFIG.getPortalContainerName(context.getServletContextName());
+ if (portalContainerName == null)
+ {
+ log.warn("The Servlet Context '" + context.getServletContextName() + "' has not been registered"
+ + " has a dependency of any PortalContainerDefinitions.");
+ return null;
+ }
RootContainer root = RootContainer.getInstance();
return root.getPortalContainer(portalContainerName);
}
Modified: kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-06-17 07:49:10 UTC (rev 2643)
+++ kernel/branches/2.2.x/exo.kernel.container/src/main/java/org/exoplatform/container/definition/PortalContainerConfig.java 2010-06-17 08:29:27 UTC (rev 2644)
@@ -397,14 +397,24 @@
{
throw new IllegalArgumentException("The context name cannot be null");
}
- final List<String> result = scopes.get(contextName);
- if (result == null || result.isEmpty())
+ if (scopes.isEmpty())
{
- // we assume the old behavior is expected
+ // we assume that the old behavior is expected
final String portalContainerName =
portalContainerNames.contains(contextName) ? contextName : defaultDefinition.getName();
return Collections.singletonList(portalContainerName);
}
+ final List<String> result = scopes.get(contextName);
+ if (result == null || result.isEmpty())
+ {
+ // This context has not been added as dependency of any portal containers
+ if (portalContainerNames.contains(contextName))
+ {
+ // The given context is a portal container
+ return Collections.singletonList(contextName);
+ }
+ return Collections.emptyList();
+ }
return result;
}
@@ -425,11 +435,16 @@
// The given context name is a context name of a portal container
return contextName;
}
+ else if (scopes.isEmpty())
+ {
+ // we assume that the old behavior is expected
+ return defaultDefinition.getName();
+ }
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
{
- // we assume the old behavior is expected
- return defaultDefinition.getName();
+ // This context has not been added as dependency of any portal containers
+ return null;
}
return result.get(0);
}
@@ -524,11 +539,21 @@
*/
public boolean isScopeValid(String portalContainerName, String contextName)
{
+ if (portalContainerNames.contains(contextName))
+ {
+ // The given context name is a context name of a portal container
+ return true;
+ }
+ else if (scopes.isEmpty())
+ {
+ // we assume that the old behavior is expected
+ return defaultDefinition.getName().equals(portalContainerName);
+ }
final List<String> result = scopes.get(contextName);
if (result == null || result.isEmpty())
{
- // we assume the old behavior is expected
- return true;
+ // This context has not been added as dependency of any portal containers
+ return false;
}
else
{
Modified: kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java
===================================================================
--- kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-06-17 07:49:10 UTC (rev 2643)
+++ kernel/branches/2.2.x/exo.kernel.container/src/test/java/org/exoplatform/container/definition/TestPortalContainerConfig.java 2010-06-17 08:29:27 UTC (rev 2644)
@@ -206,9 +206,10 @@
assertFalse(config.isPortalContainerName("myPortal-pcdef"));
assertTrue(config.isPortalContainerName(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME));
// Needed for backward compatibility
- assertTrue(config.isScopeValid("foo", "foo"));
- assertTrue(config.isScopeValid("myPortal", "foo"));
- assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertTrue(config.isScopeValid(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, "foo"));
+ assertFalse(config.isScopeValid("foo", "foo"));
+ assertFalse(config.isScopeValid("myPortal", "foo"));
+ assertFalse(config.isScopeValid("myPortal-pcdef", "foo"));
assertFalse(config.hasDefinition());
// Empty with AddDependencies, AddDependenciesBefore and AddDependenciesAfter
@@ -233,15 +234,12 @@
assertTrue(names != null && !names.isEmpty());
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && !names.isEmpty());
- assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, names.get(0));
+ assertTrue(names != null && names.isEmpty());
names = config.getPortalContainerNames("myPortal-pcdef");
- assertTrue(names != null && !names.isEmpty());
- assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, names.get(0));
+ assertTrue(names != null && names.isEmpty());
assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getPortalContainerName("foo"));
- assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config.getPortalContainerName("myPortal"));
- assertEquals(PortalContainerConfig.DEFAULT_PORTAL_CONTAINER_NAME, config
- .getPortalContainerName("myPortal-pcdef"));
+ assertNull(config.getPortalContainerName("myPortal"));
+ assertNull(config.getPortalContainerName("myPortal-pcdef"));
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getRestContextName("foo"));
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getRestContextName("myPortal"));
assertEquals(PortalContainerConfig.DEFAULT_REST_CONTEXT_NAME, config.getRestContextName("myPortal-pcdef"));
@@ -287,9 +285,11 @@
assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
- assertTrue(config.isScopeValid("foo", "foo"));
+ assertFalse(config.isScopeValid("foo", "foo"));
assertTrue(config.isScopeValid("myPortal", "foo"));
- assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertFalse(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertTrue(config.isScopeValid("myPortal", "myPortal"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "myPortal-pcdef"));
assertTrue(config.hasDefinition());
// Without dependencies and with no portal container name
@@ -348,9 +348,11 @@
assertTrue(config.isPortalContainerName("myPortal"));
assertTrue(config.isPortalContainerName("myPortal-pcdef"));
// Needed for backward compatibility
- assertTrue(config.isScopeValid("foo", "foo"));
+ assertFalse(config.isScopeValid("foo", "foo"));
assertTrue(config.isScopeValid("myPortal", "foo"));
- assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertFalse(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertTrue(config.isScopeValid("myPortal", "myPortal"));
+ assertTrue(config.isScopeValid("myPortal-pcdef", "myPortal-pcdef"));
assertTrue(config.hasDefinition());
// Without dependencies and with default portal container definition
@@ -369,17 +371,14 @@
assertTrue(names.contains("myPortal-dpcdef"));
assertTrue(names.contains("myPortal-pcdef"));
names = config.getPortalContainerNames("foo");
- assertTrue(names != null && !names.isEmpty());
- assertEquals(1, names.size());
- assertEquals("myPortal-dpcdef", names.get(0));
+ assertTrue(names != null && names.isEmpty());
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && !names.isEmpty());
- assertEquals("myPortal-dpcdef", names.get(0));
+ assertTrue(names != null && names.isEmpty());
names = config.getPortalContainerNames("myPortal-pcdef");
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
- assertEquals("myPortal-dpcdef", config.getPortalContainerName("foo"));
- assertEquals("myPortal-dpcdef", config.getPortalContainerName("myPortal"));
+ assertNull(config.getPortalContainerName("foo"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest-dpcdef", config.getRestContextName("foo"));
assertEquals("myRest-dpcdef", config.getRestContextName("myPortal"));
@@ -434,13 +433,12 @@
assertEquals(1, names.size());
assertEquals("myPortal-dpcdef", names.get(0));
names = config.getPortalContainerNames("myPortal");
- assertTrue(names != null && !names.isEmpty());
- assertEquals("myPortal-dpcdef", names.get(0));
+ assertTrue(names != null && names.isEmpty());
names = config.getPortalContainerNames("myPortal-pcdef");
assertTrue(names != null && !names.isEmpty());
assertEquals("myPortal-pcdef", names.get(0));
assertEquals("myPortal-dpcdef", config.getPortalContainerName("foo"));
- assertEquals("myPortal-dpcdef", config.getPortalContainerName("myPortal"));
+ assertNull(config.getPortalContainerName("myPortal"));
assertEquals("myPortal-pcdef", config.getPortalContainerName("myPortal-pcdef"));
assertEquals("myRest-dpcdef", config.getRestContextName("foo"));
assertEquals("myRest-dpcdef", config.getRestContextName("myPortal"));
@@ -488,6 +486,7 @@
assertFalse(config.isScopeValid("foo", "foo"));
assertFalse(config.isScopeValid("myPortal", "foo"));
assertTrue(config.isScopeValid("myPortal-pcdef", "foo"));
+ assertFalse(config.isScopeValid("myPortal-pcdef", "fooY"));
assertTrue(config.hasDefinition());
for (String profile : profiles)
13 years, 11 months
exo-jcr SVN: r2643 - in core/trunk: exo.core.component.document and 2 other directories.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-06-17 03:49:10 -0400 (Thu, 17 Jun 2010)
New Revision: 2643
Added:
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/BaseStandaloneTest.java
core/trunk/exo.core.component.document/src/test/resources/test.policy
Modified:
core/trunk/exo.core.component.document/pom.xml
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestDocumentReadersIncomVals.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestHtmlDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSExcelDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSOutlookDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSWordDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestOpenOfficeDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPDFDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPPTDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestTextPlainDocumentReader.java
core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestXMLDocumentReader.java
core/trunk/pom.xml
Log:
EXOJCR-756: now test works with no permission. test.policy added
Modified: core/trunk/exo.core.component.document/pom.xml
===================================================================
--- core/trunk/exo.core.component.document/pom.xml 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/pom.xml 2010-06-17 07:49:10 UTC (rev 2643)
@@ -46,6 +46,11 @@
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
@@ -102,8 +107,92 @@
<include>**/*.html</include>
<include>**/*.msg</include>
<include>**/*.pst</include>
+ <include>**/*.policy</include>
</includes>
</testResource>
</testResources>
+ <plugins>
+ <plugin>
+ <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-->
+ <systemProperties>
+ <!--property>
+ <name>jcr.test.configuration.file</name>
+ <value>${jcr.test.configuration.file}</value>
+ </property-->
+ <property>
+ <name>emma.coverage.out.file</name>
+ <value>target/emma/coverage.ec</value>
+ </property>
+ </systemProperties>
+ <includes>
+ <include>org/exoplatform/services/document/**/Test*.java</include>
+ </includes>
+ <!--excludes>
+ <exclude>org/exoplatform/services/document/**/Test*.java</exclude>
+ </excludes-->
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!--execution>
+ <id>delete-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <tasks>
+ <echo>Remove files that have been customized</echo>
+ <delete>
+ <fileset dir="${project.build.directory}/generated-sources/javacc/org/exoplatform/services/jcr/impl/core/query">
+ <include name="sql/ASTLiteral.java" />
+ <include name="sql/ASTContainsExpression.java" />
+ <include name="sql/ASTPredicate.java" />
+ <include name="sql/ASTIdentifier.java" />
+ <include name="xpath/SimpleNode.java" />
+ </fileset>
+ </delete>
+ </tasks>
+ </configuration>
+ <goals>
+ <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>
-</project>
+</project>
Added: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/BaseStandaloneTest.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/BaseStandaloneTest.java (rev 0)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/BaseStandaloneTest.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2003-2010 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.document.test;
+
+import org.exoplatform.commons.utils.MimeTypeResolver;
+import org.exoplatform.container.PortalContainer;
+import org.exoplatform.test.BasicTestCase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: BaseStandaloneTest.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class BaseStandaloneTest extends BasicTestCase
+{
+
+ public PortalContainer pcontainer;
+
+ protected MimeTypeResolver mimetypeResolver = new MimeTypeResolver();
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ pcontainer = PortalContainer.getInstance();
+ }
+
+ public Object getComponentInstanceOfType(Class componentType)
+ {
+ return pcontainer.getComponentInstanceOfType(componentType);
+ }
+
+ /**
+ * Its a wrapper to cheat security.
+ */
+ public File createTempFile(String prefix, String suffix) throws IOException
+ {
+ return File.createTempFile(prefix, suffix);
+ }
+
+ /**
+ * Its a wrapper to cheat security.
+ */
+ public boolean createNewFile(File f) throws IOException
+ {
+ return f.createNewFile();
+ }
+
+ /**
+ * Its a wrapper to cheat security.
+ */
+ public InputStream getInputStream(File f) throws IOException
+ {
+ return new FileInputStream(f);
+ }
+
+ /**
+ * Its a wrapper to cheat security.
+ */
+ public boolean deleteFile(File f) throws IOException
+ {
+ return f.delete();
+ }
+
+}
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestDocumentReadersIncomVals.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestDocumentReadersIncomVals.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestDocumentReadersIncomVals.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -29,10 +29,8 @@
import org.exoplatform.services.document.impl.PPTDocumentReader;
import org.exoplatform.services.document.impl.TextPlainDocumentReader;
import org.exoplatform.services.document.impl.XMLDocumentReader;
-import org.exoplatform.test.BasicTestCase;
import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -45,9 +43,8 @@
* @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
* @version $Id: TestDocumentReadersIncomVals.java 111 2008-11-11 11:11:11Z serg $
*/
-public class TestDocumentReadersIncomVals extends BasicTestCase
+public class TestDocumentReadersIncomVals extends BaseStandaloneTest
{
-
List<DocumentReader> serviceList;
public TestDocumentReadersIncomVals()
@@ -99,13 +96,13 @@
{
StringBuilder sb = new StringBuilder();
- File f = File.createTempFile("dfd", "suf");
- f.createNewFile();
+ File f = createTempFile("dfd", "suf");
+ createNewFile(f);
InputStream in;
for (int i = 0; i < serviceList.size(); i++)
{
- in = new FileInputStream(f);
+ in = getInputStream(f);
try
{
assertEquals("", serviceList.get(i).getContentAsText(in));
@@ -124,6 +121,6 @@
System.out.println(sb.toString());
}
- f.delete();
+ deleteFile(f);
}
}
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestHtmlDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestHtmlDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestHtmlDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,11 +18,8 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.commons.utils.MimeTypeResolver;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReader;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -33,20 +30,19 @@
* @version $Id: $
*/
-public class TestHtmlDocumentReader extends BasicTestCase
+public class TestHtmlDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
{
InputStream is = TestHtmlDocumentReader.class.getResourceAsStream("/test.html");
- MimeTypeResolver mimetypeResolver = new MimeTypeResolver();
String mimeType = mimetypeResolver.getMimeType("test.html");
DocumentReader dr = service_.getDocumentReader(mimeType);
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSExcelDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSExcelDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSExcelDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,14 +29,14 @@
* @version $Id: $
*/
-public class TestMSExcelDocumentReader extends BasicTestCase
+public class TestMSExcelDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSOutlookDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSOutlookDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSOutlookDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
import org.exoplatform.test.BasicTestCase;
@@ -31,14 +30,14 @@
* @version $Id: $
*/
-public class TestMSOutlookDocumentReader extends BasicTestCase
+public class TestMSOutlookDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSWordDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSWordDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestMSWordDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,14 +29,14 @@
* @version $Id: $
*/
-public class TestMSWordDocumentReader extends BasicTestCase
+public class TestMSWordDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsStringTemplate() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestOpenOfficeDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestOpenOfficeDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestOpenOfficeDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,15 +29,14 @@
* @version $Id: $
*/
-public class TestOpenOfficeDocumentReader extends BasicTestCase
+public class TestOpenOfficeDocumentReader extends BaseStandaloneTest
{
-
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPDFDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPDFDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPDFDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,14 +29,14 @@
* @version $Id: $
*/
-public class TestPDFDocumentReader extends BasicTestCase
+public class TestPDFDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPPTDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPPTDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPPTDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,15 +29,14 @@
* @version $Id: $
*/
-public class TestPPTDocumentReader extends BasicTestCase
+public class TestPPTDocumentReader extends BaseStandaloneTest
{
-
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestPropertiesExtracting.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,10 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import junit.framework.TestCase;
-
import org.exoplatform.commons.utils.ISO8601;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DCMetaData;
import org.exoplatform.services.document.DocumentReader;
import org.exoplatform.services.document.DocumentReaderService;
@@ -32,20 +29,14 @@
import java.util.Map;
import java.util.Properties;
-public class TestPropertiesExtracting extends TestCase
+public class TestPropertiesExtracting extends BaseStandaloneTest
{
-
DocumentReaderService service_;
- public TestPropertiesExtracting(String name)
- {
- super(name);
- }
-
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testPDFDocumentReaderService() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestTextPlainDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestTextPlainDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestTextPlainDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,15 +29,14 @@
* @version $Id: $
*/
-public class TestTextPlainDocumentReader extends BasicTestCase
+public class TestTextPlainDocumentReader extends BaseStandaloneTest
{
-
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Modified: core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestXMLDocumentReader.java
===================================================================
--- core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestXMLDocumentReader.java 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/exo.core.component.document/src/test/java/org/exoplatform/services/document/test/TestXMLDocumentReader.java 2010-06-17 07:49:10 UTC (rev 2643)
@@ -18,9 +18,7 @@
*/
package org.exoplatform.services.document.test;
-import org.exoplatform.container.PortalContainer;
import org.exoplatform.services.document.DocumentReaderService;
-import org.exoplatform.test.BasicTestCase;
import java.io.InputStream;
@@ -31,14 +29,14 @@
* @version $Id: $
*/
-public class TestXMLDocumentReader extends BasicTestCase
+public class TestXMLDocumentReader extends BaseStandaloneTest
{
DocumentReaderService service_;
public void setUp() throws Exception
{
- PortalContainer pcontainer = PortalContainer.getInstance();
- service_ = (DocumentReaderService)pcontainer.getComponentInstanceOfType(DocumentReaderService.class);
+ super.setUp();
+ service_ = (DocumentReaderService)getComponentInstanceOfType(DocumentReaderService.class);
}
public void testGetContentAsString() throws Exception
Added: core/trunk/exo.core.component.document/src/test/resources/test.policy
===================================================================
--- core/trunk/exo.core.component.document/src/test/resources/test.policy (rev 0)
+++ core/trunk/exo.core.component.document/src/test/resources/test.policy 2010-06-17 07:49:10 UTC (rev 2643)
@@ -0,0 +1,12 @@
+grant codeBase "@MAVEN_REPO@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@MAIN_CLASSES@-"{
+ permission java.security.AllPermission;
+};
+
+grant codeBase "@TEST_CLASSES@-"{
+ permission java.lang.RuntimePermission "getJCRSystemSession";
+ permission java.lang.RuntimePermission "manageRepository";
+};
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2010-06-16 14:48:30 UTC (rev 2642)
+++ core/trunk/pom.xml 2010-06-17 07:49:10 UTC (rev 2643)
@@ -76,6 +76,12 @@
<artifactId>exo.kernel.commons</artifactId>
<version>${org.exoplatform.kernel.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
13 years, 11 months
exo-jcr SVN: r2642 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell.
by do-not-reply@jboss.org
Author: nzamosenchuk
Date: 2010-06-16 10:48:30 -0400 (Wed, 16 Jun 2010)
New Revision: 2642
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java
Log:
EXOJCR-758: indexer updated
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-06-16 14:39:20 UTC (rev 2641)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/spell/LuceneSpellChecker.java 2010-06-16 14:48:30 UTC (rev 2642)
@@ -32,12 +32,14 @@
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;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
+import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.List;
@@ -194,6 +196,7 @@
final String[] stmt = new String[1];
aqt.accept(new TraversingQueryNodeVisitor()
{
+ @Override
public Object visit(RelationQueryNode node, Object o) throws RepositoryException
{
if (stmt[0] == null && node.getOperation() == RelationQueryNode.OPERATION_SPELLCHECK)
@@ -227,7 +230,7 @@
/**
* The directory where the spell index is stored.
*/
- private final Directory spellIndexDirectory;
+ private Directory spellIndexDirectory;
/**
* The underlying spell checker.
@@ -249,12 +252,20 @@
InternalSpellChecker(SearchIndex handler, float minDistance, boolean morePopular) throws IOException
{
this.handler = handler;
- String path = handler.getContext().getIndexDirectory() + File.separatorChar + "spellchecker";
- this.spellIndexDirectory = FSDirectory.getDirectory(path, new NativeFSLockFactory(path));
- if (IndexReader.indexExists(spellIndexDirectory))
+ final String path = handler.getContext().getIndexDirectory() + File.separatorChar + "spellchecker";
+ spellIndexDirectory = null;
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
- this.lastRefresh = System.currentTimeMillis();
- }
+ public Object run() throws Exception
+ {
+ spellIndexDirectory = FSDirectory.getDirectory(path, new NativeFSLockFactory(path));
+ if (IndexReader.indexExists(spellIndexDirectory))
+ {
+ lastRefresh = System.currentTimeMillis();
+ }
+ return null;
+ }
+ });
this.spellChecker = new SpellChecker(spellIndexDirectory);
this.spellChecker.setAccuracy(minDistance);
this.morePopular = morePopular;
@@ -313,7 +324,14 @@
{
try
{
- spellIndexDirectory.close();
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ spellIndexDirectory.close();
+ return null;
+ }
+ });
}
catch (IOException e)
{
@@ -385,11 +403,11 @@
* @throws IOException
* if an error occurs while spell checking.
*/
- private String[] check(String words[]) throws IOException
+ private String[] check(final String words[]) throws IOException
{
refreshSpellChecker();
boolean hasSuggestion = false;
- IndexReader reader = handler.getIndexReader();
+ final IndexReader reader = handler.getIndexReader();
try
{
for (int retries = 0; retries < 100; retries++)
@@ -399,8 +417,16 @@
String[] suggestion = new String[words.length];
for (int i = 0; i < words.length; i++)
{
+ final int currentIndex = i;
String[] similar =
- spellChecker.suggestSimilar(words[i], 5, reader, FieldNames.FULLTEXT, morePopular);
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<String[]>()
+ {
+ public String[] run() throws Exception
+ {
+ return spellChecker.suggestSimilar(words[currentIndex], 5, reader, FieldNames.FULLTEXT,
+ morePopular);
+ }
+ });
if (similar.length > 0)
{
@@ -435,7 +461,14 @@
}
finally
{
- reader.close();
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Object>()
+ {
+ public Object run() throws Exception
+ {
+ reader.close();
+ return null;
+ }
+ });
}
}
@@ -462,27 +495,35 @@
{
public void run()
{
+
try
{
- IndexReader reader = handler.getIndexReader();
- try
+ SecurityHelper.doPriviledgedIOExceptionAction(new PrivilegedExceptionAction<Object>()
{
- long time = System.currentTimeMillis();
- Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
- log.debug("Starting spell checker index refresh");
- spellChecker.indexDictionary(dict);
- time = System.currentTimeMillis() - time;
- time = time / 1000;
- log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
- }
- finally
- {
- reader.close();
- synchronized (InternalSpellChecker.this)
+ public Object run() throws Exception
{
- refreshing = false;
+ IndexReader reader = handler.getIndexReader();
+ try
+ {
+ long time = System.currentTimeMillis();
+ Dictionary dict = new LuceneDictionary(reader, FieldNames.FULLTEXT);
+ log.debug("Starting spell checker index refresh");
+ spellChecker.indexDictionary(dict);
+ time = System.currentTimeMillis() - time;
+ time = time / 1000;
+ log.info("Spell checker index refreshed in: " + new Long(time) + " s.");
+ }
+ finally
+ {
+ reader.close();
+ synchronized (InternalSpellChecker.this)
+ {
+ refreshing = false;
+ }
+ }
+ return null;
}
- }
+ });
}
catch (IOException e)
{
13 years, 11 months
exo-jcr SVN: r2641 - kernel/trunk/packaging/module/src/main/javascript.
by do-not-reply@jboss.org
Author: dkatayev
Date: 2010-06-16 10:39:20 -0400 (Wed, 16 Jun 2010)
New Revision: 2641
Modified:
kernel/trunk/packaging/module/src/main/javascript/kernel.packaging.module.js
Log:
EXOJCR-746 exo.kernel.component.remote removed from js dependencies
Modified: kernel/trunk/packaging/module/src/main/javascript/kernel.packaging.module.js
===================================================================
--- kernel/trunk/packaging/module/src/main/javascript/kernel.packaging.module.js 2010-06-16 14:38:26 UTC (rev 2640)
+++ kernel/trunk/packaging/module/src/main/javascript/kernel.packaging.module.js 2010-06-16 14:39:20 UTC (rev 2641)
@@ -4,7 +4,7 @@
function getModule(params) {
var module = new Module();
- module.version = "${project.version}" ;//
+ module.version = "${project.version}" ;//
module.relativeMavenRepo = "org/exoplatform/kernel" ;
module.relativeSRCRepo = "kernel" ;
module.name = "kernel" ;
@@ -50,10 +50,6 @@
module.component.cache =
new Project("org.exoplatform.kernel", "exo.kernel.component.cache", "jar", module.version) ;
-
- module.component.remote =
- new Project("org.exoplatform.kernel", "exo.kernel.component.remote", "jar", module.version).
- addDependency(new Project("jgroups", "jgroups", "jar", "2.6.13.GA"));
return module;
}
13 years, 11 months
exo-jcr SVN: r2640 - in jcr/trunk: exo.jcr.component.core and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-06-16 10:38:26 -0400 (Wed, 16 Jun 2010)
New Revision: 2640
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/pom.xml
Log:
EXOJCR-756: fix pom.xml
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:34:33 UTC (rev 2639)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:38:26 UTC (rev 2640)
@@ -379,7 +379,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Djava.security.manager=org.exoplatform.commons.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>
@@ -575,7 +575,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
- <argLine>-Djava.security.manager=org.exoplatform.commons.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>
@@ -648,7 +648,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
- <argLine>-Djava.security.manager=org.exoplatform.commons.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: jcr/trunk/pom.xml
===================================================================
--- jcr/trunk/pom.xml 2010-06-16 14:34:33 UTC (rev 2639)
+++ jcr/trunk/pom.xml 2010-06-16 14:38:26 UTC (rev 2640)
@@ -57,6 +57,11 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <version>${org.exoplatform.kernel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.command</artifactId>
<version>${org.exoplatform.kernel.version}</version>
</dependency>
13 years, 11 months
exo-jcr SVN: r2639 - in kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons: test and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-06-16 10:34:33 -0400 (Wed, 16 Jun 2010)
New Revision: 2639
Added:
kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/
kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
Removed:
kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/TestSecurityManager.java
Log:
EXOJCR-756: fix
Deleted: kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/TestSecurityManager.java
===================================================================
--- kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/TestSecurityManager.java 2010-06-16 14:20:41 UTC (rev 2638)
+++ kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/TestSecurityManager.java 2010-06-16 14:34:33 UTC (rev 2639)
@@ -1,105 +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.commons;
-
-import java.security.Permission;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
- * @version $Id$
- *
- */
-public class TestSecurityManager extends SecurityManager
-{
- /**
- * {@inheritDoc}
- */
- @Override
- public void checkPermission(Permission perm)
- {
- try
- {
- super.checkPermission(perm);
- }
- catch (SecurityException se)
- {
- Throwable e = se;
-
- boolean srcCode = false;
- boolean testCode = false;
-
- while (e != null)
- {
- StackTraceElement[] traceElements = e.getStackTrace();
- for (int i = 0; i < traceElements.length; i++)
- {
- String className = traceElements[i].getClassName();
- String fileName = traceElements[i].getFileName();
-
- if (className.startsWith("org.exoplatform"))
- {
- // hide Exception during JCR initialization
- if (fileName.equals("BaseStandaloneTest.java"))
- {
- return;
- }
-
- if (fileName.startsWith("Test") || fileName.endsWith("Test.java")
- || fileName.endsWith("TestBase.java") || fileName.equals("Probe.java")
- || fileName.equals("ExportBase.java"))
- {
- testCode = true;
- }
- else
- {
- srcCode = true;
- }
- }
- else if (className.startsWith("org.apache.jackrabbit.test"))
- {
- // Allow access to instances
- if (fileName.equals("RepositoryHelper.java"))
- {
- return;
- }
-
- if (fileName.endsWith("Test.java") || fileName.equals("JCRTestResult.java"))
- {
- testCode = true;
- }
- }
- else if (className.startsWith("org.slf4j.impl.Log4jLoggerFactory"))
- {
- return;
- }
- }
-
- e = e.getCause();
- }
-
- // hide Exception if only test code exists
- if (!srcCode && testCode)
- {
- return;
- }
-
- throw se;
- }
- }
-}
Added: kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java
===================================================================
--- kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java (rev 0)
+++ kernel/trunk/exo.kernel.commons.test/src/main/java/org/exoplatform/commons/test/TestSecurityManager.java 2010-06-16 14:34:33 UTC (rev 2639)
@@ -0,0 +1,105 @@
+/*
+ * 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.commons.test;
+
+import java.security.Permission;
+
+/**
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
+ * @version $Id: TestSecurityManager.java 2636 2010-06-16 14:18:23Z tolusha $
+ *
+ */
+public class TestSecurityManager extends SecurityManager
+{
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void checkPermission(Permission perm)
+ {
+ try
+ {
+ super.checkPermission(perm);
+ }
+ catch (SecurityException se)
+ {
+ Throwable e = se;
+
+ boolean srcCode = false;
+ boolean testCode = false;
+
+ while (e != null)
+ {
+ StackTraceElement[] traceElements = e.getStackTrace();
+ for (int i = 0; i < traceElements.length; i++)
+ {
+ String className = traceElements[i].getClassName();
+ String fileName = traceElements[i].getFileName();
+
+ if (className.startsWith("org.exoplatform"))
+ {
+ // hide Exception during JCR initialization
+ if (fileName.equals("BaseStandaloneTest.java"))
+ {
+ return;
+ }
+
+ if (fileName.startsWith("Test") || fileName.endsWith("Test.java")
+ || fileName.endsWith("TestBase.java") || fileName.equals("Probe.java")
+ || fileName.equals("ExportBase.java"))
+ {
+ testCode = true;
+ }
+ else
+ {
+ srcCode = true;
+ }
+ }
+ else if (className.startsWith("org.apache.jackrabbit.test"))
+ {
+ // Allow access to instances
+ if (fileName.equals("RepositoryHelper.java"))
+ {
+ return;
+ }
+
+ if (fileName.endsWith("Test.java") || fileName.equals("JCRTestResult.java"))
+ {
+ testCode = true;
+ }
+ }
+ else if (className.startsWith("org.slf4j.impl.Log4jLoggerFactory"))
+ {
+ return;
+ }
+ }
+
+ e = e.getCause();
+ }
+
+ // hide Exception if only test code exists
+ if (!srcCode && testCode)
+ {
+ return;
+ }
+
+ throw se;
+ }
+ }
+}
13 years, 11 months
exo-jcr SVN: r2638 - in jcr/trunk/exo.jcr.component.core: src/main/java/org/exoplatform/services/jcr/impl/util and 1 other directory.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-06-16 10:20:41 -0400 (Wed, 16 Jun 2010)
New Revision: 2638
Removed:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
Log:
EXOJCR-756: move TestSecuritManager ot kernel project
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:19:46 UTC (rev 2637)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-16 14:20:41 UTC (rev 2638)
@@ -47,6 +47,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.command</artifactId>
</dependency>
<dependency>
@@ -374,7 +379,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -570,7 +575,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-all PROFILE -->
- <argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
@@ -643,7 +648,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- TAKE CARE TO UPDATE ALSO run-tck PROFILE -->
- <argLine>-Djava.security.manager=org.exoplatform.services.jcr.impl.util.TesterSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
+ <argLine>-Djava.security.manager=org.exoplatform.commons.TestSecurityManager -Djava.security.policy=${project.build.directory}/test-classes/test.policy</argLine>
<systemProperties>
<property>
<name>jcr.test.configuration.file</name>
Deleted: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java 2010-06-16 14:19:46 UTC (rev 2637)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/TesterSecurityManager.java 2010-06-16 14:20:41 UTC (rev 2638)
@@ -1,111 +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.security.Permission;
-
-/**
- * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy Bazko</a>
- * @version $Id$
- */
-public class TesterSecurityManager extends SecurityManager
-{
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void checkPermission(Permission perm)
- {
- try
- {
- super.checkPermission(perm);
- }
- catch (SecurityException se)
- {
- Throwable e = se;
-
- boolean srcCode = false;
- boolean testCode = false;
-
- while (e != null)
- {
- StackTraceElement[] traceElements = e.getStackTrace();
- for (int i = 0; i < traceElements.length; i++)
- {
- String className = traceElements[i].getClassName();
- String fileName = traceElements[i].getFileName();
-
- if (className.startsWith("org.exoplatform"))
- {
- // TesterSecurityManager should not be a part of source code
- if (fileName.equals("TesterSecurityManager.java"))
- {
- continue;
- }
-
- // hide Exception during JCR initialization
- if (fileName.equals("BaseStandaloneTest.java"))
- {
- return;
- }
-
- if (fileName.startsWith("Test") || fileName.endsWith("Test.java")
- || fileName.endsWith("TestBase.java") || fileName.equals("Probe.java")
- || fileName.equals("ExportBase.java"))
- {
- testCode = true;
- }
- else
- {
- srcCode = true;
- }
- }
- else if (className.startsWith("org.apache.jackrabbit.test"))
- {
- // Allow access to instances
- if (fileName.equals("RepositoryHelper.java"))
- {
- return;
- }
-
- if (fileName.endsWith("Test.java") || fileName.equals("JCRTestResult.java"))
- {
- testCode = true;
- }
- }
- else if (className.startsWith("org.slf4j.impl.Log4jLoggerFactory"))
- {
- return;
- }
- }
-
- e = e.getCause();
- }
-
- // hide Exception if only test code exists
- if (!srcCode && testCode)
- {
- return;
- }
-
- throw se;
- }
- }
-}
13 years, 11 months
exo-jcr SVN: r2637 - kernel/trunk.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-06-16 10:19:46 -0400 (Wed, 16 Jun 2010)
New Revision: 2637
Modified:
kernel/trunk/pom.xml
Log:
EXOJCR-756: add exo.kernel.commons.test component
Modified: kernel/trunk/pom.xml
===================================================================
--- kernel/trunk/pom.xml 2010-06-16 14:18:23 UTC (rev 2636)
+++ kernel/trunk/pom.xml 2010-06-16 14:19:46 UTC (rev 2637)
@@ -51,6 +51,7 @@
<modules>
<module>exo.kernel.container</module>
<module>exo.kernel.commons</module>
+ <module>exo.kernel.commons.test</module>
<module>exo.kernel.component.common</module>
<module>exo.kernel.component.cache</module>
<module>exo.kernel.component.ext.cache.impl.jboss.v3</module>
@@ -78,6 +79,16 @@
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.commons.test</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
+ <artifactId>exo.kernel.component.remote</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.component.cache</artifactId>
<version>${project.version}</version>
</dependency>
13 years, 11 months