001: /**
002: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003: * notice. All rights reserved.
004: */package org.terracotta.modules;
005:
006: import org.osgi.framework.BundleContext;
007: import org.terracotta.modules.configuration.TerracottaConfiguratorModule;
008:
009: import com.tc.object.config.ConfigLockLevel;
010: import com.tc.object.config.LockDefinition;
011:
012: public class SpringConfiguration extends TerracottaConfiguratorModule {
013:
014: protected void addInstrumentation(final BundleContext context) {
015: super .addInstrumentation(context);
016: configSpringTypes();
017: configSpringWebFlowTypes();
018: }
019:
020: private void configSpringTypes() {
021: configHelper.addIncludePattern(
022: "org.springframework.context.ApplicationEvent", false,
023: false, false);
024: configHelper.addIncludePattern(
025: "com.tcspring.ApplicationContextEventProtocol", true,
026: true, true);
027:
028: configHelper.addIncludePattern("com.tcspring.ComplexBeanId",
029: true, true, true);
030: // addIncludePattern("com.tcspring.BeanContainer", true, true, true);
031: configHelper.getOrCreateSpec("com.tcspring.BeanContainer")
032: .addTransient("isInitialized"); // .setHonorTransient(true);
033:
034: // scoped beans
035: // addTransient("org.springframework.web.context.request.ServletRequestAttributes$DestructionCallbackBindingListener",
036: // "aw$MIXIN_0");
037: configHelper
038: .addIncludePattern(
039: "com.tcspring.SessionProtocol$DestructionCallbackBindingListener",
040: true, true, true);
041: configHelper.addIncludePattern(
042: "com.tcspring.ScopedBeanDestructionCallBack", true,
043: true, true);
044:
045: // Spring AOP introduction/mixin classes
046: configHelper
047: .addIncludePattern(
048: "org.springframework.aop.support.IntroductionInfoSupport",
049: true, true, true);
050: configHelper
051: .addIncludePattern(
052: "org.springframework.aop.support.DelegatingIntroductionInterceptor",
053: true, true, true);
054: configHelper
055: .addIncludePattern(
056: "org.springframework.aop.support.DefaultIntroductionAdvisor",
057: true, true, true);
058: configHelper.addIncludePattern("gnu.trove..*", false, false,
059: true);
060: configHelper.addIncludePattern("java.lang.reflect.Proxy",
061: false, false, false);
062: configHelper.addIncludePattern("com.tc.aspectwerkz.proxy..*",
063: false, false, true);
064:
065: // TODO remove if we find a better way using ProxyApplicator etc.
066: configHelper.addIncludePattern("$Proxy..*", false, false, true);
067:
068: // backport concurrent classes
069: configHelper
070: .addIncludePattern(
071: "edu.emory.mathcs.backport.java.util.AbstractCollection",
072: false, false, false);
073: configHelper.addIncludePattern(
074: "edu.emory.mathcs.backport.java.util.AbstractQueue",
075: false, false, false);
076: configHelper
077: .addIncludePattern(
078: "edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue",
079: false, false, false);
080: configHelper
081: .addIncludePattern(
082: "edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue$Node",
083: false, false, false);
084: configHelper
085: .addIncludePattern(
086: "edu.emory.mathcs.backport.java.util.concurrent.FutureTask",
087: false, false, false);
088:
089: configHelper
090: .addIncludePattern(
091: "edu.emory.mathcs.backport.java.util.concurrent.ConcurrentLinkedQueue",
092: false, false, false);
093: configHelper
094: .addIncludePattern(
095: "edu.emory.mathcs.backport.java.util.concurrent.PriorityBlockingQueue",
096: false, false, false);
097: configHelper
098: .addIncludePattern(
099: "edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue",
100: false, false, false);
101: configHelper
102: .addIncludePattern(
103: "edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList",
104: false, false, false);
105:
106: final LockDefinition ld = configHelper.createLockDefinition(
107: "addApplicationListener", ConfigLockLevel.WRITE);
108: ld.commit();
109: configHelper
110: .addLock(
111: "* org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(..)",
112: ld);
113:
114: // used by WebFlow
115: configHelper
116: .addIncludePattern("org.springframework.core.enums.*",
117: false, false, false);
118: configHelper.addIncludePattern(
119: "org.springframework.binding..*", true, false, false);
120: configHelper
121: .addIncludePattern("org.springframework.validation..*",
122: true, false, false);
123: }
124:
125: private void configSpringWebFlowTypes() {
126: configHelper.addAspectModule("org.springframework.webflow",
127: "com.tc.object.config.SpringWebFlowAspectModule");
128: configHelper
129: .addIncludePattern("com.tcspring.DSOConversationLock",
130: false, false, false);
131:
132: configHelper.addIncludePattern(
133: "org.springframework.webflow..*", true, false, false);
134:
135: configHelper
136: .addIncludePattern(
137: "org.springframework.webflow.conversation.impl.ConversationEntry",
138: false, false, false);
139: configHelper
140: .addIncludePattern(
141: "org.springframework.webflow.core.collection.LocalAttributeMap",
142: false, false, false);
143: configHelper.addIncludePattern(
144: "org.springframework.webflow.conversation.impl.*",
145: false, false, false);
146:
147: // getOrCreateSpec("org.springframework.webflow.engine.impl.FlowSessionImpl").setHonorTransient(false).addTransient("flow");
148: // flow : Flow
149: // flowId : String
150: // state : State
151: // stateId : String
152: // .addTransient("parent") // : FlowSessionImpl
153: // .addTransient("scope") // : LocalAttributeMap
154: // .addTransient("status"); // : FlowSessionStatus
155:
156: // all "transient" for all subclasses except "State.id"
157: // getOrCreateSpec("org.springframework.webflow.engine.State") //
158: // .addTransient("logger").addTransient("flow") //
159: // .addTransient("entryActionList") //
160: // .addTransient("exceptionHandlerSet"); //
161: // getOrCreateSpec("org.springframework.webflow.engine.EndState") //
162: // .addTransient("viewSelector") //
163: // .addTransient("outputMapper"); //
164: // getOrCreateSpec("org.springframework.webflow.engine.TransitionableState") // abstract
165: // .addTransient("transitions")
166: // .addTransient("exitActionList");
167: // getOrCreateSpec("org.springframework.webflow.engine.ActionState") //
168: // .addTransient("actionList");
169: // getOrCreateSpec("org.springframework.webflow.engine.SubflowState") //
170: // .addTransient("subflow") //
171: // .addTransient("attributeMapper"); //
172: // getOrCreateSpec("org.springframework.webflow.engine.ViewState") //
173: // .addTransient("viewSelector") //
174: // .addTransient("renderActionList");
175: // // getOrCreateSpec("org.springframework.webflow.engine.DecisionState"); no fields
176:
177: // TODO investigate if better granularity of above classes is required
178: // org.springframework.webflow.execution.repository.support.DefaultFlowExecutionRepository
179: // org.springframework.webflow.execution.repository.support.AbstractConversationFlowExecutionRepository
180: // org.springframework.webflow.execution.repository.support.AbstractFlowExecutionRepository
181: // org.springframework.webflow.execution.repository.support.DefaultFlowExecutionRepositoryFactory
182: // org.springframework.webflow.execution.repository.support.DelegatingFlowExecutionRepositoryFactory
183: // org.springframework.webflow.execution.repository.support.FlowExecutionRepositoryServices
184: // org.springframework.webflow.execution.repository.support.SharedMapFlowExecutionRepositoryFactory
185: // org.springframework.webflow.execution.repository.conversation.impl.LocalConversationService
186: // org.springframework.webflow.util.RandomGuidUidGenerator
187: // org.springframework.webflow.registry.FlowRegistryImpl
188: // etc...
189: }
190:
191: }
|