You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/02/19 16:48:09 UTC
svn commit: r1569795 [35/35] - in
/tomee/tomee/trunk/container/openejb-core/src/main: config/pmd/
java/javax/xml/ws/ java/javax/xml/ws/wsaddressing/ java/org/apache/openejb/
java/org/apache/openejb/assembler/
java/org/apache/openejb/assembler/classic/ ...
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/helper/CommandHelper.java Wed Feb 19 15:47:58 2014
@@ -36,9 +36,9 @@ public final class CommandHelper {
public static Lines listEJBs(final String cr) throws Exception {
final ContainerSystem cs = SystemInstance.get().getComponent(ContainerSystem.class);
- Lines lines = new Lines(cr);
+ final Lines lines = new Lines(cr);
lines.add(new Line("Name", "Class", "Interface Type", "Bean Type"));
- for (BeanContext bc : cs.deployments()) {
+ for (final BeanContext bc : cs.deployments()) {
if (bc.isHidden()) {
continue;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/DynamicProxyImplFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/DynamicProxyImplFactory.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/DynamicProxyImplFactory.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/DynamicProxyImplFactory.java Wed Feb 19 15:47:58 2014
@@ -31,21 +31,21 @@ import java.lang.reflect.InvocationHandl
import java.lang.reflect.Method;
public class DynamicProxyImplFactory {
- public static boolean isKnownDynamicallyImplemented(Class<?> clazz) {
+ public static boolean isKnownDynamicallyImplemented(final Class<?> clazz) {
final Annotated<Class<?>> metaClass = new MetaAnnotatedClass(clazz);
return clazz.isInterface()
&& (metaClass.getAnnotation(PersistenceContext.class) != null
|| metaClass.getAnnotation(Proxy.class) != null);
}
- public static Object newProxy(BeanContext context, InvocationHandler invocationHandler) {
+ public static Object newProxy(final BeanContext context, final InvocationHandler invocationHandler) {
if (QueryProxy.class.isInstance(invocationHandler)) {
EntityManager em = null;
for (final Injection injection : context.getInjections()) {
if (QueryProxy.class.equals(injection.getTarget())) {
try {
em = (EntityManager) context.getJndiEnc().lookup(injection.getJndiName());
- } catch (NamingException e) {
+ } catch (final NamingException e) {
throw new OpenEJBRuntimeException("a dynamic bean should reference at least one correct PersistenceContext", e);
}
}
@@ -58,7 +58,7 @@ public class DynamicProxyImplFactory {
try {
return ProxyManager.newProxyInstance(context.getBeanClass(), new Handler(invocationHandler));
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
throw new OpenEJBRuntimeException("illegal access", e);
}
}
@@ -76,7 +76,7 @@ public class DynamicProxyImplFactory {
private static final class Handler implements InvocationHandler {
private InvocationHandler handler;
- private Handler(InvocationHandler handler) {
+ private Handler(final InvocationHandler handler) {
this.handler = handler;
}
@@ -85,7 +85,7 @@ public class DynamicProxyImplFactory {
}
@Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
return handler.invoke(proxy, method, args);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/Jdk13ProxyFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/Jdk13ProxyFactory.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/Jdk13ProxyFactory.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/Jdk13ProxyFactory.java Wed Feb 19 15:47:58 2014
@@ -29,18 +29,18 @@ import java.util.Set;
*/
public class Jdk13ProxyFactory implements ProxyFactory {
- public void init(Properties props) throws OpenEJBException {
+ public void init(final Properties props) throws OpenEJBException {
}
- public InvocationHandler getInvocationHandler(Object proxy) throws IllegalArgumentException {
+ public InvocationHandler getInvocationHandler(final Object proxy) throws IllegalArgumentException {
return (InvocationHandler) Proxy.getInvocationHandler(proxy);
}
- public Class getProxyClass(Class interfce) throws IllegalArgumentException {
+ public Class getProxyClass(final Class interfce) throws IllegalArgumentException {
return Proxy.getProxyClass(interfce.getClassLoader(), new Class[]{interfce});
}
- public Class getProxyClass(Class[] interfaces) throws IllegalArgumentException {
+ public Class getProxyClass(final Class[] interfaces) throws IllegalArgumentException {
if (interfaces.length < 1) {
throw new IllegalArgumentException("It's boring to implement 0 interfaces!");
}
@@ -50,7 +50,7 @@ public class Jdk13ProxyFactory implement
/*
* Returns true if and only if the specified class was dynamically generated to be a proxy class using the getProxyClass method or the newProxyInstance method.
*/
- public boolean isProxyClass(Class cl) {
+ public boolean isProxyClass(final Class cl) {
return Proxy.isProxyClass(cl);
}
@@ -58,15 +58,15 @@ public class Jdk13ProxyFactory implement
* Returns an instance of a proxy class for the specified interface that dispatches method invocations to
* the specified invocation handler.
*/
- public Object newProxyInstance(Class interfce, InvocationHandler h) throws IllegalArgumentException {
+ public Object newProxyInstance(final Class interfce, final InvocationHandler h) throws IllegalArgumentException {
try {
return Proxy.newProxyInstance(interfce.getClassLoader(), new Class[]{interfce}, h);
- } catch (IllegalArgumentException iae) {
+ } catch (final IllegalArgumentException iae) {
final ClassLoader reconciliatedCl = reconciliate(interfce);
try {
reconciliatedCl.loadClass(interfce.getName());
return Proxy.newProxyInstance(reconciliatedCl, new Class[]{interfce}, h);
- } catch (ClassNotFoundException e2) {
+ } catch (final ClassNotFoundException e2) {
throw iae;
}
}
@@ -76,31 +76,31 @@ public class Jdk13ProxyFactory implement
* Returns an instance of a proxy class for the specified interface that dispatches method invocations to
* the specified invocation handler.
*/
- public Object newProxyInstance(Class[] interfaces, InvocationHandler handler) throws IllegalArgumentException {
+ public Object newProxyInstance(final Class[] interfaces, final InvocationHandler handler) throws IllegalArgumentException {
if (interfaces.length < 1) {
throw new IllegalArgumentException("It's boring to implement 0 interfaces!");
}
try {
return Proxy.newProxyInstance(interfaces[0].getClassLoader(), interfaces, handler);
- } catch (IllegalArgumentException e) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ } catch (final IllegalArgumentException e) {
+ final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try {
- Class tcclHomeClass = tccl.loadClass(interfaces[0].getName());
+ final Class tcclHomeClass = tccl.loadClass(interfaces[0].getName());
if (tcclHomeClass == interfaces[0]) {
return Proxy.newProxyInstance(tccl, interfaces, handler);
}
- } catch (ClassNotFoundException e1) {
+ } catch (final ClassNotFoundException e1) {
// maybe all interfaces are not in the same classloader (OSGi)
// trying to reconciliate it here
- ClassLoader reconciliatedCl = reconciliate(interfaces);
- Class homeClass;
+ final ClassLoader reconciliatedCl = reconciliate(interfaces);
+ final Class homeClass;
try {
homeClass = reconciliatedCl.loadClass(interfaces[0].getName());
if (homeClass == interfaces[0]) {
return Proxy.newProxyInstance(reconciliatedCl, interfaces, handler);
}
- } catch (ClassNotFoundException e2) {
+ } catch (final ClassNotFoundException e2) {
throw e;
}
}
@@ -108,9 +108,9 @@ public class Jdk13ProxyFactory implement
}
}
- private static ClassLoader reconciliate(Class<?>... interfaces) {
- Set<ClassLoader> classloaders = new LinkedHashSet<ClassLoader>();
- for (Class<?> clazz : interfaces) {
+ private static ClassLoader reconciliate(final Class<?>... interfaces) {
+ final Set<ClassLoader> classloaders = new LinkedHashSet<ClassLoader>();
+ for (final Class<?> clazz : interfaces) {
classloaders.add(clazz.getClassLoader());
}
return new MultipleClassLoadersClassLoader(classloaders.toArray(new ClassLoader[classloaders.size()]));
@@ -125,12 +125,12 @@ public class Jdk13ProxyFactory implement
}
@Override
- public Class<?> loadClass(String name) throws ClassNotFoundException {
+ public Class<?> loadClass(final String name) throws ClassNotFoundException {
ClassNotFoundException ex = null;
- for (ClassLoader cl : delegatingClassloaders) {
+ for (final ClassLoader cl : delegatingClassloaders) {
try {
return cl.loadClass(name);
- } catch (ClassNotFoundException cnfe) {
+ } catch (final ClassNotFoundException cnfe) {
if (ex == null) {
ex = cnfe;
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/LocalBeanProxyFactory.java Wed Feb 19 15:47:58 2014
@@ -56,7 +56,7 @@ public class LocalBeanProxyFactory imple
try {
final Class proxyClass = createProxy(classToSubclass, classLoader, interfaces);
return constructProxy(proxyClass, handler);
- } catch (Throwable e) {
+ } catch (final Throwable e) {
throw new InternalError("LocalBeanProxyFactory.newProxyInstance: " + Debug.printStackTrace(e));
}
}
@@ -70,9 +70,9 @@ public class LocalBeanProxyFactory imple
} finally {
field.setAccessible(false);
}
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
throw new IllegalArgumentException(e);
}
}
@@ -86,9 +86,9 @@ public class LocalBeanProxyFactory imple
} finally {
field.setAccessible(false);
}
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
throw new IllegalArgumentException(e);
}
}
@@ -106,7 +106,7 @@ public class LocalBeanProxyFactory imple
private static Field getDeclaredField(final Class clazz, final String fieldName) {
try {
return clazz.getDeclaredField(fieldName);
- } catch (NoSuchFieldException e) {
+ } catch (final NoSuchFieldException e) {
final String message = String.format("Proxy class does not contain expected field \"%s\": %s", fieldName, clazz.getName());
throw new IllegalStateException(message, e);
}
@@ -121,7 +121,7 @@ public class LocalBeanProxyFactory imple
try {
return cl.loadClass(proxyName);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
@@ -132,14 +132,14 @@ public class LocalBeanProxyFactory imple
try { // Try it again, another thread may have beaten this one...
return cl.loadClass(proxyName);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
final byte[] proxyBytes = generateProxy(classToProxy, classFileName, interfaces);
return Unsafe.defineClass(classToProxy, proxyName, proxyBytes);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new InternalError("LocalBeanProxyFactory.createProxy: " + Debug.printStackTrace(e));
} finally {
lock.unlock();
@@ -252,7 +252,7 @@ public class LocalBeanProxyFactory imple
visit(cw, method, proxyName, handlerName).visitEnd();
}
- public static MethodVisitor visit(ClassWriter cw, Method method, String proxyName, String handlerName) throws ProxyGenerationException {
+ public static MethodVisitor visit(final ClassWriter cw, final Method method, final String proxyName, final String handlerName) throws ProxyGenerationException {
final Class<?> returnType = method.getReturnType();
final Class<?>[] parameterTypes = method.getParameterTypes();
final Class<?>[] exceptionTypes = method.getExceptionTypes();
@@ -718,16 +718,16 @@ public class LocalBeanProxyFactory imple
public Class<?> run() {
try {
return Thread.currentThread().getContextClassLoader().loadClass("sun.misc.Unsafe");
- } catch (Exception e) {
+ } catch (final Exception e) {
try {
return ClassLoader.getSystemClassLoader().loadClass("sun.misc.Unsafe");
- } catch (ClassNotFoundException e1) {
+ } catch (final ClassNotFoundException e1) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe", e);
}
}
}
});
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe class", e);
}
@@ -738,7 +738,7 @@ public class LocalBeanProxyFactory imple
final Field field = unsafeClass.getDeclaredField("theUnsafe");
field.setAccessible(true);
return field.get(null);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe", e);
}
}
@@ -750,7 +750,7 @@ public class LocalBeanProxyFactory imple
final Method mtd = unsafeClass.getDeclaredMethod("allocateInstance", Class.class);
mtd.setAccessible(true);
return mtd;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe.allocateInstance", e);
}
}
@@ -762,7 +762,7 @@ public class LocalBeanProxyFactory imple
final Method mtd = unsafeClass.getDeclaredMethod("objectFieldOffset", Field.class);
mtd.setAccessible(true);
return mtd;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe.objectFieldOffset", e);
}
}
@@ -774,7 +774,7 @@ public class LocalBeanProxyFactory imple
final Method mtd = unsafeClass.getDeclaredMethod("putObject", Object.class, long.class, Object.class);
mtd.setAccessible(true);
return mtd;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe.putObject", e);
}
}
@@ -786,7 +786,7 @@ public class LocalBeanProxyFactory imple
final Method mtd = unsafeClass.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ClassLoader.class, ProtectionDomain.class);
mtd.setAccessible(true);
return mtd;
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Cannot get sun.misc.Unsafe.defineClass", e);
}
}
@@ -796,9 +796,9 @@ public class LocalBeanProxyFactory imple
private static Object allocateInstance(final Class clazz) {
try {
return allocateInstance.invoke(unsafe, clazz);
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
throw new IllegalStateException("Failed to allocateInstance of Proxy class " + clazz.getName(), e);
- } catch (InvocationTargetException e) {
+ } catch (final InvocationTargetException e) {
final Throwable throwable = e.getTargetException() != null ? e.getTargetException() : e;
throw new IllegalStateException("Failed to allocateInstance of Proxy class " + clazz.getName(), throwable);
}
@@ -808,13 +808,13 @@ public class LocalBeanProxyFactory imple
final long offset;
try {
offset = (Long) objectFieldOffset.invoke(unsafe, field);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Failed getting offset for: field=" + field.getName() + " class=" + field.getDeclaringClass().getName(), e);
}
try {
putObject.invoke(unsafe, object, offset, value);
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalStateException("Failed putting field=" + field.getName() + " class=" + field.getDeclaringClass().getName(), e);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyEJB.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyEJB.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyEJB.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyEJB.java Wed Feb 19 15:47:58 2014
@@ -34,7 +34,7 @@ public final class ProxyEJB {
try {
return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext),
beanContext.getBeanClass(), IntraVmProxy.class, Serializable.class);
- } catch (InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen)
+ } catch (final InternalError ie) { // try without intravmproxy which is maybe not loadable (in OSGi it can happen)
return LocalBeanProxyFactory.newProxyInstance(beanContext.getModuleContext().getClassLoader(), new Handler(beanContext),
beanContext.getBeanClass(), Serializable.class);
}
@@ -60,13 +60,13 @@ public final class ProxyEJB {
private transient WeakReference<BeanContext> beanContextRef;
private final Object deploymentID;
- public Handler(BeanContext bc) {
+ public Handler(final BeanContext bc) {
beanContextRef = new WeakReference<BeanContext>(bc);
deploymentID = bc.getDeploymentID();
}
@Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
final BeanContext beanContext = getBeanContext();
final RpcContainer container = RpcContainer.class.cast(beanContext.getContainer());
@@ -77,7 +77,7 @@ public final class ProxyEJB {
public BeanContext getBeanContext() {
- BeanContext beanContext = beanContextRef.get();
+ final BeanContext beanContext = beanContextRef.get();
if (beanContext == null|| beanContext.isDestroyed()){
beanContextRef.clear();
throw new IllegalStateException("Bean '" + deploymentID + "' has been undeployed.");
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyGenerationException.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyGenerationException.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyGenerationException.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyGenerationException.java Wed Feb 19 15:47:58 2014
@@ -21,15 +21,15 @@ public class ProxyGenerationException ex
public ProxyGenerationException() {
}
- public ProxyGenerationException(String message) {
+ public ProxyGenerationException(final String message) {
super(message);
}
- public ProxyGenerationException(Throwable cause) {
+ public ProxyGenerationException(final Throwable cause) {
super(cause);
}
- public ProxyGenerationException(String message, Throwable cause) {
+ public ProxyGenerationException(final String message, final Throwable cause) {
super(message, cause);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyManager.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyManager.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyManager.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/ProxyManager.java Wed Feb 19 15:47:58 2014
@@ -25,11 +25,11 @@ public class ProxyManager {
private static final HashMap factories = new HashMap();
private static volatile String defaultFactoryName;
- public static synchronized ProxyFactory registerFactory(String factoryName, ProxyFactory factory) {
+ public static synchronized ProxyFactory registerFactory(final String factoryName, final ProxyFactory factory) {
return (ProxyFactory) factories.put(factoryName, factory);
}
- public static synchronized ProxyFactory unregisterFactory(String factoryName) {
+ public static synchronized ProxyFactory unregisterFactory(final String factoryName) {
return (ProxyFactory) factories.remove(factoryName);
}
@@ -37,15 +37,15 @@ public class ProxyManager {
if (defaultFactory == null) throw new IllegalStateException("[Proxy Manager] No default proxy factory specified.");
}
- public static ProxyFactory getFactory(String factoryName) {
+ public static ProxyFactory getFactory(final String factoryName) {
return (ProxyFactory) factories.get(factoryName);
}
- public static synchronized ProxyFactory setDefaultFactory(String factoryName) {
- ProxyFactory newFactory = getFactory(factoryName);
+ public static synchronized ProxyFactory setDefaultFactory(final String factoryName) {
+ final ProxyFactory newFactory = getFactory(factoryName);
if (newFactory == null) return defaultFactory;
- ProxyFactory oldFactory = defaultFactory;
+ final ProxyFactory oldFactory = defaultFactory;
defaultFactory = newFactory;
defaultFactoryName = factoryName;
@@ -60,7 +60,7 @@ public class ProxyManager {
return defaultFactoryName;
}
- public static InvocationHandler getInvocationHandler(Object proxy) {
+ public static InvocationHandler getInvocationHandler(final Object proxy) {
if (LocalBeanProxyFactory.isProxy(proxy.getClass())) {
return LocalBeanProxyFactory.getInvocationHandler(proxy);
}
@@ -68,25 +68,25 @@ public class ProxyManager {
return defaultFactory.getInvocationHandler(proxy);
}
- public static Class getProxyClass(Class interfaceType) throws IllegalAccessException {
+ public static Class getProxyClass(final Class interfaceType) throws IllegalAccessException {
return getProxyClass(new Class[]{interfaceType});
}
- public static Class getProxyClass(Class[] interfaces) throws IllegalAccessException {
+ public static Class getProxyClass(final Class[] interfaces) throws IllegalAccessException {
checkDefaultFactory();
return defaultFactory.getProxyClass(interfaces);
}
- public static Object newProxyInstance(Class interfaceType, InvocationHandler h) throws IllegalAccessException {
+ public static Object newProxyInstance(final Class interfaceType, final InvocationHandler h) throws IllegalAccessException {
return newProxyInstance(new Class[]{interfaceType}, h);
}
- public static Object newProxyInstance(Class[] interfaces, InvocationHandler h) throws IllegalAccessException {
+ public static Object newProxyInstance(final Class[] interfaces, final InvocationHandler h) throws IllegalAccessException {
checkDefaultFactory();
return defaultFactory.newProxyInstance(interfaces, h);
}
- public static boolean isProxyClass(Class cl) {
+ public static boolean isProxyClass(final Class cl) {
checkDefaultFactory();
return defaultFactory.isProxyClass(cl);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/QueryProxy.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/QueryProxy.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/QueryProxy.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/proxy/QueryProxy.java Wed Feb 19 15:47:58 2014
@@ -69,11 +69,11 @@ public class QueryProxy implements Invoc
NAMED, NATIVE, OTHER
}
- public void setEntityManager(EntityManager entityManager) {
+ public void setEntityManager(final EntityManager entityManager) {
em = entityManager;
}
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if (method.getDeclaringClass().equals(Object.class)) {
return method.invoke(this, args);
}
@@ -124,7 +124,7 @@ public class QueryProxy implements Invoc
* @param type the query type
* @return the expected result
*/
- private Object query(Method method, Object[] args, QueryType type) {
+ private Object query(final Method method, final Object[] args, final QueryType type) {
if (args.length < 1) {
throw new IllegalArgumentException("query() needs at least the query name");
}
@@ -153,24 +153,24 @@ public class QueryProxy implements Invoc
}
if (Map.class.isAssignableFrom(args[i].getClass())) {
- for (Map.Entry<String, ?> entry : ((Map<String, ?>) args[i]).entrySet()) {
+ for (final Map.Entry<String, ?> entry : ((Map<String, ?>) args[i]).entrySet()) {
query = query.setParameter(entry.getKey(), entry.getValue());
}
matched++;
} else if (args[i].getClass().isArray()) {
- Object[] array = (Object[]) args[i];
+ final Object[] array = (Object[]) args[i];
for (int j = 0; j < array.length; j++) {
query = query.setParameter(j, array[j]);
}
matched++;
} else if (isInt(args[i].getClass())) {
- int next = i + 1;
+ final int next = i + 1;
if (args.length == next || !isInt(args[next].getClass())) {
throw new IllegalArgumentException("if you provide a firstResult (first int parameter)" +
"you should provide a maxResult too");
}
- int first = (Integer) args[i];
- int max = (Integer) args[next];
+ final int first = (Integer) args[i];
+ final int max = (Integer) args[next];
query = query.setFirstResult(first);
query = query.setMaxResults(max);
@@ -194,9 +194,9 @@ public class QueryProxy implements Invoc
return getQueryResult(method, query);
}
- private Class<?> getReturnedType(Method method) {
+ private Class<?> getReturnedType(final Method method) {
final String methodName = method.getName();
- Class<?> type;
+ final Class<?> type;
if (returnsTypes.containsKey(methodName)) {
type = returnsTypes.get(methodName);
} else {
@@ -206,21 +206,21 @@ public class QueryProxy implements Invoc
return type;
}
- private Object getQueryResult(Method method, Query query) {
+ private Object getQueryResult(final Method method, final Query query) {
if (Collection.class.isAssignableFrom(method.getReturnType())) {
return query.getResultList();
}
return query.getSingleResult();
}
- private Object find(Method method, Object[] args) {
+ private Object find(final Method method, final Object[] args) {
final String methodName = method.getName();
final Class<?> type = getReturnedType(method);
final Query query = createFinderQuery(em, methodName, type, args);
return getQueryResult(method, query);
}
- private void remove(Object[] args, Class<?> returnType) {
+ private void remove(final Object[] args, final Class<?> returnType) {
if (args != null && args.length == 1 && returnType.equals(Void.TYPE)) {
Object entity = args[0];
if (!em.contains(entity)) { // reattach the entity if possible
@@ -232,7 +232,7 @@ public class QueryProxy implements Invoc
}
SingularAttribute<?, ?> id = null; // = et.getId(entityClass); doesn't work with openJPA
- for (SingularAttribute<?, ?> sa : et.getSingularAttributes()) {
+ for (final SingularAttribute<?, ?> sa : et.getSingularAttributes()) {
if (sa.isId()) {
id = sa;
break;
@@ -243,14 +243,14 @@ public class QueryProxy implements Invoc
}
final String idName = id.getName();
- Object idValue;
+ final Object idValue;
try {
idValue = BeanUtils.getProperty(entity, idName);
- } catch (InvocationTargetException e) {
+ } catch (final InvocationTargetException e) {
throw new IllegalArgumentException("can't invoke to get entity id");
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
throw new IllegalArgumentException("can't find the method to get entity id");
- } catch (IllegalAccessException e) {
+ } catch (final IllegalAccessException e) {
throw new IllegalArgumentException("can't access field/method to get entity id");
}
@@ -265,7 +265,7 @@ public class QueryProxy implements Invoc
}
}
- private Object merge(Object[] args, Class<?> returnType) {
+ private Object merge(final Object[] args, final Class<?> returnType) {
if (args != null && args.length == 1 && returnType.equals(args[0].getClass())) {
return em.merge(args[0]);
} else {
@@ -274,7 +274,7 @@ public class QueryProxy implements Invoc
}
}
- private void persist(Object[] args, Class<?> returnType) {
+ private void persist(final Object[] args, final Class<?> returnType) {
if (args != null && args.length == 1 && returnType.equals(Void.TYPE)) {
em.persist(args[0]);
} else {
@@ -282,9 +282,9 @@ public class QueryProxy implements Invoc
}
}
- private Class<?> getGenericType(Type type) {
+ private Class<?> getGenericType(final Type type) {
if (type instanceof ParameterizedType) {
- ParameterizedType pt = (ParameterizedType) type;
+ final ParameterizedType pt = (ParameterizedType) type;
if (pt.getActualTypeArguments().length == 1) {
return (Class<?>) pt.getActualTypeArguments()[0];
}
@@ -292,24 +292,24 @@ public class QueryProxy implements Invoc
return Class.class.cast(type);
}
- private <T> Query createFinderQuery(EntityManager entityManager, String methodName, Class<T> entityType, Object[] args) {
+ private <T> Query createFinderQuery(final EntityManager entityManager, final String methodName, final Class<T> entityType, final Object[] args) {
final List<String> conditions = parseMethodName(methodName);
final EntityType<T> et = entityManager.getMetamodel().entity(entityType);
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Object> query = cb.createQuery();
- Root<T> from = query.from(entityType);
+ final Root<T> from = query.from(entityType);
query = query.select(from);
int i = 0;
Predicate where = null;
- for (String condition : conditions) {
- SingularAttribute<? super T, ?> attribute = et.getSingularAttribute(condition);
- Path<?> path = from.get(attribute);
- Class<?> javaType = attribute.getType().getJavaType();
+ for (final String condition : conditions) {
+ final SingularAttribute<? super T, ?> attribute = et.getSingularAttribute(condition);
+ final Path<?> path = from.get(attribute);
+ final Class<?> javaType = attribute.getType().getJavaType();
- Predicate currentClause;
+ final Predicate currentClause;
if (javaType.equals(String.class)) {
currentClause = cb.like((Expression<String>) path, (String) args[i++]);
} else if (Number.class.isAssignableFrom(javaType) || javaType.isPrimitive()) {
@@ -331,11 +331,11 @@ public class QueryProxy implements Invoc
}
// pagination
- TypedQuery<?> emQuery = entityManager.createQuery(query);
+ final TypedQuery<?> emQuery = entityManager.createQuery(query);
if (args != null && args.length == conditions.size() + 2
&& isInt(args[args.length - 2].getClass()) && isInt(args[args.length - 1].getClass())) {
- int first = (Integer) args[args.length - 2];
- int max = (Integer) args[args.length - 1];
+ final int first = (Integer) args[args.length - 2];
+ final int max = (Integer) args[args.length - 1];
emQuery.setFirstResult(first);
emQuery.setMaxResults(max);
@@ -344,12 +344,12 @@ public class QueryProxy implements Invoc
return emQuery;
}
- private boolean isInt(Class<?> aClass) {
+ private boolean isInt(final Class<?> aClass) {
return Integer.TYPE.equals(aClass) || Integer.class.equals(aClass);
}
private List<String> parseMethodName(final String methodName) {
- List<String> parsed;
+ final List<String> parsed;
if (conditions.containsKey(methodName)) {
parsed = conditions.get(methodName);
} else {
@@ -358,8 +358,8 @@ public class QueryProxy implements Invoc
String toParse = methodName.substring(FIND_PREFIX.length());
if (toParse.startsWith(BY)) {
toParse = toParse.substring(2);
- String[] columns = toParse.split(AND);
- for (String column : columns) {
+ final String[] columns = toParse.split(AND);
+ for (final String column : columns) {
parsed.add(StringUtils.uncapitalize(column));
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/reflection/Reflections.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/reflection/Reflections.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/reflection/Reflections.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/reflection/Reflections.java Wed Feb 19 15:47:58 2014
@@ -29,7 +29,7 @@ public final class Reflections {
public static Method findMethod(final String name, final Class<?> type, final Class<?>... args) {
try {
return type.getMethod(name, args);
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException e) {
throw new IllegalArgumentException("Can't find public method " + name + " in " + type.getName());
}
}
@@ -44,9 +44,9 @@ public final class Reflections {
acc = mtd.isAccessible();
mtd.setAccessible(true);
return mtd.invoke(obj, args);
- } catch (NoSuchMethodException nsme) {
+ } catch (final NoSuchMethodException nsme) {
// no-op
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalArgumentException(e);
} finally {
if (mtd != null) {
@@ -64,7 +64,7 @@ public final class Reflections {
while (clazz != null) {
try {
final Field f = clazz.getDeclaredField(field);
- boolean acc = f.isAccessible();
+ final boolean acc = f.isAccessible();
f.setAccessible(true);
try {
f.set(instance, value);
@@ -72,9 +72,9 @@ public final class Reflections {
} finally {
f.setAccessible(acc);
}
- } catch (NoSuchFieldException nsfe) {
+ } catch (final NoSuchFieldException nsfe) {
// no-op
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalArgumentException(e);
}
@@ -87,16 +87,16 @@ public final class Reflections {
while (clazz != null) {
try {
final Field f = clazz.getDeclaredField(field);
- boolean acc = f.isAccessible();
+ final boolean acc = f.isAccessible();
f.setAccessible(true);
try {
return f.get(instance);
} finally {
f.setAccessible(acc);
}
- } catch (NoSuchFieldException nsfe) {
+ } catch (final NoSuchFieldException nsfe) {
// no-op
- } catch (Exception e) {
+ } catch (final Exception e) {
throw new IllegalArgumentException(e);
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/urlhandler/resource/Handler.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/urlhandler/resource/Handler.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/urlhandler/resource/Handler.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/urlhandler/resource/Handler.java Wed Feb 19 15:47:58 2014
@@ -27,7 +27,7 @@ import java.security.PrivilegedAction;
public class Handler extends URLStreamHandler {
- protected URLConnection openConnection(URL url) throws IOException {
+ protected URLConnection openConnection(final URL url) throws IOException {
final String cln = url.getHost();
final String resrce = url.getFile().substring(1);
final URL realURL;
@@ -35,7 +35,7 @@ public class Handler extends URLStreamHa
final ClassLoader cl = getContextClassLoader();
try {
Class.forName(cln, true, cl);
- } catch (ClassNotFoundException ex) {
+ } catch (final ClassNotFoundException ex) {
throw (IOException) new MalformedURLException("Class " + cln + " cannot be found (" + ex + ")").initCause(ex);
}
realURL = cl.getResource(resrce);
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/LightweightWebAppBuilder.java Wed Feb 19 15:47:58 2014
@@ -87,7 +87,7 @@ public class LightweightWebAppBuilder im
removeServletMethod = utilClass.getMethod("removeServlet", String.class, WebContext.class);
addFilterMethod = utilClass.getMethod("addFilter", String.class, WebContext.class, String.class, FilterConfig.class);
removeFilterMethod = utilClass.getMethod("removeFilter", String.class, WebContext.class);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.info("Web features will not be available, add openejb-http if you need them");
}
}
@@ -105,7 +105,7 @@ public class LightweightWebAppBuilder im
throw new OpenEJBRuntimeException("Can't find app context for " + appInfo.appId);
}
- for (WebAppInfo webAppInfo : appInfo.webApps) {
+ for (final WebAppInfo webAppInfo : appInfo.webApps) {
final Set<Injection> injections = new HashSet<Injection>(appContext.getInjections());
injections.addAll(new InjectionBuilder(classLoader).buildInjections(webAppInfo.jndiEnc));
@@ -139,7 +139,7 @@ public class LightweightWebAppBuilder im
servletContextEvents.put(webAppInfo, sce);
// listeners
- for (ListenerInfo listener : webAppInfo.listeners) {
+ for (final ListenerInfo listener : webAppInfo.listeners) {
final Class<?> clazz = webContext.getClassLoader().loadClass(listener.classname);
final Object instance = webContext.newInstance(clazz);
if (ServletContextListener.class.isInstance(instance)) {
@@ -163,34 +163,34 @@ public class LightweightWebAppBuilder im
}
// register filters
- for (FilterInfo info : webAppInfo.filters) {
- for (String mapping : info.mappings) {
+ for (final FilterInfo info : webAppInfo.filters) {
+ for (final String mapping : info.mappings) {
final FilterConfig config = new SimpleFilterConfig(sce.getServletContext(), info.name, info.initParams);
try {
addFilterMethod.invoke(null, info.classname, webContext, mapping, config);
deployedWebObjects.filterMappings.add(mapping);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.warning(e.getMessage(), e);
}
}
}
- for (ClassListInfo info : webAppInfo.webAnnotatedClasses) {
+ for (final ClassListInfo info : webAppInfo.webAnnotatedClasses) {
final String url = info.name;
- for (String filterPath : info.list) {
+ for (final String filterPath : info.list) {
final Class<?> clazz = loadFromUrls(webContext.getClassLoader(), url, filterPath);
final WebFilter annotation = clazz.getAnnotation(WebFilter.class);
if (annotation != null) {
final Properties initParams = new Properties();
- for (WebInitParam param : annotation.initParams()) {
+ for (final WebInitParam param : annotation.initParams()) {
initParams.put(param.name(), param.value());
}
final FilterConfig config = new SimpleFilterConfig(sce.getServletContext(), info.name, initParams);
- for (String mapping : annotation.urlPatterns()) {
+ for (final String mapping : annotation.urlPatterns()) {
try {
addFilterMethod.invoke(null, clazz.getName(), webContext, mapping, config);
deployedWebObjects.filterMappings.add(mapping);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.warning(e.getMessage(), e);
}
}
@@ -204,11 +204,11 @@ public class LightweightWebAppBuilder im
}
// register servlets
- for (ServletInfo info : webAppInfo.servlets) {
+ for (final ServletInfo info : webAppInfo.servlets) {
if ("true".equalsIgnoreCase(appInfo.properties.getProperty("openejb.jaxrs.on", "true"))) {
// skip jaxrs servlets
boolean skip = false;
- for (ParamValueInfo pvi : info.initParams) {
+ for (final ParamValueInfo pvi : info.initParams) {
if ("javax.ws.rs.Application".equals(pvi.name) || Application.class.getName().equals(pvi.name)) {
skip = true;
}
@@ -223,7 +223,7 @@ public class LightweightWebAppBuilder im
if (Application.class.isAssignableFrom(classLoader.loadClass(info.servletName))) {
continue;
}
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
}
@@ -235,27 +235,27 @@ public class LightweightWebAppBuilder im
}
// deploy
- for (String mapping : info.mappings) {
+ for (final String mapping : info.mappings) {
try {
addServletMethod.invoke(null, info.servletClass, webContext, mapping);
deployedWebObjects.mappings.add(mapping);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.warning(e.getMessage(), e);
}
}
}
- for (ClassListInfo info : webAppInfo.webAnnotatedClasses) {
+ for (final ClassListInfo info : webAppInfo.webAnnotatedClasses) {
final String url = info.name;
- for (String servletPath : info.list) {
+ for (final String servletPath : info.list) {
final Class<?> clazz = loadFromUrls(webContext.getClassLoader(), url, servletPath);
final WebServlet annotation = clazz.getAnnotation(WebServlet.class);
if (annotation != null) {
- for (String mapping : annotation.urlPatterns()) {
+ for (final String mapping : annotation.urlPatterns()) {
try {
addServletMethod.invoke(null, clazz.getName(), webContext, mapping);
deployedWebObjects.mappings.add(mapping);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOGGER.warning(e.getMessage(), e);
}
}
@@ -275,7 +275,7 @@ public class LightweightWebAppBuilder im
try { // in WEB-INF/classes
return loader.loadClass(className(classname));
- } catch (ClassNotFoundException cnfe) { // in a dependency (jar)
+ } catch (final ClassNotFoundException cnfe) { // in a dependency (jar)
return loader.loadClass(className(path.substring(path.indexOf("!") + 2)));
}
}
@@ -286,31 +286,31 @@ public class LightweightWebAppBuilder im
@Override
public void undeployWebApps(final AppInfo appInfo) throws Exception {
- for (WebAppInfo webAppInfo : appInfo.webApps) {
+ for (final WebAppInfo webAppInfo : appInfo.webApps) {
final DeployedWebObjects context = servletDeploymentInfo.remove(webAppInfo);
final ServletContextEvent sce = servletContextEvents.remove(webAppInfo);
final List<Object> listenerInstances = listeners.remove(webAppInfo);
if (addServletMethod != null) {
- for (String mapping : context.mappings) {
+ for (final String mapping : context.mappings) {
try {
removeServletMethod.invoke(null, mapping, context.webContext);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
}
- for (String mapping : context.filterMappings) {
+ for (final String mapping : context.filterMappings) {
try {
removeFilterMethod.invoke(null, mapping, context.webContext);
- } catch (Exception e) {
+ } catch (final Exception e) {
// no-op
}
}
}
if (listenerInstances != null) {
- for (Object instance : listenerInstances) {
+ for (final Object instance : listenerInstances) {
if (ServletContextListener.class.isInstance(instance)) {
((ServletContextListener) instance).contextDestroyed(sce);
}
@@ -348,7 +348,7 @@ public class LightweightWebAppBuilder im
public Object lookup(final String name) throws NamingException {
try {
return delegate.lookup(name);
- } catch (NameNotFoundException nnfe) {
+ } catch (final NameNotFoundException nnfe) {
return bindings.get(name);
}
}
Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java?rev=1569795&r1=1569794&r2=1569795&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/web/WebInitialContext.java Wed Feb 19 15:47:58 2014
@@ -37,7 +37,7 @@ public class WebInitialContext implement
}
@Override
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
if ("lookup".equals(method.getName()) && method.getParameterTypes().length == 1 && String.class.equals(method.getParameterTypes()[0])) {
final Object lookedUp = bindings.get(normalize((String) args[0]));
if (lookedUp != null) {