[jboss-svn-commits] JBoss Common SVN: r4165 - invokablecontainer/trunk/api/src/main/java/org/jboss/invokable.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 10 22:20:22 EST 2010


Author: david.lloyd at jboss.com
Date: 2010-03-10 22:20:21 -0500 (Wed, 10 Mar 2010)
New Revision: 4165

Removed:
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProcessingInvocationDispatcher.java
Modified:
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/Invocation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationPermission.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ObjectInvocationDispatcher.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProxyInvocationHandler.java
Log:
Javadocs

Modified: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/Invocation.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/Invocation.java	2010-03-11 02:57:03 UTC (rev 4164)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/Invocation.java	2010-03-11 03:20:21 UTC (rev 4165)
@@ -54,9 +54,9 @@
     /**
      * Construct a new instance.
      *
-     * @param context
-     * @param targetMethod
-     * @param args
+     * @param context the invocation context to use
+     * @param targetMethod the method being invoked
+     * @param args the arguments
      */
     public Invocation(final InvocationContext context, final Method targetMethod, final Object... args) {
         if (targetMethod == null) {
@@ -73,8 +73,14 @@
         this.context = context;
     }
 
-    public Invocation(final Method method, final Object... args) {
-        this(InvocationContext.EMPTY, method, args);
+    /**
+     * Construct a new instance.
+     *
+     * @param targetMethod the method being invoked
+     * @param args the arguments
+     */
+    public Invocation(final Method targetMethod, final Object... args) {
+        this(InvocationContext.EMPTY, targetMethod, args);
     }
 
     static {

Modified: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationPermission.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationPermission.java	2010-03-11 02:57:03 UTC (rev 4164)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationPermission.java	2010-03-11 03:20:21 UTC (rev 4165)
@@ -24,16 +24,32 @@
 
 import java.security.BasicPermission;
 
+/**
+ * The basic permission type for invocations.
+ */
 public final class InvocationPermission extends BasicPermission {
 
     private static final long serialVersionUID = 1974507481892267240L;
 
+    /**
+     * Construct a new instance.
+     *
+     * @param name the permission name
+     */
     public InvocationPermission(String name) {
         super(name);
     }
 
+    /**
+     * The "invoke" permission.
+     */
     public static final InvocationPermission INVOKE = new InvocationPermission("invoke");
 
+    /**
+     * Resolve constant permissions to their constant values.
+     *
+     * @return the resolved permission
+     */
     protected Object readResolve() {
         if ("invoke".equals(getName())) {
             return INVOKE;

Modified: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ObjectInvocationDispatcher.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ObjectInvocationDispatcher.java	2010-03-11 02:57:03 UTC (rev 4164)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ObjectInvocationDispatcher.java	2010-03-11 03:20:21 UTC (rev 4165)
@@ -28,16 +28,25 @@
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 
+/**
+ * An {@code InvocationDispatcher} which executes the invocation method on a target object.
+ */
 public final class ObjectInvocationDispatcher implements Serializable, InvocationDispatcher {
 
     private static final long serialVersionUID = 149324822317622879L;
 
     private final Object target;
 
+    /**
+     * Construct a new instance.
+     *
+     * @param target the target for invocations
+     */
     public ObjectInvocationDispatcher(final Object target) {
         this.target = target;
     }
 
+    /** {@inheritDoc} */
     public Object dispatch(final Invocation invocation) throws InvocationException {
         try {
             return invocation.getTargetMethod().invoke(target, invocation.getArgs());

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProcessingInvocationDispatcher.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProcessingInvocationDispatcher.java	2010-03-11 02:57:03 UTC (rev 4164)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProcessingInvocationDispatcher.java	2010-03-11 03:20:21 UTC (rev 4165)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.invokable;
-
-import java.io.IOException;
-import java.io.InvalidObjectException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-public final class ProcessingInvocationDispatcher implements InvocationDispatcher, Serializable {
-
-    private static final long serialVersionUID = -132466317660532342L;
-
-    private final InvocationDispatcher dispatcher;
-
-    public ProcessingInvocationDispatcher(final InvocationDispatcher dispatcher) {
-        this.dispatcher = dispatcher;
-    }
-
-    public Object dispatch(final Invocation invocation) throws InvocationException {
-        return dispatcher.dispatch(invocation);
-    }
-
-    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
-        ois.defaultReadObject();
-        final SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            if (! dispatcher.getClass().getProtectionDomain().implies(InvocationPermission.INVOKE)) {
-                throw new InvalidObjectException("Dispatcher does not have invoke permission");
-            }
-        }
-    }
-}

Modified: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProxyInvocationHandler.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProxyInvocationHandler.java	2010-03-11 02:57:03 UTC (rev 4164)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ProxyInvocationHandler.java	2010-03-11 03:20:21 UTC (rev 4165)
@@ -29,18 +29,39 @@
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 
+/**
+ * A proxy {@code InvocationHandler} which delegates invocations to an {@code InvocationDispatcher}.
+ */
 public final class ProxyInvocationHandler implements InvocationHandler, Serializable {
 
     private static final long serialVersionUID = -7550306900997519378L;
 
     private final InvocationDispatcher dispatcher;
 
+    /**
+     * Construct a new instance.
+     *
+     * @param dispatcher the dispatcher to send invocations to
+     */
     public ProxyInvocationHandler(final InvocationDispatcher dispatcher) {
         this.dispatcher = dispatcher;
     }
 
+    /**
+     * Handle a proxy method invocation.
+     *
+     * @param proxy the proxy instance
+     * @param method the invoked method
+     * @param args the method arguments
+     * @return the result of the method call
+     * @throws Throwable the exception to thrown from the method invocation on the proxy instance, if any
+     */
     public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
-        return dispatcher.dispatch(new Invocation(method, args));
+        try {
+            return dispatcher.dispatch(new Invocation(method, args));
+        } catch (InvocationException e) {
+            throw e.getCause();
+        }
     }
 
     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {



More information about the jboss-svn-commits mailing list