01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04:
05: package com.tc.aspectwerkz.transform;
06:
07: import com.tc.aspectwerkz.expression.regexp.Pattern;
08: import com.tc.aspectwerkz.expression.regexp.TypePattern;
09: import com.tc.aspectwerkz.expression.SubtypePatternType;
10:
11: /**
12: * TODO document class
13: *
14: * @author Jonas Bonér
15: */
16: public class Properties {
17:
18: // -- public properties --
19: public static final String ASPECT_MODULES;
20: public static final boolean USE_GLOBAL_CONTEXT;
21: public final static boolean VERBOSE_LOGGING;
22: public static final boolean PRINT_DEPLOYMENT_INFO;
23: public final static boolean EAGERLY_GENERATE_CLOSURE;
24: public static final String DUMP_DIR_CLOSURES;
25: public static final String DUMP_DIR_FACTORIES;
26: public static final boolean DUMP_JIT_CLOSURES;
27: public final static boolean DUMP_JIT_FACTORIES;
28: public final static TypePattern DUMP_PATTERN;
29: public final static boolean DUMP_BEFORE;
30: public final static boolean DUMP_AFTER;
31: public static final String DUMP_DIR_BEFORE;
32: public static final String DUMP_DIR_AFTER;
33:
34: // private options
35: private final static String AW_PRINT_DEPLOYMENT_INFO = "aspectwerkz.deployment.info";
36: private final static String AW_VERBOSE_LOGGING = "aspectwerkz.details";
37: private final static String AW_EAGERLY_GENERATE_CLOSURES = "aspectwerkz.gen.closures";
38: private final static String AW_DUMP_PATTERN = "aspectwerkz.dump.pattern";
39: private final static String AW_DUMP_CLOSURES = "aspectwerkz.dump.closures";
40: private final static String AW_DUMP_FACTORIES = "aspectwerkz.dump.factories";
41: private final static String AW_ASPECT_MODULES = "aspectwerkz.aspectmodules";
42:
43: static {
44: // DSO options
45: String global = System.getProperty("tc.dso.global");
46: if (global != null) {
47: USE_GLOBAL_CONTEXT = Boolean.valueOf(global).booleanValue();
48: } else {
49: USE_GLOBAL_CONTEXT = true;
50: }
51:
52: // AW options
53: ASPECT_MODULES = System.getProperty(AW_ASPECT_MODULES, "")
54: .trim();
55: String dumpJP = System.getProperty(AW_DUMP_CLOSURES, null);
56: DUMP_JIT_CLOSURES = "yes".equalsIgnoreCase(dumpJP)
57: || "true".equalsIgnoreCase(dumpJP);
58: String dumpFactories = System.getProperty(AW_DUMP_FACTORIES,
59: null);
60: DUMP_JIT_FACTORIES = "yes".equalsIgnoreCase(dumpFactories)
61: || "true".equalsIgnoreCase(dumpFactories);
62: String verbose = System.getProperty(AW_PRINT_DEPLOYMENT_INFO,
63: null);
64: PRINT_DEPLOYMENT_INFO = "yes".equalsIgnoreCase(verbose)
65: || "true".equalsIgnoreCase(verbose);
66: String details = System.getProperty(AW_VERBOSE_LOGGING, null);
67: VERBOSE_LOGGING = "yes".equalsIgnoreCase(details)
68: || "true".equalsIgnoreCase(details);
69: String genjp = System.getProperty(AW_EAGERLY_GENERATE_CLOSURES,
70: null);
71: EAGERLY_GENERATE_CLOSURE = "yes".equalsIgnoreCase(genjp)
72: || "true".equalsIgnoreCase(genjp);
73: String dumpPattern = System.getProperty(AW_DUMP_PATTERN, null);
74: if (dumpPattern == null) {
75: DUMP_BEFORE = false;
76: DUMP_AFTER = false;
77: DUMP_PATTERN = null;
78: } else {
79: dumpPattern = dumpPattern.trim();
80: DUMP_AFTER = true;
81: DUMP_BEFORE = dumpPattern.indexOf(",before") > 0;
82: if (DUMP_BEFORE) {
83: DUMP_PATTERN = Pattern.compileTypePattern(dumpPattern
84: .substring(0, dumpPattern.indexOf(',')),
85: SubtypePatternType.NOT_HIERARCHICAL);
86: } else {
87: DUMP_PATTERN = Pattern.compileTypePattern(dumpPattern,
88: SubtypePatternType.NOT_HIERARCHICAL);
89: }
90: }
91: DUMP_DIR_CLOSURES = "_dump/closures";
92: DUMP_DIR_BEFORE = "_dump/before";
93: DUMP_DIR_AFTER = "_dump/after";
94: DUMP_DIR_FACTORIES = "_dump/factories";
95: }
96:
97: }
|