Author: nickarls
Date: 2008-10-29 06:58:20 -0400 (Wed, 29 Oct 2008)
New Revision: 206
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyFactory.java
Log:
Minor: WS & import cleanup
ManagerImpl: Moved dependent context into context map and made helper method in
ContextMap. Up for debate, though.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-10-29
10:30:21 UTC (rev 205)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-10-29
10:58:20 UTC (rev 206)
@@ -10,6 +10,7 @@
import javax.webbeans.AmbiguousDependencyException;
import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.Dependent;
import javax.webbeans.DeploymentException;
import javax.webbeans.Observer;
import javax.webbeans.Production;
@@ -52,6 +53,11 @@
{
return (List<Context>) super.get(key);
}
+
+ public DependentContext getDependentContext()
+ {
+ return (DependentContext) get(Dependent.class).get(0);
+ }
}
private class ProxyPool extends MapWrapper<Bean<?>, Bean<?>>
@@ -73,8 +79,8 @@
private EventBus eventBus;
private ResolutionManager resolutionManager;
private ContextMap contextMap;
- private DependentContext dependentContext;
private ProxyPool proxyPool;
+ // TODO This could be a static method?
private ClientProxyFactory clientProxyFactory;
private Set<Bean<?>> beans;
@@ -115,9 +121,7 @@
this.contextMap = new ContextMap();
if (contexts == null)
{
-
- this.dependentContext = new DependentContext();
- addContext(dependentContext);
+ addContext(new DependentContext());
addContext(new RequestContext());
addContext(new SessionContext());
addContext(new ApplicationContext());
@@ -287,7 +291,7 @@
{
try
{
- dependentContext.setActive(true);
+ contextMap.getDependentContext().setActive(true);
if (getModelManager().getScopeModel(bean.getScopeType()).isNormal())
{
return (T) getClientProxy(bean);
@@ -299,7 +303,7 @@
}
finally
{
- dependentContext.setActive(false);
+ contextMap.getDependentContext().setActive(false);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java 2008-10-29
10:30:21 UTC (rev 205)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java 2008-10-29
10:58:20 UTC (rev 206)
@@ -1,10 +1,7 @@
package org.jboss.webbeans.util;
-import java.lang.reflect.Method;
-import javassist.util.proxy.MethodHandler;
-
public class ClientProxy
{
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyFactory.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyFactory.java 2008-10-29
10:30:21 UTC (rev 205)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyFactory.java 2008-10-29
10:58:20 UTC (rev 206)
@@ -35,6 +35,8 @@
Context context = manager.getContext(beanScope);
Object instance = context.get(bean, true);
return proceed.invoke(instance, args);
+// Oneliner ;-)
+// return
proceed.invoke(manager.getContext(((Bean<?>)self).getScopeType()).get(bean, true),
args);
}
}