Coverage Report - org.codehaus.classworlds.ClassRealmReverseAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
ClassRealmReverseAdapter
0 %
0/32
0 %
0/2
1,389
 
 1  
 package org.codehaus.classworlds;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2010 Codehaus Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *      http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.util.Enumeration;
 20  
 import java.net.URL;
 21  
 import java.io.IOException;
 22  
 import java.io.InputStream;
 23  
 
 24  
 /**
 25  
  * A reverse adapter for ClassRealms
 26  
  *
 27  
  * @author Andrew Williams
 28  
  */
 29  
 @Deprecated
 30  
 public class ClassRealmReverseAdapter
 31  
     extends org.codehaus.plexus.classworlds.realm.ClassRealm
 32  
 {
 33  
 
 34  
     public static ClassRealmReverseAdapter getInstance( ClassRealm oldRealm )
 35  
     {
 36  0
         ClassRealmReverseAdapter adapter = new ClassRealmReverseAdapter( oldRealm );
 37  
 
 38  0
         return adapter;
 39  
     }
 40  
 
 41  
     private ClassRealm realm;
 42  
 
 43  
     private ClassRealmReverseAdapter( ClassRealm oldRealm )
 44  
     {
 45  0
         super( ClassWorldReverseAdapter.getInstance( oldRealm.getWorld() ),
 46  
                oldRealm.getId(), oldRealm.getClassLoader() );
 47  0
         this.realm = oldRealm;
 48  0
     }
 49  
 
 50  
     public String getId()
 51  
     {
 52  0
         return realm.getId();
 53  
     }
 54  
 
 55  
     public org.codehaus.plexus.classworlds.ClassWorld getWorld()
 56  
     {
 57  0
         return ClassWorldReverseAdapter.getInstance( realm.getWorld() );
 58  
     }
 59  
 
 60  
     public void importFrom( String realmId,
 61  
                             String pkgName )
 62  
         throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException
 63  
     {
 64  
         try
 65  
         {
 66  0
             realm.importFrom( realmId, pkgName );
 67  
         }
 68  0
         catch ( NoSuchRealmException e )
 69  
         {
 70  0
             throw new org.codehaus.plexus.classworlds.realm.NoSuchRealmException( getWorld(), e.getId() );
 71  0
         }
 72  0
     }
 73  
 
 74  
     public void addURL( URL constituent )
 75  
     {
 76  0
         realm.addConstituent( constituent );
 77  0
     }
 78  
 
 79  
     public org.codehaus.plexus.classworlds.realm.ClassRealm locateSourceRealm( String className )
 80  
     {
 81  0
         return getInstance( realm.locateSourceRealm(
 82  
             className ) );
 83  
     }
 84  
 
 85  
     public void setParentRealm( org.codehaus.plexus.classworlds.realm.ClassRealm classRealm )
 86  
     {
 87  0
         realm.setParent( ClassRealmAdapter.getInstance( classRealm ) );
 88  0
     }
 89  
 
 90  
     public org.codehaus.plexus.classworlds.realm.ClassRealm createChildRealm( String id )
 91  
         throws org.codehaus.plexus.classworlds.realm.DuplicateRealmException
 92  
     {
 93  
         try
 94  
         {
 95  0
             return getInstance( realm.createChildRealm( id ) );
 96  
         }
 97  0
         catch ( DuplicateRealmException e )
 98  
         {
 99  0
             throw new org.codehaus.plexus.classworlds.realm.DuplicateRealmException( getWorld(), e.getId() );
 100  
         }
 101  
     }
 102  
 
 103  
     public ClassLoader getClassLoader()
 104  
     {
 105  0
         return realm.getClassLoader();
 106  
     }
 107  
 
 108  
     public org.codehaus.plexus.classworlds.realm.ClassRealm getParentRealm()
 109  
     {
 110  0
         return getInstance( realm.getParent() );
 111  
     }
 112  
 
 113  
     public URL[] getURLs()
 114  
     {
 115  0
         return realm.getConstituents();
 116  
     }
 117  
 
 118  
     public Class loadClass( String name )
 119  
         throws ClassNotFoundException
 120  
     {
 121  0
         return realm.loadClass( name );
 122  
     }
 123  
 
 124  
     public URL getResource( String name )
 125  
     {
 126  0
         return realm.getResource( name );
 127  
     }
 128  
 
 129  
     public Enumeration findResources( String name )
 130  
         throws IOException
 131  
     {
 132  0
         return realm.findResources( name );
 133  
     }
 134  
 
 135  
     public InputStream getResourceAsStream( String name )
 136  
     {
 137  0
         return realm.getResourceAsStream( name );
 138  
     }
 139  
 
 140  
     public void display()
 141  
     {
 142  0
         realm.display();
 143  0
     }
 144  
 
 145  
     public boolean equals(Object o)
 146  
     {
 147  0
         if ( !( o instanceof ClassRealm ) )
 148  0
             return false;
 149  
 
 150  0
         return getId().equals( ( (ClassRealm) o ).getId() );
 151  
     }
 152  
 }