deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-851 added some javadoc
Date Mon, 04 May 2015 20:15:21 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 888e2fe18 -> 38b1fa252


DELTASPIKE-851 added some javadoc

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/e3c9caa2
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/e3c9caa2
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/e3c9caa2

Branch: refs/heads/master
Commit: e3c9caa2c2eb5f627e977d67f1ead1dbf2742985
Parents: 888e2fe
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Mon May 4 22:06:10 2015 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Mon May 4 22:06:10 2015 +0200

----------------------------------------------------------------------
 .../partialbean/impl/PartialBeanProxyFactory.java         |  4 ++++
 .../proxy/invocation/AbstractManualInvocationHandler.java | 10 ++++++++++
 .../proxy/invocation/DelegateManualInvocationHandler.java |  4 ++++
 .../invocation/InterceptManualInvocationHandler.java      |  3 +++
 .../proxy/invocation/ManualInvocationContext.java         |  4 ++++
 .../ManualInvocationThrowableWrapperException.java        |  4 ++++
 .../org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java |  3 +++
 .../proxy/util/DeltaSpikeProxyContextualLifecycle.java    | 10 ++++++++++
 .../deltaspike/proxy/util/DeltaSpikeProxyFactory.java     |  1 +
 9 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
index 08c0165..431e6ee 100644
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
@@ -27,6 +27,10 @@ import javax.enterprise.inject.Typed;
 
 import org.apache.deltaspike.proxy.util.DeltaSpikeProxyFactory;
 
+/**
+ * {@link DeltaSpikeProxyFactory} which delegates all abstract methods to the 
+ * partial bean binding {@link java.lang.reflect.InvocationHandler}.
+ */
 @Typed
 public class PartialBeanProxyFactory extends DeltaSpikeProxyFactory
 {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/AbstractManualInvocationHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/AbstractManualInvocationHandler.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/AbstractManualInvocationHandler.java
index 603eb55..3c49bb4 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/AbstractManualInvocationHandler.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/AbstractManualInvocationHandler.java
@@ -36,6 +36,7 @@ public abstract class AbstractManualInvocationHandler implements InvocationHandl
     @Override
     public Object invoke(Object proxy, Method method, Object[] parameters) throws Throwable
     {
+        // check if interceptors are defined, otherwise just call the original logik
         List<Interceptor<?>> interceptors = resolveInterceptors(proxy, method);
         if (interceptors != null && interceptors.size() > 0)
         {
@@ -62,6 +63,15 @@ public abstract class AbstractManualInvocationHandler implements InvocationHandl
         return proceedOriginal(proxy, method, parameters);
     }
 
+    /**
+     * Calls the original logic after invoking the interceptor chain.
+     * 
+     * @param proxy The current proxy instance.
+     * @param method The current invoked method.
+     * @param parameters The method parameter.
+     * @return The original value from the original method.
+     * @throws Throwable 
+     */
     protected abstract Object proceedOriginal(Object proxy, Method method, Object[] parameters)
throws Throwable;
 
     protected List<Interceptor<?>> resolveInterceptors(Object instance, Method
method)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/DelegateManualInvocationHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/DelegateManualInvocationHandler.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/DelegateManualInvocationHandler.java
index 0d5c947..10da64d 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/DelegateManualInvocationHandler.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/DelegateManualInvocationHandler.java
@@ -25,6 +25,10 @@ import javax.enterprise.inject.Typed;
 
 import org.apache.deltaspike.proxy.util.DeltaSpikeProxy;
 
+/**
+ * {@link AbstractManualInvocationHandler} which delegates the method call to the defined
{@link InvocationHandler}
+ * in {@link DeltaSpikeProxy#getDelegateInvocationHandler()}.
+ */
 @Typed
 public class DelegateManualInvocationHandler extends AbstractManualInvocationHandler
 {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/InterceptManualInvocationHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/InterceptManualInvocationHandler.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/InterceptManualInvocationHandler.java
index 03e2a0d..8eb6b90 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/InterceptManualInvocationHandler.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/InterceptManualInvocationHandler.java
@@ -25,6 +25,9 @@ import javax.enterprise.inject.Typed;
 
 import org.apache.deltaspike.proxy.util.DeltaSpikeProxyFactory;
 
+/**
+ * {@link AbstractManualInvocationHandler} which just delegates to the original method after
invoking interceptors.
+ */
 @Typed
 public class InterceptManualInvocationHandler extends AbstractManualInvocationHandler
 {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationContext.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationContext.java
index 793e242..4761c2f 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationContext.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationContext.java
@@ -31,6 +31,10 @@ import javax.enterprise.inject.spi.Interceptor;
 import javax.interceptor.InvocationContext;
 import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 
+/**
+ * {@link InvocationContext} implementation to support manual interceptor invocation before
invoking the
+ * original logic via the given {@link AbstractManualInvocationHandler}.
+ */
 @Typed
 public class ManualInvocationContext<T, H> implements InvocationContext
 {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationThrowableWrapperException.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationThrowableWrapperException.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationThrowableWrapperException.java
index 4c3b8be..259b493 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationThrowableWrapperException.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/invocation/ManualInvocationThrowableWrapperException.java
@@ -18,6 +18,10 @@
  */
 package org.apache.deltaspike.proxy.invocation;
 
+/**
+ * Wrapper exception to wrap and pass trough the original {@link Throwable} because
+ * the {@link javax.interceptor.InvocationContext#proceed()} method only declares "throws
Exception".
+ */
 public class ManualInvocationThrowableWrapperException extends Exception
 {
     public ManualInvocationThrowableWrapperException(Throwable e)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
index 8dbc54c..cc3ed09 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxy.java
@@ -20,6 +20,9 @@ package org.apache.deltaspike.proxy.util;
 
 import java.lang.reflect.InvocationHandler;
 
+/**
+ * Interface which will automatically be implemented by the proxy instance.
+ */
 public interface DeltaSpikeProxy
 {
     void setDelegateInvocationHandler(InvocationHandler redirectInvocationHandler);

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyContextualLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyContextualLifecycle.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyContextualLifecycle.java
index 93daf78..c8fefc8 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyContextualLifecycle.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyContextualLifecycle.java
@@ -33,6 +33,16 @@ import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.util.ExceptionUtils;
 import org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;
 
+/**
+ * {@link ContextualLifecycle} which handles a complete lifecycle of a proxy:
+ * - creates a proxy via a {@link DeltaSpikeProxyFactory}
+ * - handles the instantiation and injection of the proxy
+ * - handles the instantiation via CDI of the delegate {@link InvocationHandler} and assign
it to the proxy
+ * - handles the release/destruction of both proxy and delegate {@link InvocationHandler}
+ *
+ * @param <T> The class of the original class.
+ * @param <H> The class of the delegate {@link InvocationHandler}.
+ */
 public class DeltaSpikeProxyContextualLifecycle<T, H extends InvocationHandler> implements
ContextualLifecycle<T>
 {
     private final Class<T> proxyClass;

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e3c9caa2/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
index fa9b1f4..7a8ae2f 100644
--- a/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
+++ b/deltaspike/modules/proxy-utils/api/src/main/java/org/apache/deltaspike/proxy/util/DeltaSpikeProxyFactory.java
@@ -36,6 +36,7 @@ public abstract class DeltaSpikeProxyFactory
     public <T> Class<T> getProxyClass(Class<T> targetClass,
             Class<? extends InvocationHandler> invocationHandlerClass)
     {
+        // check if a proxy is already defined for this class
         Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass),
targetClass);
         if (proxyClass == null)
         {


Mime
View raw message