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 {@link org.codehaus.plexus.classworlds.ClassWorld}
23   * provided for legacy code.
24   *
25   * <p><b>Note:</b> This is a legacy class provided for backward compatibility with Maven 2.
26   * New code should use {@link org.codehaus.plexus.classworlds.ClassWorld}.</p>
27   *
28   * @author Andrew Williams
29   * @deprecated Use {@link org.codehaus.plexus.classworlds.ClassWorld}
30   */
31  @SuppressWarnings("rawtypes")
32  @Deprecated
33  public class ClassWorld {
34      private ClassWorldAdapter adapter;
35  
36      public ClassWorld(String realmId, ClassLoader classLoader) {
37          adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld(realmId, classLoader));
38      }
39  
40      public ClassWorld() {
41          adapter = ClassWorldAdapter.getInstance(new org.codehaus.plexus.classworlds.ClassWorld());
42      }
43  
44      public ClassWorld(boolean ignore) {
45          /* fake */
46      }
47  
48      public ClassRealm newRealm(String id) throws DuplicateRealmException {
49          return adapter.newRealm(id);
50      }
51  
52      public ClassRealm newRealm(String id, ClassLoader classLoader) throws DuplicateRealmException {
53          return adapter.newRealm(id, classLoader);
54      }
55  
56      public void disposeRealm(String id) throws NoSuchRealmException {
57          adapter.disposeRealm(id);
58      }
59  
60      public ClassRealm getRealm(String id) throws NoSuchRealmException {
61          return adapter.getRealm(id);
62      }
63  
64      public Collection getRealms() {
65          return adapter.getRealms();
66      }
67  }