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 cl...@apache.org on 2006/09/20 19:37:21 UTC
svn commit: r448311 [22/25] - in /incubator/graffito/trunk: ./ api/
api/src/java/org/apache/portals/graffito/context/
api/src/java/org/apache/portals/graffito/exception/
api/src/java/org/apache/portals/graffito/services/core/
api/src/java/org/apache/po...
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java Wed Sep 20 12:37:05 2006
@@ -1,126 +1,126 @@
-/*
- * 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.
- */
-package org.apache.portals.graffito.jcr.query.impl;
-
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.portals.graffito.jcr.mapper.Mapper;
-import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
-import org.apache.portals.graffito.jcr.mapper.model.FieldDescriptor;
-import org.apache.portals.graffito.jcr.persistence.PersistenceConstant;
-import org.apache.portals.graffito.jcr.query.Filter;
-import org.apache.portals.graffito.jcr.query.Query;
-import org.apache.portals.graffito.jcr.query.QueryManager;
-
-public class QueryManagerImpl implements QueryManager {
-
- private Mapper mapper;
- private Map atomicTypeConverters;
-
- public QueryManagerImpl(Mapper mapper, Map atomicTypeConverters) {
- this.mapper = mapper;
- this.atomicTypeConverters = atomicTypeConverters;
- }
-
- public Filter createFilter(Class classQuery) {
- return new FilterImpl(mapper.getClassDescriptorByClass(classQuery),
- atomicTypeConverters,
- classQuery);
- }
-
- public Query createQuery(Filter filter) {
- return new QueryImpl(filter, mapper);
- }
-
- public String buildJCRExpression(Query query) {
-
- Filter filter = query.getFilter();
-
- // Check if the class has an inheritance discriminator field
- ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
- if (classDescriptor.hasDiscriminator()) {
- Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor);
- filter = filter.addAndFilter(discrininatorFilter);
- }
-
- String jcrExp = "";
-
- // Add scope
- if (((filter.getScope() != null) && (!filter.getScope().equals("")))) {
- jcrExp += "/jcr:root" + filter.getScope() + "element(*, ";
- }
- else {
- jcrExp += "//element(*, ";
- }
-
- // Add node type
- jcrExp += this.getNodeType(filter) + ") ";
-
- // Add filter criteria
- String filterExp = ((FilterImpl) filter).getJcrExpression();
-
- // Build the jcr filter
- if ((filterExp != null) && (!filterExp.equals(""))) {
- jcrExp += "[" + filterExp + "]";
- }
-
- // Add order by
- jcrExp += ((QueryImpl) query).getOrderByExpression();
-
- return jcrExp;
-
- }
-
- private Filter buildDiscriminatorFilter(Query query, ClassDescriptor classDescriptor) {
- Filter discriminatorFilter = this.createFilter(query.getFilter().getFilterClass());
- if (!classDescriptor.isAbstract() && (! classDescriptor.isInterface()) ) {
- discriminatorFilter.addJCRExpression("@" + PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME + "='" + classDescriptor.getClassName() + "'");
- }
-
- if (classDescriptor.hasDescendants()) {
- Iterator descendantDescriptorIterator = classDescriptor.getDescendantClassDescriptors().iterator();
-
- while (descendantDescriptorIterator.hasNext()) {
- ClassDescriptor descendantClassDescriptor = (ClassDescriptor) descendantDescriptorIterator.next();
-
- //Add subdescendant discriminator value
- discriminatorFilter = discriminatorFilter.addOrFilter(
- this.buildDiscriminatorFilter(query, descendantClassDescriptor));
- }
-
- }
-
- return discriminatorFilter;
- }
-
- private String getNodeType(Filter filter) {
- ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
-
- String jcrNodeType = classDescriptor.getJcrNodeType();
- if (jcrNodeType == null || jcrNodeType.equals(""))
- {
- return PersistenceConstant.NT_UNSTRUCTURED;
- }
- else
- {
- return jcrNodeType;
- }
- }
-
-}
+/*
+ * 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.
+ */
+package org.apache.portals.graffito.jcr.query.impl;
+
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.portals.graffito.jcr.mapper.Mapper;
+import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
+import org.apache.portals.graffito.jcr.mapper.model.FieldDescriptor;
+import org.apache.portals.graffito.jcr.persistence.PersistenceConstant;
+import org.apache.portals.graffito.jcr.query.Filter;
+import org.apache.portals.graffito.jcr.query.Query;
+import org.apache.portals.graffito.jcr.query.QueryManager;
+
+public class QueryManagerImpl implements QueryManager {
+
+ private Mapper mapper;
+ private Map atomicTypeConverters;
+
+ public QueryManagerImpl(Mapper mapper, Map atomicTypeConverters) {
+ this.mapper = mapper;
+ this.atomicTypeConverters = atomicTypeConverters;
+ }
+
+ public Filter createFilter(Class classQuery) {
+ return new FilterImpl(mapper.getClassDescriptorByClass(classQuery),
+ atomicTypeConverters,
+ classQuery);
+ }
+
+ public Query createQuery(Filter filter) {
+ return new QueryImpl(filter, mapper);
+ }
+
+ public String buildJCRExpression(Query query) {
+
+ Filter filter = query.getFilter();
+
+ // Check if the class has an inheritance discriminator field
+ ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
+ if (classDescriptor.hasDiscriminator()) {
+ Filter discrininatorFilter = buildDiscriminatorFilter(query, classDescriptor);
+ filter = filter.addAndFilter(discrininatorFilter);
+ }
+
+ String jcrExp = "";
+
+ // Add scope
+ if (((filter.getScope() != null) && (!filter.getScope().equals("")))) {
+ jcrExp += "/jcr:root" + filter.getScope() + "element(*, ";
+ }
+ else {
+ jcrExp += "//element(*, ";
+ }
+
+ // Add node type
+ jcrExp += this.getNodeType(filter) + ") ";
+
+ // Add filter criteria
+ String filterExp = ((FilterImpl) filter).getJcrExpression();
+
+ // Build the jcr filter
+ if ((filterExp != null) && (!filterExp.equals(""))) {
+ jcrExp += "[" + filterExp + "]";
+ }
+
+ // Add order by
+ jcrExp += ((QueryImpl) query).getOrderByExpression();
+
+ return jcrExp;
+
+ }
+
+ private Filter buildDiscriminatorFilter(Query query, ClassDescriptor classDescriptor) {
+ Filter discriminatorFilter = this.createFilter(query.getFilter().getFilterClass());
+ if (!classDescriptor.isAbstract() && (! classDescriptor.isInterface()) ) {
+ discriminatorFilter.addJCRExpression("@" + PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME + "='" + classDescriptor.getClassName() + "'");
+ }
+
+ if (classDescriptor.hasDescendants()) {
+ Iterator descendantDescriptorIterator = classDescriptor.getDescendantClassDescriptors().iterator();
+
+ while (descendantDescriptorIterator.hasNext()) {
+ ClassDescriptor descendantClassDescriptor = (ClassDescriptor) descendantDescriptorIterator.next();
+
+ //Add subdescendant discriminator value
+ discriminatorFilter = discriminatorFilter.addOrFilter(
+ this.buildDiscriminatorFilter(query, descendantClassDescriptor));
+ }
+
+ }
+
+ return discriminatorFilter;
+ }
+
+ private String getNodeType(Filter filter) {
+ ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(filter.getFilterClass());
+
+ String jcrNodeType = classDescriptor.getJcrNodeType();
+ if (jcrNodeType == null || jcrNodeType.equals(""))
+ {
+ return PersistenceConstant.NT_UNSTRUCTURED;
+ }
+ else
+ {
+ return jcrNodeType;
+ }
+ }
+
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java Wed Sep 20 12:37:05 2006
@@ -1,183 +1,183 @@
-/*
- * Copyright 2000-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.reflection;
-
-import java.lang.reflect.InvocationTargetException;
-
-import net.sf.cglib.proxy.Enhancer;
-
-import org.apache.commons.beanutils.ConstructorUtils;
-import org.apache.commons.beanutils.PropertyUtils;
-import org.apache.portals.graffito.jcr.exception.JcrMappingException;
-
-
-/**
- * Utility class for handling reflection using BeanUtils.
- *
- * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
- */
-abstract public class ReflectionUtils {
-
- // default the class loader to the load of this class
- private static ClassLoader classLoader = ReflectionUtils.class.getClassLoader();
-
- /**
- * Sets the class loader to use in the {@link #forName(String)} method to
- * load classes.
- * <p>
- * Care must be taken when using this method as when setting an improperly
- * set up classloader, the mapper will not work again throwing tons of
- * exceptions.
- *
- * @param newClassLoader The new class loader to use. This may be
- * <code>null</code> in which case the system class loader will be used.
- */
- public static void setClassLoader(ClassLoader newClassLoader) {
- classLoader = newClassLoader;
- }
-
- /**
- * Returns the class loader which is used by the {@link #forName(String)}
- * method to load classes.
- *
- * @return The class loader used by {@link #forName(String)} or
- * <code>null</code> if the system class loader is used.
- */
- public static ClassLoader getClassLoader() {
- return classLoader;
- }
-
- public static Object getNestedProperty(Object object, String fieldName) {
- if (null == object) {
- return null;
- }
-
- try {
- return PropertyUtils.getNestedProperty(object, fieldName);
- }
- catch(IllegalAccessException e) {
- throw new JcrMappingException("Cannot access property "
- + fieldName,
- e);
- }
- catch(InvocationTargetException e) {
- throw new JcrMappingException("Cannot access property "
- + fieldName,
- e);
- }
- catch(NoSuchMethodException e) {
- throw new JcrMappingException("Cannot access property "
- + fieldName,
- e);
- }
- }
-
- public static Class getPropertyType(Object object, String fieldName) {
- try {
- return PropertyUtils.getPropertyType(object, fieldName);
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot access property "
- + fieldName,
- ex);
- }
- }
-
- public static Object newInstance(Class clazz) {
- try {
- return clazz.newInstance();
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot create instance for class "
- + clazz,
- ex);
- }
- }
-
- /**
- * @param className
- * @param objects
- * @return
- */
- public static Object invokeConstructor(String className, Object[] params) {
- try {
- Class converterClass= forName(className);
-
- return ConstructorUtils.invokeConstructor(converterClass, params);
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot create instance for class " + className, ex);
- }
- }
-
- /**
- * @param object
- * @param fieldName
- * @param path
- */
- public static void setNestedProperty(Object object, String fieldName, Object value) {
- try {
- PropertyUtils.setNestedProperty(object, fieldName, value);
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot set the field " + fieldName + " in the class : " + object.getClass().toString(),
- ex);
- }
- }
-
- /**
- * @param string
- * @return
- */
- public static Object newInstance(String clazz) {
- try {
- return forName(clazz).newInstance();
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot create instance for class " + clazz, ex);
- }
- }
-
- /**
- * @param elementClassName
- * @return
- */
- public static Class forName(String clazz) {
- try {
- return Class.forName(clazz, true, getClassLoader());
- }
- catch(Exception ex) {
- throw new JcrMappingException("Cannot load class " + clazz, ex);
- }
- }
-
- public static boolean isProxy(Class beanClass)
- {
- return Enhancer.isEnhanced(beanClass);
- }
-
- public static Class getBeanClass(Object bean)
- {
- Class beanClass = bean.getClass();
- if (isProxy(beanClass))
- {
- //CGLIB specific
- return beanClass.getSuperclass();
- }
- return beanClass;
- }
-
-}
+/*
+ * Copyright 2000-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.reflection;
+
+import java.lang.reflect.InvocationTargetException;
+
+import net.sf.cglib.proxy.Enhancer;
+
+import org.apache.commons.beanutils.ConstructorUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.portals.graffito.jcr.exception.JcrMappingException;
+
+
+/**
+ * Utility class for handling reflection using BeanUtils.
+ *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+abstract public class ReflectionUtils {
+
+ // default the class loader to the load of this class
+ private static ClassLoader classLoader = ReflectionUtils.class.getClassLoader();
+
+ /**
+ * Sets the class loader to use in the {@link #forName(String)} method to
+ * load classes.
+ * <p>
+ * Care must be taken when using this method as when setting an improperly
+ * set up classloader, the mapper will not work again throwing tons of
+ * exceptions.
+ *
+ * @param newClassLoader The new class loader to use. This may be
+ * <code>null</code> in which case the system class loader will be used.
+ */
+ public static void setClassLoader(ClassLoader newClassLoader) {
+ classLoader = newClassLoader;
+ }
+
+ /**
+ * Returns the class loader which is used by the {@link #forName(String)}
+ * method to load classes.
+ *
+ * @return The class loader used by {@link #forName(String)} or
+ * <code>null</code> if the system class loader is used.
+ */
+ public static ClassLoader getClassLoader() {
+ return classLoader;
+ }
+
+ public static Object getNestedProperty(Object object, String fieldName) {
+ if (null == object) {
+ return null;
+ }
+
+ try {
+ return PropertyUtils.getNestedProperty(object, fieldName);
+ }
+ catch(IllegalAccessException e) {
+ throw new JcrMappingException("Cannot access property "
+ + fieldName,
+ e);
+ }
+ catch(InvocationTargetException e) {
+ throw new JcrMappingException("Cannot access property "
+ + fieldName,
+ e);
+ }
+ catch(NoSuchMethodException e) {
+ throw new JcrMappingException("Cannot access property "
+ + fieldName,
+ e);
+ }
+ }
+
+ public static Class getPropertyType(Object object, String fieldName) {
+ try {
+ return PropertyUtils.getPropertyType(object, fieldName);
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot access property "
+ + fieldName,
+ ex);
+ }
+ }
+
+ public static Object newInstance(Class clazz) {
+ try {
+ return clazz.newInstance();
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot create instance for class "
+ + clazz,
+ ex);
+ }
+ }
+
+ /**
+ * @param className
+ * @param objects
+ * @return
+ */
+ public static Object invokeConstructor(String className, Object[] params) {
+ try {
+ Class converterClass= forName(className);
+
+ return ConstructorUtils.invokeConstructor(converterClass, params);
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot create instance for class " + className, ex);
+ }
+ }
+
+ /**
+ * @param object
+ * @param fieldName
+ * @param path
+ */
+ public static void setNestedProperty(Object object, String fieldName, Object value) {
+ try {
+ PropertyUtils.setNestedProperty(object, fieldName, value);
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot set the field " + fieldName + " in the class : " + object.getClass().toString(),
+ ex);
+ }
+ }
+
+ /**
+ * @param string
+ * @return
+ */
+ public static Object newInstance(String clazz) {
+ try {
+ return forName(clazz).newInstance();
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot create instance for class " + clazz, ex);
+ }
+ }
+
+ /**
+ * @param elementClassName
+ * @return
+ */
+ public static Class forName(String clazz) {
+ try {
+ return Class.forName(clazz, true, getClassLoader());
+ }
+ catch(Exception ex) {
+ throw new JcrMappingException("Cannot load class " + clazz, ex);
+ }
+ }
+
+ public static boolean isProxy(Class beanClass)
+ {
+ return Enhancer.isEnhanced(beanClass);
+ }
+
+ public static Class getBeanClass(Object bean)
+ {
+ Class beanClass = bean.getClass();
+ if (isProxy(beanClass))
+ {
+ //CGLIB specific
+ return beanClass.getSuperclass();
+ }
+ return beanClass;
+ }
+
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/reflection/ReflectionUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java Wed Sep 20 12:37:05 2006
@@ -1,294 +1,294 @@
-/*
- * 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.repository;
-
-import java.util.Hashtable;
-
-import javax.jcr.Repository;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jackrabbit.core.jndi.RegistryHelper;
-import org.apache.jackrabbit.util.ISO9075;
-import org.apache.jackrabbit.util.Text;
-import org.apache.portals.graffito.jcr.exception.JcrMappingException;
-import org.apache.portals.graffito.jcr.exception.PersistenceException;
-import org.apache.portals.graffito.jcr.exception.RepositoryException;
-
-/**
-* Utility class for managing JCR repositories.
-* <b>Note</b>: most of the utility methods in this class can be used only with Jackrabbit.
-*
-* @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
-* @version $Id: Exp $
-*/
-public class RepositoryUtil
-{
-
- /** Graffito namespace prefix constant.
- */
- public static final String GRAFFITO_NAMESPACE_PREFIX = "graffito";
-
- /** Graffito namespace constant.
- */
- public static final String GRAFFITO_NAMESPACE = "http://incubator.apache.org/graffito";
- /** Item path separator */
- public static final String PATH_SEPARATOR = "/";
-
- private final static Log log = LogFactory.getLog(RepositoryUtil.class);
- /**
- * Register a new repository
- *
- * @param repositoryName The repository unique name
- * @param configFile The JCR config file
- * @param homeDir The directory containing the complete repository settings (workspace, node types, ...)
- *
- * @throws RepositoryException when it is not possible to register the repository
- */
- public static void registerRepository(String repositoryName, String configFile, String homeDir) throws RepositoryException
- {
- try
- {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
- env.put(Context.PROVIDER_URL, "localhost");
- InitialContext ctx = new InitialContext(env);
-
- RegistryHelper.registerRepository(ctx, repositoryName, configFile, homeDir, true);
- }
- catch (Exception e)
- {
- throw new RepositoryException("Impossible to register the respository : " +
- repositoryName + " - config file : " + configFile, e);
- }
-
- }
-
-
- /**
- * Unregister a repository
- *
- * @param repositoryName The repository unique name
- *
- * @throws RepositoryException when it is not possible to unregister the repository
- */
- public static void unRegisterRepository(String repositoryName) throws RepositoryException
- {
- try
- {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
- env.put(Context.PROVIDER_URL, "localhost");
- InitialContext ctx = new InitialContext(env);
-
- RegistryHelper.unregisterRepository(ctx, repositoryName);
- }
- catch (Exception e)
- {
- throw new RepositoryException("Impossible to unregister the respository : " +
- repositoryName , e);
- }
-
- }
-
- /**
- * Get a repository
- *
- * @param repositoryName The repository name
- * @return a JCR repository reference
- *
- * @throws RepositoryException when it is not possible to get the repository.
- * Before calling this method, the repository has to be registered (@see RepositoryUtil#registerRepository(String, String, String)
- */
- public static Repository getRepository(String repositoryName) throws RepositoryException
- {
- try
- {
- Hashtable env = new Hashtable();
- env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
- env.put(Context.PROVIDER_URL, "localhost");
- InitialContext ctx = new InitialContext(env);
-
- Repository repository = (Repository) ctx.lookup(repositoryName);
- return repository;
- }
- catch (Exception e)
- {
- throw new RepositoryException("Impossible to get the repository : " + repositoryName, e);
- }
- }
-
- /**
- * Connect to a JCR repository
- *
- * @param repository The JCR repository
- * @param user The user name
- * @param password The password
- * @return a valid JCR session
- *
- * @throws RepositoryException when it is not possible to connect to the JCR repository
- */
- public static Session login(Repository repository, String user, String password) throws RepositoryException
- {
- try
- {
- Session session = repository.login(new SimpleCredentials(user, password.toCharArray()), null);
- setupSession(session);
-
- return session;
- }
- catch (Exception e)
- {
- throw new RepositoryException("Impossible to login ", e);
- }
- }
-
- /**
- * Check if a path is valid
- *
- * @param path The path to validate
- * @return true if the path is valid, else false
- */
- public static boolean isValidPath(String path)
- {
- if ((path == null) ||
- (path.equals(PATH_SEPARATOR)) ||
- (path.endsWith(PATH_SEPARATOR)) ||
- (! path.startsWith(PATH_SEPARATOR)) ||
- (path.equals("")))
- {
- return false;
- }
- return true;
- }
-
- /**
- * Get the parent path
- * @param path The path from wich the parent path has to be returned
- * @return The parent path
- *
- * @throws PersistenceException when the path is invalid
- */
- public static String getParentPath(String path) throws PersistenceException
- {
- String parentPath = "";
-
- if (!isValidPath(path))
- {
- throw new JcrMappingException("Invalid path : " + path);
- }
-
- String[] pathElements = path.split(PATH_SEPARATOR);
-
- // Firts path element should be = empty string because a uri always start with '/'
- // So, if len=2, means it is a root folder like '/foo'.
- // In this case the uri has not parent folder => return "/"
- if (pathElements.length == 2)
- {
- return PATH_SEPARATOR;
- }
-
- for(int i=0; i < pathElements.length -1; i++)
- {
- if (! pathElements[i].equals(""))
- {
- parentPath += PATH_SEPARATOR + pathElements[i];
- }
- }
- return parentPath;
- }
-
- /**
- * Get the node name
- * @param path The path from which the node name has to be retrieved
- * @return The node name
- *
- * @throws PersistenceException when the path is invalid
- */
- public static String getNodeName(String path) throws PersistenceException
- {
-
- String[] pathElements = path.split(PATH_SEPARATOR);
-
- if (! isValidPath(path))
- {
- throw new JcrMappingException("Invalid path : " + path);
- }
- return pathElements[pathElements.length-1];
- }
-
- /**
- * Setup the session.
- * Until now, we check only if the Graffito namespace prefix exist in the repository
- *
- */
- private static void setupSession(Session session) throws RepositoryException
- {
- try
- {
- String[] jcrNamespaces = session.getWorkspace().getNamespaceRegistry().getPrefixes();
- boolean createGraffitoNamespace = true;
- for (int i = 0; i < jcrNamespaces.length; i++)
- {
- if (jcrNamespaces[i].equals(GRAFFITO_NAMESPACE_PREFIX))
- {
- createGraffitoNamespace = false;
- log.debug("Graffito namespace exists.");
- }
- }
-
- if (createGraffitoNamespace)
- {
- session.getWorkspace().getNamespaceRegistry().registerNamespace(GRAFFITO_NAMESPACE_PREFIX, GRAFFITO_NAMESPACE);
- log.info("Successfully created graffito namespace.");
- }
-
- if (session.getRootNode() != null)
- {
- log.info("Jcr repository setup successfull.");
- }
-
-
- }
- catch (Exception e)
- {
- log.error("Error while setting up the jcr repository.", e);
- throw new RepositoryException(e.getMessage());
- }
- }
-
- /**
- * Encode a path
- * @TODO : drop Jackrabbit dependency
- *
- * @param path the path to encode
- * @return the encoded path
- *
- */
- public static String encodePath(String path)
- {
- String[] pathElements = Text.explode(path, '/');
- for (int i=0;i<pathElements.length;i++)
- {
- pathElements[i] = ISO9075.encode(pathElements[i]);
- }
- return "/" + Text.implode(pathElements, "/");
- }
-}
+/*
+ * 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.repository;
+
+import java.util.Hashtable;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.core.jndi.RegistryHelper;
+import org.apache.jackrabbit.util.ISO9075;
+import org.apache.jackrabbit.util.Text;
+import org.apache.portals.graffito.jcr.exception.JcrMappingException;
+import org.apache.portals.graffito.jcr.exception.PersistenceException;
+import org.apache.portals.graffito.jcr.exception.RepositoryException;
+
+/**
+* Utility class for managing JCR repositories.
+* <b>Note</b>: most of the utility methods in this class can be used only with Jackrabbit.
+*
+* @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+* @version $Id: Exp $
+*/
+public class RepositoryUtil
+{
+
+ /** Graffito namespace prefix constant.
+ */
+ public static final String GRAFFITO_NAMESPACE_PREFIX = "graffito";
+
+ /** Graffito namespace constant.
+ */
+ public static final String GRAFFITO_NAMESPACE = "http://incubator.apache.org/graffito";
+ /** Item path separator */
+ public static final String PATH_SEPARATOR = "/";
+
+ private final static Log log = LogFactory.getLog(RepositoryUtil.class);
+ /**
+ * Register a new repository
+ *
+ * @param repositoryName The repository unique name
+ * @param configFile The JCR config file
+ * @param homeDir The directory containing the complete repository settings (workspace, node types, ...)
+ *
+ * @throws RepositoryException when it is not possible to register the repository
+ */
+ public static void registerRepository(String repositoryName, String configFile, String homeDir) throws RepositoryException
+ {
+ try
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
+ env.put(Context.PROVIDER_URL, "localhost");
+ InitialContext ctx = new InitialContext(env);
+
+ RegistryHelper.registerRepository(ctx, repositoryName, configFile, homeDir, true);
+ }
+ catch (Exception e)
+ {
+ throw new RepositoryException("Impossible to register the respository : " +
+ repositoryName + " - config file : " + configFile, e);
+ }
+
+ }
+
+
+ /**
+ * Unregister a repository
+ *
+ * @param repositoryName The repository unique name
+ *
+ * @throws RepositoryException when it is not possible to unregister the repository
+ */
+ public static void unRegisterRepository(String repositoryName) throws RepositoryException
+ {
+ try
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
+ env.put(Context.PROVIDER_URL, "localhost");
+ InitialContext ctx = new InitialContext(env);
+
+ RegistryHelper.unregisterRepository(ctx, repositoryName);
+ }
+ catch (Exception e)
+ {
+ throw new RepositoryException("Impossible to unregister the respository : " +
+ repositoryName , e);
+ }
+
+ }
+
+ /**
+ * Get a repository
+ *
+ * @param repositoryName The repository name
+ * @return a JCR repository reference
+ *
+ * @throws RepositoryException when it is not possible to get the repository.
+ * Before calling this method, the repository has to be registered (@see RepositoryUtil#registerRepository(String, String, String)
+ */
+ public static Repository getRepository(String repositoryName) throws RepositoryException
+ {
+ try
+ {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
+ env.put(Context.PROVIDER_URL, "localhost");
+ InitialContext ctx = new InitialContext(env);
+
+ Repository repository = (Repository) ctx.lookup(repositoryName);
+ return repository;
+ }
+ catch (Exception e)
+ {
+ throw new RepositoryException("Impossible to get the repository : " + repositoryName, e);
+ }
+ }
+
+ /**
+ * Connect to a JCR repository
+ *
+ * @param repository The JCR repository
+ * @param user The user name
+ * @param password The password
+ * @return a valid JCR session
+ *
+ * @throws RepositoryException when it is not possible to connect to the JCR repository
+ */
+ public static Session login(Repository repository, String user, String password) throws RepositoryException
+ {
+ try
+ {
+ Session session = repository.login(new SimpleCredentials(user, password.toCharArray()), null);
+ setupSession(session);
+
+ return session;
+ }
+ catch (Exception e)
+ {
+ throw new RepositoryException("Impossible to login ", e);
+ }
+ }
+
+ /**
+ * Check if a path is valid
+ *
+ * @param path The path to validate
+ * @return true if the path is valid, else false
+ */
+ public static boolean isValidPath(String path)
+ {
+ if ((path == null) ||
+ (path.equals(PATH_SEPARATOR)) ||
+ (path.endsWith(PATH_SEPARATOR)) ||
+ (! path.startsWith(PATH_SEPARATOR)) ||
+ (path.equals("")))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Get the parent path
+ * @param path The path from wich the parent path has to be returned
+ * @return The parent path
+ *
+ * @throws PersistenceException when the path is invalid
+ */
+ public static String getParentPath(String path) throws PersistenceException
+ {
+ String parentPath = "";
+
+ if (!isValidPath(path))
+ {
+ throw new JcrMappingException("Invalid path : " + path);
+ }
+
+ String[] pathElements = path.split(PATH_SEPARATOR);
+
+ // Firts path element should be = empty string because a uri always start with '/'
+ // So, if len=2, means it is a root folder like '/foo'.
+ // In this case the uri has not parent folder => return "/"
+ if (pathElements.length == 2)
+ {
+ return PATH_SEPARATOR;
+ }
+
+ for(int i=0; i < pathElements.length -1; i++)
+ {
+ if (! pathElements[i].equals(""))
+ {
+ parentPath += PATH_SEPARATOR + pathElements[i];
+ }
+ }
+ return parentPath;
+ }
+
+ /**
+ * Get the node name
+ * @param path The path from which the node name has to be retrieved
+ * @return The node name
+ *
+ * @throws PersistenceException when the path is invalid
+ */
+ public static String getNodeName(String path) throws PersistenceException
+ {
+
+ String[] pathElements = path.split(PATH_SEPARATOR);
+
+ if (! isValidPath(path))
+ {
+ throw new JcrMappingException("Invalid path : " + path);
+ }
+ return pathElements[pathElements.length-1];
+ }
+
+ /**
+ * Setup the session.
+ * Until now, we check only if the Graffito namespace prefix exist in the repository
+ *
+ */
+ private static void setupSession(Session session) throws RepositoryException
+ {
+ try
+ {
+ String[] jcrNamespaces = session.getWorkspace().getNamespaceRegistry().getPrefixes();
+ boolean createGraffitoNamespace = true;
+ for (int i = 0; i < jcrNamespaces.length; i++)
+ {
+ if (jcrNamespaces[i].equals(GRAFFITO_NAMESPACE_PREFIX))
+ {
+ createGraffitoNamespace = false;
+ log.debug("Graffito namespace exists.");
+ }
+ }
+
+ if (createGraffitoNamespace)
+ {
+ session.getWorkspace().getNamespaceRegistry().registerNamespace(GRAFFITO_NAMESPACE_PREFIX, GRAFFITO_NAMESPACE);
+ log.info("Successfully created graffito namespace.");
+ }
+
+ if (session.getRootNode() != null)
+ {
+ log.info("Jcr repository setup successfull.");
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ log.error("Error while setting up the jcr repository.", e);
+ throw new RepositoryException(e.getMessage());
+ }
+ }
+
+ /**
+ * Encode a path
+ * @TODO : drop Jackrabbit dependency
+ *
+ * @param path the path to encode
+ * @return the encoded path
+ *
+ */
+ public static String encodePath(String path)
+ {
+ String[] pathElements = Text.explode(path, '/');
+ for (int i=0;i<pathElements.length;i++)
+ {
+ pathElements[i] = ISO9075.encode(pathElements[i]);
+ }
+ return "/" + Text.implode(pathElements, "/");
+ }
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/repository/RepositoryUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/security/SimpleAccessManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/security/SimpleLoginModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/transaction/jackrabbit/UserTransactionImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/Version.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/Version.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/Version.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/Version.java Wed Sep 20 12:37:05 2006
@@ -1,93 +1,93 @@
-/*
- * 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.version;
-
-import java.util.Calendar;
-
-import javax.jcr.RepositoryException;
-
-import org.apache.portals.graffito.jcr.exception.VersionException;
-
-/**
- *
- *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
- *
- */
-public class Version
-{
-
- private javax.jcr.version.Version version;
-
- public Version(javax.jcr.version.Version version)
- {
- this.version = version;
- }
-
- public Calendar getCreated()
- {
- try
- {
- return version.getCreated();
- }
- catch (RepositoryException e)
- {
-
- throw new VersionException("Error while retrieving the version creation date", e);
- }
- }
-
- public String getUuid()
- {
- try
- {
- return version.getUUID();
- }
- catch (RepositoryException e)
- {
-
- throw new VersionException("Error while retrieving the version UUID", e);
- }
- }
-
- public String getPath()
- {
- try
- {
- return version.getPath();
- }
- catch (RepositoryException e)
- {
-
- throw new VersionException("Error while retrieving the version path", e);
- }
- }
-
- public String getName()
- {
- try
- {
- return version.getName();
-
- }
- catch (RepositoryException e)
- {
-
- throw new VersionException("Error while retrieving the version path", e);
- }
- }
-
-}
+/*
+ * 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.version;
+
+import java.util.Calendar;
+
+import javax.jcr.RepositoryException;
+
+import org.apache.portals.graffito.jcr.exception.VersionException;
+
+/**
+ *
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ *
+ */
+public class Version
+{
+
+ private javax.jcr.version.Version version;
+
+ public Version(javax.jcr.version.Version version)
+ {
+ this.version = version;
+ }
+
+ public Calendar getCreated()
+ {
+ try
+ {
+ return version.getCreated();
+ }
+ catch (RepositoryException e)
+ {
+
+ throw new VersionException("Error while retrieving the version creation date", e);
+ }
+ }
+
+ public String getUuid()
+ {
+ try
+ {
+ return version.getUUID();
+ }
+ catch (RepositoryException e)
+ {
+
+ throw new VersionException("Error while retrieving the version UUID", e);
+ }
+ }
+
+ public String getPath()
+ {
+ try
+ {
+ return version.getPath();
+ }
+ catch (RepositoryException e)
+ {
+
+ throw new VersionException("Error while retrieving the version path", e);
+ }
+ }
+
+ public String getName()
+ {
+ try
+ {
+ return version.getName();
+
+ }
+ catch (RepositoryException e)
+ {
+
+ throw new VersionException("Error while retrieving the version path", e);
+ }
+ }
+
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/Version.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/version/VersionIterator.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-beandescriptor.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-beandescriptor.xml?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-beandescriptor.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-beandescriptor.xml Wed Sep 20 12:37:05 2006
@@ -1,43 +1,43 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
-<graffito-jcr>
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.D" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="d1" jcrName="d1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
- jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
-
- <bean-descriptor fieldName="b1" jcrName="b1" inline="true" />
-
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.E" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="d1"
- jcrName="d1"
- jcrType="String"
- jcrAutoCreated="false"
- jcrMandatory="false"
- jcrOnParentVersion="IGNORE"
- jcrProtected="false"
- jcrMultiple="false" />
-
- <bean-descriptor fieldName="b1"
- jcrName="b1"
- converter="org.apache.portals.graffito.jcr.persistence.beanconverter.FakeBeanConverter" />
-
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.DFull" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="d1" jcrName="d1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
- jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
-
- <field-descriptor fieldName="b1" jcrName="b1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
- jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
-
- <field-descriptor fieldName="b2" jcrName="b2" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
- jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
- </class-descriptor>
-</graffito-jcr>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
+<graffito-jcr>
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.D" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="d1" jcrName="d1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
+ jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
+
+ <bean-descriptor fieldName="b1" jcrName="b1" inline="true" />
+
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.E" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="d1"
+ jcrName="d1"
+ jcrType="String"
+ jcrAutoCreated="false"
+ jcrMandatory="false"
+ jcrOnParentVersion="IGNORE"
+ jcrProtected="false"
+ jcrMultiple="false" />
+
+ <bean-descriptor fieldName="b1"
+ jcrName="b1"
+ converter="org.apache.portals.graffito.jcr.persistence.beanconverter.FakeBeanConverter" />
+
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.DFull" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="d1" jcrName="d1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
+ jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
+
+ <field-descriptor fieldName="b1" jcrName="b1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
+ jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
+
+ <field-descriptor fieldName="b2" jcrName="b2" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
+ jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
+ </class-descriptor>
+</graffito-jcr>
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-beandescriptor.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml Wed Sep 20 12:37:05 2006
@@ -1,100 +1,100 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
-<graffito-jcr>
-
-
-
- <!--
- The following classes are used to test object associations
- A has an assocition (1..1) with B (field b) => B is mapped as subnode in A
- A has a collection of C (field "collection" ) => there are n subnodes used to map the "C" collection
-
- -->
- <class-descriptor
- className="org.apache.portals.graffito.jcr.testmodel.A"
- jcrNodeType="nt:unstructured"
- jcrMixinTypes="mixin:a,mixin:b">
- <!-- Field-descriptor is used to map simple attributes to jcr property -->
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="a1" jcrName="a1" />
- <field-descriptor fieldName="a2" jcrName="a2" />
-
- <!-- bean-descriptor is used to map a bean into subnode
- * The definition of the associated class has to be defined in this mapping file
- * proxy="true" => use lazy laoding for this attribute b when retrieving A
- -->
- <bean-descriptor fieldName="b"
- jcrName="b"
- proxy="false"
- inline="true"
- jcrNodeType="nt:unstructured"
- jcrAutoCreated="false"
- jcrMandatory="false"
- jcrOnParentVersion="IGNORE"
- jcrProtected="false"
- jcrSameNameSiblings="false" />
-
- <!--
- Use the default collection mapping stategy and the default collection type (can be a Vector, an ArrayList, a Collection or a List)
- The default collection mapping strategy map a collection under an extra JCR node (specify by the jcrName).
-
- -->
- <collection-descriptor fieldName="collection" jcrName="collection" proxy="false"
- elementClassName="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C"
- jcrAutoCreated="false" jcrMandatory="false" jcrOnParentVersion="IGNORE"
- jcrProtected="false" jcrSameNameSiblings="false"/>
-
- <collection-descriptor fieldName="emptyCollection" jcrName="emptyCollection" proxy="false"
- elementClassName="org.apache.portals.graffito.jcr.testmodel.C" />
-
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.B" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
- <!-- Field-descriptor is used to map simple attributes to jcr property -->
-
- <field-descriptor fieldName="b1" jcrName="b1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
- jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
-
- <field-descriptor fieldName="b2" jcrName="b2" jcrType="String" jcrAutoCreated="true" jcrMandatory="true"
- jcrOnParentVersion="COPY" jcrProtected="true" jcrMultiple="true" />
-
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C" discriminator="false">
- <!-- Field-descriptor is used to map simple attributes to jcr property -->
- <field-descriptor fieldName="id" jcrName="graffito:id" id="true" />
- <field-descriptor fieldName="name" jcrName="graffito:name" />
- </class-descriptor>
-
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrNodeType="graffito:page" discriminator="false">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="title" jcrName="graffito:title" />
- <collection-descriptor fieldName="paragraphs" proxy="false"
- elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph"
- collectionConverter="org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl" />
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrNodeType="graffito:paragraph" discriminator="false">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="text" jcrName="graffito:text"/>
- </class-descriptor>
-
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Main" jcrNodeType="nt:unstructured">
- <field-descriptor fieldName="path" path="true" />
- <field-descriptor fieldName="text" jcrName="text" />
- <collection-descriptor fieldName="elements" proxy="false"
- elementClassName="org.apache.portals.graffito.jcr.testmodel.hashmap.Element"
- collectionConverter="org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl"
- collectionClassName="org.apache.portals.graffito.jcr.testmodel.hashmap.HashMapElement" />
-
- </class-descriptor>
-
- <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Element" jcrNodeType="graffito:element" discriminator="false">
- <field-descriptor fieldName="id" jcrName="graffito:id" />
- <field-descriptor fieldName="text" jcrName="graffito:text" />
- </class-descriptor>
-</graffito-jcr>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
+<graffito-jcr>
+
+
+
+ <!--
+ The following classes are used to test object associations
+ A has an assocition (1..1) with B (field b) => B is mapped as subnode in A
+ A has a collection of C (field "collection" ) => there are n subnodes used to map the "C" collection
+
+ -->
+ <class-descriptor
+ className="org.apache.portals.graffito.jcr.testmodel.A"
+ jcrNodeType="nt:unstructured"
+ jcrMixinTypes="mixin:a,mixin:b">
+ <!-- Field-descriptor is used to map simple attributes to jcr property -->
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="a1" jcrName="a1" />
+ <field-descriptor fieldName="a2" jcrName="a2" />
+
+ <!-- bean-descriptor is used to map a bean into subnode
+ * The definition of the associated class has to be defined in this mapping file
+ * proxy="true" => use lazy laoding for this attribute b when retrieving A
+ -->
+ <bean-descriptor fieldName="b"
+ jcrName="b"
+ proxy="false"
+ inline="true"
+ jcrNodeType="nt:unstructured"
+ jcrAutoCreated="false"
+ jcrMandatory="false"
+ jcrOnParentVersion="IGNORE"
+ jcrProtected="false"
+ jcrSameNameSiblings="false" />
+
+ <!--
+ Use the default collection mapping stategy and the default collection type (can be a Vector, an ArrayList, a Collection or a List)
+ The default collection mapping strategy map a collection under an extra JCR node (specify by the jcrName).
+
+ -->
+ <collection-descriptor fieldName="collection" jcrName="collection" proxy="false"
+ elementClassName="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C"
+ jcrAutoCreated="false" jcrMandatory="false" jcrOnParentVersion="IGNORE"
+ jcrProtected="false" jcrSameNameSiblings="false"/>
+
+ <collection-descriptor fieldName="emptyCollection" jcrName="emptyCollection" proxy="false"
+ elementClassName="org.apache.portals.graffito.jcr.testmodel.C" />
+
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.B" jcrNodeType="nt:unstructured" jcrSuperTypes="nt:base">
+ <!-- Field-descriptor is used to map simple attributes to jcr property -->
+
+ <field-descriptor fieldName="b1" jcrName="b1" jcrType="String" jcrAutoCreated="false" jcrMandatory="false"
+ jcrOnParentVersion="IGNORE" jcrProtected="false" jcrMultiple="false" />
+
+ <field-descriptor fieldName="b2" jcrName="b2" jcrType="String" jcrAutoCreated="true" jcrMandatory="true"
+ jcrOnParentVersion="COPY" jcrProtected="true" jcrMultiple="true" />
+
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.C" jcrNodeType="graffito:C" discriminator="false">
+ <!-- Field-descriptor is used to map simple attributes to jcr property -->
+ <field-descriptor fieldName="id" jcrName="graffito:id" id="true" />
+ <field-descriptor fieldName="name" jcrName="graffito:name" />
+ </class-descriptor>
+
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Page" jcrNodeType="graffito:page" discriminator="false">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="title" jcrName="graffito:title" />
+ <collection-descriptor fieldName="paragraphs" proxy="false"
+ elementClassName="org.apache.portals.graffito.jcr.testmodel.Paragraph"
+ collectionConverter="org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl" />
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Paragraph" jcrNodeType="graffito:paragraph" discriminator="false">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="graffito:text"/>
+ </class-descriptor>
+
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Main" jcrNodeType="nt:unstructured">
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="text" jcrName="text" />
+ <collection-descriptor fieldName="elements" proxy="false"
+ elementClassName="org.apache.portals.graffito.jcr.testmodel.hashmap.Element"
+ collectionConverter="org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.NTCollectionConverterImpl"
+ collectionClassName="org.apache.portals.graffito.jcr.testmodel.hashmap.HashMapElement" />
+
+ </class-descriptor>
+
+ <class-descriptor className="org.apache.portals.graffito.jcr.testmodel.hashmap.Element" jcrNodeType="graffito:element" discriminator="false">
+ <field-descriptor fieldName="id" jcrName="graffito:id" />
+ <field-descriptor fieldName="text" jcrName="graffito:text" />
+ </class-descriptor>
+</graffito-jcr>
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testmappings.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository-bdb.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository-derby.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/repository-xml.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test-data/data-import.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java Wed Sep 20 12:37:05 2006
@@ -1,56 +1,56 @@
-/* ========================================================================
- * 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;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.portals.graffito.jcr.mapper.DigesterMapperImplTest;
-import org.apache.portals.graffito.jcr.querymanager.QueryManagerTest;
-import org.apache.portals.graffito.jcr.repository.RepositoryUtilTest;
-
-
-/**
- * OCM suite definition. Bundles together all independent and package level test suites.
- *
- * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
- */
-public class AllTests {
-
- public static Test suite() throws Exception {
- return new RepositoryLifecycleTestSetup(buildSuite());
- }
-
- public static Test buildSuite() throws Exception {
- TestSuite suite= new TestSuite("Graffito OCM Tests");
- suite.addTest(org.apache.portals.graffito.jcr.mapper.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.atomic.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.auto.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.basic.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.beanconverter.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.collectionconverter.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.inheritance.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.interfaces.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.proxy.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.query.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.persistence.version.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.querymanager.AllTests.buildSuite());
- suite.addTest(org.apache.portals.graffito.jcr.repository.AllTests.buildSuite());
- return suite;
- }
-}
-
+/* ========================================================================
+ * 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;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.portals.graffito.jcr.mapper.DigesterMapperImplTest;
+import org.apache.portals.graffito.jcr.querymanager.QueryManagerTest;
+import org.apache.portals.graffito.jcr.repository.RepositoryUtilTest;
+
+
+/**
+ * OCM suite definition. Bundles together all independent and package level test suites.
+ *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+ public static Test suite() throws Exception {
+ return new RepositoryLifecycleTestSetup(buildSuite());
+ }
+
+ public static Test buildSuite() throws Exception {
+ TestSuite suite= new TestSuite("Graffito OCM Tests");
+ suite.addTest(org.apache.portals.graffito.jcr.mapper.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.atomic.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.auto.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.basic.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.beanconverter.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.collectionconverter.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.inheritance.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.interfaces.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.proxy.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.query.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.persistence.version.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.querymanager.AllTests.buildSuite());
+ suite.addTest(org.apache.portals.graffito.jcr.repository.AllTests.buildSuite());
+ return suite;
+ }
+}
+
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java Wed Sep 20 12:37:05 2006
@@ -1,53 +1,53 @@
-/* ========================================================================
- * 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;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
-/**
- * A TestSetup that opens/close the JCR repository.
- *
- * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
- */
-public class RepositoryLifecycleTestSetup extends TestSetup {
- public RepositoryLifecycleTestSetup(Test test) {
- super(test);
- }
-
- /**
- * @see junit.extensions.TestSetup#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- System.out.println("registering repository ... ");
- RepositoryUtil.registerRepository("repositoryTest",
- "./src/test-config/repository-derby.xml", "./target/repository");
- }
-
- /**
- * @see junit.extensions.TestSetup#tearDown()
- */
- protected void tearDown() throws Exception {
- RepositoryUtil.unRegisterRepository("repositoryTest");
- System.out.println("repository shutdown");
- super.tearDown();
- }
-
-
-}
+/* ========================================================================
+ * 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;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
+/**
+ * A TestSetup that opens/close the JCR repository.
+ *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class RepositoryLifecycleTestSetup extends TestSetup {
+ public RepositoryLifecycleTestSetup(Test test) {
+ super(test);
+ }
+
+ /**
+ * @see junit.extensions.TestSetup#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ System.out.println("registering repository ... ");
+ RepositoryUtil.registerRepository("repositoryTest",
+ "./src/test-config/repository-derby.xml", "./target/repository");
+ }
+
+ /**
+ * @see junit.extensions.TestSetup#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ RepositoryUtil.unRegisterRepository("repositoryTest");
+ System.out.println("repository shutdown");
+ super.tearDown();
+ }
+
+
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/RepositoryLifecycleTestSetup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/AllTests.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/AllTests.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/AllTests.java Wed Sep 20 12:37:05 2006
@@ -1,45 +1,45 @@
-/* ========================================================================
- * 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.mapper;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
-
-
-/**
- * Package level tests.
- *
- * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
- */
-public class AllTests {
-
- public static Test suite() {
- return new RepositoryLifecycleTestSetup(buildSuite());
- }
-
- public static Test buildSuite() {
- TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.mapper");
- //$JUnit-BEGIN$
- suite.addTestSuite(DigesterMapperImplTest.class);
-
- //$JUnit-END$
-
- return suite;
- }
-}
+/* ========================================================================
+ * 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.mapper;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+
+
+/**
+ * Package level tests.
+ *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+ public static Test suite() {
+ return new RepositoryLifecycleTestSetup(buildSuite());
+ }
+
+ public static Test buildSuite() {
+ TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.mapper");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(DigesterMapperImplTest.class);
+
+ //$JUnit-END$
+
+ return suite;
+ }
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AllTests.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AllTests.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AllTests.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AllTests.java Wed Sep 20 12:37:05 2006
@@ -1,45 +1,45 @@
-/* ========================================================================
- * 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.persistence.atomic;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
-
-
-/**
- * Package level tests.
- *
- * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
- */
-public class AllTests {
-
- public static Test suite() {
- return new RepositoryLifecycleTestSetup(buildSuite());
- }
-
- public static Test buildSuite() {
- TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.persistence.atomic");
- //$JUnit-BEGIN$
- suite.addTestSuite(AtomicTest.class);
- suite.addTestSuite(NullAtomicTest.class);
- //$JUnit-END$
-
- return suite;
- }
-}
+/* ========================================================================
+ * 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.persistence.atomic;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+
+
+/**
+ * Package level tests.
+ *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
+ */
+public class AllTests {
+
+ public static Test suite() {
+ return new RepositoryLifecycleTestSetup(buildSuite());
+ }
+
+ public static Test buildSuite() {
+ TestSuite suite= new TestSuite("Test for org.apache.portals.graffito.jcr.persistence.atomic");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(AtomicTest.class);
+ suite.addTestSuite(NullAtomicTest.class);
+ //$JUnit-END$
+
+ return suite;
+ }
+}
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AllTests.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/NullAtomicTest.java
------------------------------------------------------------------------------
svn:eol-style = native