Coverage Report - org.codehaus.classworlds.ClassWorldAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
ClassWorldAdapter
0 %
0/27
0 %
0/2
2,714
 
 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.Collection;
 20  
 import java.util.Vector;
 21  
 import java.util.Iterator;
 22  
 
 23  
 /**
 24  
  * An adapter for ClassWorlds
 25  
  *
 26  
  * @author Andrew Williams
 27  
  */
 28  
 @Deprecated
 29  
 public class ClassWorldAdapter
 30  
     extends ClassWorld
 31  
 {
 32  
 
 33  
     public static ClassWorldAdapter getInstance( org.codehaus.plexus.classworlds.ClassWorld newWorld )
 34  
     {
 35  0
         ClassWorldAdapter adapter = new ClassWorldAdapter( newWorld );
 36  
 
 37  0
         return adapter;
 38  
     }
 39  
 
 40  
     private org.codehaus.plexus.classworlds.ClassWorld world;
 41  
 
 42  
     private ClassWorldAdapter( org.codehaus.plexus.classworlds.ClassWorld newWorld )
 43  
     {
 44  0
         super( false );
 45  0
         this.world = newWorld;
 46  0
     }
 47  
 
 48  
     public ClassRealm newRealm( String id )
 49  
         throws DuplicateRealmException
 50  
     {
 51  
         try
 52  
         {
 53  0
             return ClassRealmAdapter.getInstance( world.newRealm( id ) );
 54  
         }
 55  0
         catch ( org.codehaus.plexus.classworlds.realm.DuplicateRealmException e )
 56  
         {
 57  0
             throw new DuplicateRealmException( this, e.getId() );
 58  
         }
 59  
     }
 60  
 
 61  
     public ClassRealm newRealm( String id,
 62  
                                 ClassLoader classLoader )
 63  
         throws DuplicateRealmException
 64  
     {
 65  
         try
 66  
         {
 67  0
             return ClassRealmAdapter.getInstance( world.newRealm( id,
 68  
                                                                   classLoader ) );
 69  
         }
 70  0
         catch ( org.codehaus.plexus.classworlds.realm.DuplicateRealmException e )
 71  
         {
 72  0
             throw new DuplicateRealmException( this, e.getId() );
 73  
         }
 74  
     }
 75  
 
 76  
     public void disposeRealm( String id )
 77  
         throws NoSuchRealmException
 78  
     {
 79  
         try
 80  
         {
 81  0
             world.disposeRealm( id );
 82  
         }
 83  0
         catch ( org.codehaus.plexus.classworlds.realm.NoSuchRealmException e )
 84  
         {
 85  0
             throw new NoSuchRealmException( this, e.getId() );
 86  0
         }
 87  0
     }
 88  
 
 89  
     public ClassRealm getRealm( String id )
 90  
         throws NoSuchRealmException
 91  
     {
 92  
         try
 93  
         {
 94  0
             return ClassRealmAdapter.getInstance( world.getRealm( id ) );
 95  
         }
 96  0
         catch ( org.codehaus.plexus.classworlds.realm.NoSuchRealmException e )
 97  
         {
 98  0
             throw new NoSuchRealmException( this, e.getId() );
 99  
         }            
 100  
     }
 101  
 
 102  
     public Collection getRealms()
 103  
     {
 104  0
         Collection realms = world.getRealms();
 105  0
         Vector ret = new Vector();
 106  
 
 107  0
         Iterator it = realms.iterator();
 108  0
         while ( it.hasNext() )
 109  
         {
 110  0
             org.codehaus.plexus.classworlds.realm.ClassRealm realm =
 111  
                 (org.codehaus.plexus.classworlds.realm.ClassRealm) it.next();
 112  0
             ret.add( ClassRealmAdapter.getInstance( realm ) );
 113  0
         }
 114  
 
 115  0
         return ret;
 116  
     }
 117  
 }