You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:46:42 UTC

[sling-org-apache-sling-jcr-classloader] 03/08: SLING-1152 : Remove deprecated interface RepositoryClassLoaderProvider (and implementations)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.jcr.classloader-3.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-classloader.git

commit 0a7b91efa9d825a9ccbf011ba209d486d1218087
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 12 08:58:00 2009 +0000

    SLING-1152 : Remove deprecated interface RepositoryClassLoaderProvider (and implementations)
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/classloader@824267 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  5 +-
 .../classloader/RepositoryClassLoaderProvider.java | 35 ---------
 .../internal/BundleProxyClassLoader.java           | 76 -------------------
 .../RepositoryClassLoaderProviderImpl.java         | 86 ----------------------
 .../OSGI-INF/metatype/metatype.properties          |  7 --
 5 files changed, 1 insertion(+), 208 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6a0958a..4d5b550 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
     </parent>
 
     <artifactId>org.apache.sling.jcr.classloader</artifactId>
-    <version>2.0.7-SNAPSHOT</version>
+    <version>3.0.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Repository ClassLoader</name>
@@ -58,9 +58,6 @@
                         <Bundle-Category>
                             sling,jcr,jackrabbit
                         </Bundle-Category>
-                        <Export-Package>
-                            org.apache.sling.jcr.classloader;version=${pom.version}
-                        </Export-Package>
                         <Private-Package>
                             org.apache.sling.jcr.classloader.internal.*,
                             org.apache.jackrabbit;
