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      private ClassWorldAdapter adapter;
30  
31      public ClassWorld(String realmId, ClassLoader classLoader) {
32          adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld(realmId, classLoader));
33      }
34  
35      public ClassWorld() {
36          adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld());
37      }
38  
39      public ClassWorld(boolean ignore) {
40          /* fake */
41      }
42  
43      public ClassRealm newRealm(String id) throws DuplicateRealmException {
44          return adapter.newRealm(id);
45      }
46  
47      public ClassRealm newRealm(String id, ClassLoader classLoader) throws DuplicateRealmException {
48          return adapter.newRealm(id, classLoader);
49      }
50  
51      public void disposeRealm(String id) throws NoSuchRealmException {
52          adapter.disposeRealm(id);
53      }
54  
55      public ClassRealm getRealm(String id) throws NoSuchRealmException {
56          return adapter.getRealm(id);
57      }
58  
59      public Collection getRealms() {
60          return adapter.getRealms();
61      }
62  }