View Javadoc

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  
21  /**
22   * A compatibility wrapper for org.codehaus.plexus.classworlds.ClassWorld
23   * provided for legacy code
24   *
25   * @author Andrew Williams
26   */
27  @Deprecated
28  public class ClassWorld
29  {
30      private ClassWorldAdapter adapter;
31  
32      public ClassWorld( String realmId,
33                         ClassLoader classLoader )
34      {
35          adapter = ClassWorldAdapter.getInstance(
36              new org.codehaus.plexus.classworlds.ClassWorld( realmId, classLoader ) );
37      }
38  
39      public ClassWorld()
40      {
41          adapter = ClassWorldAdapter.getInstance(
42              new org.codehaus.plexus.classworlds.ClassWorld( ) );
43      }
44  
45      public ClassWorld( boolean ignore )
46      {
47          /* fake */
48      }
49  
50      public ClassRealm newRealm( String id )
51          throws DuplicateRealmException
52      {
53          return adapter.newRealm( id );
54      }
55  
56      public ClassRealm newRealm( String id,
57                                  ClassLoader classLoader )
58          throws DuplicateRealmException
59      {
60          return adapter.newRealm( id, classLoader );
61      }
62  
63      public void disposeRealm( String id )
64          throws NoSuchRealmException
65      {
66          adapter.disposeRealm( id );
67      }
68  
69      public ClassRealm getRealm( String id )
70          throws NoSuchRealmException
71      {
72          return adapter.getRealm( id );
73      }
74  
75      public Collection getRealms()
76      {
77          return adapter.getRealms();
78      }
79  }