You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2012/03/23 07:18:27 UTC

svn commit: r1304198 [2/3] - in /openejb/trunk/openejb: itests/failover/src/main/java/org/apache/openejb/server/control/ itests/failover/src/test/java/org/apache/openejb/itest/failover/ server/openejb-client/ server/openejb-client/src/main/java/org/apa...

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/Observers.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client;
+
+import org.apache.openejb.client.event.Observes;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Observers {
+    private static final Logger logger = Logger.getLogger("OpenEJB.client");
+
+    private final List<Observer> observers = new ArrayList<Observer>();
+
+    public boolean addObserver(Object observer) {
+        if (observer == null) throw new IllegalArgumentException("observer cannot be null");
+        return observers.add(new Observer(observer));
+    }
+
+    public boolean removeObserver(Object listener) {
+        if (listener == null) throw new IllegalArgumentException("listener cannot be null");
+        return observers.remove(new Observer(listener));
+    }
+
+    public void fireEvent(Object event) {
+        if (event == null) throw new IllegalArgumentException("event cannot be null");
+
+        for (Observer observer : observers) {
+            try {
+                observer.invoke(event);
+            } catch (InvocationTargetException e) {
+                final Throwable t = e.getTargetException() == null ? e : e.getTargetException();
+
+                if (e.getTargetException() != null) {
+                    logger.log(Level.WARNING, "Observer method invocation failed", t);
+                }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    /**
+     * @version $Rev$ $Date$
+     */
+    public static class Observer {
+        private final Map<Class, Method> methods = new HashMap<Class, Method>();
+        private final Object observer;
+        private final Method defaultMethod;
+
+        public Observer(Object observer) {
+            if (observer == null) throw new IllegalArgumentException("observer cannot be null");
+
+            this.observer = observer;
+            for (Method method : observer.getClass().getMethods()) {
+                if (!isObserver(method)) continue;
+
+                if (method.getParameterTypes().length > 1) {
+                    throw new IllegalArgumentException("@Observes method must have only 1 parameter: " + method.toString());
+                }
+
+                if (Modifier.isAbstract(method.getModifiers())) {
+                    throw new IllegalArgumentException("@Observes method must not be abstract: " + method.toString());
+                }
+
+                if (!Modifier.isPublic(method.getModifiers())) {
+                    throw new IllegalArgumentException("@Observes method must be public: " + method.toString());
+                }
+
+                final Class<?> type = method.getParameterTypes()[0];
+
+                if (type.isAnnotation()) {
+                    throw new IllegalArgumentException("@Observes method parameter must be a concrete class (not an annotation): " + method.toString());
+                }
+
+                if (Modifier.isAbstract(type.getModifiers())) {
+                    throw new IllegalArgumentException("@Observes method parameter must be a concrete class (not an abstract class): " + method.toString());
+                }
+
+                if (type.isInterface()) {
+                    throw new IllegalArgumentException("@Observes method parameter must be a concrete class (not an interface): " + method.toString());
+                }
+
+                if (type.isArray()) {
+                    throw new IllegalArgumentException("@Observes method parameter must be a concrete class (not an array): " + method.toString());
+                }
+
+                if (type.isPrimitive()) {
+                    throw new IllegalArgumentException("@Observes method parameter must be a concrete class (not a primitive): " + method.toString());
+                }
+
+                methods.put(type, method);
+            }
+
+            defaultMethod = methods.get(Object.class);
+
+            if (methods.size() == 0) {
+                throw new IllegalArgumentException("Object has no @Observes methods. For example: public void observe(@Observes RetryConditionAdded event){...}");
+            }
+        }
+
+        public void invoke(Object event) throws InvocationTargetException, IllegalAccessException {
+            if (event == null) throw new IllegalArgumentException("event cannot be null");
+
+            final Class eventType = event.getClass();
+            final Method method = methods.get(eventType);
+
+            if (method != null) {
+                method.invoke(observer, event);
+            } else if (defaultMethod != null) {
+                defaultMethod.invoke(observer, event);
+            }
+        }
+
+        private boolean isObserver(Method method) {
+            for (Annotation[] annotations : method.getParameterAnnotations()) {
+                for (Annotation annotation : annotations) {
+                    if (annotation.annotationType().equals(Observes.class)) return true;
+                }
+            }
+            return false;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+
+            final Observer observer1 = (Observer) o;
+
+            return observer.equals(observer1.observer);
+        }
+
+        @Override
+        public int hashCode() {
+            return observer.hashCode();
+        }
+    }
+}

Modified: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RandomConnectionStrategy.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RandomConnectionStrategy.java?rev=1304198&r1=1304197&r2=1304198&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RandomConnectionStrategy.java (original)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RandomConnectionStrategy.java Fri Mar 23 06:18:25 2012
@@ -16,83 +16,77 @@
  */
 package org.apache.openejb.client;
 
-import java.io.IOException;
+import org.apache.openejb.client.event.FailoverSelection;
+import org.apache.openejb.client.event.RandomFailoverSelection;
+
 import java.net.URI;
-import java.rmi.RemoteException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.Set;
 import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
 import java.util.Random;
+import java.util.Set;
 
-public class RandomConnectionStrategy implements ConnectionStrategy {
-    private static final Logger LOGGER = Logger.getLogger("OpenEJB.client");
-    private final Random random = new Random();
+public class RandomConnectionStrategy extends AbstractConnectionStrategy {
 
+    @Override
+    protected FailoverSelection createFailureEvent(Set<URI> remaining, Set<URI> failed, URI uri) {
+        return new RandomFailoverSelection(remaining, failed, uri);
+    }
 
-    public Connection connect(ClusterMetaData cluster, ServerMetaData server) throws IOException {
-        Set<URI> failed = Client.getFailed();
+    @Override
+    protected Iterable<URI> createIterable(ClusterMetaData cluster) {
+        return new RandomIterable(cluster);
+    }
 
-        URI[] locations = cluster.getLocations();
+    public static class RandomIterable implements Iterable<URI> {
+        private final URI[] locations;
 
-        if (locations.length == 0){
-            return connect(cluster, server.getLocation());
+        public RandomIterable(ClusterMetaData clusterMetaData) {
+            this.locations = clusterMetaData.getLocations();
         }
 
-        List<URI> available = Arrays.asList(locations);
-        available.removeAll(failed);
-
-        URI lastLocation = cluster.getLastLocation();
-
-        if (available.size() > 2) available.remove(lastLocation);
-
-
-        while (available.size() > 0) {
-
-            URI uri = next(available);
-
-            try {
-                return connect(cluster, uri);
-            } catch (IOException e) {
-                failed.add(uri);
-                available.remove(uri);
-                LOGGER.log(Level.WARNING, "Random: Failover: Cannot connect to server(s): " + uri.toString() + " Exception: " + e.getMessage()+".  Trying next.");
-            } catch (Throwable e) {
-                failed.add(uri);
-                available.remove(uri);
-                throw new RemoteException("Random: Failover: Cannot connect to server: " +  uri.toString() + " due to an unkown exception in the OpenEJB client: ", e);
-            }
+        @Override
+        public Iterator<URI> iterator() {
+            return new RandomIterator<URI>(locations);
         }
+    }
 
-        if (available.size() == 0 && server.getLocation() != null && !failed.contains(server.getLocation())){
-            return connect(cluster, server.getLocation());
+    public static class RandomIterator<T> implements Iterator<T> {
+        private final Random random = new Random();
+        private final T[] items;
+        private int size;
+
+        public RandomIterator(T[] items) {
+            this.items = Arrays.copyOf(items, items.length);
+            this.size = items.length;
         }
 
-        // If no servers responded, throw an error
-        StringBuilder buffer = new StringBuilder();
-        for (int i = 0; i < locations.length; i++) {
-            URI uri = locations[i];
-            buffer.append((i != 0 ? ", " : "") + "Server #" + i + ": " + uri);
+        @Override
+        public boolean hasNext() {
+            return size > 0;
         }
-        throw new RemoteException("Cannot connect to any servers: " + buffer.toString());
-    }
 
-    private URI next(List<URI> available) {
-        int i = Math.abs(random.nextInt()) % available.size();
-        URI uri = available.get(i);
-        return uri;
-    }
+        @Override
+        public T next() {
+            if (!hasNext()) throw new NoSuchElementException();
+
+            // Random.nextInt is exclusive.
+            // So if size=10, result will be between 0-9
+            final int selected = random.nextInt(size--);
+
+            T selectedObject = items[selected];
+
+            // Take the object from the end of the list
+            // and move it into the place where selected was.
+            items[selected] = items[size];
+            items[size] = null;
 
-    protected Connection connect(ClusterMetaData cluster, URI uri) throws IOException {
-        Connection connection = ConnectionManager.getConnection(uri);
+            return selectedObject;
+        }
 
-        // Grabbing the URI from the associated connection allows the ConnectionFactory to
-        // employ discovery to find and connect to a server.  We then attempt to connect
-        // to the discovered server rather than repeat the discovery process again.
-        cluster.setLastLocation(connection.getURI());
-        return connection;
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException("remove");
+        }
     }
-
 }
\ No newline at end of file

Modified: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RoundRobinConnectionStrategy.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RoundRobinConnectionStrategy.java?rev=1304198&r1=1304197&r2=1304198&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RoundRobinConnectionStrategy.java (original)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/RoundRobinConnectionStrategy.java Fri Mar 23 06:18:25 2012
@@ -16,87 +16,71 @@
  */
 package org.apache.openejb.client;
 
-import java.io.IOException;
+import org.apache.openejb.client.event.FailoverSelection;
+import org.apache.openejb.client.event.RoundRobinFailoverSelection;
+
 import java.net.URI;
-import java.rmi.RemoteException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
 import java.util.Set;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-public class RoundRobinConnectionStrategy implements ConnectionStrategy {
-    private static final Logger LOGGER = Logger.getLogger("OpenEJB.client");
+import java.util.concurrent.atomic.AtomicInteger;
 
-    public Connection connect(ClusterMetaData cluster, ServerMetaData server) throws IOException {
-        Set<URI> failed = Client.getFailed();
+public class RoundRobinConnectionStrategy extends AbstractConnectionStrategy {
 
-        URI[] locations = cluster.getLocations();
+    private static class RoundRobinIterable implements Iterable<URI> {
+        private final URI[] locations;
+        private AtomicInteger index = new AtomicInteger(-1);
 
-        if (locations.length == 0){
-            return connect(cluster, server.getLocation());
+        private RoundRobinIterable(ClusterMetaData clusterMetaData) {
+            this.locations = clusterMetaData.getLocations();
         }
 
+        private int index() {
+            final int i = index.incrementAndGet();
+            if (i < locations.length) return i;
 
-        List<URI> list = Arrays.asList(locations);
-        URI lastLocation = cluster.getLastLocation();
-        if (null != lastLocation && !failed.contains(lastLocation)) {
-            try {
-                int i = list.indexOf(lastLocation) + 1;
-                if (i >= list.size()) i = 0;
-
-                URI uri = list.get(i);
-
-                return connect(cluster, uri);
-            } catch (IOException e) {
-                if (locations.length > 1){
-                    LOGGER.log(Level.WARNING, "RoundRobin: Failing over.  Cannot connect to next server: " + lastLocation.toString() + " Exception: " + e.getClass().getName() +" " + e.getMessage());
-                }
-            }
+            index.compareAndSet(i, -1);
+            return index();
         }
 
+        @Override
+        public Iterator<URI> iterator() {
+            return new RoundRobinIterator();
+        }
 
-        Set<URI> remaining = new LinkedHashSet<URI>(list);
-
-        remaining.remove(lastLocation);
-        remaining.removeAll(failed);
+        private class RoundRobinIterator implements Iterator<URI> {
+            private final Set<URI> seen = new HashSet<URI>();
 
-        for (URI uri : remaining) {
-            try {
-                return connect(cluster, uri);
-            } catch (IOException e) {
-                failed.add(uri);
-                LOGGER.log(Level.WARNING, "RoundRobin: Failover: Cannot connect to server(s): " + uri.toString() + " Exception: " + e.getMessage()+".  Trying next.");
-            } catch (Throwable e) {
-                failed.add(uri);
-                throw new RemoteException("RoundRobin: Failover: Cannot connect to server: " +  uri.toString() + " due to an unkown exception in the OpenEJB client: ", e);
+            @Override
+            public boolean hasNext() {
+                return seen.size() < locations.length;
             }
-        }
 
-        remaining.removeAll(failed);
+            @Override
+            public URI next() {
+                if (!hasNext()) throw new NoSuchElementException();
 
-        if (remaining.size() == 0 && server.getLocation() != null && !failed.contains(server.getLocation())){
-            return connect(cluster, server.getLocation());
-        }
+                final URI location = locations[index()];
+                seen.add(location);
+
+                return location;
+            }
 
-        // If no servers responded, throw an error
-        StringBuilder buffer = new StringBuilder();
-        for (int i = 0; i < locations.length; i++) {
-            URI uri = locations[i];
-            buffer.append((i != 0 ? ", " : "") + "Server #" + i + ": " + uri);
+            @Override
+            public void remove() {
+            }
         }
-        throw new RemoteException("Cannot connect to any servers: " + buffer.toString());
     }
 
-    protected Connection connect(ClusterMetaData cluster, URI uri) throws IOException {
-        Connection connection = ConnectionManager.getConnection(uri);
+    @Override
+    protected FailoverSelection createFailureEvent(Set<URI> remaining, Set<URI> failed, URI uri) {
+        return new RoundRobinFailoverSelection(remaining, failed, uri);
+    }
 
-        // Grabbing the URI from the associated connection allows the ConnectionFactory to
-        // employ discovery to find and connect to a server.  We then attempt to connect
-        // to the discovered server rather than repeat the discovery process again.
-        cluster.setLastLocation(connection.getURI());
-        return connection;
+    @Override
+    protected Iterable<URI> createIterable(ClusterMetaData cluster) {
+        return new RoundRobinIterable(cluster);
     }
 
 }
\ No newline at end of file

Modified: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/SocketConnectionFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/SocketConnectionFactory.java?rev=1304198&r1=1304197&r2=1304198&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/SocketConnectionFactory.java (original)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/SocketConnectionFactory.java Fri Mar 23 06:18:25 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.openejb.client;
 
+import org.apache.openejb.client.event.ConnectionOpened;
+
 import javax.net.ssl.SSLSocket;
 import javax.net.ssl.SSLSocketFactory;
 import java.io.BufferedInputStream;
@@ -200,6 +202,7 @@ public class SocketConnectionFactory imp
                 }
 
                 socket.setTcpNoDelay(true);
+                Client.fireEvent(new ConnectionOpened(uri));
             } catch (ConnectException e) {
                 throw new IOException("Cannot connect to server '" + uri.toString() + "'.  Check that the server is started and that the specified serverURL is correct.", e);
 

Modified: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/StickyConnectionStrategy.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/StickyConnectionStrategy.java?rev=1304198&r1=1304197&r2=1304198&view=diff
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/StickyConnectionStrategy.java (original)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/StickyConnectionStrategy.java Fri Mar 23 06:18:25 2012
@@ -16,78 +16,100 @@
  */
 package org.apache.openejb.client;
 
-import java.io.IOException;
+import org.apache.openejb.client.event.FailoverSelection;
+import org.apache.openejb.client.event.StickyFailoverSelection;
+
 import java.net.URI;
-import java.rmi.RemoteException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
 import java.util.Set;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
 
-public class StickyConnectionStrategy implements ConnectionStrategy {
-    private static final Logger LOGGER = Logger.getLogger("OpenEJB.client");
+public class StickyConnectionStrategy extends AbstractConnectionStrategy {
+
+
+    private final AbstractConnectionStrategy secondaryConnectionStrategy;
+
+    public StickyConnectionStrategy() {
+        this(new RoundRobinConnectionStrategy());
+    }
+
+    public StickyConnectionStrategy(AbstractConnectionStrategy secondaryConnectionStrategy) {
+        this.secondaryConnectionStrategy = secondaryConnectionStrategy;
+    }
+
+    public AbstractConnectionStrategy getSecondaryConnectionStrategy() {
+        return secondaryConnectionStrategy;
+    }
+
+    @Override
+    protected FailoverSelection createFailureEvent(Set<URI> remaining, Set<URI> failed, URI uri) {
+        return new StickyFailoverSelection(remaining, failed, uri);
+    }
+
+    @Override
+    protected Iterable<URI> createIterable(ClusterMetaData cluster) {
+        return new StickyIterable(cluster);
+    }
 
-    public Connection connect(ClusterMetaData cluster, ServerMetaData server) throws IOException {
-        Set<URI> failed = Client.getFailed();
+    public class StickyIterable implements Iterable<URI> {
 
-        URI[] locations = cluster.getLocations();
+        private final ClusterMetaData cluster;
+        private final Iterable<URI> iterable;
 
-        if (locations.length == 0){
-            return connect(cluster, server.getLocation());
+        public StickyIterable(ClusterMetaData cluster) {
+            this.cluster = cluster;
+            this.iterable = secondaryConnectionStrategy.createIterable(cluster);
         }
 
-        URI lastLocation = cluster.getLastLocation();
-        if (null != lastLocation && !failed.contains(lastLocation)) {
-            try {
-                return connect(cluster, lastLocation);
-            } catch (IOException e) {
-                if (locations.length > 1){
-                    LOGGER.log(Level.WARNING, "Failing over.  Cannot connect to last server: " + lastLocation.toString() + " Exception: " + e.getClass().getName() +" " + e.getMessage());
-                }
-            }
+        @Override
+        public Iterator<URI> iterator() {
+            return new StickyIterator();
         }
 
+        public class StickyIterator implements Iterator<URI> {
+            private Iterator<URI> iterator;
+            private URI last;
+            private boolean first = true;
 
-        Set<URI> remaining = new LinkedHashSet<URI>(Arrays.asList(locations));
-        remaining.remove(lastLocation);
-        remaining.removeAll(failed);
-
-        for (URI uri : remaining) {
-            try {
-                return connect(cluster, uri);
-            } catch (IOException e) {
-                failed.add(uri);
-                LOGGER.log(Level.WARNING, "Failover: Cannot connect to server(s): " + uri.toString() + " Exception: " + e.getMessage()+".  Trying next.");
-            } catch (Throwable e) {
-                failed.add(uri);
-                throw new RemoteException("Failover: Cannot connect to server: " +  uri.toString() + " due to an unkown exception in the OpenEJB client: ", e);
+            private StickyIterator() {
+                setLast(cluster.getLastLocation());
             }
-        }
 
-        remaining.removeAll(failed);
+            private void setLast(URI lastLocation) {
+                last = lastLocation;
+            }
 
-        if (remaining.size() == 0 && server.getLocation() != null && !failed.contains(server.getLocation())){
-            return connect(cluster, server.getLocation());
-        }
+            @Override
+            public boolean hasNext() {
+                return first && last != null || getIterator().hasNext();
+            }
 
-        // If no servers responded, throw an error
-        StringBuilder buffer = new StringBuilder();
-        for (int i = 0; i < locations.length; i++) {
-            URI uri = locations[i];
-            buffer.append((i != 0 ? ", " : "") + "Server #" + i + ": " + uri);
-        }
-        throw new RemoteException("Cannot connect to any servers: " + buffer.toString());
-    }
+            @Override
+
+            public URI next() {
+                if (!hasNext()) throw new NoSuchElementException();
+
+                if (first && last != null) {
+                    first = false;
+                    return last;
+                }
 
-    protected Connection connect(ClusterMetaData cluster, URI uri) throws IOException {
-        Connection connection = ConnectionManager.getConnection(uri);
+                Iterator<URI> iterator = getIterator();
 
-        // Grabbing the URI from the associated connection allows the ConnectionFactory to
-        // employ discovery to find and connect to a server.  We then attempt to connect
-        // to the discovered server rather than repeat the discovery process again.
-        cluster.setLastLocation(connection.getURI());
-        return connection;
+                return iterator.next();
+            }
+
+            private Iterator<URI> getIterator() {
+                if (iterator == null) {
+                    iterator = iterable.iterator();
+                }
+                return iterator;
+            }
+
+            @Override
+            public void remove() {
+            }
+        }
     }
 
 }

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/BootstrappingConnection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/BootstrappingConnection.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/BootstrappingConnection.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/BootstrappingConnection.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.WARNING)
+public class BootstrappingConnection {
+
+    private final URI provider;
+
+    public BootstrappingConnection(URI provider) {
+        this.provider = provider;
+    }
+
+    @Override
+    public String toString() {
+        return "BootstrappingConnection{" +
+                "provider=" + provider +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClientVersion.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClientVersion.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClientVersion.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClientVersion.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ResourceFinder;
+
+import java.util.Properties;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ClientVersion {
+
+    private final String version;
+    private final String date;
+    private final String time;
+
+    public ClientVersion(String version, String date, String time) {
+        this.version = version;
+        this.date = date;
+        this.time = time;
+    }
+
+    public ClientVersion() {
+        Properties info = new Properties();
+
+        try {
+            ResourceFinder finder = new ResourceFinder();
+            info = finder.findProperties("openejb-client-version.properties");
+        } catch (java.io.IOException e) {
+            e.printStackTrace();
+        }
+
+        version = info.getProperty("version");
+        date = info.getProperty("date");
+        time = info.getProperty("time");
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public String getTime() {
+        return time;
+    }
+
+    @Override
+    public String toString() {
+        return "ClientVersion{" +
+                "version='" + version + '\'' +
+                ", date='" + date + '\'' +
+                ", time='" + time + '\'' +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClusterMetaDataUpdated.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClusterMetaDataUpdated.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClusterMetaDataUpdated.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ClusterMetaDataUpdated.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ClusterMetaData;
+import org.apache.openejb.client.ServerMetaData;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ClusterMetaDataUpdated {
+
+    private final ServerMetaData serverMetaData;
+    private final ClusterMetaData clusterMetaData;
+    private final ClusterMetaData previousClusterMetaData;
+
+    public ClusterMetaDataUpdated(ServerMetaData serverMetaData, ClusterMetaData clusterMetaData, ClusterMetaData previousClusterMetaData) {
+        this.serverMetaData = serverMetaData;
+        this.clusterMetaData = clusterMetaData;
+        this.previousClusterMetaData = previousClusterMetaData;
+    }
+
+    public ServerMetaData getServerMetaData() {
+        return serverMetaData;
+    }
+
+    public ClusterMetaData getClusterMetaData() {
+        return clusterMetaData;
+    }
+
+    public ClusterMetaData getPreviousClusterMetaData() {
+        return previousClusterMetaData;
+    }
+
+    @Override
+    public String toString() {
+        return "ClusterMetaDataUpdated{" +
+                "provider=" + serverMetaData.getLocation() +
+                ", version=" + clusterMetaData.getVersion() +
+                ", uris=" + clusterMetaData.getLocations().length +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryAdded.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryAdded.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryAdded.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryAdded.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ConnectionFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ConnectionFactoryAdded {
+
+    private final String scheme;
+    private final ConnectionFactory factory;
+
+    public ConnectionFactoryAdded(String scheme, ConnectionFactory factory) {
+        this.scheme = scheme;
+        this.factory = factory;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public ConnectionFactory getFactory() {
+        return factory;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionFactoryAdded{" +
+                "scheme='" + scheme + '\'' +
+                ", factory=" + factory.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryRemoved.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryRemoved.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryRemoved.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFactoryRemoved.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ConnectionFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ConnectionFactoryRemoved {
+
+    private final String scheme;
+    private final ConnectionFactory factory;
+
+    public ConnectionFactoryRemoved(String scheme, ConnectionFactory factory) {
+        this.scheme = scheme;
+        this.factory = factory;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public ConnectionFactory getFactory() {
+        return factory;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionFactoryRemoved{" +
+                "scheme='" + scheme + '\'' +
+                ", factory=" + factory.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFailed.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFailed.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFailed.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionFailed.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.SEVERE)
+public class ConnectionFailed {
+    private final URI uri;
+    private final Throwable cause;
+
+    public ConnectionFailed(URI uri, Throwable cause) {
+        this.uri = uri;
+        this.cause = cause;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionFailed{" +
+                "uri=" + uri +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionOpened.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionOpened.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionOpened.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionOpened.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log
+public class ConnectionOpened {
+    private final URI uri;
+
+    public ConnectionOpened(URI uri) {
+        this.uri = uri;
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionOpened{" +
+                "uri=" + uri +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyAdded.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyAdded.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyAdded.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyAdded.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ConnectionStrategy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ConnectionStrategyAdded {
+
+    private final String scheme;
+    private final ConnectionStrategy strategy;
+
+    public ConnectionStrategyAdded(String scheme, ConnectionStrategy strategy) {
+        this.scheme = scheme;
+        this.strategy = strategy;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public ConnectionStrategy getStrategy() {
+        return strategy;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionStrategyAdded{" +
+                "scheme='" + scheme + '\'' +
+                ", strategy=" + strategy.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyFailed.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyFailed.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyFailed.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyFailed.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ClusterMetaData;
+import org.apache.openejb.client.ConnectionStrategy;
+import org.apache.openejb.client.ServerMetaData;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.SEVERE)
+public class ConnectionStrategyFailed {
+
+    private final ConnectionStrategy strategy;
+    private final ClusterMetaData cluster;
+    private final ServerMetaData server;
+    private final Throwable cause;
+
+    public ConnectionStrategyFailed(ConnectionStrategy strategy, ClusterMetaData cluster, ServerMetaData server, Throwable cause) {
+        this.strategy = strategy;
+        this.cluster = cluster;
+        this.server = server;
+        this.cause = cause;
+    }
+
+    public ConnectionStrategy getStrategy() {
+        return strategy;
+    }
+
+    public ClusterMetaData getCluster() {
+        return cluster;
+    }
+
+    public ServerMetaData getServer() {
+        return server;
+    }
+
+    public Throwable getCause() {
+        return cause;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionStrategyFailed{" +
+                "strategy=" + strategy.getClass().getSimpleName() +
+                ", cluster=" + cluster +
+                ", server=" + server.getLocation() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyRemoved.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyRemoved.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyRemoved.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ConnectionStrategyRemoved.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.ConnectionStrategy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ConnectionStrategyRemoved {
+
+    private final String scheme;
+    private final ConnectionStrategy strategy;
+
+    public ConnectionStrategyRemoved(String scheme, ConnectionStrategy strategy) {
+        this.scheme = scheme;
+        this.strategy = strategy;
+    }
+
+    public String getScheme() {
+        return scheme;
+    }
+
+    public ConnectionStrategy getStrategy() {
+        return strategy;
+    }
+
+    @Override
+    public String toString() {
+        return "ConnectionStrategyRemoved{" +
+                "scheme='" + scheme + '\'' +
+                ", strategy=" + strategy.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/FailoverSelection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/FailoverSelection.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/FailoverSelection.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/FailoverSelection.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FailoverSelection {
+    protected final Set<URI> remaining;
+    protected final Set<URI> failed;
+    protected final URI server;
+
+    public FailoverSelection(Set<URI> remaining, Set<URI> failed, URI server) {
+        this.remaining = Collections.unmodifiableSet(remaining);
+        this.failed = Collections.unmodifiableSet(failed);
+        this.server = server;
+    }
+
+    public Set<URI> getRemaining() {
+        return remaining;
+    }
+
+    public Set<URI> getFailed() {
+        return failed;
+    }
+
+    public URI getServer() {
+        return server;
+    }
+
+    @Override
+    public String toString() {
+        return this.getClass().getSimpleName() + "{" +
+                "remaining=" + remaining.size() +
+                ", failed=" + failed.size() +
+                ", server=" + server +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Log.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Log.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Log.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Log.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+@Documented
+public @interface Log {
+    Level value() default Level.INFO;
+
+    public static enum Level {
+        SEVERE,
+        WARNING,
+        INFO,
+        CONFIG,
+        FINE,
+        FINER,
+        FINEST
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverAdded.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverAdded.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverAdded.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverAdded.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ObserverAdded {
+
+    private final Object observer;
+
+    public ObserverAdded(Object observer) {
+        this.observer = observer;
+    }
+
+    public Object getObserver() {
+        return observer;
+    }
+
+    @Override
+    public String toString() {
+        return "ObserverAdded{" +
+                "observer=" + observer.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverRemoved.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverRemoved.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverRemoved.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ObserverRemoved.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class ObserverRemoved {
+
+    private final Object observer;
+
+    public ObserverRemoved(Object observer) {
+        this.observer = observer;
+    }
+
+    public Object getObserver() {
+        return observer;
+    }
+
+    @Override
+    public String toString() {
+        return "ObserverRemoved{" +
+                "observer=" + observer.getClass().getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Observes.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Observes.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Observes.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/Observes.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Target(PARAMETER)
+@Retention(RUNTIME)
+@Documented
+public @interface Observes {
+}
\ No newline at end of file

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RandomFailoverSelection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RandomFailoverSelection.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RandomFailoverSelection.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RandomFailoverSelection.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+import java.util.Set;
+
+/**
+* @version $Rev$ $Date$
+*/
+@Log(Log.Level.WARNING)
+public class RandomFailoverSelection extends FailoverSelection {
+
+    public RandomFailoverSelection(Set<URI> remaining, Set<URI> failed, URI server) {
+        super(remaining, failed, server);
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RemoteInitialContextCreated.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RemoteInitialContextCreated.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RemoteInitialContextCreated.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RemoteInitialContextCreated.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log
+public class RemoteInitialContextCreated {
+
+    private final URI providerUri;
+
+    public RemoteInitialContextCreated(URI providerUri) {
+        this.providerUri = providerUri;
+    }
+
+    public URI getProviderUri() {
+        return providerUri;
+    }
+
+    @Override
+    public String toString() {
+        return "RemoteInitialContextCreated{" +
+                "providerUri=" + providerUri +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RequestFailed.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RequestFailed.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RequestFailed.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RequestFailed.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.Request;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.SEVERE)
+public class RequestFailed {
+
+    private final URI server;
+
+    private final Request request;
+
+    public RequestFailed(URI server, Request request) {
+        this.server = server;
+        this.request = request;
+    }
+
+
+    public URI getServer() {
+        return server;
+    }
+
+    public Request getRequest() {
+        return request;
+    }
+
+    @Override
+    public String toString() {
+        return "RequestFailed{" +
+                "server=" + server +
+                "} " + request;
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionAdded.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionAdded.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionAdded.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionAdded.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class RetryConditionAdded {
+
+    private final Class<? extends Throwable> condition;
+
+    public RetryConditionAdded(Class<? extends Throwable> condition) {
+        this.condition = condition;
+    }
+
+    public Class<? extends Throwable> getCondition() {
+        return condition;
+    }
+
+    @Override
+    public String toString() {
+        return "RetryConditionAdded{" +
+                "condition=" + condition.getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionRemoved.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionRemoved.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionRemoved.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryConditionRemoved.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log(Log.Level.CONFIG)
+public class RetryConditionRemoved {
+
+    private final Class<? extends Throwable> condition;
+
+    public RetryConditionRemoved(Class<? extends Throwable> condition) {
+        this.condition = condition;
+    }
+
+    public Class<? extends Throwable> getCondition() {
+        return condition;
+    }
+
+    @Override
+    public String toString() {
+        return "RetryConditionRemoved{" +
+                "condition=" + condition.getName() +
+                '}';
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryingRequest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryingRequest.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryingRequest.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RetryingRequest.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import org.apache.openejb.client.Request;
+import org.apache.openejb.client.ServerMetaData;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log
+public class RetryingRequest {
+
+    private final Request request;
+    private final ServerMetaData serverMetaData;
+
+    public RetryingRequest(Request request, ServerMetaData serverMetaData) {
+        this.request = request;
+        this.serverMetaData = serverMetaData;
+    }
+
+    public Request getRequest() {
+        return request;
+    }
+
+    public ServerMetaData getServerMetaData() {
+        return serverMetaData;
+    }
+
+    @Override
+    public String toString() {
+        return "RetryingRequest{" +
+                "server=" + serverMetaData.getLocation() +
+                "} " + request;
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RoundRobinFailoverSelection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RoundRobinFailoverSelection.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RoundRobinFailoverSelection.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/RoundRobinFailoverSelection.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+import java.util.Set;
+
+/**
+* @version $Rev$ $Date$
+*/
+@Log(Log.Level.WARNING)
+public class RoundRobinFailoverSelection extends FailoverSelection {
+
+    public RoundRobinFailoverSelection(Set<URI> remaining, Set<URI> failed, URI server) {
+        super(remaining, failed, server);
+    }
+
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerAdded.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerAdded.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerAdded.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerAdded.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log
+public class ServerAdded {
+
+    private final ClusterMetaDataUpdated clusterMetaDataUpdated;
+    private final URI server;
+
+    public ServerAdded(ClusterMetaDataUpdated clusterMetaDataUpdated, URI server) {
+        this.clusterMetaDataUpdated = clusterMetaDataUpdated;
+        this.server = server;
+    }
+
+    @Override
+    public String toString() {
+        return "ServerAdded{" +
+                "server=" + server +
+                "} " + clusterMetaDataUpdated;
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerRemoved.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerRemoved.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerRemoved.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/ServerRemoved.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Log
+public class ServerRemoved {
+
+    private final ClusterMetaDataUpdated clusterMetaDataUpdated;
+    private final URI server;
+
+    public ServerRemoved(ClusterMetaDataUpdated clusterMetaDataUpdated, URI server) {
+        this.clusterMetaDataUpdated = clusterMetaDataUpdated;
+        this.server = server;
+    }
+
+    @Override
+    public String toString() {
+        return "ServerRemoved{" +
+                "server=" + server +
+                "} " + clusterMetaDataUpdated;
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/StickyFailoverSelection.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/StickyFailoverSelection.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/StickyFailoverSelection.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/java/org/apache/openejb/client/event/StickyFailoverSelection.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client.event;
+
+import java.net.URI;
+import java.util.Set;
+
+/**
+* @version $Rev$ $Date$
+*/
+@Log(Log.Level.WARNING)
+public class StickyFailoverSelection extends FailoverSelection {
+
+    public StickyFailoverSelection(Set<URI> remaining, Set<URI> failed, URI server) {
+        super(remaining, failed, server);
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/main/resources/openejb-client-version.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/main/resources/openejb-client-version.properties?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/main/resources/openejb-client-version.properties (added)
+++ openejb/trunk/openejb/server/openejb-client/src/main/resources/openejb-client-version.properties Fri Mar 23 06:18:25 2012
@@ -0,0 +1,21 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+copyright=Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.
+url=http://openejb.apache.org/
+version=${pom.version}
+date=@DATE-REPLACED-BY-MAVEN@
+time=@TIME-REPLACED-BY-MAVEN@

Added: openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RandomConnectionStrategyIteratorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RandomConnectionStrategyIteratorTest.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RandomConnectionStrategyIteratorTest.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RandomConnectionStrategyIteratorTest.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RandomConnectionStrategyIteratorTest {
+
+
+    @Test
+    public void test() throws Exception {
+        final URI[] uris = uris(
+                "one://localhost:1243",
+                "two://localhost:1243",
+                "three://localhost:1243",
+                "four://localhost:1243");
+
+        ClusterMetaData cluster = new ClusterMetaData(System.currentTimeMillis(), uris);
+        Iterable<URI> iterable = new RandomConnectionStrategy().createIterable(cluster);
+
+
+        List<URI> found = new ArrayList<URI>();
+
+        for (URI uri : iterable) {
+            found.add(uri);
+        }
+
+        Assert.assertEquals(uris.length, found.size());
+        for (URI uri : uris) {
+            Assert.assertTrue(found.contains(uri));
+        }
+
+        Assert.assertFalse(
+                found.get(0).equals(uris[0]) &&
+                found.get(1).equals(uris[1]) &&
+                found.get(2).equals(uris[2]) &&
+                found.get(3).equals(uris[3])
+        );
+    }
+
+    private URI[] uris(String... strings) {
+        final URI[] uris = new URI[strings.length];
+
+        for (int i = 0; i < strings.length; i++) {
+            uris[i] = URI.create(strings[i]);
+        }
+
+        return uris;
+    }
+}

Added: openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RoundRobinConnectionStrategyIteratorTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RoundRobinConnectionStrategyIteratorTest.java?rev=1304198&view=auto
==============================================================================
--- openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RoundRobinConnectionStrategyIteratorTest.java (added)
+++ openejb/trunk/openejb/server/openejb-client/src/test/java/org/apache/openejb/client/RoundRobinConnectionStrategyIteratorTest.java Fri Mar 23 06:18:25 2012
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.client;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RoundRobinConnectionStrategyIteratorTest {
+
+
+    @Test
+    public void test() throws Exception {
+        final URI[] uris = uris(
+                "one://localhost:1243",
+                "two://localhost:1243",
+                "three://localhost:1243",
+                "four://localhost:1243");
+
+        ClusterMetaData cluster = new ClusterMetaData(System.currentTimeMillis(), uris);
+        Iterable<URI> iterable = new RoundRobinConnectionStrategy().createIterable(cluster);
+
+        {
+            Iterator<URI> iterator = iterable.iterator();
+            Assert.assertTrue(iterator.hasNext());
+            Assert.assertEquals(uris[0], iterator.next());
+            Assert.assertTrue(iterator.hasNext());
+            Assert.assertEquals(uris[1], iterator.next());
+            Assert.assertTrue(iterator.hasNext());
+            Assert.assertEquals(uris[2], iterator.next());
+            Assert.assertTrue(iterator.hasNext());
+            Assert.assertEquals(uris[3], iterator.next());
+            Assert.assertTrue(!iterator.hasNext());
+
+            try {
+                iterator.next();
+                Assert.fail("Expected NoSuchElementException");
+            } catch (NoSuchElementException e) {
+                // pass
+            }
+        }
+
+        {
+            Iterator<URI> prep = iterable.iterator();
+            prep.next();
+            prep.next();
+
+            Iterator<URI> iterator = iterable.iterator();
+            Assert.assertEquals(uris[2], iterator.next());
+            Assert.assertEquals(uris[3], iterator.next());
+            Assert.assertEquals(uris[0], iterator.next());
+            Assert.assertEquals(uris[1], iterator.next());
+        }
+
+
+    }
+
+    private URI[] uris(String... strings) {
+        final URI[] uris = new URI[strings.length];
+
+        for (int i = 0; i < strings.length; i++) {
+            uris[i] = URI.create(strings[i]);
+        }
+
+        return uris;
+    }
+
+}