Author: nickarls
Date: 2008-10-29 03:34:07 -0400 (Wed, 29 Oct 2008)
New Revision: 204
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyUtil.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
Log:
Minor. renames
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
07:24:34 UTC (rev 203)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-10-29
07:34:07 UTC (rev 204)
@@ -34,7 +34,7 @@
import org.jboss.webbeans.exceptions.TypesafeResolutionLocation;
import org.jboss.webbeans.injectable.Injectable;
import org.jboss.webbeans.injectable.ResolverInjectable;
-import org.jboss.webbeans.util.ClientProxyUtil;
+import org.jboss.webbeans.util.ClientProxy;
import org.jboss.webbeans.util.MapWrapper;
import org.jboss.webbeans.util.Reflections;
@@ -341,7 +341,7 @@
else
{
Bean<T> bean = beans.iterator().next();
- if (getModelManager().getScopeModel(bean.getScopeType()).isNormal() &&
!ClientProxyUtil.isProxyable(injectable.getType()))
+ if (getModelManager().getScopeModel(bean.getScopeType()).isNormal() &&
!ClientProxy.isProxyable(injectable.getType()))
{
throw new UnproxyableDependencyException(new
TypesafeResolutionLocation(injectable) + "Unable to proxy");
}
@@ -390,7 +390,7 @@
{
try
{
- clientProxy = ClientProxyUtil.createProxy(new ProxyData(bean, this));
+ clientProxy = ClientProxy.createProxy(new ProxyData(bean, this));
} catch (Exception e) {
throw new UnproxyableDependencyException("Could not create proxy",
e);
}
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java (from
rev 203, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyUtil.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java
(rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxy.java 2008-10-29
07:34:07 UTC (rev 204)
@@ -0,0 +1,69 @@
+package org.jboss.webbeans.util;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import javassist.util.proxy.MethodHandler;
+import javassist.util.proxy.ProxyFactory;
+import javassist.util.proxy.ProxyObject;
+
+import javax.webbeans.manager.Bean;
+import javax.webbeans.manager.Context;
+import javax.webbeans.manager.Manager;
+
+import org.jboss.webbeans.ProxyData;
+
+
+public class ClientProxy
+{
+
+ public static boolean isProxyable(Class<?> rawType)
+ {
+ // TODO Add logging
+
+ if (Reflections.getConstructor(rawType) == null)
+ {
+ return false;
+ }
+ else if (Reflections.isTypeOrAnyMethodFinal(rawType))
+ {
+ return false;
+ }
+ else if (Reflections.isPrimitive(rawType))
+ {
+ return false;
+ }
+ else if (Reflections.isArrayType(rawType))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ private static MethodHandler methodHandler = new MethodHandler()
+ {
+ public Object invoke(Object self, Method m, Method proceed, Object[] args) throws
Throwable
+ {
+ ProxyData proxyData = (ProxyData)self;
+ Manager manager = proxyData.getManager();
+ Class<? extends Annotation> beanScope =
proxyData.getBean().getScopeType();
+ Context context = manager.getContext(beanScope);
+ Object instance = context.get(proxyData.getBean(), true);
+ return proceed.invoke(instance, args);
+ }
+ };
+
+ public static Bean<?> createProxy(ProxyData proxyData) throws
InstantiationException, IllegalAccessException
+ {
+ ProxyFactory proxyFactory = new ProxyFactory();
+ proxyFactory.setSuperclass(proxyData.getClass());
+ Class<?> proxyClass = proxyFactory.createClass();
+ Bean<?> proxy = (Bean<?>) proxyClass.newInstance();
+ ((ProxyObject)proxy).setHandler(methodHandler);
+ return proxy;
+ }
+
+}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyUtil.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyUtil.java 2008-10-29
07:24:34 UTC (rev 203)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClientProxyUtil.java 2008-10-29
07:34:07 UTC (rev 204)
@@ -1,69 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-
-import javassist.util.proxy.MethodHandler;
-import javassist.util.proxy.ProxyFactory;
-import javassist.util.proxy.ProxyObject;
-
-import javax.webbeans.manager.Bean;
-import javax.webbeans.manager.Context;
-import javax.webbeans.manager.Manager;
-
-import org.jboss.webbeans.ProxyData;
-
-
-public class ClientProxyUtil
-{
-
- public static boolean isProxyable(Class<?> rawType)
- {
- // TODO Add logging
-
- if (Reflections.getConstructor(rawType) == null)
- {
- return false;
- }
- else if (Reflections.isTypeOrAnyMethodFinal(rawType))
- {
- return false;
- }
- else if (Reflections.isPrimitive(rawType))
- {
- return false;
- }
- else if (Reflections.isArrayType(rawType))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
- private static MethodHandler methodHandler = new MethodHandler()
- {
- public Object invoke(Object self, Method m, Method proceed, Object[] args) throws
Throwable
- {
- ProxyData proxyData = (ProxyData)self;
- Manager manager = proxyData.getManager();
- Class<? extends Annotation> beanScope =
proxyData.getBean().getScopeType();
- Context context = manager.getContext(beanScope);
- Object instance = context.get(proxyData.getBean(), true);
- return proceed.invoke(instance, args);
- }
- };
-
- public static Bean<?> createProxy(ProxyData clientProxy) throws
InstantiationException, IllegalAccessException
- {
- ProxyFactory proxyFactory = new ProxyFactory();
- proxyFactory.setSuperclass(clientProxy.getClass());
- Class<?> proxyClass = proxyFactory.createClass();
- Bean<?> proxy = (Bean<?>) proxyClass.newInstance();
- ((ProxyObject)proxy).setHandler(methodHandler);
- return proxy;
- }
-
-}
Show replies by date