diff --git a/pom.xml b/pom.xml index db36b0f..9e2646b 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ <_nouses>true - org.codehaus.classworlds.*;org.codehaus.plexus.classworlds.* + org.codehaus.plexus.classworlds.* @@ -127,7 +127,7 @@ maven-surefire-plugin true - -ea:org.codehaus.classworlds:org.codehaus.plexus.classworlds + -ea:org.codehaus.plexus.classworlds 1 diff --git a/src/main/java/org/codehaus/classworlds/BytesURLConnection.java b/src/main/java/org/codehaus/classworlds/BytesURLConnection.java deleted file mode 100644 index c42c168..0000000 --- a/src/main/java/org/codehaus/classworlds/BytesURLConnection.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; - -/** - */ -@Deprecated -public class BytesURLConnection extends URLConnection { - protected final byte[] content; - - protected int offset; - - protected int length; - - public BytesURLConnection(URL url, byte[] content) { - super(url); - this.content = content; - } - - public void connect() {} - - public InputStream getInputStream() { - return new ByteArrayInputStream(content); - } -} diff --git a/src/main/java/org/codehaus/classworlds/BytesURLStreamHandler.java b/src/main/java/org/codehaus/classworlds/BytesURLStreamHandler.java deleted file mode 100644 index 894adaf..0000000 --- a/src/main/java/org/codehaus/classworlds/BytesURLStreamHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; - -/** - * @author Hani Suleiman (hani@formicary.net) - * Date: Oct 20, 2003 - * Time: 12:45:18 AM - */ -@Deprecated -public class BytesURLStreamHandler extends URLStreamHandler { - final byte[] content; - - int offset; - - int length; - - public BytesURLStreamHandler(byte[] content) { - this.content = content; - } - - public URLConnection openConnection(URL url) { - return new BytesURLConnection(url, content); - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassRealm.java b/src/main/java/org/codehaus/classworlds/ClassRealm.java deleted file mode 100644 index 389b52a..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealm.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.codehaus.classworlds; - -/* - -Copyright 2002 (C) The Werken Company. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "classworlds" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - -4. Products derived from this Software may not be called "classworlds" - nor may "classworlds" appear in their names without prior written - permission of The Werken Company. "classworlds" is a registered - trademark of The Werken Company. - -5. Due credit should be given to The Werken Company. - (http://classworlds.werken.com/). - -THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -/** - *

Autonomous sub-portion of a ClassWorld.

- * - *

This class most closed maps to the ClassLoader - * role from Java and in facts can provide a ClassLoader - * view of itself using {@link #getClassLoader}.

- * - * @author bob mcwhirter - * @author Jason van Zyl - */ -@SuppressWarnings("rawtypes") -@Deprecated -public interface ClassRealm { - String getId(); - - ClassWorld getWorld(); - - void importFrom(String realmId, String pkgName) throws NoSuchRealmException; - - void addConstituent(URL constituent); - - ClassRealm locateSourceRealm(String className); - - void setParent(ClassRealm classRealm); - - ClassRealm createChildRealm(String id) throws DuplicateRealmException; - - ClassLoader getClassLoader(); - - ClassRealm getParent(); - - URL[] getConstituents(); - - // ---------------------------------------------------------------------- - // Classloading - // ---------------------------------------------------------------------- - - Class loadClass(String name) throws ClassNotFoundException; - - // ---------------------------------------------------------------------- - // Resource handling - // ---------------------------------------------------------------------- - - URL getResource(String name); - - Enumeration findResources(String name) throws IOException; - - InputStream getResourceAsStream(String name); - - void display(); -} diff --git a/src/main/java/org/codehaus/classworlds/ClassRealmAdapter.java b/src/main/java/org/codehaus/classworlds/ClassRealmAdapter.java deleted file mode 100644 index 27b8cd9..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealmAdapter.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -/** - * An adapter for ClassRealms - * - * @author Andrew Williams - */ -@SuppressWarnings({"UnnecessaryLocalVariable", "DeprecatedIsStillUsed", "rawtypes"}) -@Deprecated -public class ClassRealmAdapter implements ClassRealm { - - public static ClassRealmAdapter getInstance(org.codehaus.plexus.classworlds.realm.ClassRealm newRealm) { - ClassRealmAdapter adapter = new ClassRealmAdapter(newRealm); - - return adapter; - } - - private final org.codehaus.plexus.classworlds.realm.ClassRealm realm; - - private ClassRealmAdapter(org.codehaus.plexus.classworlds.realm.ClassRealm newRealm) { - this.realm = newRealm; - } - - public String getId() { - return realm.getId(); - } - - public ClassWorld getWorld() { - return ClassWorldAdapter.getInstance(realm.getWorld()); - } - - public void importFrom(String realmId, String pkgName) throws NoSuchRealmException { - try { - realm.importFrom(realmId, pkgName); - } catch (org.codehaus.plexus.classworlds.realm.NoSuchRealmException e) { - throw new NoSuchRealmException(getWorld(), e.getId()); - } - } - - public void addConstituent(URL constituent) { - realm.addURL(constituent); - } - - public ClassRealm locateSourceRealm(String className) { - ClassLoader importLoader = realm.getImportClassLoader(className); - - if (importLoader instanceof org.codehaus.plexus.classworlds.realm.ClassRealm) { - return ClassRealmAdapter.getInstance((org.codehaus.plexus.classworlds.realm.ClassRealm) importLoader); - } else { - return null; - } - } - - public void setParent(ClassRealm classRealm) { - if (classRealm != null) { - realm.setParentRealm(ClassRealmReverseAdapter.getInstance(classRealm)); - } - } - - public ClassRealm createChildRealm(String id) throws DuplicateRealmException { - try { - return ClassRealmAdapter.getInstance(realm.createChildRealm(id)); - } catch (org.codehaus.plexus.classworlds.realm.DuplicateRealmException e) { - throw new DuplicateRealmException(getWorld(), e.getId()); - } - } - - public ClassLoader getClassLoader() { - return realm; - } - - public ClassRealm getParent() { - return ClassRealmAdapter.getInstance(realm.getParentRealm()); - } - - public ClassRealm getParentRealm() { - return ClassRealmAdapter.getInstance(realm.getParentRealm()); - } - - public URL[] getConstituents() { - return realm.getURLs(); - } - - public Class loadClass(String name) throws ClassNotFoundException { - return realm.loadClass(name); - } - - public URL getResource(String name) { - return realm.getResource(trimLeadingSlash(name)); - } - - public Enumeration findResources(String name) throws IOException { - return realm.findResources(trimLeadingSlash(name)); - } - - public InputStream getResourceAsStream(String name) { - return realm.getResourceAsStream(trimLeadingSlash(name)); - } - - public void display() { - realm.display(); - } - - public boolean equals(Object o) { - if (!(o instanceof ClassRealm)) return false; - - return getId().equals(((ClassRealm) o).getId()); - } - - /** - * Provides backward-compat with the old classworlds which accepted resource names with leading slashes. - */ - private String trimLeadingSlash(String resource) { - if (resource != null && resource.startsWith("/")) { - return resource.substring(1); - } else { - return resource; - } - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassRealmReverseAdapter.java b/src/main/java/org/codehaus/classworlds/ClassRealmReverseAdapter.java deleted file mode 100644 index f6eca5d..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealmReverseAdapter.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -/** - * A reverse adapter for ClassRealms - * - * @author Andrew Williams - */ -@SuppressWarnings({"UnnecessaryLocalVariable", "rawtypes"}) -@Deprecated -public class ClassRealmReverseAdapter extends org.codehaus.plexus.classworlds.realm.ClassRealm { - - public static ClassRealmReverseAdapter getInstance(ClassRealm oldRealm) { - ClassRealmReverseAdapter adapter = new ClassRealmReverseAdapter(oldRealm); - - return adapter; - } - - private final ClassRealm realm; - - private ClassRealmReverseAdapter(ClassRealm oldRealm) { - super(ClassWorldReverseAdapter.getInstance(oldRealm.getWorld()), oldRealm.getId(), oldRealm.getClassLoader()); - this.realm = oldRealm; - } - - public String getId() { - return realm.getId(); - } - - public org.codehaus.plexus.classworlds.ClassWorld getWorld() { - return ClassWorldReverseAdapter.getInstance(realm.getWorld()); - } - - public void importFrom(String realmId, String pkgName) - throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException { - try { - realm.importFrom(realmId, pkgName); - } catch (NoSuchRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException(getWorld(), e.getId()); - } - } - - public void addURL(URL constituent) { - realm.addConstituent(constituent); - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm locateSourceRealm(String className) { - return getInstance(realm.locateSourceRealm(className)); - } - - public void setParentRealm(org.codehaus.plexus.classworlds.realm.ClassRealm classRealm) { - realm.setParent(ClassRealmAdapter.getInstance(classRealm)); - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm createChildRealm(String id) - throws org.codehaus.plexus.classworlds.realm.DuplicateRealmException { - try { - return getInstance(realm.createChildRealm(id)); - } catch (DuplicateRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.DuplicateRealmException(getWorld(), e.getId()); - } - } - - public ClassLoader getClassLoader() { - return realm.getClassLoader(); - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm getParentRealm() { - return getInstance(realm.getParent()); - } - - public URL[] getURLs() { - return realm.getConstituents(); - } - - public Class loadClass(String name) throws ClassNotFoundException { - return realm.loadClass(name); - } - - public URL getResource(String name) { - return realm.getResource(name); - } - - @SuppressWarnings("unchecked") - public Enumeration findResources(String name) throws IOException { - return realm.findResources(name); - } - - public InputStream getResourceAsStream(String name) { - return realm.getResourceAsStream(name); - } - - public void display() { - realm.display(); - } - - public boolean equals(Object o) { - if (!(o instanceof ClassRealm)) return false; - - return getId().equals(((ClassRealm) o).getId()); - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassWorld.java b/src/main/java/org/codehaus/classworlds/ClassWorld.java deleted file mode 100644 index 3e497ba..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorld.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.util.Collection; - -/** - * A compatibility wrapper for org.codehaus.plexus.classworlds.ClassWorld - * provided for legacy code - * - * @author Andrew Williams - */ -@SuppressWarnings("rawtypes") -@Deprecated -public class ClassWorld { - private ClassWorldAdapter adapter; - - public ClassWorld(String realmId, ClassLoader classLoader) { - adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld(realmId, classLoader)); - } - - public ClassWorld() { - adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld()); - } - - public ClassWorld(boolean ignore) { - /* fake */ - } - - public ClassRealm newRealm(String id) throws DuplicateRealmException { - return adapter.newRealm(id); - } - - public ClassRealm newRealm(String id, ClassLoader classLoader) throws DuplicateRealmException { - return adapter.newRealm(id, classLoader); - } - - public void disposeRealm(String id) throws NoSuchRealmException { - adapter.disposeRealm(id); - } - - public ClassRealm getRealm(String id) throws NoSuchRealmException { - return adapter.getRealm(id); - } - - public Collection getRealms() { - return adapter.getRealms(); - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassWorldAdapter.java b/src/main/java/org/codehaus/classworlds/ClassWorldAdapter.java deleted file mode 100644 index 0bc4af9..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldAdapter.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.util.Collection; -import java.util.Vector; - -/** - * An adapter for ClassWorlds - * - * @author Andrew Williams - */ -@SuppressWarnings("rawtypes") -@Deprecated -public class ClassWorldAdapter extends ClassWorld { - - public static ClassWorldAdapter getInstance(org.codehaus.plexus.classworlds.ClassWorld newWorld) { - return new ClassWorldAdapter(newWorld); - } - - private final org.codehaus.plexus.classworlds.ClassWorld world; - - private ClassWorldAdapter(org.codehaus.plexus.classworlds.ClassWorld newWorld) { - super(false); - this.world = newWorld; - } - - public ClassRealm newRealm(String id) throws DuplicateRealmException { - try { - return ClassRealmAdapter.getInstance(world.newRealm(id)); - } catch (org.codehaus.plexus.classworlds.realm.DuplicateRealmException e) { - throw new DuplicateRealmException(this, e.getId()); - } - } - - public ClassRealm newRealm(String id, ClassLoader classLoader) throws DuplicateRealmException { - try { - return ClassRealmAdapter.getInstance(world.newRealm(id, classLoader)); - } catch (org.codehaus.plexus.classworlds.realm.DuplicateRealmException e) { - throw new DuplicateRealmException(this, e.getId()); - } - } - - public void disposeRealm(String id) throws NoSuchRealmException { - try { - world.disposeRealm(id); - } catch (org.codehaus.plexus.classworlds.realm.NoSuchRealmException e) { - throw new NoSuchRealmException(this, e.getId()); - } - } - - public ClassRealm getRealm(String id) throws NoSuchRealmException { - try { - return ClassRealmAdapter.getInstance(world.getRealm(id)); - } catch (org.codehaus.plexus.classworlds.realm.NoSuchRealmException e) { - throw new NoSuchRealmException(this, e.getId()); - } - } - - public Collection getRealms() { - Collection realms = world.getRealms(); - Vector ret = new Vector<>(); - for (org.codehaus.plexus.classworlds.realm.ClassRealm classRealm : realms) { - ret.add(ClassRealmAdapter.getInstance(classRealm)); - } - - return ret; - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassWorldException.java b/src/main/java/org/codehaus/classworlds/ClassWorldException.java deleted file mode 100644 index 749752d..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldException.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.codehaus.classworlds; - -/* - -Copyright 2002 (C) The Werken Company. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "classworlds" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - -4. Products derived from this Software may not be called "classworlds" - nor may "classworlds" appear in their names without prior written - permission of The Werken Company. "classworlds" is a registered - trademark of The Werken Company. - -5. Due credit should be given to The Werken Company. - (http://classworlds.werken.com/). - -THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/** - * Base exception for ClassWorld errors. - * - * @author bob mcwhirter - */ -@Deprecated -public class ClassWorldException extends Exception { - // ------------------------------------------------------------ - // Instance members - // ------------------------------------------------------------ - - /** - * The world. - */ - private final ClassWorld world; - - // ------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------ - - /** - * Construct. - * - * @param world The world. - */ - public ClassWorldException(final ClassWorld world) { - this.world = world; - } - - /** - * Construct. - * - * @param world The world. - * @param msg The detail message. - */ - public ClassWorldException(final ClassWorld world, final String msg) { - super(msg); - this.world = world; - } - - // ------------------------------------------------------------ - // Instance methods - // ------------------------------------------------------------ - - /** - * Retrieve the world. - * - * @return The world. - */ - public ClassWorld getWorld() { - return this.world; - } -} diff --git a/src/main/java/org/codehaus/classworlds/ClassWorldReverseAdapter.java b/src/main/java/org/codehaus/classworlds/ClassWorldReverseAdapter.java deleted file mode 100644 index 31c9131..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldReverseAdapter.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.util.Collection; -import java.util.HashMap; -import java.util.Vector; - -/** - * A reverse adapter for ClassWorlds - * - * @author Andrew Williams - */ -@SuppressWarnings({"unchecked", "rawtypes"}) -@Deprecated -public class ClassWorldReverseAdapter extends org.codehaus.plexus.classworlds.ClassWorld { - private static final HashMap instances = new HashMap(); - - public static ClassWorldReverseAdapter getInstance(ClassWorld oldWorld) { - if (instances.containsKey(oldWorld)) return (ClassWorldReverseAdapter) instances.get(oldWorld); - - ClassWorldReverseAdapter adapter = new ClassWorldReverseAdapter(oldWorld); - instances.put(oldWorld, adapter); - - return adapter; - } - - private final ClassWorld world; - - private ClassWorldReverseAdapter(ClassWorld newWorld) { - super(); - this.world = newWorld; - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm newRealm(String id) - throws org.codehaus.plexus.classworlds.realm.DuplicateRealmException { - try { - return ClassRealmReverseAdapter.getInstance(world.newRealm(id)); - } catch (DuplicateRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.DuplicateRealmException(this, e.getId()); - } - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm newRealm(String id, ClassLoader classLoader) - throws org.codehaus.plexus.classworlds.realm.DuplicateRealmException { - try { - return ClassRealmReverseAdapter.getInstance(world.newRealm(id, classLoader)); - } catch (DuplicateRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.DuplicateRealmException(this, e.getId()); - } - } - - public void disposeRealm(String id) throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException { - try { - world.disposeRealm(id); - } catch (NoSuchRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException(this, e.getId()); - } - } - - public org.codehaus.plexus.classworlds.realm.ClassRealm getRealm(String id) - throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException { - try { - return ClassRealmReverseAdapter.getInstance(world.getRealm(id)); - } catch (NoSuchRealmException e) { - throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException(this, e.getId()); - } - } - - public Collection getRealms() { - Collection realms = world.getRealms(); - Vector ret = new Vector(); - - for (Object o : realms) { - ClassRealm realm = (ClassRealm) o; - ret.add(ClassRealmReverseAdapter.getInstance(realm)); - } - - return ret; - } -} diff --git a/src/main/java/org/codehaus/classworlds/ConfigurationException.java b/src/main/java/org/codehaus/classworlds/ConfigurationException.java deleted file mode 100644 index f536be2..0000000 --- a/src/main/java/org/codehaus/classworlds/ConfigurationException.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.codehaus.classworlds; - -/* - -Copyright 2002 (C) The Werken Company. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "classworlds" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - -4. Products derived from this Software may not be called "classworlds" - nor may "classworlds" appear in their names without prior written - permission of The Werken Company. "classworlds" is a registered - trademark of The Werken Company. - -5. Due credit should be given to The Werken Company. - (http://classworlds.werken.com/). - -THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/** - * Indicates an error during Launcher configuration. - * - * @author bob mcwhirter - */ -@Deprecated -public class ConfigurationException extends Exception { - /** - * Construct. - * - * @param msg The message. - */ - public ConfigurationException(String msg) { - super(msg); - } - - /** - * Construct. - * - * @param msg The message. - * @param lineNo The number of configuraton line where the problem occured. - * @param line The configuration line where the problem occured. - */ - public ConfigurationException(String msg, int lineNo, String line) { - super(msg + " (" + lineNo + "): " + line); - } -} diff --git a/src/main/java/org/codehaus/classworlds/Configurator.java b/src/main/java/org/codehaus/classworlds/Configurator.java deleted file mode 100644 index 5f76e53..0000000 --- a/src/main/java/org/codehaus/classworlds/Configurator.java +++ /dev/null @@ -1,129 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; - -/** - * A compatibility wrapper for org.codehaus.plexus.classworlds.launcher.Configurator - * provided for legacy code - * - * @author Andrew Williams - */ -@Deprecated -public class Configurator { - private final ConfiguratorAdapter config; - - /** Construct. - * - * @param launcher The launcher to configure. - */ - public Configurator(Launcher launcher) { - config = ConfiguratorAdapter.getInstance( - new org.codehaus.plexus.classworlds.launcher.Configurator(launcher), launcher); - } - - /** Construct. - * - * @param world The classWorld to configure. - */ - public Configurator(ClassWorld world) { - config = ConfiguratorAdapter.getInstance( - new org.codehaus.plexus.classworlds.launcher.Configurator(ClassWorldReverseAdapter.getInstance(world)), - world); - } - - /** set world. - * this setter is provided so you can use the same configurator to configure several "worlds" - * - * @param world The classWorld to configure. - */ - public void setClassWorld(ClassWorld world) { - config.setClassWorld(world); - } - - /** - * Configure from a file. - * - * @param is The config input stream - * @throws IOException If an error occurs reading the config file. - * @throws MalformedURLException If the config file contains invalid URLs. - * @throws ConfigurationException If the config file is corrupt. - * @throws DuplicateRealmException If the config file defines two realms with the same id. - * @throws NoSuchRealmException If the config file defines a main entry point in - * a non-existent realm. - */ - public void configure(InputStream is) - throws IOException, MalformedURLException, ConfigurationException, DuplicateRealmException, - NoSuchRealmException { - config.configureAdapter(is); - } - - /** - * Associate parent realms with their children. - */ - protected void associateRealms() { - config.associateRealms(); - } - - /** - * Load a glob into the specified classloader. - * - * @param line The path configuration line. - * @param realm The realm to populate - * @throws MalformedURLException If the line does not represent - * a valid path element. - * @throws FileNotFoundException If the line does not represent - * a valid path element in the filesystem. - */ - protected void loadGlob(String line, ClassRealm realm) throws MalformedURLException, FileNotFoundException { - loadGlob(line, realm, false); - } - - /** - * Load a glob into the specified classloader. - * - * @param line The path configuration line. - * @param realm The realm to populate - * @param optionally Whether the path is optional or required - * @throws MalformedURLException If the line does not represent - * a valid path element. - * @throws FileNotFoundException If the line does not represent - * a valid path element in the filesystem. - */ - @SuppressWarnings("RedundantThrows") - protected void loadGlob(String line, ClassRealm realm, boolean optionally) - throws MalformedURLException, FileNotFoundException { - config.loadGlob(line, realm, optionally); - } - - /** - * Filter a string for system properties. - * - * @param text The text to filter. - * @return The filtered text. - * @throws ConfigurationException If the property does not - * exist or if there is a syntax error. - */ - @SuppressWarnings("RedundantThrows") - protected String filter(String text) throws ConfigurationException { - return config.filter(text); - } -} diff --git a/src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java b/src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java deleted file mode 100644 index 3704171..0000000 --- a/src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; - -/** - */ -@Deprecated -public class ConfiguratorAdapter extends Configurator { - - public static ConfiguratorAdapter getInstance( - org.codehaus.plexus.classworlds.launcher.Configurator newConfig, Launcher launcher) { - return new ConfiguratorAdapter(newConfig, launcher); - } - - public static ConfiguratorAdapter getInstance( - org.codehaus.plexus.classworlds.launcher.Configurator newConfig, ClassWorld world) { - return new ConfiguratorAdapter(newConfig, world); - } - - private final org.codehaus.plexus.classworlds.launcher.Configurator config; - - private ConfiguratorAdapter(org.codehaus.plexus.classworlds.launcher.Configurator config, Launcher launcher) { - super(launcher); - this.config = config; - } - - private ConfiguratorAdapter(org.codehaus.plexus.classworlds.launcher.Configurator config, ClassWorld world) { - super(world); - this.config = config; - } - - public void associateRealms() { - config.associateRealms(); - } - - @SuppressWarnings("DuplicateThrows") - public void configureAdapter(InputStream is) - throws IOException, MalformedURLException, ConfigurationException, DuplicateRealmException, - NoSuchRealmException { - try { - config.configure(is); - } catch (org.codehaus.plexus.classworlds.launcher.ConfigurationException e) { - throw new ConfigurationException(e.getMessage()); - } catch (org.codehaus.plexus.classworlds.realm.DuplicateRealmException e) { - throw new DuplicateRealmException(ClassWorldAdapter.getInstance(e.getWorld()), e.getId()); - } catch (org.codehaus.plexus.classworlds.realm.NoSuchRealmException e) { - throw new NoSuchRealmException(ClassWorldAdapter.getInstance(e.getWorld()), e.getId()); - } - } -} diff --git a/src/main/java/org/codehaus/classworlds/DefaultClassRealm.java b/src/main/java/org/codehaus/classworlds/DefaultClassRealm.java deleted file mode 100644 index d743525..0000000 --- a/src/main/java/org/codehaus/classworlds/DefaultClassRealm.java +++ /dev/null @@ -1,141 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -/* - * A compatibility wrapper for org.codehaus.plexus.classworlds.realm.ClassRealm - * provided for legacy code - * - * @author Andrew Williams - */ - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -@SuppressWarnings("rawtypes") -@Deprecated -public class DefaultClassRealm implements ClassRealm { - private final ClassRealmAdapter adapter; - - public DefaultClassRealm(ClassWorld world, String id) { - this(world, id, null); - } - - public DefaultClassRealm(ClassWorld world, String id, ClassLoader foreignClassLoader) { - this.adapter = ClassRealmAdapter.getInstance(new org.codehaus.plexus.classworlds.realm.ClassRealm( - ClassWorldReverseAdapter.getInstance(world), id, foreignClassLoader)); - } - - public URL[] getConstituents() { - return adapter.getConstituents(); - } - - public ClassRealm getParent() { - return adapter.getParentRealm(); - } - - public void setParent(ClassRealm parent) { - adapter.setParent(parent); - } - - public String getId() { - return adapter.getId(); - } - - public ClassWorld getWorld() { - return adapter.getWorld(); - } - - public void importFrom(String realmId, String packageName) throws NoSuchRealmException { - adapter.importFrom(realmId, packageName); - } - - public void addConstituent(URL constituent) { - adapter.addConstituent(constituent); - } - - /** - * Adds a byte[] class definition as a constituent for locating classes. - * Currently uses BytesURLStreamHandler to hold a reference of the byte[] in memory. - * This ensures we have a unifed URL resource model for all constituents. - * The code to cache to disk is commented out - maybe a property to choose which method? - * - * @param constituent class name - * @param b the class definition as a byte[] - * @throws ClassNotFoundException when class couldn't be loaded - */ - public void addConstituent(String constituent, byte[] b) throws ClassNotFoundException { - try { - File path, file; - if (constituent.lastIndexOf('.') != -1) { - path = new File("byteclass/" - + constituent - .substring(0, constituent.lastIndexOf('.') + 1) - .replace('.', File.separatorChar)); - - file = new File(path, constituent.substring(constituent.lastIndexOf('.') + 1) + ".class"); - } else { - path = new File("byteclass/"); - - file = new File(path, constituent + ".class"); - } - - addConstituent(new URL(null, file.toURI().toURL().toExternalForm(), new BytesURLStreamHandler(b))); - } catch (java.io.IOException e) { - throw new ClassNotFoundException("Couldn't load byte stream.", e); - } - } - - public ClassRealm locateSourceRealm(String classname) { - return adapter.locateSourceRealm(classname); - } - - public ClassLoader getClassLoader() { - return adapter.getClassLoader(); - } - - public ClassRealm createChildRealm(String id) throws DuplicateRealmException { - return adapter.createChildRealm(id); - } - - // ---------------------------------------------------------------------- - // ClassLoader API - // ---------------------------------------------------------------------- - - public Class loadClass(String name) throws ClassNotFoundException { - return adapter.loadClass(name); - } - - public URL getResource(String name) { - return adapter.getResource(name); - } - - public InputStream getResourceAsStream(String name) { - return adapter.getResourceAsStream(name); - } - - public Enumeration findResources(String name) throws IOException { - return adapter.findResources(name); - } - - public void display() { - adapter.display(); - } -} diff --git a/src/main/java/org/codehaus/classworlds/DuplicateRealmException.java b/src/main/java/org/codehaus/classworlds/DuplicateRealmException.java deleted file mode 100644 index cc8df3f..0000000 --- a/src/main/java/org/codehaus/classworlds/DuplicateRealmException.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.codehaus.classworlds; - -/* - -Copyright 2002 (C) The Werken Company. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "classworlds" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - -4. Products derived from this Software may not be called "classworlds" - nor may "classworlds" appear in their names without prior written - permission of The Werken Company. "classworlds" is a registered - trademark of The Werken Company. - -5. Due credit should be given to The Werken Company. - (http://classworlds.werken.com/). - -THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/** - * Indicates an attempt to add a ClassRealm to a - * ClassWorld with a duplicate id. - * - * @author bob mcwhirter - */ -@Deprecated -public class DuplicateRealmException extends ClassWorldException { - // ------------------------------------------------------------ - // Instance members - // ------------------------------------------------------------ - - /** - * The realm id. - */ - private final String id; - - // ------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------ - - /** - * Construct. - * - * @param world The world. - * @param id The realm id. - */ - public DuplicateRealmException(ClassWorld world, String id) { - super(world, id); - this.id = id; - } - - // ------------------------------------------------------------ - // Instance methods - // ------------------------------------------------------------ - - /** - * Retrieve the duplicate realm id. - * - * @return The id. - */ - public String getId() { - return this.id; - } -} diff --git a/src/main/java/org/codehaus/classworlds/Launcher.java b/src/main/java/org/codehaus/classworlds/Launcher.java deleted file mode 100644 index 261f879..0000000 --- a/src/main/java/org/codehaus/classworlds/Launcher.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.codehaus.classworlds; - -/* - * Copyright 2001-2010 Codehaus 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. - */ - -/** - * A compatibility wrapper for org.codehaus.plexus.classworlds.launcher.Launcher - * provided for legacy code - * - * @author Andrew Williams - */ -@Deprecated -public class Launcher extends org.codehaus.plexus.classworlds.launcher.Launcher { - public Launcher() {} - - // ------------------------------------------------------------ - // Class methods - // ------------------------------------------------------------ - - /** - * Launch the launcher from the command line. - * Will exit using System.exit with an exit code of 0 for success, 100 if there was an unknown exception, - * or some other code for an application error. - * - * @param args The application command-line arguments. - */ - public static void main(String[] args) { - org.codehaus.plexus.classworlds.launcher.Launcher.main(args); - } - - /** - * Launch the launcher. - * - * @param args The application command-line arguments. - * @return an integer exit code - * @throws Exception If an error occurs. - */ - public static int mainWithExitCode(String[] args) throws Exception { - return org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(args); - } -} diff --git a/src/main/java/org/codehaus/classworlds/NoSuchRealmException.java b/src/main/java/org/codehaus/classworlds/NoSuchRealmException.java deleted file mode 100644 index 4e388ed..0000000 --- a/src/main/java/org/codehaus/classworlds/NoSuchRealmException.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.codehaus.classworlds; - -/* - -Copyright 2002 (C) The Werken Company. All Rights Reserved. - -Redistribution and use of this software and associated documentation -("Software"), with or without modification, are permitted provided -that the following conditions are met: - -1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - -2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - -3. The name "classworlds" must not be used to endorse or promote - products derived from this Software without prior written - permission of The Werken Company. For written permission, - please contact bob@werken.com. - -4. Products derived from this Software may not be called "classworlds" - nor may "classworlds" appear in their names without prior written - permission of The Werken Company. "classworlds" is a registered - trademark of The Werken Company. - -5. Due credit should be given to The Werken Company. - (http://classworlds.werken.com/). - -THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -/** - * Indicates an attempt to retrieve a ClassRealm from a - * ClassWorld with an invalid id. - * - * @author bob mcwhirter - */ -@Deprecated -public class NoSuchRealmException extends ClassWorldException { - // ------------------------------------------------------------ - // Instance members - // ------------------------------------------------------------ - - /** - * The realm id. - */ - private final String id; - - // ------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------ - - /** - * Construct. - * - * @param world The world. - * @param id The realm id. - */ - public NoSuchRealmException(ClassWorld world, String id) { - super(world, id); - this.id = id; - } - - // ------------------------------------------------------------ - // Instance methods - // ------------------------------------------------------------ - - /** - * Retrieve the invalid realm id. - * - * @return The id. - */ - public String getId() { - return this.id; - } -} diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index a4a2e60..a7ff21b 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -18,7 +18,7 @@ much headache and confusion for certain types of application developers. Projects which involve dynamic loading of components or otherwise represent a 'container' can benefit from the classloading - control provided by Classworlds. + control provided by Classworlds.

@@ -47,7 +47,7 @@

- This model allows for fine-grained control of which + This model allows for fine-grained control of which classloader loads any particular class. This form of partial isolation can reduce the myriad strange errors that are produced by loading classes from multiple @@ -61,12 +61,6 @@ from a configuration file and the launching of the application's main method from the correct class loaded through the correct classloader.

- -

- And for seamless transition from older Classworlds up to 1.1, - Plexus Classworlds provides - a compatibility layer. -

diff --git a/src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java b/src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java index 7ebfe86..b91c9f2 100644 --- a/src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java +++ b/src/test/java/org/codehaus/plexus/classworlds/launcher/LauncherTest.java @@ -33,8 +33,6 @@ class LauncherTest extends AbstractClassWorldsTestCase { @BeforeEach void setUp() { - System.setProperty("java.protocol.handler.pkgs", "org.codehaus.classworlds.protocol"); - this.launcher = new Launcher(); this.launcher.setSystemClassLoader(Thread.currentThread().getContextClassLoader()); diff --git a/src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java b/src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java index 3360f8b..127fe9e 100644 --- a/src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java +++ b/src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java @@ -21,7 +21,6 @@ import java.util.Collections; import java.util.concurrent.CountDownLatch; -import org.codehaus.classworlds.ClassRealmAdapter; import org.codehaus.plexus.classworlds.AbstractClassWorldsTestCase; import org.codehaus.plexus.classworlds.ClassWorld; import org.junit.jupiter.api.Test; @@ -208,16 +207,6 @@ void malformedResource() throws Exception { assertSame(null, mainRealm.getResource("/" + resource)); assertSame(null, officialClassLoader.getResource("/" + resource)); - - /* - * For backward-compat, legacy class realms have to support leading slashes. - */ - - @SuppressWarnings("deprecation") - org.codehaus.classworlds.ClassRealm legacyRealm = ClassRealmAdapter.getInstance(mainRealm); - assertNotNull(legacyRealm.getResource("/" + resource)); - assertNotNull(legacyRealm.getResourceAsStream("/" + resource)); - assertTrue(legacyRealm.findResources("/" + resource).hasMoreElements()); } }