You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by ok...@apache.org on 2005/11/13 00:22:57 UTC
svn commit: r332863 - in /incubator/graffito/trunk/jcr-nodemanagement: ./
src/config/ src/config/jackrabbit/ src/config/jeceira/
src/java/org/apache/portals/graffito/jcr/nodemanagement/
src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackr...
Author: okiessler
Date: Sat Nov 12 16:22:44 2005
New Revision: 332863
URL: http://svn.apache.org/viewcvs?rev=332863&view=rev
Log:
Issue: GRFT-67
Testcase Setup
First code for Jackrabbit implementation
Added:
incubator/graffito/trunk/jcr-nodemanagement/src/config/
incubator/graffito/trunk/jcr-nodemanagement/src/config/jaas.config
incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/
incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/jaas.config
incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/nodetypes_test1.xml
incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/repository.xml
incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit_nodetypes_test1.xml
incubator/graffito/trunk/jcr-nodemanagement/src/config/jeceira/
incubator/graffito/trunk/jcr-nodemanagement/src/config/repository.xml
incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/
incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/NodeTypeManagerImpl.java
incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/TestBase.java
incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImplTest.java
Modified:
incubator/graffito/trunk/jcr-nodemanagement/project.xml
incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java
incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
incubator/graffito/trunk/jcr-nodemanagement/src/test/log4j.properties
Modified: incubator/graffito/trunk/jcr-nodemanagement/project.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/project.xml?rev=332863&r1=332862&r2=332863&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/project.xml (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/project.xml Sat Nov 12 16:22:44 2005
@@ -99,17 +99,20 @@
<build>
<sourceDirectory>src/java</sourceDirectory>
- <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
- <unitTest>
- <resources>
- <resource>
- <directory>${basedir}/src/test</directory>
- <excludes>
- <exclude>**/*.java</exclude>
- </excludes>
- </resource>
- </resources>
- </unitTest>
+ <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
+ <unitTest>
+ <excludes>
+ <exclude>**/*TestBase.java</exclude>
+ </excludes>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/test</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </unitTest>
<resources>
<resource>
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/jaas.config
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/jaas.config?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/jaas.config (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/jaas.config Sat Nov 12 16:22:44 2005
@@ -0,0 +1,3 @@
+Jackrabbit {
+org.apache.jackrabbit.core.security.SimpleLoginModule required debug=false;
+};
\ No newline at end of file
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/jaas.config
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/jaas.config?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/jaas.config (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/jaas.config Sat Nov 12 16:22:44 2005
@@ -0,0 +1,3 @@
+Jackrabbit {
+org.apache.jackrabbit.core.security.SimpleLoginModule required debug=false;
+};
\ No newline at end of file
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/nodetypes_test1.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/nodetypes_test1.xml?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/nodetypes_test1.xml (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/nodetypes_test1.xml Sat Nov 12 16:22:44 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+<nodeTypes
+ xmlns:rep="internal"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:graffito="http://incubator.apache.org/graffito">
+
+ <nodeType name="graffito:test1" isMixin="false" hasOrderableChildNodes="false" primaryItemName="test1">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ </supertypes>
+
+ <propertyDefinition name="graffito:testProperty" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="IGNORE" protected="false" multiple="false"/>
+ </nodeType>
+</nodeTypes>
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/repository.xml?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/repository.xml (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit/repository.xml Sat Nov 12 16:22:44 2005
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE Repository [
+ <!--
+ the Repository element configures a repository instance;
+ individual workspaces of the repository are configured through
+ separate configuration files called workspace.xml which are
+ located in a subfolder of the workspaces root directory
+ (see Workspaces element).
+
+ it consists of
+
+ a FileSystem element (the virtual file system
+ used by the repository to persist global state such as
+ registered namespaces, custom node types, etc..
+
+ a Security element that specifies the name of the app-entry
+ in the JAAS config and the access manager
+
+ a Workspaces element that specifies to the location of
+ workspaces root directory and the name of default workspace
+
+ a Workspace element that is used as a workspace configuration
+ template; it is used to create the initial workspace if there's
+ no workspace yet and for creating additional workspaces through
+ the api
+
+ a SearchIndex element that is used for configuring per workspace
+ Indexing-related settings
+
+ a Versioning element that is used for configuring
+ versioning-related settings
+ -->
+ <!ELEMENT Repository (FileSystem,Security,Workspaces,Workspace,Versioning)>
+
+ <!--
+ a virtual file system
+ -->
+ <!ELEMENT FileSystem (param*)>
+ <!ATTLIST FileSystem
+ class CDATA #REQUIRED>
+
+ <!--
+ the Security element specifies the name (appName attribute)
+ of the JAAS configuration app-entry for this repository.
+
+ it also specifies the access manager to be used (AccessManager element).
+ -->
+ <!ELEMENT Security (AccessManager, LoginModule?)>
+ <!ATTLIST Security
+ appName CDATA #REQUIRED>
+
+ <!--
+ the AccessManager element configures the access manager to be used by
+ this repository instance; the class attribute specifies the FQN of the
+ class implementing the AccessManager interface
+ -->
+ <!ELEMENT AccessManager (param*)>
+ <!ATTLIST AccessManager
+ class CDATA #REQUIRED>
+
+ <!--
+ generic parameter (name/value pair)
+ -->
+ <!ELEMENT param EMPTY>
+ <!ATTLIST param
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED>
+
+ <!--
+ the LoginModule element optionally specifies a JAAS login module to
+ authenticate users. This feature allows the use of Jackrabbit in a
+ non-JAAS environment.
+ -->
+ <!ELEMENT LoginModule (param*)>
+ <!ATTLIST LoginModule
+ class CDATA #REQUIRED>
+
+ <!--
+ the Workspaces element specifies the workspaces root directory
+ (rootPath attribute) and the name of the default workspace
+ (defaultWorkspace attribute).
+
+ individual workspaces are configured through individual workspace.xml
+ files located in a subfolder each of the workspaces root directory.
+ -->
+ <!ELEMENT Workspaces EMPTY>
+ <!ATTLIST Workspaces
+ rootPath CDATA #REQUIRED
+ defaultWorkspace CDATA #REQUIRED>
+
+ <!--
+ the Workspace element serves as a workspace configuration template;
+ it is used to create the initial workspace if there's no workspace yet
+ and for creating additional workspaces through the api
+ -->
+ <!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?)>
+ <!ATTLIST Workspace
+ name CDATA #REQUIRED>
+
+ <!--
+ the PersistenceManager element configures the persistence manager
+ to be used for the workspace; the class attribute specifies the
+ FQN of the class implementing the PersistenceManager interface
+ -->
+ <!ELEMENT PersistenceManager (param*)>
+ <!ATTLIST PersistenceManager
+ class CDATA #REQUIRED>
+
+ <!--
+ the SearchIndex element specifies the locaction of the search index
+ (used by the QueryHandler); the class attribute specifies the
+ FQN of the class implementing the QueryHandler interface.
+ -->
+ <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ATTLIST SearchIndex
+ class CDATA #REQUIRED>
+
+ <!--
+ the Versioning element configures the persistence manager
+ to be used for persisting version state
+ -->
+ <!ELEMENT Versioning (FileSystem, PersistenceManager)>
+ <!ATTLIST Versioning
+ rootPath CDATA #REQUIRED
+ >
+]>
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/repository"/>
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <param name="config" value="${rep.home}/access.xml"/> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <param name="anonymousId" value="anonymous"/>
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <Workspace name="${wsp.name}">
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+
+ <FileSystem class="com.day.jackrabbit.fs.cq.CQFileSystem">
+ <param name="path" value="${wsp.home}/wspStore.dat"/>
+ <param name="autoRepair" value="false"/>
+ <param name="blockSize" value="128"/>
+ <param name="autoSync" value="false"/>
+ </FileSystem>
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${wsp.home}"/>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+
+ <PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>
+
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="useCompoundFile" value="true"/>
+ <param name="minMergeDocs" value="1000"/>
+ <param name="maxMergeDocs" value="100000"/>
+ <param name="mergeFactor" value="10"/>
+ <param name="bufferSize" value="10"/>
+ <param name="path" value="${wsp.home}/index"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <Versioning rootPath="${rep.home}/version">
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+
+ <FileSystem class="com.day.jackrabbit.fs.cq.CQFileSystem">
+ <param name="path" value="${rep.home}/version/version.dat"/>
+ <param name="autoRepair" value="false"/>
+ <param name="blockSize" value="128"/>
+ <param name="autoSync" value="false"/>
+ </FileSystem>
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/version"/>
+ </FileSystem>
+
+ <!--
+ Configures the perisistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.state.obj.ObjectPersistenceManager"/>
+
+ </Versioning>
+</Repository>
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit_nodetypes_test1.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit_nodetypes_test1.xml?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit_nodetypes_test1.xml (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/jackrabbit_nodetypes_test1.xml Sat Nov 12 16:22:44 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ -->
+<nodeTypes
+ xmlns:rep="internal"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
+ xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
+ xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:graffito="http://incubator.apache.org/graffito">
+
+ <nodeType name="graffito:test1" isMixin="false" hasOrderableChildNodes="false" primaryItemName="test1">
+ <supertypes>
+ <supertype>nt:base</supertype>
+ </supertypes>
+
+ <propertyDefinition name="graffito:testProperty" requiredType="String" autoCreated="false" mandatory="false"
+ onParentVersion="IGNORE" protected="false" multiple="false"/>
+ </nodeType>
+</nodeTypes>
Added: incubator/graffito/trunk/jcr-nodemanagement/src/config/repository.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/config/repository.xml?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/config/repository.xml (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/config/repository.xml Sat Nov 12 16:22:44 2005
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE Repository [
+ <!--
+ the Repository element configures a repository instance;
+ individual workspaces of the repository are configured through
+ separate configuration files called workspace.xml which are
+ located in a subfolder of the workspaces root directory
+ (see Workspaces element).
+
+ it consists of
+
+ a FileSystem element (the virtual file system
+ used by the repository to persist global state such as
+ registered namespaces, custom node types, etc..
+
+ a Security element that specifies the name of the app-entry
+ in the JAAS config and the access manager
+
+ a Workspaces element that specifies to the location of
+ workspaces root directory and the name of default workspace
+
+ a Workspace element that is used as a workspace configuration
+ template; it is used to create the initial workspace if there's
+ no workspace yet and for creating additional workspaces through
+ the api
+
+ a SearchIndex element that is used for configuring per workspace
+ Indexing-related settings
+
+ a Versioning element that is used for configuring
+ versioning-related settings
+ -->
+ <!ELEMENT Repository (FileSystem,Security,Workspaces,Workspace,Versioning)>
+
+ <!--
+ a virtual file system
+ -->
+ <!ELEMENT FileSystem (param*)>
+ <!ATTLIST FileSystem
+ class CDATA #REQUIRED>
+
+ <!--
+ the Security element specifies the name (appName attribute)
+ of the JAAS configuration app-entry for this repository.
+
+ it also specifies the access manager to be used (AccessManager element).
+ -->
+ <!ELEMENT Security (AccessManager, LoginModule?)>
+ <!ATTLIST Security
+ appName CDATA #REQUIRED>
+
+ <!--
+ the AccessManager element configures the access manager to be used by
+ this repository instance; the class attribute specifies the FQN of the
+ class implementing the AccessManager interface
+ -->
+ <!ELEMENT AccessManager (param*)>
+ <!ATTLIST AccessManager
+ class CDATA #REQUIRED>
+
+ <!--
+ generic parameter (name/value pair)
+ -->
+ <!ELEMENT param EMPTY>
+ <!ATTLIST param
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED>
+
+ <!--
+ the LoginModule element optionally specifies a JAAS login module to
+ authenticate users. This feature allows the use of Jackrabbit in a
+ non-JAAS environment.
+ -->
+ <!ELEMENT LoginModule (param*)>
+ <!ATTLIST LoginModule
+ class CDATA #REQUIRED>
+
+ <!--
+ the Workspaces element specifies the workspaces root directory
+ (rootPath attribute) and the name of the default workspace
+ (defaultWorkspace attribute).
+
+ individual workspaces are configured through individual workspace.xml
+ files located in a subfolder each of the workspaces root directory.
+ -->
+ <!ELEMENT Workspaces EMPTY>
+ <!ATTLIST Workspaces
+ rootPath CDATA #REQUIRED
+ defaultWorkspace CDATA #REQUIRED>
+
+ <!--
+ the Workspace element serves as a workspace configuration template;
+ it is used to create the initial workspace if there's no workspace yet
+ and for creating additional workspaces through the api
+ -->
+ <!ELEMENT Workspace (FileSystem,PersistenceManager,SearchIndex?)>
+ <!ATTLIST Workspace
+ name CDATA #REQUIRED>
+
+ <!--
+ the PersistenceManager element configures the persistence manager
+ to be used for the workspace; the class attribute specifies the
+ FQN of the class implementing the PersistenceManager interface
+ -->
+ <!ELEMENT PersistenceManager (param*)>
+ <!ATTLIST PersistenceManager
+ class CDATA #REQUIRED>
+
+ <!--
+ the SearchIndex element specifies the locaction of the search index
+ (used by the QueryHandler); the class attribute specifies the
+ FQN of the class implementing the QueryHandler interface.
+ -->
+ <!ELEMENT SearchIndex (param*,FileSystem)>
+ <!ATTLIST SearchIndex
+ class CDATA #REQUIRED>
+
+ <!--
+ the Versioning element configures the persistence manager
+ to be used for persisting version state
+ -->
+ <!ELEMENT Versioning (FileSystem, PersistenceManager)>
+ <!ATTLIST Versioning
+ rootPath CDATA #REQUIRED
+ >
+]>
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/repository"/>
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <param name="config" value="${rep.home}/access.xml"/> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <param name="anonymousId" value="anonymous"/>
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <Workspace name="${wsp.name}">
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+
+ <FileSystem class="com.day.jackrabbit.fs.cq.CQFileSystem">
+ <param name="path" value="${wsp.home}/wspStore.dat"/>
+ <param name="autoRepair" value="false"/>
+ <param name="blockSize" value="128"/>
+ <param name="autoSync" value="false"/>
+ </FileSystem>
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${wsp.home}"/>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+
+ <PersistenceManager class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager"/>
+
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <param name="useCompoundFile" value="true"/>
+ <param name="minMergeDocs" value="1000"/>
+ <param name="maxMergeDocs" value="100000"/>
+ <param name="mergeFactor" value="10"/>
+ <param name="bufferSize" value="10"/>
+ <param name="path" value="${wsp.home}/index"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <Versioning rootPath="${rep.home}/version">
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+
+ <FileSystem class="com.day.jackrabbit.fs.cq.CQFileSystem">
+ <param name="path" value="${rep.home}/version/version.dat"/>
+ <param name="autoRepair" value="false"/>
+ <param name="blockSize" value="128"/>
+ <param name="autoSync" value="false"/>
+ </FileSystem>
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <param name="path" value="${rep.home}/version"/>
+ </FileSystem>
+
+ <!--
+ Configures the perisistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.state.obj.ObjectPersistenceManager"/>
+
+ </Versioning>
+</Repository>
Modified: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java?rev=332863&r1=332862&r2=332863&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/NodeTypeManager.java Sat Nov 12 16:22:44 2005
@@ -23,6 +23,7 @@
import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
import org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NamespaceCreationException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.OperationNotSupportedException;
@@ -52,7 +53,8 @@
* @param namespace Namespace
* @param namespaceUri Full namespace URI
*/
- void createNamespace(String namespace, String namespaceUri);
+ void createNamespace(Session session, String namespace, String namespaceUri)
+ throws NamespaceCreationException;
/** This method creates JCR node types based on the MappingDescriptor object
* which is created by a graffito jcr-mapping Mapper implementation. A
Modified: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java?rev=332863&r1=332862&r2=332863&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java Sat Nov 12 16:22:44 2005
@@ -16,14 +16,24 @@
package org.apache.portals.graffito.jcr.nodemanagement.impl.jackrabbit;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.List;
import javax.jcr.Session;
+import javax.jcr.Workspace;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
+import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
+import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
import org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor;
import org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NamespaceCreationException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException;
import org.apache.portals.graffito.jcr.nodemanagement.exception.OperationNotSupportedException;
@@ -34,14 +44,34 @@
*/
public class NodeTypeManagerImpl implements NodeTypeManager
{
+ /**
+ * Logging.
+ */
+ private static Log log = LogFactory.getLog(NodeTypeManagerImpl.class);
/** Creates a new instance of NodeTypeManagerImpl. */
public NodeTypeManagerImpl()
{
}
- public void createNamespace(String namespace, String namespaceUri)
- {
+ /**
+ * @see org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager#createNamespace
+ */
+ public void createNamespace(Session session, String namespace, String namespaceUri)
+ throws NamespaceCreationException
+ {
+ if (session != null)
+ {
+ try
+ {
+ session.getWorkspace().getNamespaceRegistry().registerNamespace(namespace, namespaceUri);
+ log.info("Namespace created: " + namespace);
+ }
+ catch (Exception e)
+ {
+ throw new NamespaceCreationException(e);
+ }
+ }
}
public void createNodeTypes(Session session, MappingDescriptor mappingDescriptor)
@@ -77,11 +107,36 @@
{
}
-
+ /**
+ * @see org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager#createNodeTypesFromConfiguration
+ */
public void createNodeTypesFromConfiguration(Session session,
InputStream jcrRepositoryConfigurationFile)
throws OperationNotSupportedException, NodeTypeCreationException
{
+ try
+ {
+ NodeTypeDef[] types = NodeTypeReader.read(jcrRepositoryConfigurationFile);
+
+ ArrayList list = new ArrayList();
+ for (int i = 0; i < types.length; i++)
+ {
+ list.add(types[i]);
+ }
+
+ Workspace wsp = session.getWorkspace();
+ javax.jcr.nodetype.NodeTypeManager ntMgr = wsp.getNodeTypeManager();
+ NodeTypeRegistry ntReg =
+ ((org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
+
+ ntReg.registerNodeTypes(list);
+ log.info("Registered " + list.size() + " nodetypes from xml configuration file.");
+ }
+ catch (Exception e)
+ {
+ log.error("Could not create node types from configuration file.", e);
+ throw new NodeTypeCreationException(e);
+ }
}
public void removeNodeTypes(Session session, InputStream[] mappingXmlFiles)
Added: incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/NodeTypeManagerImpl.java?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/NodeTypeManagerImpl.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/java/org/apache/portals/graffito/jcr/nodemanagement/impl/jeceira/NodeTypeManagerImpl.java Sat Nov 12 16:22:44 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2000-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.jcr.nodemanagement.impl.jeceira;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.jcr.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
+import org.apache.portals.graffito.jcr.mapper.model.MappingDescriptor;
+import org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NamespaceCreationException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeCreationException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NodeTypeRemovalException;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.OperationNotSupportedException;
+
+/** This is the NodeTypeManager implementation for Jeceira.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class NodeTypeManagerImpl implements NodeTypeManager {
+
+ /**
+ * Logging.
+ */
+ private static Log log = LogFactory.getLog(NodeTypeManagerImpl.class);
+
+ /** Creates a new instance of NodeTypeManagerImpl. */
+ public NodeTypeManagerImpl()
+ {
+ }
+
+ /**
+ * @see org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager#createNamespace
+ */
+ public void createNamespace(Session session, String namespace, String namespaceUri)
+ throws NamespaceCreationException
+ {
+ }
+
+ public void createNodeTypes(Session session, MappingDescriptor mappingDescriptor)
+ throws NodeTypeCreationException
+ {
+ }
+
+ public void createNodeTypes(Session session, ClassDescriptor[] classDescriptors)
+ throws NodeTypeCreationException
+ {
+ }
+
+ public void createNodeTypesFromMappingFiles(Session session,
+ InputStream[] mappingXmlFiles)
+ throws NodeTypeCreationException
+ {
+ }
+
+ public void createSingleNodeType(Session session, ClassDescriptor classDescriptor)
+ throws NodeTypeCreationException
+ {
+ }
+
+ public void createSingleNodeTypeFromMappingFile(Session session,
+ InputStream mappingXmlFile, String jcrNodeType)
+ throws NodeTypeCreationException
+ {
+ }
+
+ public void createNodeTypeFromClass(Session session, Class clazz,
+ String jcrNodeType, boolean reflectSuperClasses)
+ throws NodeTypeCreationException
+ {
+ }
+
+ /**
+ * @see org.apache.portals.graffito.jcr.nodemanagement.NodeTypeManager#createNodeTypesFromConfiguration
+ */
+ public void createNodeTypesFromConfiguration(Session session,
+ InputStream jcrRepositoryConfigurationFile)
+ throws OperationNotSupportedException, NodeTypeCreationException
+ {
+ }
+
+ public void removeNodeTypes(Session session, InputStream[] mappingXmlFiles)
+ throws NodeTypeRemovalException
+ {
+ }
+
+ public void removeSingleNodeType(Session session, String jcrNodeType)
+ throws NodeTypeRemovalException
+ {
+ }
+
+ public List getPrimaryNodeTypeNames(String namespace)
+ {
+ return null;
+ }
+
+ public List getAllPrimaryNodeTypeNames()
+ {
+ return null;
+ }
+}
Modified: incubator/graffito/trunk/jcr-nodemanagement/src/test/log4j.properties
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/test/log4j.properties?rev=332863&r1=332862&r2=332863&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/test/log4j.properties (original)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/test/log4j.properties Sat Nov 12 16:22:44 2005
@@ -25,7 +25,7 @@
log4j.rootLogger = WARN, console
-log4j.category.org.apache.portals.graffito.jcr.nodemanagement= DEBUG, console
+log4j.category.org.apache.portals.graffito.jcr.nodemanagement=DEBUG, console
log4j.additivity.org.apache.portals.graffito.jcr.nodemanagement=false
#
Added: incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/TestBase.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/TestBase.java?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/TestBase.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/TestBase.java Sat Nov 12 16:22:44 2005
@@ -0,0 +1,105 @@
+/* ========================================================================
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================================
+ */
+package org.apache.portals.graffito.jcr.nodemanagement;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.nodetype.PropertyDefinition;
+
+import junit.framework.TestCase;
+
+import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
+
+/** Base class of JUnit test cases.
+ *
+ * @author Oliver Kiessler
+ */
+public class TestBase extends TestCase
+{
+ private Session session;
+
+ private static Repository repository;
+
+ /**
+ * Setting up the testcase.
+ *
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception
+ {
+ if (repository == null)
+ {
+ RepositoryUtil.registerRepository("repositoryTest",
+ "./src/config/jackrabbit/repository.xml",
+ "./target/repository");
+ repository = RepositoryUtil.getRepository("repositoryTest");
+ }
+
+ session = RepositoryUtil.login(repository, "superuser", "superuser");
+ }
+
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ getSession().logout();
+ }
+
+ /** Returns true if a property was found in an array of property defintions.
+ *
+ * @param defintions PropertyDefinition[]
+ * @param propertyName Name of property to find
+ * @return true/false
+ */
+ public boolean containsPropertyDefintion(PropertyDefinition[] definitions,
+ String propertyName)
+ {
+ boolean found = false;
+
+ if (definitions != null && definitions.length > 0)
+ {
+ for (int i = 0; i < definitions.length; i++)
+ {
+ if (definitions[i].getName().equals(propertyName))
+ {
+ found = true;
+ }
+ }
+ }
+
+ return found;
+ }
+
+ /** Getter for property session;
+ *
+ * @return session
+ */
+ public Session getSession()
+ {
+ return session;
+ }
+
+ /** Setter for property session.
+ *
+ * @param object Session
+ */
+ public void setSession(Session object)
+ {
+ this.session = object;
+ }
+}
Added: incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImplTest.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImplTest.java?rev=332863&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImplTest.java (added)
+++ incubator/graffito/trunk/jcr-nodemanagement/src/test/org/apache/portals/graffito/jcr/nodemanagement/impl/jackrabbit/NodeTypeManagerImplTest.java Sat Nov 12 16:22:44 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2000-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.jcr.nodemanagement.impl.jackrabbit;
+
+import java.io.FileInputStream;
+
+import javax.jcr.nodetype.NodeType;
+
+import junit.framework.*;
+
+import org.apache.portals.graffito.jcr.nodemanagement.TestBase;
+import org.apache.portals.graffito.jcr.nodemanagement.exception.NamespaceCreationException;
+
+/** JUnit test for NodeTypeManagerImpl.
+ *
+ * @author <a href="mailto:okiessler@apache.org">Oliver Kiessler</a>
+ */
+public class NodeTypeManagerImplTest extends TestBase {
+
+ /** Returns testsuite.
+ * @return suite
+ */
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(NodeTypeManagerImplTest.class);
+ return suite;
+ }
+
+ /**
+ * Test of createNamespace method, of class org.apache.portals.graffito.jcr.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl.
+ */
+ public void testCreateNamespace() throws Exception
+ {
+ NodeTypeManagerImpl jackrabbitNodeTypeManagerImpl
+ = new NodeTypeManagerImpl();
+ jackrabbitNodeTypeManagerImpl.createNamespace(getSession(),
+ "test", "http://www.test.com/test-uri");
+
+ assertEquals(getSession().getWorkspace().getNamespaceRegistry().getPrefix("http://www.test.com/test-uri"), "test");
+ assertEquals(getSession().getWorkspace().getNamespaceRegistry().getURI("test"), "http://www.test.com/test-uri");
+
+ boolean failed = false;
+
+ try
+ {
+ jackrabbitNodeTypeManagerImpl.createNamespace(getSession(),
+ "test", "http://www.test.com/test-uri");
+ } catch (NamespaceCreationException nce) {
+ // expected
+ failed = true;
+ }
+
+ assertTrue(failed);
+ }
+
+ /**
+ * Test of createNodeTypesFromConfiguration method, of class org.apache.portals.graffito.jcr.nodemanagement.impl.jackrabbit.NodeTypeManagerImpl.
+ * @throws java.lang.Exception
+ */
+ public void testCreateNodeTypesFromConfiguration() throws Exception
+ {
+ NodeTypeManagerImpl jackrabbitNodeTypeManagerImpl
+ = new NodeTypeManagerImpl();
+ jackrabbitNodeTypeManagerImpl.createNodeTypesFromConfiguration(getSession(),
+ new FileInputStream("./src/config/jackrabbit/nodetypes_test1.xml"));
+
+ NodeType test1 = getSession().getWorkspace().getNodeTypeManager().getNodeType("graffito:test1");
+ assertNotNull(test1);
+ assertFalse(test1.isMixin());
+ assertFalse(test1.hasOrderableChildNodes());
+ assertEquals(test1.getPrimaryItemName(), "test1");
+ assertEquals(test1.getSupertypes().length, 1);
+ assertEquals(test1.getSupertypes()[0].getName(), "nt:base");
+ assertTrue(containsPropertyDefintion(test1.getPropertyDefinitions(), "graffito:testProperty"));
+ }
+}