[jboss-svn-commits] JBoss Common SVN: r4206 - in invokablecontainer/trunk/api/src/main/java/org/jboss/invokable: ejb3 and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 29 16:34:01 EDT 2010


Author: david.lloyd at jboss.com
Date: 2010-03-29 16:33:58 -0400 (Mon, 29 Mar 2010)
New Revision: 4206

Added:
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ClientInvocationContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ExportedInvocationDispatcher.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/FieldSetter.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ForwardedInvocationDispatcher.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransport.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransportConnection.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoClientContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoNodeContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoServerContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationHandle.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationType.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeInvocationContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeLocation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteDispatcherLocation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteInvokerContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ServerInvocationContext.java
Removed:
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ClientInvocationContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ExportedInvocationDispatcher.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ForwardedInvocationDispatcher.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransport.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransportConnection.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoClientContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoNodeContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoServerContextException.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationHandle.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationType.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeInvocationContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeLocation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteDispatcherLocation.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteInvokerContext.java
   invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ServerInvocationContext.java
Log:
Move EJB3-specific stuff to ejb3 subpackage for now

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ClientInvocationContext.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ClientInvocationContext.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ClientInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,71 +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.util.Map;
-
-/**
- * A client invocation context is an invocation environment which supports outbound method invocations only.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public class ClientInvocationContext {
-    static {
-        // configure the global context (todo)
-        globalContext = null;
-    }
-
-    ClientInvocationContext() {
-    }
-
-    private static final ClientInvocationContext globalContext;
-
-    private static final ThreadLocal<ClientInvocationContext> current = new ThreadLocal<ClientInvocationContext>();
-
-    public static ClientInvocationContext getCurrent() {
-        final ClientInvocationContext context = current.get();
-        return context == null ? globalContext : context;
-    }
-
-    public static ClientInvocationContext requireCurrent() throws NoClientContextException {
-        final ClientInvocationContext context = getCurrent();
-        if (context == null) {
-            throw new NoClientContextException();
-        }
-        return context;
-    }
-
-    public void start() {
-        if (current.get() != null) {
-            throw new IllegalStateException("A client invocation context is already associated with the current thread");
-        }
-        current.set(this);
-    }
-
-    public void end() {
-        if (current.get() == this) {
-            current.set(null);
-        }
-    }
-
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ExportedInvocationDispatcher.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ExportedInvocationDispatcher.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ExportedInvocationDispatcher.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,69 +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;
-
-/**
- * An exported dispatcher which refers to a local invocation context.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-final class ExportedInvocationDispatcher implements InvocationDispatcher, Serializable {
-
-    private static final long serialVersionUID = -3950038476252367014L;
-
-    private transient final NodeInvocationContext nodeInvocationContext;
-    private final DispatcherIdentifier dispatcherIdentifier;
-
-    private static final FieldSetter<ExportedInvocationDispatcher> nodeInvocationContextSetter = FieldSetter.forField(ExportedInvocationDispatcher.class, "nodeInvocationContext");
-
-    ExportedInvocationDispatcher(final NodeInvocationContext nodeInvocationContext, final DispatcherIdentifier dispatcherIdentifier) {
-        this.nodeInvocationContext = nodeInvocationContext;
-        this.dispatcherIdentifier = dispatcherIdentifier;
-    }
-
-    public InvocationReply dispatch(final Invocation invocation) throws InvocationException {
-        final InvocationDispatcher dispatcher = nodeInvocationContext.getLocalDispatcher(dispatcherIdentifier);
-        return dispatcher.dispatch(invocation);
-    }
-
-    public <I> void accept(final Visitor<InvocationDispatcher, I> visitor, final I param) {
-        visitor.visit(this, param);
-    }
-
-    private void readObject(final ObjectInputStream ois) throws ClassNotFoundException, IOException {
-        ois.defaultReadObject();
-        if (dispatcherIdentifier == null) {
-            throw new InvalidObjectException("dispatcherIdentifier is null");
-        }
-        nodeInvocationContextSetter.set(this, NodeInvocationContext.requireCurrent());
-    }
-
-    public DispatcherIdentifier getDispatcherIdentifier() {
-        return dispatcherIdentifier;
-    }
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ForwardedInvocationDispatcher.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ForwardedInvocationDispatcher.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ForwardedInvocationDispatcher.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,68 +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.IOError;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-
-/**
- * An exported dispatcher which refers to a remote invocation context.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-final class ForwardedInvocationDispatcher implements InvocationDispatcher, Serializable {
-
-    private static final long serialVersionUID = -3950038476252367014L;
-
-    private transient final NodeInvocationContext nodeInvocationContext;
-    private final String transport;
-    private final RemoteDispatcherLocation dispatcherLocation;
-
-    private static final FieldSetter<ForwardedInvocationDispatcher> nodeInvocationContextSetter = FieldSetter.forField(ForwardedInvocationDispatcher.class, "nodeInvocationContext");
-
-    ForwardedInvocationDispatcher(final NodeInvocationContext nodeInvocationContext, final RemoteDispatcherLocation dispatcherLocation, final String transport) {
-        this.nodeInvocationContext = nodeInvocationContext;
-        this.dispatcherLocation = dispatcherLocation;
-        this.transport = transport;
-    }
-
-    public InvocationReply dispatch(final Invocation invocation) throws InvocationException {
-        return null;
-    }
-
-    public <I> void accept(final Visitor<InvocationDispatcher, I> visitor, final I param) {
-        visitor.visit(this, param);
-    }
-
-
-    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
-        ois.defaultReadObject();
-        nodeInvocationContextSetter.set(this, NodeInvocationContext.requireCurrent());
-    }
-
-    public RemoteDispatcherLocation getLocation() {
-        return dispatcherLocation;
-    }
-}
\ No newline at end of file

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransport.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransport.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransport.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,35 +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.net.URI;
-
-/**
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public interface InvocationTransport {
-    String getName();
-
-    InvocationTransportConnection connectTo(URI connectUri) throws IOException;
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransportConnection.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransportConnection.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransportConnection.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,40 +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.Closeable;
-
-/**
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public interface InvocationTransportConnection extends Closeable {
-
-    /**
-     * Get a dispatcher from the remote node.  This method should always succeed on an open connection.
-     *
-     * @param contextName the context name
-     * @param dispatcherName the dispatcher name
-     * @return the dispatcher
-     */
-    InvocationDispatcher getDispatcher(String contextName, String dispatcherName);
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoClientContextException.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoClientContextException.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoClientContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,67 +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;
-
-public final class NoClientContextException extends IllegalStateException {
-
-    private static final long serialVersionUID = -1739332805464223362L;
-
-    /**
-     * Constructs a {@code NoClientContextException} with no detail message. The cause is not initialized, and may
-     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     */
-    public NoClientContextException() {
-    }
-
-    /**
-     * Constructs a {@code NoClientContextException} with the specified detail message. The cause is not initialized, and
-     * may subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     *
-     * @param msg the detail message
-     */
-    public NoClientContextException(final String msg) {
-        super(msg);
-    }
-
-    /**
-     * Constructs a {@code NoClientContextException} with the specified cause. The detail message is set to:
-     * <pre>(cause == null ? null : cause.toString())</pre>
-     * (which typically contains the class and detail message of {@code cause}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoClientContextException(final Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Constructs a {@code NoClientContextException} with the specified detail message and cause.
-     *
-     * @param msg the detail message
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoClientContextException(final String msg, final Throwable cause) {
-        super(msg, cause);
-    }
-
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoNodeContextException.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoNodeContextException.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoNodeContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,67 +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;
-
-public final class NoNodeContextException extends IllegalStateException {
-
-    private static final long serialVersionUID = -4218112918054622891L;
-
-    /**
-     * Constructs a {@code NoNodeContextException} with no detail message. The cause is not initialized, and may
-     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     */
-    public NoNodeContextException() {
-    }
-
-    /**
-     * Constructs a {@code NoNodeContextException} with the specified detail message. The cause is not initialized, and may
-     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     *
-     * @param msg the detail message
-     */
-    public NoNodeContextException(final String msg) {
-        super(msg);
-    }
-
-    /**
-     * Constructs a {@code NoNodeContextException} with the specified cause. The detail message is set to:
-     * <pre>(cause == null ? null : cause.toString())</pre>
-     * (which typically contains the class and detail message of {@code cause}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoNodeContextException(final Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Constructs a {@code NoNodeContextException} with the specified detail message and cause.
-     *
-     * @param msg the detail message
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoNodeContextException(final String msg, final Throwable cause) {
-        super(msg, cause);
-    }
-
-}
\ No newline at end of file

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoServerContextException.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoServerContextException.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoServerContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,67 +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;
-
-public final class NoServerContextException extends IllegalStateException {
-
-    private static final long serialVersionUID = 3873017282274298512L;
-
-    /**
-     * Constructs a {@code NoServerContextException} with no detail message. The cause is not initialized, and may
-     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     */
-    public NoServerContextException() {
-    }
-
-    /**
-     * Constructs a {@code NoServerContextException} with the specified detail message. The cause is not initialized, and
-     * may subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
-     *
-     * @param msg the detail message
-     */
-    public NoServerContextException(final String msg) {
-        super(msg);
-    }
-
-    /**
-     * Constructs a {@code NoServerContextException} with the specified cause. The detail message is set to:
-     * <pre>(cause == null ? null : cause.toString())</pre>
-     * (which typically contains the class and detail message of {@code cause}).
-     *
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoServerContextException(final Throwable cause) {
-        super(cause);
-    }
-
-    /**
-     * Constructs a {@code NoServerContextException} with the specified detail message and cause.
-     *
-     * @param msg the detail message
-     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
-     */
-    public NoServerContextException(final String msg, final Throwable cause) {
-        super(msg, cause);
-    }
-
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociation.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociation.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,55 +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;
-
-/**
- * An association with a node.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public abstract class NodeAssociation {
-    private final InvocationTransport transport;
-    private final NodeLocation nodeLocation;
-
-    protected NodeAssociation(final InvocationTransport transport, final NodeLocation nodeLocation) {
-        this.transport = transport;
-        this.nodeLocation = nodeLocation;
-    }
-
-    public InvocationTransport getTransport() {
-        return transport;
-    }
-
-    public NodeLocation getNodeLocation() {
-        return nodeLocation;
-    }
-
-    /**
-     * Get a dispatcher for the given identifier.  The returned dispatcher should (block? throw an exception?) if the
-     * association is temporarily unavailable.
-     *
-     * @param identifier the identifier of the dispatcher on the remote node
-     * @return a dispatcher which traverses the node association
-     */
-    public abstract InvocationDispatcher getInvocationDispatcher(DispatcherIdentifier identifier);
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationHandle.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationHandle.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationHandle.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,39 +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.Closeable;
-
-/**
- * A handle for a node association, used to indicate to the client invocation context that the node association has
- * ended.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public interface NodeAssociationHandle extends Closeable {
-
-    /**
-     * Call when the node association has been closed.
-     */
-    void close();
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationType.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationType.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationType.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,37 +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;
-
-/**
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public interface NodeAssociationType {
-
-    /**
-     * Get the node association for a given name, or {@code null} if none is available.
-     *
-     * @param name the name
-     * @return the association
-     */
-    NodeAssociation getAssociation(String name);
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeInvocationContext.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeInvocationContext.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,178 +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.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-public final class NodeInvocationContext {
-    private final ConcurrentMap<NodeLocation, NodeAssociation> nodeAssociations = new ConcurrentHashMap<NodeLocation, NodeAssociation>();
-
-    private static final String NODE_NAME;
-
-    static {
-        // Inside the AS, this will use the AS settings.  Outside, it will get the node name in a similar way.
-        String hostName = System.getProperty("jboss.host.name");
-        String qualifiedHostName = System.getProperty("jboss.qualified.host.name");
-        if (qualifiedHostName == null) {
-            // if host name is specified, don't pick a qualified host name that isn't related to it
-            qualifiedHostName = hostName;
-            if (qualifiedHostName == null) {
-                // POSIX-like OSes including Mac should have this set
-                qualifiedHostName = System.getenv("HOSTNAME");
-            }
-            if (qualifiedHostName == null) {
-                // Certain versions of Windows
-                qualifiedHostName = System.getenv("COMPUTERNAME");
-            }
-            if (qualifiedHostName == null) {
-                try {
-                    qualifiedHostName = InetAddress.getLocalHost().getHostName();
-                } catch (UnknownHostException e) {
-                    qualifiedHostName = null;
-                }
-            }
-            if (qualifiedHostName != null && qualifiedHostName.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$|:")) {
-                // IP address is not acceptable
-                qualifiedHostName = null;
-            }
-            if (qualifiedHostName == null) {
-                // Give up
-                qualifiedHostName = "unknown-host.unknown-domain";
-            }
-            qualifiedHostName = qualifiedHostName.trim().toLowerCase();
-        }
-        if (hostName == null) {
-            // Use the host part of the qualified host name
-            final int idx = qualifiedHostName.indexOf('.');
-            hostName = idx == -1 ? qualifiedHostName : qualifiedHostName.substring(0, idx);
-        }
-        // Set up the node name
-        String nodeName = System.getProperty("jboss.node.name");
-        if (nodeName == null) {
-            nodeName = hostName;
-        }
-        NODE_NAME = nodeName;
-    }
-
-    private static final ThreadLocal<NodeInvocationContext> current = new ThreadLocal<NodeInvocationContext>();
-
-    private static final NodeInvocationContext global = new NodeInvocationContext(NODE_NAME); // (todo - configure)
-
-    private final String name;
-
-    public NodeInvocationContext(final String name) {
-        this.name = name;
-    }
-
-    public NodeAssociationHandle addNodeAssociation(final NodeLocation location, final String transport, final NodeAssociation association) throws IllegalArgumentException {
-        if (location == null) {
-            throw new IllegalArgumentException("location is null");
-        }
-        if (association == null) {
-            throw new IllegalArgumentException("association is null");
-        }
-        if (transport == null) {
-            throw new IllegalArgumentException("transport is null");
-        }
-        if (transport.length() == 0 || transport.equals("*")) {
-            throw new IllegalArgumentException(location.toString() + " does not specify a specific transport");
-        }
-        final NodeAssociation appearing = nodeAssociations.putIfAbsent(location, association);
-        if (appearing != null) {
-            throw new IllegalArgumentException(location.toString() + " is already registered");
-        }
-        return new NodeAssociationHandle() {
-            public void close() {
-                nodeAssociations.remove(location, association);
-            }
-        };
-    }
-
-    public InvocationDispatcher createDispatcher(final RemoteDispatcherLocation dispatcherLocation) {
-        return new ExportedInvocationDispatcher(this, dispatcherLocation.getDispatcherIdentifier());
-    }
-
-    public static NodeInvocationContext getCurrent() {
-        return defaulted(current.get(), global);
-    }
-
-    public static NodeInvocationContext requireCurrent() {
-        final NodeInvocationContext context = getCurrent();
-        if (context == null) {
-            throw new NoNodeContextException();
-        }
-        return context;
-    }
-
-    public void start() {
-        if (current.get() != null) {
-            throw new IllegalStateException("A node invocation context is already associated with the current thread");
-        }
-        current.set(this);
-    }
-
-    public void end() {
-        if (current.get() == this) {
-            current.set(null);
-        }
-    }
-
-    private static <T> T defaulted(T val, T defVal) {
-        return val == null ? defVal : val;
-    }
-
-    public NodeAssociation getNodeAssociation(final NodeLocation nodeLocation) {
-        // (todo - access check)
-        final String transport = null; // todo
-        if (transport.length() == 0 || transport.equals("*")) {
-            // (todo - index by transport type)
-            for (Map.Entry<NodeLocation, NodeAssociation> entry : nodeAssociations.entrySet()) {
-                if (nodeLocation.isSameNode(entry.getKey())) {
-                    return entry.getValue();
-                }
-            }
-            return null;
-        } else {
-            return nodeAssociations.get(nodeLocation);
-        }
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Get a dispatcher which (directly or indirectly) forwards to a registered, exported dispatcher with the given
-     * identifier.
-     *
-     * @param dispatcherIdentifier the identifier
-     * @return the dispatcher
-     */
-    public InvocationDispatcher getLocalDispatcher(final DispatcherIdentifier dispatcherIdentifier) {
-        return null;
-    }
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeLocation.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeLocation.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeLocation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,94 +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 NodeLocation implements Serializable {
-
-    private static final long serialVersionUID = -4658944294566402276L;
-
-    private static final FieldSetter<NodeLocation> hashCodeSetter = FieldSetter.forField(NodeLocation.class, "hashCode");
-
-    private final String scheme;
-    private final String name;
-    private transient final int hashCode;
-
-    public NodeLocation(final String scheme, final String name) {
-        if (scheme == null) {
-            throw new IllegalArgumentException("scheme is null");
-        }
-        if (name == null) {
-            throw new IllegalArgumentException("name is null");
-        }
-        this.scheme = scheme;
-        this.name = name;
-        hashCode = hashCode(scheme, name);
-    }
-
-    private static int hashCode(final String scheme, final String name) {
-        return scheme.hashCode() * 31 + name.hashCode();
-    }
-
-    public String getScheme() {
-        return scheme;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public int hashCode() {
-        return hashCode;
-    }
-
-    public boolean isSameNode(final NodeLocation other) {
-        return this == other || other != null && scheme.equals(other.scheme) && name.equals(other.name);
-    }
-
-    public boolean equals(final Object obj) {
-        return obj instanceof NodeLocation && equals((NodeLocation) obj);
-    }
-
-    public boolean equals(final NodeLocation other) {
-        return this == other || other != null && hashCode == other.hashCode && scheme.equals(other.scheme) && name.equals(other.name);
-    }
-
-    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
-        ois.defaultReadObject();
-        if (scheme == null) {
-            throw new InvalidObjectException("scheme is null");
-        }
-        if (name == null) {
-            throw new InvalidObjectException("name is null");
-        }
-        hashCodeSetter.setInt(this, hashCode(scheme, name));
-    }
-
-    public String toString() {
-        return String.format("Node location \"%s:%s\"", scheme, name);
-    }
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteDispatcherLocation.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteDispatcherLocation.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteDispatcherLocation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,86 +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.ObjectInputStream;
-import java.io.Serializable;
-
-public final class RemoteDispatcherLocation implements Serializable {
-
-    private static final long serialVersionUID = -8104174497055191121L;
-
-    private static final FieldSetter<RemoteDispatcherLocation> hashCodeSetter = FieldSetter.forField(RemoteDispatcherLocation.class, "hashCode");
-
-    private final NodeLocation nodeLocation;
-    private final DispatcherIdentifier dispatcherIdentifier;
-    private transient final int hashCode;
-
-    public RemoteDispatcherLocation(final NodeLocation nodeLocation, final DispatcherIdentifier dispatcherIdentifier) {
-        if (nodeLocation == null) {
-            throw new IllegalArgumentException("nodeLocation is null");
-        }
-        if (dispatcherIdentifier == null) {
-            throw new IllegalArgumentException("dispatcherIdentifier is null");
-        }
-        this.nodeLocation = nodeLocation;
-        this.dispatcherIdentifier = dispatcherIdentifier;
-        hashCode = hashCode(nodeLocation, dispatcherIdentifier);
-    }
-
-    private static int hashCode(final NodeLocation nodeLocation, final DispatcherIdentifier dispatcherIdentifier) {
-        return nodeLocation.hashCode() * 31 + dispatcherIdentifier.hashCode();
-    }
-
-    public NodeLocation getNodeLocation() {
-        return nodeLocation;
-    }
-
-    public DispatcherIdentifier getDispatcherIdentifier() {
-        return dispatcherIdentifier;
-    }
-
-    public boolean equals(final Object obj) {
-        return obj instanceof RemoteDispatcherLocation && equals((RemoteDispatcherLocation) obj);
-    }
-
-    public boolean equals(final RemoteDispatcherLocation other) {
-        return this == other || other != null
-                && hashCode == other.hashCode
-                && nodeLocation.equals(other.nodeLocation)
-                && dispatcherIdentifier.equals(other.dispatcherIdentifier);
-    }
-
-    public int hashCode() {
-        return hashCode;
-    }
-
-    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
-        ois.defaultReadObject();
-        hashCodeSetter.setInt(this, hashCode(nodeLocation, dispatcherIdentifier));
-    }
-
-    public String toString() {
-        return String.format("Remote dispatcher location {node=\"%s\", dispatcher=\"%s\"}", nodeLocation, dispatcherIdentifier);
-    }
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteInvokerContext.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteInvokerContext.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteInvokerContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,102 +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;
-
-/**
- * The invocation context.
- */
-public final class RemoteInvokerContext {
-
-
-    private final String name;
-
-    private static final ThreadLocal<RemoteInvokerContext> current = new ThreadLocal<RemoteInvokerContext>();
-
-    RemoteInvokerContext(final String name) {
-        this.name = name;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void begin() {
-        final ThreadLocal<RemoteInvokerContext> current = RemoteInvokerContext.current;
-        if (current.get() != null) {
-            throw new IllegalStateException("Another remote invocation context is already in effect");
-        }
-        current.set(this);
-    }
-
-    public void end() {
-        final ThreadLocal<RemoteInvokerContext> current = RemoteInvokerContext.current;
-        if (current.get() == this) {
-            current.set(null);
-        }
-    }
-
-    public static RemoteInvokerContext getCurrent() {
-        return current.get();
-    }
-
-    public static RemoteInvokerContext requireCurrent() throws IllegalStateException {
-        final RemoteInvokerContext context = getCurrent();
-        if (context == null) {
-            throw new IllegalStateException("No active invocation context");
-        }
-        return context;
-    }
-
-    /**
-     * Register a 
-     * @param name
-     * @param remoteDispatcher
-     */
-    public void addPeer(String name, InvocationDispatcher remoteDispatcher) {
-
-    }
-
-    /**
-     * Register a local invocation dispatcher, returning a serializable dispatcher which can be sent to remote clients or used
-     * locally.
-     *
-     * @param processor the invocation processor
-     * @param targetDispatcher the target dispatcher
-     * @return a serializable dispatcher
-     */
-    public InvocationDispatcher register(final InvocationProcessor processor, final InvocationDispatcher targetDispatcher) {
-        return null;
-    }
-
-    InvocationDispatcher getLocalDispatcher(final String dispatcherId) {
-        return null;
-    }
-
-    InvocationDispatcher requireLocalDispatcher(final String dispatcherId) {
-        final InvocationDispatcher dispatcher = getLocalDispatcher(dispatcherId);
-        if (dispatcher == null) {
-            throw new IllegalArgumentException("No dispatcher found");
-        }
-        return dispatcher;
-    }
-}

Deleted: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ServerInvocationContext.java
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ServerInvocationContext.java	2010-03-29 19:42:59 UTC (rev 4205)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ServerInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -1,90 +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.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A server invocation context is an invocation environment which supports inbound and outbound invocations.
- *
- * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
- */
-public class ServerInvocationContext extends ClientInvocationContext {
-    private final NodeInvocationContext nodeInvocationContext;
-    private final String name;
-
-    ServerInvocationContext(final String name, final NodeInvocationContext nodeInvocationContext) {
-        this.name = name;
-        this.nodeInvocationContext = nodeInvocationContext;
-    }
-
-    public static ServerInvocationContext getCurrent() {
-        final ClientInvocationContext current = ClientInvocationContext.getCurrent();
-        if (current instanceof ServerInvocationContext) {
-            return (ServerInvocationContext) current;
-        } else {
-            return null;
-        }
-    }
-
-    public static ServerInvocationContext requireCurrent() throws NoServerContextException {
-        final ServerInvocationContext context = getCurrent();
-        if (context == null) {
-            throw new NoServerContextException();
-        }
-        return context;
-    }
-
-    public static ServerInvocationContext create(final String name) {
-        return new ServerInvocationContext(name, NodeInvocationContext.requireCurrent());
-    }
-
-    private final ConcurrentMap<String, Reg> exportedDispatchers = new ConcurrentHashMap<String, Reg>();
-
-    private static final class Reg {
-        private final InvocationDispatcher localDispatcher;
-        private final InvocationProcessor processor;
-
-        private Reg(final InvocationDispatcher localDispatcher, final InvocationProcessor processor) {
-            this.localDispatcher = localDispatcher;
-            this.processor = processor;
-        }
-    }
-
-    public InvocationDispatcher export(InvocationDispatcher dispatcher, String name) {
-        dispatcher.accept(new Visitor<InvocationDispatcher, Void>() {
-            public void visit(final InvocationDispatcher visited, final Void parameter) {
-                if (visited instanceof ExportedInvocationDispatcher) {
-                    throw new IllegalArgumentException("Dispatcher is already exported");
-                }
-            }
-        }, null);
-        return new ExportedInvocationDispatcher(nodeInvocationContext, new DispatcherIdentifier(getName(), name));
-    }
-
-    public String getName() {
-        return name;
-    }
-}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ClientInvocationContext.java (from rev 4200, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ClientInvocationContext.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ClientInvocationContext.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ClientInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,69 @@
+/*
+ * 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.ejb3;
+
+/**
+ * A client invocation context is an invocation environment which supports outbound method invocations only.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public class ClientInvocationContext {
+    static {
+        // configure the global context (todo)
+        globalContext = null;
+    }
+
+    ClientInvocationContext() {
+    }
+
+    private static final ClientInvocationContext globalContext;
+
+    private static final ThreadLocal<ClientInvocationContext> current = new ThreadLocal<ClientInvocationContext>();
+
+    public static ClientInvocationContext getCurrent() {
+        final ClientInvocationContext context = current.get();
+        return context == null ? globalContext : context;
+    }
+
+    public static ClientInvocationContext requireCurrent() throws NoClientContextException {
+        final ClientInvocationContext context = getCurrent();
+        if (context == null) {
+            throw new NoClientContextException();
+        }
+        return context;
+    }
+
+    public void start() {
+        if (current.get() != null) {
+            throw new IllegalStateException("A client invocation context is already associated with the current thread");
+        }
+        current.set(this);
+    }
+
+    public void end() {
+        if (current.get() == this) {
+            current.set(null);
+        }
+    }
+
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ExportedInvocationDispatcher.java (from rev 4195, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ExportedInvocationDispatcher.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ExportedInvocationDispatcher.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ExportedInvocationDispatcher.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,75 @@
+/*
+ * 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.ejb3;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import org.jboss.invokable.DispatcherIdentifier;
+import org.jboss.invokable.Invocation;
+import org.jboss.invokable.InvocationDispatcher;
+import org.jboss.invokable.InvocationException;
+import org.jboss.invokable.InvocationReply;
+import org.jboss.invokable.Visitor;
+
+/**
+ * An exported dispatcher which refers to a local invocation context.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+final class ExportedInvocationDispatcher implements InvocationDispatcher, Serializable {
+
+    private static final long serialVersionUID = -3950038476252367014L;
+
+    private transient final NodeInvocationContext nodeInvocationContext;
+    private final DispatcherIdentifier dispatcherIdentifier;
+
+    private static final FieldSetter<ExportedInvocationDispatcher> nodeInvocationContextSetter = FieldSetter.forField(ExportedInvocationDispatcher.class, "nodeInvocationContext");
+
+    ExportedInvocationDispatcher(final NodeInvocationContext nodeInvocationContext, final DispatcherIdentifier dispatcherIdentifier) {
+        this.nodeInvocationContext = nodeInvocationContext;
+        this.dispatcherIdentifier = dispatcherIdentifier;
+    }
+
+    public InvocationReply dispatch(final Invocation invocation) throws InvocationException {
+        final InvocationDispatcher dispatcher = nodeInvocationContext.getLocalDispatcher(dispatcherIdentifier);
+        return dispatcher.dispatch(invocation);
+    }
+
+    public <I> void accept(final Visitor<InvocationDispatcher, I> visitor, final I param) {
+        visitor.visit(this, param);
+    }
+
+    private void readObject(final ObjectInputStream ois) throws ClassNotFoundException, IOException {
+        ois.defaultReadObject();
+        if (dispatcherIdentifier == null) {
+            throw new InvalidObjectException("dispatcherIdentifier is null");
+        }
+        nodeInvocationContextSetter.set(this, NodeInvocationContext.requireCurrent());
+    }
+
+    public DispatcherIdentifier getDispatcherIdentifier() {
+        return dispatcherIdentifier;
+    }
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/FieldSetter.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/FieldSetter.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/FieldSetter.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/FieldSetter.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,121 @@
+/*
+ * 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.ejb3;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+final class FieldSetter<T> {
+    private final Field field;
+
+    private FieldSetter(final Field field) {
+        this.field = field;
+    }
+
+    static <T> FieldSetter<T> forField(final Class<T> clazz, final String name) {
+        return AccessController.doPrivileged(new PrivilegedAction<FieldSetter<T>>() {
+            public FieldSetter<T> run() {
+                try {
+                    final Field field = clazz.getDeclaredField(name);
+                    field.setAccessible(true);
+                    return new FieldSetter<T>(field);
+                } catch (NoSuchFieldException e) {
+                    throw new NoSuchFieldError(e.getMessage());
+                }
+            }
+        });
+    }
+
+    public void set(final T obj, final Object value) {
+        try {
+            field.set(obj, value);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setBoolean(final T obj, final boolean z) {
+        try {
+            field.setBoolean(obj, z);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setByte(final T obj, final byte b) {
+        try {
+            field.setByte(obj, b);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setChar(final T obj, final char c) {
+        try {
+            field.setChar(obj, c);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setShort(final T obj, final short s) {
+        try {
+            field.setShort(obj, s);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setInt(final T obj, final int i) {
+        try {
+            field.setInt(obj, i);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setLong(final T obj, final long l) {
+        try {
+            field.setLong(obj, l);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setFloat(final T obj, final float f) {
+        try {
+            field.setFloat(obj, f);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+
+    public void setDouble(final T obj, final double d) {
+        try {
+            field.setDouble(obj, d);
+        } catch (IllegalAccessException e) {
+            throw new IllegalAccessError(e.getMessage());
+        }
+    }
+}
\ No newline at end of file

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ForwardedInvocationDispatcher.java (from rev 4200, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ForwardedInvocationDispatcher.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ForwardedInvocationDispatcher.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ForwardedInvocationDispatcher.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,72 @@
+/*
+ * 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.ejb3;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import org.jboss.invokable.Invocation;
+import org.jboss.invokable.InvocationDispatcher;
+import org.jboss.invokable.InvocationException;
+import org.jboss.invokable.InvocationReply;
+import org.jboss.invokable.Visitor;
+
+/**
+ * An exported dispatcher which refers to a remote invocation context.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+final class ForwardedInvocationDispatcher implements InvocationDispatcher, Serializable {
+
+    private static final long serialVersionUID = -3950038476252367014L;
+
+    private transient final NodeInvocationContext nodeInvocationContext;
+    private final String transport;
+    private final RemoteDispatcherLocation dispatcherLocation;
+
+    private static final FieldSetter<ForwardedInvocationDispatcher> nodeInvocationContextSetter = FieldSetter.forField(ForwardedInvocationDispatcher.class, "nodeInvocationContext");
+
+    ForwardedInvocationDispatcher(final NodeInvocationContext nodeInvocationContext, final RemoteDispatcherLocation dispatcherLocation, final String transport) {
+        this.nodeInvocationContext = nodeInvocationContext;
+        this.dispatcherLocation = dispatcherLocation;
+        this.transport = transport;
+    }
+
+    public InvocationReply dispatch(final Invocation invocation) throws InvocationException {
+        return null;
+    }
+
+    public <I> void accept(final Visitor<InvocationDispatcher, I> visitor, final I param) {
+        visitor.visit(this, param);
+    }
+
+
+    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+        ois.defaultReadObject();
+        nodeInvocationContextSetter.set(this, NodeInvocationContext.requireCurrent());
+    }
+
+    public RemoteDispatcherLocation getLocation() {
+        return dispatcherLocation;
+    }
+}
\ No newline at end of file

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransport.java (from rev 4200, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransport.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransport.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransport.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,35 @@
+/*
+ * 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.ejb3;
+
+import java.io.IOException;
+import java.net.URI;
+
+/**
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public interface InvocationTransport {
+    String getName();
+
+    InvocationTransportConnection connectTo(URI connectUri) throws IOException;
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransportConnection.java (from rev 4201, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/InvocationTransportConnection.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransportConnection.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/InvocationTransportConnection.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,41 @@
+/*
+ * 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.ejb3;
+
+import java.io.Closeable;
+import org.jboss.invokable.InvocationDispatcher;
+
+/**
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public interface InvocationTransportConnection extends Closeable {
+
+    /**
+     * Get a dispatcher from the remote node.  This method should always succeed on an open connection.
+     *
+     * @param contextName the context name
+     * @param dispatcherName the dispatcher name
+     * @return the dispatcher
+     */
+    InvocationDispatcher getDispatcher(String contextName, String dispatcherName);
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoClientContextException.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoClientContextException.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoClientContextException.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoClientContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,67 @@
+/*
+ * 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.ejb3;
+
+public final class NoClientContextException extends IllegalStateException {
+
+    private static final long serialVersionUID = -1739332805464223362L;
+
+    /**
+     * Constructs a {@code NoClientContextException} with no detail message. The cause is not initialized, and may
+     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     */
+    public NoClientContextException() {
+    }
+
+    /**
+     * Constructs a {@code NoClientContextException} with the specified detail message. The cause is not initialized, and
+     * may subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     *
+     * @param msg the detail message
+     */
+    public NoClientContextException(final String msg) {
+        super(msg);
+    }
+
+    /**
+     * Constructs a {@code NoClientContextException} with the specified cause. The detail message is set to:
+     * <pre>(cause == null ? null : cause.toString())</pre>
+     * (which typically contains the class and detail message of {@code cause}).
+     *
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoClientContextException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a {@code NoClientContextException} with the specified detail message and cause.
+     *
+     * @param msg the detail message
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoClientContextException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoNodeContextException.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoNodeContextException.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoNodeContextException.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoNodeContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,67 @@
+/*
+ * 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.ejb3;
+
+public final class NoNodeContextException extends IllegalStateException {
+
+    private static final long serialVersionUID = -4218112918054622891L;
+
+    /**
+     * Constructs a {@code NoNodeContextException} with no detail message. The cause is not initialized, and may
+     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     */
+    public NoNodeContextException() {
+    }
+
+    /**
+     * Constructs a {@code NoNodeContextException} with the specified detail message. The cause is not initialized, and may
+     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     *
+     * @param msg the detail message
+     */
+    public NoNodeContextException(final String msg) {
+        super(msg);
+    }
+
+    /**
+     * Constructs a {@code NoNodeContextException} with the specified cause. The detail message is set to:
+     * <pre>(cause == null ? null : cause.toString())</pre>
+     * (which typically contains the class and detail message of {@code cause}).
+     *
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoNodeContextException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a {@code NoNodeContextException} with the specified detail message and cause.
+     *
+     * @param msg the detail message
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoNodeContextException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+
+}
\ No newline at end of file

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoServerContextException.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NoServerContextException.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoServerContextException.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NoServerContextException.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,67 @@
+/*
+ * 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.ejb3;
+
+public final class NoServerContextException extends IllegalStateException {
+
+    private static final long serialVersionUID = 3873017282274298512L;
+
+    /**
+     * Constructs a {@code NoServerContextException} with no detail message. The cause is not initialized, and may
+     * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     */
+    public NoServerContextException() {
+    }
+
+    /**
+     * Constructs a {@code NoServerContextException} with the specified detail message. The cause is not initialized, and
+     * may subsequently be initialized by a call to {@link #initCause(Throwable) initCause}.
+     *
+     * @param msg the detail message
+     */
+    public NoServerContextException(final String msg) {
+        super(msg);
+    }
+
+    /**
+     * Constructs a {@code NoServerContextException} with the specified cause. The detail message is set to:
+     * <pre>(cause == null ? null : cause.toString())</pre>
+     * (which typically contains the class and detail message of {@code cause}).
+     *
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoServerContextException(final Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructs a {@code NoServerContextException} with the specified detail message and cause.
+     *
+     * @param msg the detail message
+     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method)
+     */
+    public NoServerContextException(final String msg, final Throwable cause) {
+        super(msg, cause);
+    }
+
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociation.java (from rev 4203, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociation.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociation.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,58 @@
+/*
+ * 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.ejb3;
+
+import org.jboss.invokable.DispatcherIdentifier;
+import org.jboss.invokable.InvocationDispatcher;
+
+/**
+ * An association with a node.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public abstract class NodeAssociation {
+    private final InvocationTransport transport;
+    private final NodeLocation nodeLocation;
+
+    protected NodeAssociation(final InvocationTransport transport, final NodeLocation nodeLocation) {
+        this.transport = transport;
+        this.nodeLocation = nodeLocation;
+    }
+
+    public InvocationTransport getTransport() {
+        return transport;
+    }
+
+    public NodeLocation getNodeLocation() {
+        return nodeLocation;
+    }
+
+    /**
+     * Get a dispatcher for the given identifier.  The returned dispatcher should (block? throw an exception?) if the
+     * association is temporarily unavailable.
+     *
+     * @param identifier the identifier of the dispatcher on the remote node
+     * @return a dispatcher which traverses the node association
+     */
+    public abstract InvocationDispatcher getInvocationDispatcher(DispatcherIdentifier identifier);
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationHandle.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationHandle.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationHandle.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationHandle.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,39 @@
+/*
+ * 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.ejb3;
+
+import java.io.Closeable;
+
+/**
+ * A handle for a node association, used to indicate to the client invocation context that the node association has
+ * ended.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public interface NodeAssociationHandle extends Closeable {
+
+    /**
+     * Call when the node association has been closed.
+     */
+    void close();
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationType.java (from rev 4204, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeAssociationType.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationType.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeAssociationType.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,37 @@
+/*
+ * 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.ejb3;
+
+/**
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public interface NodeAssociationType {
+
+    /**
+     * Get the node association for a given name, or {@code null} if none is available.
+     *
+     * @param name the name
+     * @return the association
+     */
+    NodeAssociation getAssociation(String name);
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeInvocationContext.java (from rev 4195, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeInvocationContext.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeInvocationContext.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,180 @@
+/*
+ * 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.ejb3;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.jboss.invokable.DispatcherIdentifier;
+import org.jboss.invokable.InvocationDispatcher;
+
+public final class NodeInvocationContext {
+    private final ConcurrentMap<NodeLocation, NodeAssociation> nodeAssociations = new ConcurrentHashMap<NodeLocation, NodeAssociation>();
+
+    private static final String NODE_NAME;
+
+    static {
+        // Inside the AS, this will use the AS settings.  Outside, it will get the node name in a similar way.
+        String hostName = System.getProperty("jboss.host.name");
+        String qualifiedHostName = System.getProperty("jboss.qualified.host.name");
+        if (qualifiedHostName == null) {
+            // if host name is specified, don't pick a qualified host name that isn't related to it
+            qualifiedHostName = hostName;
+            if (qualifiedHostName == null) {
+                // POSIX-like OSes including Mac should have this set
+                qualifiedHostName = System.getenv("HOSTNAME");
+            }
+            if (qualifiedHostName == null) {
+                // Certain versions of Windows
+                qualifiedHostName = System.getenv("COMPUTERNAME");
+            }
+            if (qualifiedHostName == null) {
+                try {
+                    qualifiedHostName = InetAddress.getLocalHost().getHostName();
+                } catch (UnknownHostException e) {
+                    qualifiedHostName = null;
+                }
+            }
+            if (qualifiedHostName != null && qualifiedHostName.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$|:")) {
+                // IP address is not acceptable
+                qualifiedHostName = null;
+            }
+            if (qualifiedHostName == null) {
+                // Give up
+                qualifiedHostName = "unknown-host.unknown-domain";
+            }
+            qualifiedHostName = qualifiedHostName.trim().toLowerCase();
+        }
+        if (hostName == null) {
+            // Use the host part of the qualified host name
+            final int idx = qualifiedHostName.indexOf('.');
+            hostName = idx == -1 ? qualifiedHostName : qualifiedHostName.substring(0, idx);
+        }
+        // Set up the node name
+        String nodeName = System.getProperty("jboss.node.name");
+        if (nodeName == null) {
+            nodeName = hostName;
+        }
+        NODE_NAME = nodeName;
+    }
+
+    private static final ThreadLocal<NodeInvocationContext> current = new ThreadLocal<NodeInvocationContext>();
+
+    private static final NodeInvocationContext global = new NodeInvocationContext(NODE_NAME); // (todo - configure)
+
+    private final String name;
+
+    public NodeInvocationContext(final String name) {
+        this.name = name;
+    }
+
+    public NodeAssociationHandle addNodeAssociation(final NodeLocation location, final String transport, final NodeAssociation association) throws IllegalArgumentException {
+        if (location == null) {
+            throw new IllegalArgumentException("location is null");
+        }
+        if (association == null) {
+            throw new IllegalArgumentException("association is null");
+        }
+        if (transport == null) {
+            throw new IllegalArgumentException("transport is null");
+        }
+        if (transport.length() == 0 || transport.equals("*")) {
+            throw new IllegalArgumentException(location.toString() + " does not specify a specific transport");
+        }
+        final NodeAssociation appearing = nodeAssociations.putIfAbsent(location, association);
+        if (appearing != null) {
+            throw new IllegalArgumentException(location.toString() + " is already registered");
+        }
+        return new NodeAssociationHandle() {
+            public void close() {
+                nodeAssociations.remove(location, association);
+            }
+        };
+    }
+
+    public InvocationDispatcher createDispatcher(final RemoteDispatcherLocation dispatcherLocation) {
+        return new ExportedInvocationDispatcher(this, dispatcherLocation.getDispatcherIdentifier());
+    }
+
+    public static NodeInvocationContext getCurrent() {
+        return defaulted(current.get(), global);
+    }
+
+    public static NodeInvocationContext requireCurrent() {
+        final NodeInvocationContext context = getCurrent();
+        if (context == null) {
+            throw new NoNodeContextException();
+        }
+        return context;
+    }
+
+    public void start() {
+        if (current.get() != null) {
+            throw new IllegalStateException("A node invocation context is already associated with the current thread");
+        }
+        current.set(this);
+    }
+
+    public void end() {
+        if (current.get() == this) {
+            current.set(null);
+        }
+    }
+
+    private static <T> T defaulted(T val, T defVal) {
+        return val == null ? defVal : val;
+    }
+
+    public NodeAssociation getNodeAssociation(final NodeLocation nodeLocation) {
+        // (todo - access check)
+        final String transport = null; // todo
+        if (transport.length() == 0 || transport.equals("*")) {
+            // (todo - index by transport type)
+            for (Map.Entry<NodeLocation, NodeAssociation> entry : nodeAssociations.entrySet()) {
+                if (nodeLocation.isSameNode(entry.getKey())) {
+                    return entry.getValue();
+                }
+            }
+            return null;
+        } else {
+            return nodeAssociations.get(nodeLocation);
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Get a dispatcher which (directly or indirectly) forwards to a registered, exported dispatcher with the given
+     * identifier.
+     *
+     * @param dispatcherIdentifier the identifier
+     * @return the dispatcher
+     */
+    public InvocationDispatcher getLocalDispatcher(final DispatcherIdentifier dispatcherIdentifier) {
+        return null;
+    }
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeLocation.java (from rev 4195, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/NodeLocation.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeLocation.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/NodeLocation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,94 @@
+/*
+ * 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.ejb3;
+
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+
+public final class NodeLocation implements Serializable {
+
+    private static final long serialVersionUID = -4658944294566402276L;
+
+    private static final FieldSetter<NodeLocation> hashCodeSetter = FieldSetter.forField(NodeLocation.class, "hashCode");
+
+    private final String scheme;
+    private final String name;
+    private transient final int hashCode;
+
+    public NodeLocation(final String scheme, final String name) {
+        if (scheme == null) {
+            throw new IllegalArgumentException("scheme is null");
+        }
+        if (name == null) {
+            throw new IllegalArgumentException("name is null");
+        }
+        this.scheme = scheme;
+        this.name = name;
+        hashCode = hashCode(scheme, name);
+    }
+
+    private static int hashCode(final String scheme, final String name) {
+        return scheme.hashCode() * 31 + name.hashCode();
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public int hashCode() {
+        return hashCode;
+    }
+
+    public boolean isSameNode(final NodeLocation other) {
+        return this == other || other != null && scheme.equals(other.scheme) && name.equals(other.name);
+    }
+
+    public boolean equals(final Object obj) {
+        return obj instanceof NodeLocation && equals((NodeLocation) obj);
+    }
+
+    public boolean equals(final NodeLocation other) {
+        return this == other || other != null && hashCode == other.hashCode && scheme.equals(other.scheme) && name.equals(other.name);
+    }
+
+    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+        ois.defaultReadObject();
+        if (scheme == null) {
+            throw new InvalidObjectException("scheme is null");
+        }
+        if (name == null) {
+            throw new InvalidObjectException("name is null");
+        }
+        hashCodeSetter.setInt(this, hashCode(scheme, name));
+    }
+
+    public String toString() {
+        return String.format("Node location \"%s:%s\"", scheme, name);
+    }
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteDispatcherLocation.java (from rev 4195, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteDispatcherLocation.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteDispatcherLocation.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteDispatcherLocation.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,87 @@
+/*
+ * 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.ejb3;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import org.jboss.invokable.DispatcherIdentifier;
+
+public final class RemoteDispatcherLocation implements Serializable {
+
+    private static final long serialVersionUID = -8104174497055191121L;
+
+    private static final FieldSetter<RemoteDispatcherLocation> hashCodeSetter = FieldSetter.forField(RemoteDispatcherLocation.class, "hashCode");
+
+    private final NodeLocation nodeLocation;
+    private final DispatcherIdentifier dispatcherIdentifier;
+    private transient final int hashCode;
+
+    public RemoteDispatcherLocation(final NodeLocation nodeLocation, final DispatcherIdentifier dispatcherIdentifier) {
+        if (nodeLocation == null) {
+            throw new IllegalArgumentException("nodeLocation is null");
+        }
+        if (dispatcherIdentifier == null) {
+            throw new IllegalArgumentException("dispatcherIdentifier is null");
+        }
+        this.nodeLocation = nodeLocation;
+        this.dispatcherIdentifier = dispatcherIdentifier;
+        hashCode = hashCode(nodeLocation, dispatcherIdentifier);
+    }
+
+    private static int hashCode(final NodeLocation nodeLocation, final DispatcherIdentifier dispatcherIdentifier) {
+        return nodeLocation.hashCode() * 31 + dispatcherIdentifier.hashCode();
+    }
+
+    public NodeLocation getNodeLocation() {
+        return nodeLocation;
+    }
+
+    public DispatcherIdentifier getDispatcherIdentifier() {
+        return dispatcherIdentifier;
+    }
+
+    public boolean equals(final Object obj) {
+        return obj instanceof RemoteDispatcherLocation && equals((RemoteDispatcherLocation) obj);
+    }
+
+    public boolean equals(final RemoteDispatcherLocation other) {
+        return this == other || other != null
+                && hashCode == other.hashCode
+                && nodeLocation.equals(other.nodeLocation)
+                && dispatcherIdentifier.equals(other.dispatcherIdentifier);
+    }
+
+    public int hashCode() {
+        return hashCode;
+    }
+
+    private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+        ois.defaultReadObject();
+        hashCodeSetter.setInt(this, hashCode(nodeLocation, dispatcherIdentifier));
+    }
+
+    public String toString() {
+        return String.format("Remote dispatcher location {node=\"%s\", dispatcher=\"%s\"}", nodeLocation, dispatcherIdentifier);
+    }
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteInvokerContext.java (from rev 4190, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/RemoteInvokerContext.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteInvokerContext.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/RemoteInvokerContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,105 @@
+/*
+ * 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.ejb3;
+
+import org.jboss.invokable.InvocationDispatcher;
+import org.jboss.invokable.InvocationProcessor;
+
+/**
+ * The invocation context.
+ */
+public final class RemoteInvokerContext {
+
+
+    private final String name;
+
+    private static final ThreadLocal<RemoteInvokerContext> current = new ThreadLocal<RemoteInvokerContext>();
+
+    RemoteInvokerContext(final String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void begin() {
+        final ThreadLocal<RemoteInvokerContext> current = RemoteInvokerContext.current;
+        if (current.get() != null) {
+            throw new IllegalStateException("Another remote invocation context is already in effect");
+        }
+        current.set(this);
+    }
+
+    public void end() {
+        final ThreadLocal<RemoteInvokerContext> current = RemoteInvokerContext.current;
+        if (current.get() == this) {
+            current.set(null);
+        }
+    }
+
+    public static RemoteInvokerContext getCurrent() {
+        return current.get();
+    }
+
+    public static RemoteInvokerContext requireCurrent() throws IllegalStateException {
+        final RemoteInvokerContext context = getCurrent();
+        if (context == null) {
+            throw new IllegalStateException("No active invocation context");
+        }
+        return context;
+    }
+
+    /**
+     * Register a 
+     * @param name
+     * @param remoteDispatcher
+     */
+    public void addPeer(String name, InvocationDispatcher remoteDispatcher) {
+
+    }
+
+    /**
+     * Register a local invocation dispatcher, returning a serializable dispatcher which can be sent to remote clients or used
+     * locally.
+     *
+     * @param processor the invocation processor
+     * @param targetDispatcher the target dispatcher
+     * @return a serializable dispatcher
+     */
+    public InvocationDispatcher register(final InvocationProcessor processor, final InvocationDispatcher targetDispatcher) {
+        return null;
+    }
+
+    InvocationDispatcher getLocalDispatcher(final String dispatcherId) {
+        return null;
+    }
+
+    InvocationDispatcher requireLocalDispatcher(final String dispatcherId) {
+        final InvocationDispatcher dispatcher = getLocalDispatcher(dispatcherId);
+        if (dispatcher == null) {
+            throw new IllegalArgumentException("No dispatcher found");
+        }
+        return dispatcher;
+    }
+}

Copied: invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ServerInvocationContext.java (from rev 4200, invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ServerInvocationContext.java)
===================================================================
--- invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ServerInvocationContext.java	                        (rev 0)
+++ invokablecontainer/trunk/api/src/main/java/org/jboss/invokable/ejb3/ServerInvocationContext.java	2010-03-29 20:33:58 UTC (rev 4206)
@@ -0,0 +1,93 @@
+/*
+ * 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.ejb3;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.jboss.invokable.DispatcherIdentifier;
+import org.jboss.invokable.InvocationDispatcher;
+import org.jboss.invokable.InvocationProcessor;
+import org.jboss.invokable.Visitor;
+
+/**
+ * A server invocation context is an invocation environment which supports inbound and outbound invocations.
+ *
+ * @author <a href="mailto:david.lloyd at redhat.com">David M. Lloyd</a>
+ */
+public class ServerInvocationContext extends ClientInvocationContext {
+    private final NodeInvocationContext nodeInvocationContext;
+    private final String name;
+
+    ServerInvocationContext(final String name, final NodeInvocationContext nodeInvocationContext) {
+        this.name = name;
+        this.nodeInvocationContext = nodeInvocationContext;
+    }
+
+    public static ServerInvocationContext getCurrent() {
+        final ClientInvocationContext current = ClientInvocationContext.getCurrent();
+        if (current instanceof ServerInvocationContext) {
+            return (ServerInvocationContext) current;
+        } else {
+            return null;
+        }
+    }
+
+    public static ServerInvocationContext requireCurrent() throws NoServerContextException {
+        final ServerInvocationContext context = getCurrent();
+        if (context == null) {
+            throw new NoServerContextException();
+        }
+        return context;
+    }
+
+    public static ServerInvocationContext create(final String name) {
+        return new ServerInvocationContext(name, NodeInvocationContext.requireCurrent());
+    }
+
+    private final ConcurrentMap<String, Reg> exportedDispatchers = new ConcurrentHashMap<String, Reg>();
+
+    private static final class Reg {
+        private final InvocationDispatcher localDispatcher;
+        private final InvocationProcessor processor;
+
+        private Reg(final InvocationDispatcher localDispatcher, final InvocationProcessor processor) {
+            this.localDispatcher = localDispatcher;
+            this.processor = processor;
+        }
+    }
+
+    public InvocationDispatcher export(InvocationDispatcher dispatcher, String name) {
+        dispatcher.accept(new Visitor<InvocationDispatcher, Void>() {
+            public void visit(final InvocationDispatcher visited, final Void parameter) {
+                if (visited instanceof ExportedInvocationDispatcher) {
+                    throw new IllegalArgumentException("Dispatcher is already exported");
+                }
+            }
+        }, null);
+        return new ExportedInvocationDispatcher(nodeInvocationContext, new DispatcherIdentifier(getName(), name));
+    }
+
+    public String getName() {
+        return name;
+    }
+}



More information about the jboss-svn-commits mailing list