diff --git a/src/main/java/org/apache/sling/jcr/classloader/RepositoryClassLoaderProvider.java b/src/main/java/org/apache/sling/jcr/classloader/RepositoryClassLoaderProvider.java
deleted file mode 100644
index 66af2f4..0000000
--- a/src/main/java/org/apache/sling/jcr/classloader/RepositoryClassLoaderProvider.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.sling.jcr.classloader;
-
-import javax.jcr.RepositoryException;
-
-/**
- * The <code>RepositoryClassLoaderProvider</code>
- *
- * @deprecated Use the {@link org.apache.sling.commons.classloader.DynamicClassLoaderManager}
- * instead.
- */
-@Deprecated
-public interface RepositoryClassLoaderProvider {
-
-    ClassLoader getClassLoader(String owner) throws RepositoryException;
-    void ungetClassLoader(ClassLoader classLoader);
-
-}
diff --git a/src/main/java/org/apache/sling/jcr/classloader/internal/BundleProxyClassLoader.java b/src/main/java/org/apache/sling/jcr/classloader/internal/BundleProxyClassLoader.java
deleted file mode 100644
index 8bb76c1..0000000
--- a/src/main/java/org/apache/sling/jcr/classloader/internal/BundleProxyClassLoader.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.sling.jcr.classloader.internal;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-
-import org.osgi.framework.Bundle;
-
-/**
- * The <code>BundleProxyDelegate</code> TODO
- */
-/* package */ class BundleProxyClassLoader extends ClassLoader {
-
-    private Bundle bundle;
-    private ClassLoader parent;
-
-    public BundleProxyClassLoader(Bundle bundle) {
-        this.bundle = bundle;
-    }
-
-    public BundleProxyClassLoader(Bundle bundle, ClassLoader parent) {
-        super(parent);
-        this.parent = parent;
-        this.bundle = bundle;
-    }
-
-    // Note: Both ClassLoader.getResources(...) and bundle.getResources(...) consult
-    // the boot classloader. As a result, BundleProxyClassLoader.getResources(...)
-    // might return duplicate results from the boot classloader. Prior to Java 5
-    // Classloader.getResources was marked final. If your target environment requires
-    // at least Java 5 you can prevent the occurence of duplicate boot classloader
-    // resources by overriding ClassLoader.getResources(...) instead of
-    // ClassLoader.findResources(...).
-    @SuppressWarnings("unchecked")
-    public Enumeration<URL> findResources(String name) throws IOException {
-        return this.bundle.getResources(name);
-    }
-
-    public URL findResource(String name) {
-        return this.bundle.getResource(name);
-    }
-
-    public Class<?> findClass(String name) throws ClassNotFoundException {
-        return this.bundle.loadClass(name);
-    }
-
-    public URL getResource(String name) {
-        return (this.parent == null) ? this.findResource(name) : super.getResource(name);
-    }
-
-    protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        Class<?> clazz = (this.parent == null) ? this.findClass(name) : super.loadClass(name, false);
-        if (resolve) {
-            super.resolveClass(clazz);
-        }
-        return clazz;
-    }
-}
diff --git a/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java b/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
deleted file mode 100644
index 389a585..0000000
--- a/src/main/java/org/apache/sling/jcr/classloader/internal/RepositoryClassLoaderProviderImpl.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.sling.jcr.classloader.internal;
-
-import org.apache.sling.jcr.classloader.RepositoryClassLoaderProvider;
-import org.osgi.framework.Bundle;
-import org.osgi.service.component.ComponentContext;
-
-/**
- * The <code>RepositoryClassLoaderProviderImpl</code> TODO
- *
- * @scr.component inherit="false" label="%deprecatedloader.name"
- *      description="%deprecatedloader.description"
- * @scr.property name="service.vendor" value="The Apache Software Foundation"
- * @scr.property name="service.description"
- *      value="Provides Repository ClassLoaders"
- * @scr.service servicefactory="true" interface="RepositoryClassLoaderProvider"
- * @scr.property nameRef="DynamicClassLoaderProviderImpl.CLASS_PATH_PROP" valueRefs0="DynamicClassLoaderProviderImpl.CLASS_PATH_DEFAULT"
- * @scr.property nameRef="DynamicClassLoaderProviderImpl.OWNER_PROP" valueRef="DynamicClassLoaderProviderImpl.OWNER_DEFAULT"
- * @scr.reference name="repository" interface="org.apache.sling.jcr.api.SlingRepository"
- * @scr.reference name="mimeTypeService" policy="dynamic" interface="org.apache.sling.commons.mime.MimeTypeService"
- */
-public class RepositoryClassLoaderProviderImpl
-        extends DynamicClassLoaderProviderImpl
-        implements RepositoryClassLoaderProvider {
-
-    private BundleProxyClassLoader parent;
-
-    private RepositoryClassLoaderFacade classLoaderFacade;
-
-    /**
-     * @see org.apache.sling.jcr.classloader.RepositoryClassLoaderProvider#getClassLoader(java.lang.String)
-     */
-    public ClassLoader getClassLoader(String owner) {
-        if (this.classLoaderFacade == null) {
-            this.classLoaderFacade = new RepositoryClassLoaderFacade(this, this.parent,
-                this.getClassPaths());
-        }
-
-        return this.classLoaderFacade;
-    }
-
-    /**
-     * @see org.apache.sling.jcr.classloader.RepositoryClassLoaderProvider#ungetClassLoader(java.lang.ClassLoader)
-     */
-    public void ungetClassLoader(ClassLoader classLoader) {
-        // nothing to do
-    }
-
-    protected void activate(ComponentContext componentContext) {
-        super.activate(componentContext);
-        final Bundle owner = componentContext.getUsingBundle();
-
-        // if there is no using bundle, we have an error !!
-        if (owner == null) {
-            throw new IllegalStateException("Using Bundle expected. Is this a servicefactory component ?");
-        }
-        this.parent = new BundleProxyClassLoader(owner, null);
-    }
-
-    @SuppressWarnings("unchecked")
-    protected void deactivate(ComponentContext componentContext) {
-        if ( this.classLoaderFacade != null ) {
-            this.classLoaderFacade.destroy();
-            this.classLoaderFacade = null;
-        }
-        this.parent = null;
-        super.deactivate(componentContext);
-    }
-}
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 49b1383..247648b 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -22,13 +22,6 @@
 # descriptions as used in the metatype.xml descriptor generated by the
 # the Sling SCR plugin
 
-deprecatedloader.name = Apache Sling Repository Class Loader Factory
-deprecatedloader.description = Configuration for the Repository Class Loader Factory. This \
- configuration applies to all clients of the factory even though each Bundle \
- using the factory retrieves its own factory. The class path of the created \
- Repository Class Loaders is configurable and the class loaders delegate use \
- the bundle asking for the factory as the parent class loader.
-
 loader.name = Apache Sling Repository Class Loader Factory
 loader.description = Configuration for the Repository Class Loader. The class path of the created \
  Repository Class Loaders is configurable.

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.