incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r465390 - in /incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter: ProxyManager.java impl/ObjectConverterImpl.java impl/ProxyManager.java impl/ProxyManagerImpl.java
Date Wed, 18 Oct 2006 22:01:14 GMT
Author: clombart
Date: Wed Oct 18 15:01:13 2006
New Revision: 465390

URL: http://svn.apache.org/viewvc?view=rev&rev=465390
Log:
Give the possibility to replace the proxy manager (see GRFT-105)

Added:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java
  (contents, props changed)
      - copied, changed from r448321, incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManagerImpl.java
      - copied, changed from r448321, incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java
Removed:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java
Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java

Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java
(from r448321, incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java)
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java?view=diff&rev=465390&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java&r1=448321&p2=incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java&r2=465390
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java
Wed Oct 18 15:01:13 2006
@@ -1,67 +1,19 @@
-/*
- * 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.persistence.objectconverter.impl;
+package org.apache.portals.graffito.jcr.persistence.objectconverter;
 
 import javax.jcr.Node;
-import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.LazyLoader;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter;
-import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
-import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollectionUtil;
-import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
-
-public class ProxyManager {
-
-	 private final static Log log = LogFactory.getLog(ProxyManager.class);
-	
-	 
-	public  Object createBeanProxy(Session session, ObjectConverter objectConverter,  Class
beanClass, String path) 
-	{
-		
-       try {
-			if (!session.itemExists(path)) {
-				return null;
-			}
-		} catch (RepositoryException e) {
-			throw new org.apache.portals.graffito.jcr.exception.RepositoryException(	"Impossible to
check,if the object exits on " + path, e);
-		}
-				
-		LazyLoader loader = new BeanLazyLoader(objectConverter, session, beanClass, path) ;		
-		return  Enhancer.create(beanClass, loader);
-	}
-
-	
-	public  Object createCollectionProxy(Session session, CollectionConverter collectionConverter,
Node parentNode,  CollectionDescriptor collectionDescriptor, Class collectionFieldClass) 
-	{	
-		
-		if (collectionConverter.isNull(session, parentNode, collectionDescriptor, collectionFieldClass))
	{
-			return null;
-		}
-		
-		ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
-		
-		LazyLoader loader = new CollectionLazyLoader(collectionConverter, session, parentNode,
collectionDescriptor, collectionFieldClass);
-		return  Enhancer.create(manageableCollection.getClass(), loader);
-	}	
-}
+
+public interface ProxyManager {
+
+	public abstract Object createBeanProxy(Session session,
+			ObjectConverter objectConverter, Class beanClass, String path);
+
+	public abstract Object createCollectionProxy(Session session,
+			CollectionConverter collectionConverter, Node parentNode,
+			CollectionDescriptor collectionDescriptor,
+			Class collectionFieldClass);
+
+}
\ No newline at end of file

Propchange: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ProxyManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?view=diff&rev=465390&r1=465389&r2=465390
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
Wed Oct 18 15:01:13 2006
@@ -52,6 +52,7 @@
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.DefaultCollectionConverterImpl;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.BeanConverter;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.ProxyManager;
 import org.apache.portals.graffito.jcr.reflection.ReflectionUtils;
 import org.apache.portals.graffito.jcr.repository.RepositoryUtil;
 
@@ -91,9 +92,23 @@
 	public ObjectConverterImpl(Mapper mapper, AtomicTypeConverterProvider converterProvider)
{
 		this.mapper = mapper;
 		this.atomicTypeConverterProvider = converterProvider;
-		this.proxyManager = new ProxyManager();
+		this.proxyManager = new ProxyManagerImpl();
 	}
 
+	/**
+	 * Constructor
+	 * 
+	 * @param mapper
+	 *            The mapper to used
+	 * @param converterProvider
+	 *            The atomic type converter provider
+	 * 
+	 */
+	public ObjectConverterImpl(Mapper mapper, AtomicTypeConverterProvider converterProvider,
ProxyManager proxyManager) {
+		this.mapper = mapper;
+		this.atomicTypeConverterProvider = converterProvider;
+		this.proxyManager = proxyManager;
+	}	
 	/**
 	 * Set the <code>Mapper</code> used to solve mappings.
 	 * 

Copied: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManagerImpl.java
(from r448321, incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java)
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManagerImpl.java?view=diff&rev=465390&p1=incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java&r1=448321&p2=incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManagerImpl.java&r2=465390
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManager.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ProxyManagerImpl.java
Wed Oct 18 15:01:13 2006
@@ -30,12 +30,17 @@
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollectionUtil;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
+import org.apache.portals.graffito.jcr.persistence.objectconverter.ProxyManager;
 
-public class ProxyManager {
+public class ProxyManagerImpl implements ProxyManager 
+{
 
-	 private final static Log log = LogFactory.getLog(ProxyManager.class);
+	private final static Log log = LogFactory.getLog(ProxyManagerImpl.class);
 	
 	 
+	/* (non-Javadoc)
+	 * @see org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ProxyManager#createBeanProxy(javax.jcr.Session,
org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter, java.lang.Class,
java.lang.String)
+	 */
 	public  Object createBeanProxy(Session session, ObjectConverter objectConverter,  Class
beanClass, String path) 
 	{
 		
@@ -52,6 +57,9 @@
 	}
 
 	
+	/* (non-Javadoc)
+	 * @see org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ProxyManager#createCollectionProxy(javax.jcr.Session,
org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter, javax.jcr.Node,
org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, java.lang.Class)
+	 */
 	public  Object createCollectionProxy(Session session, CollectionConverter collectionConverter,
Node parentNode,  CollectionDescriptor collectionDescriptor, Class collectionFieldClass) 
 	{	
 		



Mime
View raw message