01: /**
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */package org.terracotta.modules;
05:
06: import org.osgi.framework.BundleContext;
07: import org.terracotta.modules.configuration.TerracottaConfiguratorModule;
08:
09: import com.tc.object.config.TransparencyClassSpec;
10:
11: public class StandardConfiguration extends TerracottaConfiguratorModule {
12:
13: protected void addInstrumentation(final BundleContext context) {
14: super .addInstrumentation(context);
15: configFileTypes();
16: configEventTypes();
17: configExceptionTypes();
18: configArrayTypes();
19: configUnsafe();
20: }
21:
22: private void configUnsafe() {
23: TransparencyClassSpec spec;
24:
25: spec = getOrCreateSpec("sun.misc.Unsafe");
26: spec.setCustomClassAdapter(new UnsafeAdapter());
27: spec.markPreInstrumented();
28:
29: spec = getOrCreateSpec("com.tcclient.util.DSOUnsafe");
30: spec.setCustomClassAdapter(new DSOUnsafeAdapter());
31: spec.markPreInstrumented();
32: }
33:
34: private void configArrayTypes() {
35: final TransparencyClassSpec spec = getOrCreateSpec("java.util.Arrays");
36: spec.addDoNotInstrument("copyOfRange");
37: spec.addDoNotInstrument("copyOf");
38: getOrCreateSpec("java.util.Arrays$ArrayList");
39: }
40:
41: private void configFileTypes() {
42: final TransparencyClassSpec spec = getOrCreateSpec("java.io.File");
43: spec.setHonorTransient(true);
44: }
45:
46: private void configEventTypes() {
47: getOrCreateSpec("java.util.EventObject");
48: }
49:
50: private void configExceptionTypes() {
51: getOrCreateSpec("java.lang.Exception");
52: getOrCreateSpec("java.lang.RuntimeException");
53: getOrCreateSpec("java.lang.InterruptedException");
54: getOrCreateSpec("java.awt.AWTException");
55: getOrCreateSpec("java.io.IOException");
56: getOrCreateSpec("java.io.FileNotFoundException");
57: getOrCreateSpec("java.lang.Error");
58: getOrCreateSpec("java.util.ConcurrentModificationException");
59: getOrCreateSpec("java.util.NoSuchElementException");
60: }
61:
62: }
|