KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > object > config > DSOChangeApplicatorSpec


1 /*
2  * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.object.config;
6
7 public final class DSOChangeApplicatorSpec implements ChangeApplicatorSpec {
8   private final String JavaDoc changeApplicatorClassName;
9   private final ClassLoader JavaDoc classLoader;
10
11   public DSOChangeApplicatorSpec(String JavaDoc changeApplicatorClassName) {
12     this.changeApplicatorClassName = changeApplicatorClassName;
13     classLoader = null;
14   }
15
16   public DSOChangeApplicatorSpec(String JavaDoc changeApplicatorClassName, ClassLoader JavaDoc classLoader) {
17     this.changeApplicatorClassName = changeApplicatorClassName;
18     this.classLoader = classLoader;
19   }
20
21   public final Class JavaDoc getChangeApplicator(Class JavaDoc clazz) {
22     try {
23       if (classLoader == null) {
24         return Class.forName(changeApplicatorClassName);
25       } else {
26         return Class.forName(changeApplicatorClassName, false, classLoader);
27       }
28     } catch (Exception JavaDoc e) {
29       throw new AssertionError JavaDoc(e);
30     }
31   }
32
33 }
34
Popular Tags