001: /*
002: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */
005: package com.tc.object.config;
006:
007: import com.tc.asm.ClassAdapter;
008: import com.tc.asm.ClassVisitor;
009: import com.tc.asm.ClassWriter;
010: import com.tc.aspectwerkz.reflect.ClassInfo;
011: import com.tc.aspectwerkz.reflect.FieldInfo;
012: import com.tc.aspectwerkz.reflect.MemberInfo;
013: import com.tc.config.schema.NewCommonL1Config;
014: import com.tc.object.Portability;
015: import com.tc.object.bytecode.ClassAdapterFactory;
016: import com.tc.object.bytecode.TransparencyClassAdapter;
017: import com.tc.object.config.schema.DSOInstrumentationLoggingOptions;
018: import com.tc.object.config.schema.DSORuntimeLoggingOptions;
019: import com.tc.object.config.schema.DSORuntimeOutputOptions;
020: import com.tc.object.config.schema.InstrumentedClass;
021: import com.tc.object.logging.InstrumentationLogger;
022: import com.terracottatech.config.Modules;
023:
024: import java.net.URL;
025: import java.util.Collection;
026: import java.util.Iterator;
027: import java.util.Map;
028:
029: /**
030: * Knows how to interpret the DSO client config and tell you things like whether a class is portable. This interface
031: * extends DSOApplicationConfig which is a much simpler interface suitable for manipulating the config from the
032: * perspective of generating a configuration file.
033: */
034: public interface DSOClientConfigHelper extends DSOApplicationConfig {
035:
036: String[] getMissingRootDeclarations(ClassInfo classInfo);
037:
038: boolean shouldBeAdapted(ClassInfo classInfo);
039:
040: boolean isNeverAdaptable(ClassInfo classInfo);
041:
042: boolean isLogical(String theClass);
043:
044: DSOInstrumentationLoggingOptions getInstrumentationLoggingOptions();
045:
046: void verifyBootJarContents() throws IncompleteBootJarException,
047: UnverifiedBootJarException;
048:
049: TransparencyClassSpec[] getAllSpecs();
050:
051: Iterator getAllUserDefinedBootSpecs();
052:
053: TransparencyClassAdapter createDsoClassAdapterFor(
054: ClassVisitor writer, ClassInfo classInfo,
055: InstrumentationLogger lgr, ClassLoader caller,
056: final boolean forcePortable, boolean honorTransient);
057:
058: ClassAdapter createClassAdapterFor(ClassWriter writer,
059: ClassInfo classInfo, InstrumentationLogger lgr,
060: ClassLoader caller);
061:
062: ClassAdapter createClassAdapterFor(ClassWriter writer,
063: ClassInfo classInfo, InstrumentationLogger lgr,
064: ClassLoader caller, boolean disableSuperClassTypeChecking);
065:
066: boolean isCallConstructorOnLoad(ClassInfo classInfo);
067:
068: // String getChangeApplicatorClassNameFor(String className);
069: Class getChangeApplicator(Class clazz);
070:
071: boolean isPortableModuleClass(Class clazz);
072:
073: void setModuleSpecs(ModuleSpec[] pluginSpecs);
074:
075: // HACK: is also in IStandardDSOClientConfigHelper
076: TransparencyClassSpec getOrCreateSpec(String className);
077:
078: // HACK: is also in IStandardDSOClientConfigHelper
079: TransparencyClassSpec getOrCreateSpec(String className,
080: String applicator);
081:
082: LockDefinition[] lockDefinitionsFor(MemberInfo memberInfo);
083:
084: boolean isRoot(FieldInfo fi);
085:
086: boolean isRootDSOFinal(FieldInfo fi);
087:
088: boolean isTransient(int modifiers, ClassInfo classInfo, String field);
089:
090: boolean isVolatile(int modifiers, ClassInfo classInfo, String field);
091:
092: String rootNameFor(FieldInfo fi);
093:
094: boolean isLockMethod(MemberInfo memberInfo);
095:
096: DistributedMethodSpec getDmiSpec(MemberInfo memberInfo);
097:
098: TransparencyClassSpec getSpec(String className);
099:
100: boolean isDSOSessions(String name);
101:
102: DSORuntimeLoggingOptions runtimeLoggingOptions();
103:
104: DSORuntimeOutputOptions runtimeOutputOptions();
105:
106: DSOInstrumentationLoggingOptions instrumentationLoggingOptions();
107:
108: int getFaultCount();
109:
110: void addWriteAutolock(String methodPattern);
111:
112: void addSynchronousWriteAutolock(String methodPattern);
113:
114: void addLock(String methodPattern, LockDefinition lockDefinition);
115:
116: void addReadAutolock(String methodPattern);
117:
118: void addAutolock(String methodPattern, ConfigLockLevel type);
119:
120: void addAutoLockExcludePattern(String expression);
121:
122: void addReadAutoSynchronize(String methodPattern);
123:
124: void addWriteAutoSynchronize(String methodPattern);
125:
126: void setFaultCount(int count);
127:
128: void addRoot(Root root, boolean addSpecForClass);
129:
130: boolean matches(final Lock lock, final MemberInfo methodInfo);
131:
132: boolean matches(final String expression, final MemberInfo methodInfo);
133:
134: void addTransient(String className, String fieldName);
135:
136: String getOnLoadScriptIfDefined(ClassInfo classInfo);
137:
138: String getPreCreateMethodIfDefined(String className);
139:
140: String getPostCreateMethodIfDefined(String className);
141:
142: String getOnLoadMethodIfDefined(ClassInfo classInfo);
143:
144: boolean isUseNonDefaultConstructor(Class clazz);
145:
146: // HACK: is also in IStandardDSOClientConfigHelper
147: void addIncludePattern(String expression);
148:
149: NewCommonL1Config getNewCommonL1Config();
150:
151: // Used for testing
152: void addIncludePattern(String expression, boolean honorTransient);
153:
154: void addIncludePattern(String expression, boolean honorTransient,
155: boolean oldStyleCallConstructorOnLoad, boolean honorVolatile);
156:
157: // Used for testing and Spring
158: void addIncludeAndLockIfRequired(String expression,
159: boolean honorTransient,
160: boolean oldStyleCallConstructorOnLoad,
161: boolean honorVolatile, String lockExpression,
162: ClassInfo classInfo);
163:
164: // Used for testing
165: void addExcludePattern(String expression);
166:
167: boolean hasIncludeExcludePatterns();
168:
169: boolean hasIncludeExcludePattern(ClassInfo classInfo);
170:
171: void addAspectModule(String pattern, String moduleName);
172:
173: Map getAspectModules();
174:
175: void addDSOSpringConfig(DSOSpringConfigHelper config);
176:
177: Collection getDSOSpringConfigs();
178:
179: void addDistributedMethodCall(DistributedMethodSpec dms);
180:
181: Portability getPortability();
182:
183: void removeSpec(String className);
184:
185: String getLogicalExtendingClassName(String className);
186:
187: void addUserDefinedBootSpec(String className,
188: TransparencyClassSpec spec);
189:
190: void addApplicationName(String name);
191:
192: void addSynchronousWriteApplication(String name);
193:
194: void addInstrumentationDescriptor(InstrumentedClass classDesc);
195:
196: Modules getModulesForInitialization();
197:
198: void addRepository(String location);
199:
200: void addModule(String name, String version);
201:
202: boolean removeCustomAdapter(String name);
203:
204: // HACK: is also in IStandardDSOClientConfigHelper
205: /**
206: * If an adapter with the same name was already present, this new one will not be added, and the operation will simply
207: * return as a no-op.
208: */
209: void addCustomAdapter(String name,
210: ClassAdapterFactory adapterFactory);
211:
212: int getSessionLockType(String appName);
213:
214: Class getTCPeerClass(Class clazz);
215:
216: ClassReplacementMapping getClassReplacementMapping();
217:
218: URL getClassResource(String className);
219:
220: boolean hasCustomAdapter(ClassInfo classInfo);
221:
222: ClassAdapterFactory getCustomAdapter(ClassInfo classInfo);
223:
224: boolean reflectionEnabled();
225: }
|