diff --git a/pom.xml b/pom.xml index 7ae5b44..9218695 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ plexus-classworlds - 2.6-SNAPSHOT + 3.0.0-SNAPSHOT bundle Plexus Classworlds 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 07a93c9..0000000 --- a/src/main/java/org/codehaus/classworlds/BytesURLConnection.java +++ /dev/null @@ -1,53 +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.URLConnection; -import java.net.URL; -import java.io.InputStream; -import java.io.ByteArrayInputStream; - -/** - * @author Hani Suleiman (hani@formicary.net) - *

- * Date: Oct 20, 2003 - * Time: 12:46:01 AM - */ -@Deprecated -public class BytesURLConnection extends URLConnection -{ - protected 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 ); - } -} \ No newline at end of file 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 e99432b..0000000 --- a/src/main/java/org/codehaus/classworlds/BytesURLStreamHandler.java +++ /dev/null @@ -1,46 +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.URLStreamHandler; -import java.net.URLConnection; -import java.net.URL; - -/** - * @author Hani Suleiman (hani@formicary.net) - * Date: Oct 20, 2003 - * Time: 12:45:18 AM - */ -@Deprecated -public class BytesURLStreamHandler extends URLStreamHandler -{ - byte[] content; - - int offset; - - int length; - - public BytesURLStreamHandler( byte[] content ) - { - this.content = content; - } - - public URLConnection openConnection( URL url ) - { - return new BytesURLConnection( url, content ); - } -} \ No newline at end of file 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 3948455..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealm.java +++ /dev/null @@ -1,110 +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 - */ -@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 56f8fe2..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealmAdapter.java +++ /dev/null @@ -1,182 +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.util.Enumeration; -import java.io.IOException; -import java.io.InputStream; - -/** - * An adapter for ClassRealms - * - * @author Andrew Williams - */ -@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 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 83ad5db..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassRealmReverseAdapter.java +++ /dev/null @@ -1,152 +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.Enumeration; -import java.net.URL; -import java.io.IOException; -import java.io.InputStream; - -/** - * A reverse adapter for ClassRealms - * - * @author Andrew Williams - */ -@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 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 ); - } - - 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 81721e6..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorld.java +++ /dev/null @@ -1,79 +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 - */ -@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 882bd87..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldAdapter.java +++ /dev/null @@ -1,117 +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; -import java.util.Iterator; - -/** - * An adapter for ClassWorlds - * - * @author Andrew Williams - */ -@Deprecated -public class ClassWorldAdapter - extends ClassWorld -{ - - public static ClassWorldAdapter getInstance( org.codehaus.plexus.classworlds.ClassWorld newWorld ) - { - ClassWorldAdapter adapter = new ClassWorldAdapter( newWorld ); - - return adapter; - } - - private 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(); - - Iterator it = realms.iterator(); - while ( it.hasNext() ) - { - org.codehaus.plexus.classworlds.realm.ClassRealm realm = - (org.codehaus.plexus.classworlds.realm.ClassRealm) it.next(); - ret.add( ClassRealmAdapter.getInstance( realm ) ); - } - - 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 f78d653..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldException.java +++ /dev/null @@ -1,104 +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 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 eeb8e9e..0000000 --- a/src/main/java/org/codehaus/classworlds/ClassWorldReverseAdapter.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.util.HashMap; -import java.util.Collection; -import java.util.Vector; -import java.util.Iterator; - -/** - * A reverse adapter for ClassWorlds - * - * @author Andrew Williams - */ -@Deprecated -public class ClassWorldReverseAdapter - extends org.codehaus.plexus.classworlds.ClassWorld -{ - private static 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 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(); - - Iterator it = realms.iterator(); - while ( it.hasNext() ) - { - ClassRealm realm = (ClassRealm) it.next(); - 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 7205d6f..0000000 --- a/src/main/java/org/codehaus/classworlds/ConfigurationException.java +++ /dev/null @@ -1,77 +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 d801de1..0000000 --- a/src/main/java/org/codehaus/classworlds/Configurator.java +++ /dev/null @@ -1,139 +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 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. - */ - 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. - */ - 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 6552d4a..0000000 --- a/src/main/java/org/codehaus/classworlds/ConfiguratorAdapter.java +++ /dev/null @@ -1,90 +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.InputStream; -import java.io.IOException; -import java.net.MalformedURLException; - -/** - * Created by IntelliJ IDEA. - * - * @uthor: Andrew Williams - * @since: Nov 25, 2006 - */ -@Deprecated -public class ConfiguratorAdapter - extends Configurator -{ - - public static ConfiguratorAdapter getInstance( org.codehaus.plexus.classworlds.launcher.Configurator newConfig, - Launcher launcher ) - { - ConfiguratorAdapter adapter = new ConfiguratorAdapter( newConfig, launcher ); - - return adapter; - } - - public static ConfiguratorAdapter getInstance( org.codehaus.plexus.classworlds.launcher.Configurator newConfig, - ClassWorld world ) - { - ConfiguratorAdapter adapter = new ConfiguratorAdapter( newConfig, world ); - - return adapter; - } - - private 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(); - } - - 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 0a9b235..0000000 --- a/src/main/java/org/codehaus/classworlds/DefaultClassRealm.java +++ /dev/null @@ -1,171 +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 - * @version $Id$ - */ - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; - -@Deprecated -public class DefaultClassRealm - implements ClassRealm -{ - private 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[] - */ - 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 c226459..0000000 --- a/src/main/java/org/codehaus/classworlds/DuplicateRealmException.java +++ /dev/null @@ -1,96 +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 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 109e24c..0000000 --- a/src/main/java/org/codehaus/classworlds/Launcher.java +++ /dev/null @@ -1,62 +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 084a7ec..0000000 --- a/src/main/java/org/codehaus/classworlds/NoSuchRealmException.java +++ /dev/null @@ -1,96 +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 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/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java b/src/test/java/org/codehaus/plexus/classworlds/realm/DefaultClassRealmTest.java index 4fca630..8ea1706 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; @@ -222,15 +221,6 @@ public void testMalformedResource() assertSame( null, mainRealm.getResource( "/" + resource ) ); assertSame( null, officialClassLoader.getResource( "/" + resource ) ); - - /* - * For backward-compat, legacy class realms have to support leading slashes. - */ - - org.codehaus.classworlds.ClassRealm legacyRealm = ClassRealmAdapter.getInstance( mainRealm ); - assertNotNull( legacyRealm.getResource( "/" + resource ) ); - assertNotNull( legacyRealm.getResourceAsStream( "/" + resource ) ); - assertTrue( legacyRealm.findResources( "/" + resource ).hasMoreElements() ); } public void testFindResourceOnlyScansSelf()