You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/01/25 13:47:31 UTC
svn commit: r615211 [1/3] - in /incubator/sling/trunk: ./
api/src/main/java/org/apache/sling/api/adapter/
api/src/main/java/org/apache/sling/api/resource/
api/src/main/java/org/apache/sling/api/scripting/ jcr/ocm/ jcr/ocm/src/
jcr/ocm/src/main/ jcr/ocm...
Author: fmeschbe
Date: Fri Jan 25 04:47:20 2008
New Revision: 615211
URL: http://svn.apache.org/viewvc?rev=615211&view=rev
Log:
SLING-197 Merge resource integration concept into trunk
Added:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/adapter/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/adapter/
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
incubator/sling/trunk/jcr/ocm/ (props changed)
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/
incubator/sling/trunk/jcr/ocm/pom.xml
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/pom.xml
incubator/sling/trunk/jcr/ocm/src/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/
incubator/sling/trunk/jcr/ocm/src/main/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/
incubator/sling/trunk/jcr/ocm/src/main/java/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/
incubator/sling/trunk/jcr/ocm/src/main/java/org/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/AbstractMappedObject.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/AbstractMappedObject.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/DefaultMappedObject.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/DefaultMappedObject.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/OcmConstants.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/OcmConstants.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/BundleMapper.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/BundleMapper.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ClassDescriptorReader.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ClassDescriptorReader.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObjectContentManagerFactory.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObjectContentManagerFactory.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObservingObjectCache.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ObservingObjectCache.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/SlingAtomicTypeConverterProvider.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/SlingAtomicTypeConverterProvider.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ValueTypeConverterImpl.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/ValueTypeConverterImpl.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/BundleLoader.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/BundleLoader.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/ClassLoaderLoader.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/ClassLoaderLoader.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/Loader.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/Loader.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/LoaderDelegate.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/LoaderDelegate.java
incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/MapperClassLoader.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/classloader/MapperClassLoader.java
incubator/sling/trunk/jcr/ocm/src/main/resources/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/
incubator/sling/trunk/jcr/ocm/src/main/resources/META-INF/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/META-INF/
incubator/sling/trunk/jcr/ocm/src/main/resources/META-INF/LICENSE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/META-INF/LICENSE
incubator/sling/trunk/jcr/ocm/src/main/resources/META-INF/LICENSE.kxml2
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/META-INF/LICENSE.kxml2
incubator/sling/trunk/jcr/ocm/src/main/resources/META-INF/NOTICE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/META-INF/NOTICE
incubator/sling/trunk/jcr/ocm/src/main/resources/graffito-jcr-mapping.dtd
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/resources/graffito-jcr-mapping.dtd
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderEntry.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProviderEntry.java
incubator/sling/trunk/osgi/commons/ (props changed)
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/
incubator/sling/trunk/osgi/commons/pom.xml
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/pom.xml
incubator/sling/trunk/osgi/commons/src/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/
incubator/sling/trunk/osgi/commons/src/main/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/
incubator/sling/trunk/osgi/commons/src/main/java/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/
incubator/sling/trunk/osgi/commons/src/main/java/org/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/
incubator/sling/trunk/osgi/commons/src/main/java/org/apache/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/apache/
incubator/sling/trunk/osgi/commons/src/main/java/org/apache/sling/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/apache/sling/
incubator/sling/trunk/osgi/commons/src/main/java/org/apache/sling/osgi/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/apache/sling/osgi/
incubator/sling/trunk/osgi/commons/src/main/java/org/apache/sling/osgi/commons/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/apache/sling/osgi/commons/
incubator/sling/trunk/osgi/commons/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
incubator/sling/trunk/osgi/commons/src/main/resources/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/resources/
incubator/sling/trunk/osgi/commons/src/main/resources/META-INF/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/resources/META-INF/
incubator/sling/trunk/osgi/commons/src/main/resources/META-INF/LICENSE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/resources/META-INF/LICENSE
incubator/sling/trunk/osgi/commons/src/main/resources/META-INF/NOTICE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/main/resources/META-INF/NOTICE
incubator/sling/trunk/osgi/commons/src/test/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/osgi/commons/src/test/
incubator/sling/trunk/readme.txt
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/readme.txt
incubator/sling/trunk/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/impl/SlingScriptAdapterFactory.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/impl/SlingScriptAdapterFactory.java
incubator/sling/trunk/sling/adapter/ (props changed)
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/
incubator/sling/trunk/sling/adapter/pom.xml
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/pom.xml
incubator/sling/trunk/sling/adapter/src/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/
incubator/sling/trunk/sling/adapter/src/main/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/
incubator/sling/trunk/sling/adapter/src/main/java/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/
incubator/sling/trunk/sling/adapter/src/main/java/org/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/SlingAdaptable.java
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/internal/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/internal/
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptor.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptor.java
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptorKey.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptorKey.java
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptorMap.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterFactoryDescriptorMap.java
incubator/sling/trunk/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterManagerImpl.java
incubator/sling/trunk/sling/adapter/src/main/resources/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/resources/
incubator/sling/trunk/sling/adapter/src/main/resources/META-INF/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/resources/META-INF/
incubator/sling/trunk/sling/adapter/src/main/resources/META-INF/LICENSE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/resources/META-INF/LICENSE
incubator/sling/trunk/sling/adapter/src/main/resources/META-INF/NOTICE
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/main/resources/META-INF/NOTICE
incubator/sling/trunk/sling/adapter/src/test/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/
incubator/sling/trunk/sling/adapter/src/test/java/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/
incubator/sling/trunk/sling/adapter/src/test/java/org/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/internal/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/internal/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/internal/AdapterManagerTest.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/internal/AdapterManagerTest.java
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/mock/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/mock/
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockAdapterFactory.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockAdapterFactory.java
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockBundle.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockBundle.java
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockComponentContext.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockComponentContext.java
incubator/sling/trunk/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockServiceReference.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/adapter/src/test/java/org/apache/sling/adapter/mock/MockServiceReference.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java
- copied unchanged from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/PathSupport.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/
- copied from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/ServletResource.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/ServletResource.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/ServletResourceProvider.java
- copied, changed from r614819, incubator/sling/whiteboard/fmeschbe/resource/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/resource/ServletResourceProvider.java
Removed:
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/AbstractMappedObject.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/DefaultMappedObject.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProvider.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/mapping/
incubator/sling/trunk/jcr/resource/src/main/resources/graffito-jcr-mapping.dtd
incubator/sling/trunk/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/ScriptPathSupport.java
incubator/sling/trunk/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/impl/DefaultSlingScriptResolver.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/ErrorSlingHttpServletRequest.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/helper/SlingScriptServlet.java
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/Resource.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
incubator/sling/trunk/jcr/resource/pom.xml
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/PathResolver.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/SyntheticResource.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/bundle/BundleResource.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/bundle/BundleResourceIterator.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/bundle/BundleResourceProvider.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/bundle/BundleResourceURLConnection.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrPropertyResource.java
incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/loader/JsonReader.java
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/JcrResourceUtilTest.java
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntryTest.java
incubator/sling/trunk/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/loader/JsonReaderTest.java
incubator/sling/trunk/launcher/app/pom.xml
incubator/sling/trunk/launcher/app/src/main/java/org/apache/sling/launcher/app/main/Main.java
incubator/sling/trunk/launcher/webapp/pom.xml
incubator/sling/trunk/launcher/webapp/src/main/java/org/apache/sling/launcher/webapp/SlingServlet.java
incubator/sling/trunk/launchpad/launchpad-servlets/src/main/java/org/apache/sling/launchpad/servlets/LaunchpadDefaultServlet.java
incubator/sling/trunk/launchpad/launchpad-webapp/pom.xml
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/JcrNodeResource.java
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/JcrPropertyResource.java
incubator/sling/trunk/microsling/microsling-core/src/main/java/org/apache/sling/microsling/resource/SyntheticResource.java
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/request/helpers/MicroslingRequestPathInfoTest.java
incubator/sling/trunk/microsling/microsling-core/src/test/java/org/apache/sling/microsling/scripting/helpers/ScriptSearchPathsBuilderTest.java
incubator/sling/trunk/osgi/obr/ (props changed)
incubator/sling/trunk/pom.xml
incubator/sling/trunk/scripting/api/ (props changed)
incubator/sling/trunk/scripting/jsp-taglib/pom.xml
incubator/sling/trunk/scripting/jsp/pom.xml
incubator/sling/trunk/scripting/resolver/ (props changed)
incubator/sling/trunk/scripting/resolver/pom.xml
incubator/sling/trunk/scripting/resolver/src/main/java/org/apache/sling/scripting/resolver/impl/DefaultSlingScript.java
incubator/sling/trunk/sling/core/pom.xml
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingHttpServletResponseImpl.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/SlingMainServlet.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/auth/SlingAuthenticator.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/RequestData.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/impl/request/SlingRequestDispatcher.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/objects/AbstractSelectableMappedObject.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/objects/SelectableDefaultMappedObject.java
incubator/sling/trunk/sling/core/src/main/java/org/apache/sling/core/servlets/ErrorHandler.java
incubator/sling/trunk/sling/core/src/test/java/org/apache/sling/core/impl/request/SlingRequestPathInfoTest.java
incubator/sling/trunk/sling/sample/ (props changed)
incubator/sling/trunk/sling/sample/pom.xml
incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java
incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/SampleContent.java
incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/SamplePage.java
incubator/sling/trunk/sling/servlet-resolver/pom.xml
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/ServletResolverConstants.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/defaults/DefaultServlet.java
incubator/sling/trunk/sling/servlets-standard/pom.xml
incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/HierarchyNodeObject.java
incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ReferenceObject.java
incubator/sling/trunk/sling/servlets-standard/src/main/java/org/apache/sling/servlets/standard/ResourceObject.java
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/NonExistingResource.java Fri Jan 25 04:47:20 2008
@@ -47,6 +47,14 @@
}
/**
+ * Returns <code>null</code> because this resource instance is not
+ * reflected by a real resource by any provider.
+ */
+ public ResourceProvider getResourceProvider() {
+ return null;
+ }
+
+ /**
* Returns <code>null</code> because a non-existing resource cannot adapt
* to anything.
*/
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/Resource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/Resource.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/Resource.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/Resource.java Fri Jan 25 04:47:20 2008
@@ -16,15 +16,23 @@
*/
package org.apache.sling.api.resource;
-/** Resources are pieces of content on which Sling acts */
-public interface Resource {
+import org.apache.sling.api.adapter.Adaptable;
+
+/**
+ * Resources are pieces of content on which Sling acts
+ * <p>
+ * The <code>Resource</code> is also an {@link Adaptable} to get adapters to
+ * other types. A JCR based resource might support adapting to the JCR Node on
+ * which the resource is based.
+ */
+public interface Resource extends Adaptable {
/**
* The special resource type for resource instances representing nonexisting
* resources (value is "sling:nonexisting"). This resource type is used by
* {@link ResourceResolver} instances to mark a resource which could not
* actually be resolved.
- *
+ *
* @see #getResourceType()
* @see ResourceResolver#resolve(javax.servlet.http.HttpServletRequest)
*/
@@ -55,22 +63,14 @@
* except for the {@link ResourceMetadata#RESOLUTION_PATH} property which is
* required to be set to the part of the request URI used to resolve the
* resource.
- *
+ *
* @see ResourceMetadata
*/
ResourceMetadata getResourceMetadata();
/**
- * Adapts this resource to another type. A JCR based resource might support
- * adapting to the JCR Node on which the resource is based.
- *
- * @param <AdapterType> The generic type to which this resource is adapted
- * to
- * @param type The Class object of the target type, such as
- * <code>Node.class</code>
- * @return The adapter target or <code>null</code> if the resource cannot
- * adapt to the requested type
+ * Returns the ResourceProvider from which this resource has been retrieved.
*/
- <AdapterType> AdapterType adaptTo(Class<AdapterType> type);
+ ResourceProvider getResourceProvider();
}
Copied: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java (from r614819, incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java)
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java?p2=incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java&p1=incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java&r1=614819&r2=615211&rev=615211&view=diff
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java Fri Jan 25 04:47:20 2008
@@ -59,22 +59,24 @@
* is support for a JSR-311 style resource provider to support the
* parametrized URL patterns.
*
- * @throws Exception may be thrown in case of any problem creating the
+ * @return <code>null</code> If this provider does not have a resource for
+ * the path.
+ * @throws SlingException may be thrown in case of any problem creating the
* <code>Resource</code> instance.
*/
- Resource getResource(/* ResourceResolver resourceResolver, */
- HttpServletRequest request, String path) throws SlingException;
+ Resource getResource(HttpServletRequest request, String path);
/**
* Returns a resource from this resource provider or <code>null</code> if
* the resource provider cannot find it. The path should have one of the
* {@link #getRoots()} strings as its prefix.
*
- * @throws Exception may be thrown in case of any problem creating the
+ * @return <code>null</code> If this provider does not have a resource for
+ * the path.
+ * @throws SlingException may be thrown in case of any problem creating the
* <code>Resource</code> instance.
*/
- Resource getResource(/* ResourceResolver ResourceResolver, */String path)
- throws SlingException;
+ Resource getResource(String path);
/**
* Returns an <code>Iterator</code> of {@link Resource} objects loaded
@@ -92,6 +94,6 @@
* @throws SlingException If any error occurs acquiring the child resource
* iterator.
*/
- Iterator<Resource> listChildren(Resource parent) throws SlingException;
+ Iterator<Resource> listChildren(Resource parent);
}
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java Fri Jan 25 04:47:20 2008
@@ -23,14 +23,20 @@
import javax.servlet.http.HttpServletRequest;
+import org.apache.sling.api.adapter.Adaptable;
+
/**
* The <code>ResourceResolver</code> defines the service API which may be used
* to resolve {@link Resource} objects. The resource resolver is available to
* the request processing servlet through the
* {@link org.apache.sling.api.SlingHttpServletRequest#getResourceResolver()}
* method.
+ * <p>
+ * The <code>ResourceResolver</code> is also an {@link Adaptable} to get
+ * adapters to other types. A JCR based resource resolver might support adapting
+ * to the JCR Session used by the resolver to access the JCR Repository.
*/
-public interface ResourceResolver {
+public interface ResourceResolver extends Adaptable {
/**
* Resolves the resource from the given <code>HttpServletRequest</code>.
@@ -42,7 +48,7 @@
* {@link Resource#getPath() resource path} set to the request URI.
* {@link Resource#adaptTo(Class) object} returns <code>null</code> for
* all classes.
- *
+ *
* @param request The http servlet request object used to resolve the
* resource for.
* @return The {@link Resource} for the request.
@@ -62,7 +68,7 @@
* a Java Content Repository, the path could be a
* <code>javax.jcr.Item</code> path from which the resource object is
* loaded.
- *
+ *
* @param path The absolute path to the resource object to be loaded. The
* path may contain relative path specifiers like <code>.</code>
* (current location) and <code>..</code> (parent location),
@@ -88,7 +94,7 @@
* a Java Content Repository, the path could be a
* <code>javax.jcr.Item</code> path from which the resource object is
* loaded.
- *
+ *
* @param base The base {@link Resource} against which a relative path
* argument given by <code>path</code> is resolved. This
* parameter may be <code>null</code> if the <code>path</code>
@@ -120,7 +126,7 @@
* reading content from a Java Content Repository, the children could be the
* {@link Resource} objects loaded from child items of the <code>Item</code>
* of the given <code>Resource</code>.
- *
+ *
* @param parent The {@link Resource Resource} whose children are requested.
* @return An <code>Iterator</code> of {@link Resource} objects.
* @throws NullPointerException If <code>parent</code> is
@@ -140,7 +146,7 @@
* create a JCR <code>Query</code> through the <code>QueryManager</code>.
* The result returned is then based on the <code>NodeIterator</code>
* provided by the query result.
- *
+ *
* @param query The query string to use to find the resources.
* @param language The language in which the query is formulated.
* @return An <code>Iterator</code> of {@link Resource} objects matching
@@ -165,7 +171,7 @@
* the column name and the column value is the JCR <code>Value</code>
* object converted into the respective Java object, such as
* <code>Boolean</code> for a value of property type <em>Boolean</em>.
- *
+ *
* @param query The query string to use to find the resources.
* @param language The language in which the query is formulated.
* @return An <code>Iterator</code> of <code>Map</code> instances
@@ -177,17 +183,4 @@
*/
Iterator<Map<String, Object>> queryResources(String query, String language);
- /**
- * Adapts this resource resolver to another type. A JCR based resource
- * resolver might support adapting to the JCR Session used by the resolver
- * to access the JCR Repository.
- *
- * @param <AdapterType> The generic type to which this resource is adapted
- * to
- * @param type The Class object of the target type, such as
- * <code>Session.class</code>
- * @return The adapter target or <code>null</code> if the resource cannot
- * adapt to the requested type
- */
- <AdapterType> AdapterType adaptTo(Class<AdapterType> type);
}
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java Fri Jan 25 04:47:20 2008
@@ -47,20 +47,6 @@
public interface SlingScriptResolver {
/**
- * Resolves a {@link SlingScript} to handle the given request.
- *
- * @param request The {@link SlingHttpServletRequest} for which a
- * {@link SlingScript} is to be found.
- * @return The {@link SlingScript} or <code>null</code> if no script can
- * be found to handle the request.
- * @throws AccessControlException If the script to which the request
- * resolves cannot be accessed due to access control
- * restrictions.
- * @throws SlingException If an error occurrs trying to find a script.
- */
- SlingScript resolveScript(SlingHttpServletRequest request);
-
- /**
* Finds the given name to a {@link SlingScript}.
* <p>
* The semantic meaning of the name is implementation specific: It may be an
Propchange: incubator/sling/trunk/jcr/ocm/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Jan 25 04:47:20 2008
@@ -0,0 +1,4 @@
+.project
+.classpath
+.settings
+target
Copied: incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java (from r614819, incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java)
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java?p2=incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java&p1=incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java&r1=614819&r2=615211&rev=615211&view=diff
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java (original)
+++ incubator/sling/trunk/jcr/ocm/src/main/java/org/apache/sling/jcr/ocm/impl/OcmAdapterFactory.java Fri Jan 25 04:47:20 2008
@@ -96,7 +96,7 @@
if (type.getName().equals(CLASS_OBJECT)) {
// unchecked cast
try {
- return (AdapterType) ocm.getObject(res.getURI());
+ return (AdapterType) ocm.getObject(res.getPath());
} catch (JcrMappingException jme) {
// no default mapping, try DefaultMappedObject
type = (Class<AdapterType>) DefaultMappedObject.class;
@@ -104,7 +104,7 @@
}
// unchecked cast
- return (AdapterType) ocm.getObject(type, res.getURI());
+ return (AdapterType) ocm.getObject(type, res.getPath());
} catch (RepositoryException re) {
// TODO: should log
} catch (NestableRuntimeException nre) {
Modified: incubator/sling/trunk/jcr/resource/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/pom.xml?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/pom.xml (original)
+++ incubator/sling/trunk/jcr/resource/pom.xml Fri Jan 25 04:47:20 2008
@@ -68,14 +68,6 @@
<instructions>
<Export-Package>
org.apache.sling.jcr.resource;version=${pom.version},
- org.apache.jackrabbit.ocm.exception;
- org.apache.jackrabbit.ocm.mapper;
- org.apache.jackrabbit.ocm.manager;
- org.apache.jackrabbit.ocm.manager.atomictypeconverter;
- org.apache.jackrabbit.ocm.manager.collectionconverter;
- org.apache.jackrabbit.ocm.manager.collectionconverter.impl;
- org.apache.jackrabbit.ocm.query;
- org.apache.jackrabbit.ocm.version;version=1.4
</Export-Package>
<Private-Package>
org.apache.sling.jcr.resource.internal.*,
@@ -85,32 +77,16 @@
org.apache.jackrabbit.util;
org.apache.jackrabbit.uuid;
org.apache.jackrabbit.value;-split-package:=merge-first,
- org.apache.jackrabbit.ocm.lock,
- org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl,
- org.apache.jackrabbit.ocm.manager.beanconverter,
- org.apache.jackrabbit.ocm.manager.beanconverter.impl,
- org.apache.jackrabbit.ocm.manager.cache,
- org.apache.jackrabbit.ocm.manager.cache.impl,
- org.apache.jackrabbit.ocm.manager.impl,
- org.apache.jackrabbit.ocm.manager.objectconverter,
- org.apache.jackrabbit.ocm.manager.objectconverter.impl,
- org.apache.jackrabbit.ocm.mapper.impl,
- org.apache.jackrabbit.ocm.mapper.impl.annotation,
- org.apache.jackrabbit.ocm.mapper.model,
- org.apache.jackrabbit.ocm.query.impl,
- org.apache.jackrabbit.ocm.reflection,
- org.apache.jackrabbit.ocm.repository,
org.kxml2.io, org.xmlpull.v1
</Private-Package>
- <Import-Package>
- !org.apache.jackrabbit.ocm.mapper.impl.digester,
- *
- </Import-Package>
<Sling-Namespaces>
- sling=http://sling.apache.org/jcr/sling/1.0,
- ocm=http://jackrabbit.apache.org/ocm
+ sling=http://sling.apache.org/jcr/sling/1.0
</Sling-Namespaces>
+
+ <Embed-Dependency>
+ jackrabbit-classloader, kxml2
+ </Embed-Dependency>
</instructions>
</configuration>
</plugin>
@@ -146,11 +122,21 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.osgi.commons</artifactId>
+ <version>2.0.0-incubator-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.api</artifactId>
<version>2.0.0-incubator-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.adapter</artifactId>
+ <version>2.0.0-incubator-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.testing</artifactId>
<version>2.0.0-incubator-SNAPSHOT</version>
<scope>test</scope>
@@ -160,10 +146,7 @@
<artifactId>slf4j-simple</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-ocm</artifactId>
- </dependency>
+ <!-- for adapting JCR resources to URLs -->
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-jcr-commons</artifactId>
@@ -178,6 +161,7 @@
<dependency>
<groupId>net.sf.kxml</groupId>
<artifactId>kxml2</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java Fri Jan 25 04:47:20 2008
@@ -20,7 +20,6 @@
import javax.jcr.Session;
-import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.ResourceResolver;
/**
@@ -40,9 +39,7 @@
*
* @param session The JCR <code>Session</code> used by the created
* resource manager to access the repository.
- * @throws SlingException May be thrown if an error occurrs setting up the
- * <code>ResourceResolver</code>.
*/
- ResourceResolver getResourceResolver(Session session) throws SlingException;
+ ResourceResolver getResourceResolver(Session session);
}
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/PathResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/PathResolver.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/PathResolver.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/PathResolver.java Fri Jan 25 04:47:20 2008
@@ -20,7 +20,6 @@
import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceResolver;
/**
* The <code>PathResolver</code> interface defines additional methods to the
@@ -31,7 +30,7 @@
* This reverse mapping may be used for example to create links for existing
* paths.
*/
-public interface PathResolver extends ResourceResolver {
+public interface PathResolver {
/**
* Resolves the given url string to a <code>Resource</code> applying the
@@ -59,22 +58,6 @@
* @param path The resource path to map to an url string
* @return The external (URI) representation of the resource path.
*/
- String pathToURL(String path);
-
- /**
- * Maps a Content path to an url string, which when fed to the
- * {@link #resolve(String)} method returns a resource of the given path.
- * This method may be used to get the external (URI) representation of a
- * resource, which is guaranteed to map back to the same handle, when used
- * in a request.
- *
- * @param prefix A prefix to prepend to the url string, ignored if empty or
- * <code>null</code>
- * @param path The resource path to map to an url string
- * @param suffix A suffix to append to the url string, ignored if empty or
- * <code>null</code>
- * @return The external (URI) representation of the resource path.
- */
- String pathToURL(String prefix, String path, String suffix);
+ String pathToURL(Resource resource);
}
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/SyntheticResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/SyntheticResource.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/SyntheticResource.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/SyntheticResource.java Fri Jan 25 04:47:20 2008
@@ -20,6 +20,7 @@
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceMetadata;
+import org.apache.sling.api.resource.ResourceProvider;
/**
* The <code>SyntheticResource</code> class is a simple implementation of the
@@ -68,6 +69,11 @@
return resourceMetadata;
}
+ /** synthetic resources have no provider */
+ public ResourceProvider getResourceProvider() {
+ return null;
+ }
+
public <Type> Type adaptTo(Class<Type> type) {
return null;
}
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java Fri Jan 25 04:47:20 2008
@@ -37,25 +37,21 @@
import javax.jcr.query.RowIterator;
import javax.servlet.http.HttpServletRequest;
-import org.apache.jackrabbit.ocm.exception.JcrMappingException;
-import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
import org.apache.sling.api.SlingException;
import org.apache.sling.api.resource.NonExistingResource;
import org.apache.sling.api.resource.QuerySyntaxException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceMetadata;
import org.apache.sling.api.resource.ResourceResolver;
-import org.apache.sling.jcr.resource.DefaultMappedObject;
import org.apache.sling.jcr.resource.JcrResourceUtil;
import org.apache.sling.jcr.resource.PathResolver;
import org.apache.sling.jcr.resource.internal.helper.Descendable;
import org.apache.sling.jcr.resource.internal.helper.Mapping;
import org.apache.sling.jcr.resource.internal.helper.ResourcePathIterator;
-import org.apache.sling.jcr.resource.internal.helper.ResourceProvider;
-import org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResource;
+import org.apache.sling.jcr.resource.internal.helper.ResourceProviderEntry;
import org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator;
import org.apache.sling.jcr.resource.internal.helper.jcr.JcrPropertyResource;
+import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,32 +68,12 @@
/** default log */
private final Logger log = LoggerFactory.getLogger(getClass());
- /**
- * The class used to load repository content into if a mapping cannot be
- * found for a given existing node. See {@link #getObject(String, Class)}.
- */
- public static final Class<?> DEFAULT_CONTENT_CLASS = DefaultMappedObject.class;
-
- protected static final String ACTION_READ = "read";
-
- protected static final String ACTION_CREATE = "add_node,set_property";
-
- protected static final String ACTION_ADD_NODE = "add_node";
-
- protected static final String ACTION_SET_PROPERTY = "set_property";
-
- protected static final String ACTION_REMOVE = "remove";
-
+ private final JcrResourceProviderEntry rootProvider;
private final JcrResourceResolverFactoryImpl factory;
-
- private final Session session;
-
- private ObjectContentManager objectContentManager;
-
- public JcrResourceResolver(JcrResourceResolverFactoryImpl factory,
- Session session) {
+
+ public JcrResourceResolver(JcrResourceProviderEntry rootProvider, JcrResourceResolverFactoryImpl factory) {
+ this.rootProvider = rootProvider;
this.factory = factory;
- this.session = session;
}
// ---------- ResourceResolver interface ----------------------------------
@@ -114,8 +90,20 @@
}
public Resource getResource(String path) throws SlingException {
- return getResource(path, null);
- }
+ path = JcrResourceUtil.normalize(path);
+ if (path != null) {
+ try {
+ Resource resource = getResourceInternal(path);
+ return resource;
+ } catch (Exception ex) {
+ throw new SlingException("Problem accessing resource" + path,
+ ex);
+ }
+ }
+
+ // relative path segments cannot be resolved
+ return null;
+ }
public Resource getResource(Resource base, String path)
throws SlingException {
@@ -165,7 +153,7 @@
try {
QueryResult res = JcrResourceUtil.query(getSession(), query,
language);
- return new JcrNodeResourceIterator(this, res.getNodes());
+ return new JcrNodeResourceIterator(rootProvider.getResourceProvider(), res.getNodes());
} catch (javax.jcr.query.InvalidQueryException iqe) {
throw new QuerySyntaxException(iqe.getMessage(), query, language,
iqe);
@@ -218,8 +206,6 @@
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
if (type == Session.class) {
return (AdapterType) getSession();
- } else if (type == ObjectContentManager.class) {
- return (AdapterType) getObjectContentManager();
} else if (type == PathResolver.class) {
return (AdapterType) this;
}
@@ -273,14 +259,11 @@
}
}
- public String pathToURL(String path) {
- return pathToURL(null, path, null);
- }
-
- public String pathToURL(String prefix, String path, String suffix) {
- String href = null;
+ public String pathToURL(Resource resource) {
+ String path = resource.getPath();
// get first map
+ String href = null;
Mapping[] mappings = factory.getMappings();
for (int i = 0; i < mappings.length && href == null; i++) {
href = mappings[i].mapHandle(path);
@@ -299,246 +282,14 @@
href = virtual;
}
- // handle prefix and suffix
- if (prefix != null && !prefix.equals("") && !prefix.equals("/")) {
- href = prefix + href;
- }
- if (suffix != null) {
- href += suffix;
- }
-
- log.debug("MapHandle: {} + {} + {} -> {}", new Object[] { prefix, path,
- suffix, href });
+ log.debug("MapHandle: {} -> {}", path, href);
return href;
}
- // ---------- former ResourceManager interface
- // -----------------------------------
-
- /**
- * @throws AccessControlException If this manager has does not have enough
- * permisssions to store the resource's object.
- */
- public void store(Resource resource) throws SlingException {
- String path = resource.getPath();
- Object data = resource.adaptTo(Object.class);
- if (data != null) {
- try {
- if (itemExists(path)) {
- checkPermission(path, ACTION_SET_PROPERTY);
- getObjectContentManager().update(data);
- } else {
- checkPermission(path, ACTION_CREATE);
- getObjectContentManager().insert(data);
- }
- } catch (RepositoryException re) {
- throw new SlingException("Problem storing object for resource "
- + path, re);
- }
- } else {
- log.info("store: The resource {} has no object to store", path);
- }
- }
-
- /**
- * @throws AccessControlException if this manager has no read access
- */
- public Resource getResource(String path, Class<?> type)
- throws SlingException {
- path = JcrResourceUtil.normalize(path);
- if (path != null) {
- try {
- Resource resource = getResourceInternal(path);
- if (type != null && resource instanceof JcrNodeResource) {
- ((JcrNodeResource) resource).setObjectType(type);
- }
- return resource;
- } catch (Exception ex) {
- throw new SlingException("Problem accessing resource" + path,
- ex);
- }
- }
-
- // relative path segments cannot be resolved
- return null;
- }
-
- public void delete(Resource resource) throws SlingException {
- String path = resource.getPath();
- try {
- checkPermission(path, ACTION_REMOVE);
- getObjectContentManager().remove(path);
- } catch (AccessControlException ace) {
- // rethrow access control issues
- throw ace;
- } catch (Exception ex) {
- throw new SlingException("Problem deleting resource " + path, ex);
- }
- }
-
- public void copy(Resource resource, String destination, boolean deep)
- throws SlingException {
-
- String source = resource.getPath();
- try {
-
- checkPermission(destination, ACTION_CREATE);
-
- if (deep) {
- // recursively copy directly in the repository
- getSession().getWorkspace().copy(source, destination);
- } else {
- // TODO: Create node at destination:
- // - same primary node type
- // - same mixins
- // - same non-protected properties
- }
-
- } catch (AccessControlException ace) {
- // rethrow access control issues
- throw ace;
- } catch (Exception ex) {
- throw new SlingException("Problem copying resource " + source
- + " to " + destination, ex);
- }
- }
-
- public void move(Resource resource, String destination)
- throws SlingException {
- String source = resource.getPath();
-
- try {
- checkPermission(source, ACTION_REMOVE);
- checkPermission(destination, ACTION_CREATE);
-
- getSession().move(source, destination);
-
- } catch (AccessControlException ace) {
- // rethrow access control issues
- throw ace;
- } catch (Exception ex) {
- throw new SlingException("Problem moving resource " + source
- + " to " + destination, ex);
- }
- }
-
- public void orderBefore(Resource resource, String afterName)
- throws SlingException {
-
- String path = resource.getPath();
- Node node = resource.adaptTo(Node.class);
- if (node == null) {
- log.info("orderBefore: Resource {} is not based on a JCR", path);
- return;
- }
-
- try {
- Node parent = node.getParent();
-
- // check whether the parent node supports child node ordering
- if (!parent.getPrimaryNodeType().hasOrderableChildNodes()) {
- return;
- }
-
- String name = path.substring(path.lastIndexOf('/') + 1);
- parent.orderBefore(name, afterName);
- } catch (AccessControlException ace) {
- // rethrow access control issues
- throw ace;
- } catch (Exception ex) {
- throw new SlingException("Problem ordering resource " + path
- + " before " + afterName, ex);
- }
- }
-
- /**
- * Returns <code>true</code> if this manager has unsaved changes or if an
- * error occurrs checking for such changes.
- */
- public boolean hasChanges() {
- try {
- return getSession().hasPendingChanges();
- } catch (RepositoryException re) {
- log.error(
- "hasChanges: Problem checking for session changes, assuming true",
- re);
- return true;
- }
- }
-
- public void save() throws SlingException {
- try {
- getSession().save();
- } catch (RepositoryException re) {
- throw new SlingException("Problems while saving changes", re);
- }
- }
-
- public void rollback() {
- try {
- getSession().refresh(false);
- } catch (RepositoryException re) {
- log.error("rollback: Problem rolling back changes", re);
- }
- }
-
// ---------- implementation helper ----------------------------------------
- /**
- * Loads the object to which the repository node at the given
- * <code>path</code> is mapping. If no mapping exists for an existing
- * node, the node's content is loaded into a new instance of the
- * {@link #DEFAULT_CONTENT_CLASS default content class}.
- *
- * @param type Load the node's content into an object of the given type if
- * not <code>null</code>.
- * @return the <code>Content</code> object loaded from the node or
- * <code>null</code> if no node exists at the given path.
- */
- public Object getObject(String path, Class<?> type) {
- try {
- if (itemExists(path)) {
-
- ObjectContentManager ocm = getObjectContentManager();
-
- // load object with explicit type, fail if not possible
- if (type != null) {
- return ocm.getObject(type, path);
- }
-
- // have the mapper find a type or fall back to default type
- try {
-
- return ocm.getObject(path);
-
- } catch (JcrMappingException jme) {
-
- // fall back to default content
- try {
- return ocm.getObject(DEFAULT_CONTENT_CLASS, path);
- } catch (Throwable t) {
- // don't care for this exception, use initial one
- throw jme;
- }
- }
- }
- } catch (Exception ex) {
- log.error("getObject: Problem while mapping resource {}", ex);
- }
-
- // item does not exist or is no content or errors mapping item
- return null;
- }
-
public Session getSession() {
- return session;
- }
-
- protected ObjectContentManager getObjectContentManager() {
- if (objectContentManager == null) {
- objectContentManager = factory.getObjectContentManager(getSession());
- }
- return objectContentManager;
+ return rootProvider.getSession();
}
private Resource transformURL(String uri) throws SlingException {
@@ -598,12 +349,14 @@
*/
protected Resource getResourceInternal(String path) throws Exception {
- ResourceProvider rp = factory.getResourceProvider(path);
- Resource resource = rp.getResource(this, path);
- if (resource == null && rp != factory) {
- resource = factory.getResource(this, path);
- }
+ Resource resource= null;
+ ResourceProviderEntry rp = rootProvider.getResourceProvider(path);
+ while (rp != null && resource == null) {
+ resource = rp.getResourceProvider().getResource(path);
+ rp = rp.getParentEntry();
+ }
+
if (resource != null) {
resource.getResourceMetadata().put(
ResourceMetadata.RESOLUTION_PATH, path);
@@ -612,78 +365,6 @@
log.debug("Cannot resolve path '{}' to a resource", path);
return null;
- }
-
- /**
- * Checks whether the item exists and this content manager's session has
- * read access to the item. If the item does not exist, access control is
- * ignored by this method and <code>false</code> is returned.
- *
- * @param path The path to the item to check
- * @return <code>true</code> if the item exists and this content manager's
- * session has read access. If the item does not exist,
- * <code>false</code> is returned ignoring access control.
- * @throws RepositoryException
- * @throws AccessControlException If the item really exists but this content
- * manager's session has no read access to it.
- */
- boolean itemExists(String path) throws RepositoryException {
- if (factory.itemReallyExists(getSession(), path)) {
- checkPermission(path, ACTION_READ);
- return true;
- }
-
- return false;
- }
-
- /**
- * Creates a <code>Resource</code> instance for the item found at the
- * given path. If no item exists at that path or the item does not have
- * read-access for the session of this resolver, <code>null</code> is
- * returned.
- *
- * @param path The absolute path
- * @return The <code>Resource</code> for the item at the given path.
- * @throws RepositoryException If an error occurrs accessingor checking the
- * item in the repository.
- * @throws AccessControlException If the item really exists but this content
- * manager's session has no read access to it.
- */
- Resource createResource(String path) throws RepositoryException {
- if (itemExists(path)) {
- Item item = getSession().getItem(path);
- if (item.isNode()) {
- log.debug(
- "createResource: Found JCR Node Resource at path '{}'",
- path);
- return new JcrNodeResource(this, (Node) item);
- }
-
- log.debug(
- "createResource: Found JCR Property Resource at path '{}'",
- path);
- return new JcrPropertyResource(path, (Property) item);
- }
-
- log.debug("createResource: No JCR Item exists at path '{}'", path);
- return null;
- }
-
- /**
- * @param path
- * @param actions
- * @throws RepositoryException
- * @throws AccessControlException if this manager does not have the
- * permission for the listed action(s).
- */
- protected void checkPermission(String path, String actions)
- throws RepositoryException {
- getSession().checkPermission(path, actions);
- }
-
- protected void setPath(Object content, String path) {
- // TODO: Investigate more here !!
- ReflectionUtils.setNestedProperty(content, "path", path);
}
}
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java Fri Jan 25 04:47:20 2008
@@ -32,22 +32,21 @@
import org.apache.commons.collections.BidiMap;
import org.apache.commons.collections.bidimap.TreeBidiMap;
-import org.apache.jackrabbit.ocm.manager.ObjectContentManager;
-import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceProvider;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.commons.mime.MimeTypeService;
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.jcr.resource.JcrResourceResolverFactory;
import org.apache.sling.jcr.resource.internal.helper.Mapping;
-import org.apache.sling.jcr.resource.internal.helper.ResourceProvider;
import org.apache.sling.jcr.resource.internal.helper.ResourceProviderEntry;
import org.apache.sling.jcr.resource.internal.helper.bundle.BundleResourceProvider;
+import org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderEntry;
import org.apache.sling.jcr.resource.internal.loader.Loader;
-import org.apache.sling.jcr.resource.internal.mapping.ObjectContentManagerFactory;
+import org.apache.sling.osgi.commons.OsgiUtil;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
import org.osgi.framework.ServiceReference;
-import org.osgi.framework.SynchronousBundleListener;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
@@ -72,9 +71,12 @@
* JcrResourceResolverFactory Implementation"
* @scr.property name="service.vendor" value="The Apache Software Foundation"
* @scr.service interface="org.apache.sling.jcr.resource.JcrResourceResolverFactory"
+ * @scr.reference name="ResourceProvider"
+ * interface="org.apache.sling.api.resource.ResourceProvider"
+ * cardinality="0..n" policy="dynamic"
*/
public class JcrResourceResolverFactoryImpl implements
- JcrResourceResolverFactory, SynchronousBundleListener, ResourceProvider {
+ JcrResourceResolverFactory, BundleListener {
/**
* @scr.property value="true" type="Boolean"
@@ -124,6 +126,8 @@
*/
private MimeTypeService mimeTypeService;
+ private ComponentContext componentContext;
+
/**
* This services ServiceReference for use in
* {@link #fireEvent(Bundle, String, Map)}
@@ -149,12 +153,6 @@
private Map<String, Session> adminSessions = new HashMap<String, Session>();
/**
- * The {@link ObjectContentManagerFactory} used retrieve object content
- * managers on-demand on behalf of {@link JcrResourceResolver} instances.
- */
- private ObjectContentManagerFactory objectContentManagerFactory;
-
- /**
* The initial content loader which is called to load initial content up
* into the repository when the providing bundle is installed.
*/
@@ -165,7 +163,7 @@
private Map<Long, BundleResourceProvider> bundleResourceProviderMap = new HashMap<Long, BundleResourceProvider>();
public JcrResourceResolverFactoryImpl() {
- this.rootProviderEntry = new ResourceProviderEntry("/", this);
+ this.rootProviderEntry = new ResourceProviderEntry("/", null, null);
}
// ---------- JcrResourceResolverFactory -----------------------------------
@@ -178,7 +176,9 @@
* may be cast.
*/
public ResourceResolver getResourceResolver(Session session) {
- return new JcrResourceResolver(this, session);
+ JcrResourceProviderEntry sessionRoot = new JcrResourceProviderEntry(this,
+ session, rootProviderEntry.getEntries());
+ return new JcrResourceResolver(sessionRoot, this);
}
// ---------- BundleListener -----------------------------------------------
@@ -214,14 +214,13 @@
+ event.getBundle().getBundleId() + ")", t);
}
- // register mappings before the bundle gets activated
- objectContentManagerFactory.registerMapperClient(event.getBundle());
+ case BundleEvent.STARTED:
+ // register resource provider for the started bundle
addBundleResourceProvider(event.getBundle());
break;
case BundleEvent.STOPPED:
- // remove mappings after the bundle has stopped
- objectContentManagerFactory.unregisterMapperClient(event.getBundle());
+ // remove resource provider after the bundle has stopped
removeBundleResourceProvider(event.getBundle());
break;
@@ -231,17 +230,6 @@
}
}
- // ---------- ResourceProvider ---------------------------------------------
-
- public String[] getRoots() {
- return new String[] { "/" };
- }
-
- public Resource getResource(JcrResourceResolver jcrResourceResolver,
- String path) throws RepositoryException {
- return jcrResourceResolver.createResource(path);
- }
-
// ---------- EventAdmin Event Dispatching ---------------------------------
/**
@@ -294,13 +282,11 @@
// ---------- Implementation helpers --------------------------------------
- /** return the ObjectContentManager, used by JcrResourceResolver */
- ObjectContentManager getObjectContentManager(Session session) {
- return objectContentManagerFactory.getObjectContentManager(session);
- }
-
- /** check existence of an item with admin session, used by JcrResourceResolver */
- boolean itemReallyExists(Session clientSession, String path)
+ /**
+ * check existence of an item with admin session, used by
+ * JcrResourceResolver
+ */
+ public boolean itemReallyExists(Session clientSession, String path)
throws RepositoryException {
// assume this session has more access rights than the client Session
@@ -356,7 +342,16 @@
if (prefixes != null) {
BundleResourceProvider brp = new BundleResourceProvider(bundle,
prefixes);
- rootProviderEntry.addResourceProvider(brp);
+ String[] rootPaths = brp.getRoots();
+ for (String rootPath : rootPaths) {
+ try {
+ rootProviderEntry.addResourceProvider(rootPath, brp);
+ } catch (IllegalStateException ise) {
+ log.error(
+ "addBundleResourceProvider: A ResourceProvider for {} is already registered",
+ rootPath);
+ }
+ }
bundleResourceProviderMap.put(bundle.getBundleId(), brp);
}
}
@@ -364,22 +359,24 @@
private void removeBundleResourceProvider(Bundle bundle) {
BundleResourceProvider brp = bundleResourceProviderMap.get(bundle.getBundleId());
if (brp != null) {
- rootProviderEntry.removeResourceProvider(brp);
+ String[] rootPaths = brp.getRoots();
+ for (String rootPath : rootPaths) {
+ // TODO: Do not remove this path, if another resource
+ // owns it. This may be the case if adding the provider
+ // yielded an IllegalStateException
+ rootProviderEntry.removeResourceProvider(rootPath);
+ }
}
}
- ResourceProvider getResourceProvider(String path) {
- return rootProviderEntry.getResourceProvider(path);
- }
-
// ---------- SCR Integration ---------------------------------------------
/** Activates this component, called by SCR before registering as a service */
protected void activate(ComponentContext componentContext) {
+ this.componentContext = componentContext;
this.serviceReference = componentContext.getServiceReference();
this.initialContentLoader = new Loader(this);
- this.objectContentManagerFactory = new ObjectContentManagerFactory(this);
componentContext.getBundleContext().addBundleListener(this);
@@ -395,8 +392,7 @@
}
if (bundle.getState() == Bundle.ACTIVE) {
- // register active bundles with the mapper client
- objectContentManagerFactory.registerMapperClient(bundle);
+ // add bundle resource provider for active bundles
addBundleResourceProvider(bundle);
}
}
@@ -440,7 +436,6 @@
protected void deactivate(ComponentContext componentContext) {
componentContext.getBundleContext().removeBundleListener(this);
- objectContentManagerFactory.dispose();
initialContentLoader.dispose();
Session[] sessions = adminSessions.values().toArray(
@@ -449,8 +444,41 @@
for (int i = 0; i < sessions.length; i++) {
sessions[i].logout();
}
+
+ this.componentContext = null;
}
+ protected void bindResourceProvider(ServiceReference reference) {
+ String[] roots = OsgiUtil.toStringArray(reference.getProperty(ResourceProvider.ROOTS));
+ if (roots != null && roots.length > 0) {
+
+ ResourceProvider provider = (ResourceProvider) componentContext.locateService(
+ "ResourceProvider", reference);
+
+ for (String root : roots) {
+ try {
+ rootProviderEntry.addResourceProvider(root, provider);
+ } catch (IllegalStateException ise) {
+ log.error(
+ "bindResourceProvider: A ResourceProvider for {} is already registered",
+ root);
+ }
+ }
+ }
+ }
+
+ protected void unbindResourceProvider(ServiceReference reference) {
+ String[] roots = OsgiUtil.toStringArray(reference.getProperty(ResourceProvider.ROOTS));
+ if (roots != null && roots.length > 0) {
+ for (String root : roots) {
+ // TODO: Do not remove this path, if another resource
+ // owns it. This may be the case if adding the provider
+ // yielded an IllegalStateException
+ rootProviderEntry.removeResourceProvider(root);
+ }
+ }
+ }
+
// ---------- internal helper ----------------------------------------------
/** Returns the JCR repository used by this factory */
Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java?rev=615211&r1=615210&r2=615211&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java (original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/ResourceProviderEntry.java Fri Jan 25 04:47:20 2008
@@ -22,6 +22,8 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.sling.api.resource.ResourceProvider;
+
public class ResourceProviderEntry implements Comparable<ResourceProviderEntry> {
private final String path;
@@ -29,10 +31,18 @@
private final String prefix;
private final ResourceProvider provider;
+
+ private final ResourceProviderEntry parentEntry;
private ResourceProviderEntry[] entries;
- public ResourceProviderEntry(String path, ResourceProvider provider) {
+ public ResourceProviderEntry(String path, ResourceProvider provider,
+ ResourceProviderEntry parentEntry) {
+ this(path, provider, parentEntry, null);
+ }
+
+ public ResourceProviderEntry(String path, ResourceProvider provider,
+ ResourceProviderEntry parentEntry, ResourceProviderEntry[] entries) {
if (path.endsWith("/")) {
this.path = path.substring(0, path.length() - 1);
this.prefix = path;
@@ -41,25 +51,25 @@
this.prefix = path + "/";
}
this.provider = provider;
+ this.parentEntry = parentEntry;
+ this.entries = entries;
}
- public void addResourceProvider(ResourceProvider provider) {
- String[] roots = provider.getRoots();
- for (int i = 0; i < roots.length; i++) {
- addResourceProvider(roots[i], provider);
- }
+ public ResourceProviderEntry getParentEntry() {
+ return parentEntry;
}
-
- public void removeResourceProvider(ResourceProvider provider) {
- String[] roots = provider.getRoots();
- for (int i = 0; i < roots.length; i++) {
- removeResourceProvider(roots[i]);
- }
+
+ public ResourceProvider getResourceProvider() {
+ return provider;
+ }
+
+ public ResourceProviderEntry[] getEntries() {
+ return entries;
}
- public ResourceProvider getResourceProvider(String path) {
+ public ResourceProviderEntry getResourceProvider(String path) {
if (path.equals(this.path)) {
- return provider;
+ return this;
} else if (match(path)) {
if (entries != null) {
@@ -67,15 +77,15 @@
path = path.substring(this.prefix.length());
for (ResourceProviderEntry entry : entries) {
- ResourceProvider provider = entry.getResourceProvider(path);
- if (provider != null) {
- return provider;
+ ResourceProviderEntry test = entry.getResourceProvider(path);
+ if (test != null) {
+ return test;
}
}
}
// no more specific provider, return mine
- return provider;
+ return this;
}
// no match for my prefix, return null
@@ -86,15 +96,7 @@
return path.startsWith(prefix);
}
- // ---------- Comparable<ResourceProviderEntry> interface ------------------
-
- public int compareTo(ResourceProviderEntry o) {
- return prefix.compareTo(o.prefix);
- }
-
- // ---------- internal -----------------------------------------------------
-
- private boolean addResourceProvider(String prefix, ResourceProvider provider) {
+ public boolean addResourceProvider(String prefix, ResourceProvider provider) {
if (prefix.equals(this.path)) {
throw new IllegalStateException(
"ResourceProviderEntry for prefix already exists");
@@ -112,7 +114,7 @@
} else if (entry.prefix.startsWith(prefix)
&& entry.prefix.charAt(prefix.length()) == '/') {
ResourceProviderEntry newEntry = new ResourceProviderEntry(
- prefix, provider);
+ prefix, provider, this);
newEntry.addResourceProvider(entry.path, entry.provider);
entries[i] = newEntry;
return true;
@@ -123,7 +125,7 @@
// none found, so add it here
ResourceProviderEntry entry = new ResourceProviderEntry(prefix,
- provider);
+ provider, this);
if (entries == null) {
entries = new ResourceProviderEntry[] { entry };
} else {
@@ -140,7 +142,7 @@
return false;
}
- private boolean removeResourceProvider(String prefix) {
+ public boolean removeResourceProvider(String prefix) {
if (prefix.equals(path)) {
return true;
} else if (match(prefix)) {
@@ -186,4 +188,11 @@
return false;
}
+
+ // ---------- Comparable<ResourceProviderEntry> interface ------------------
+
+ public int compareTo(ResourceProviderEntry o) {
+ return prefix.compareTo(o.prefix);
+ }
+
}