[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15562: moved some stuff to the new impl package (in puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi: . impl)



Author: sebastian
Date: 2008-06-29 05:42:41 -0400 (Sun, 29 Jun 2008)
New Revision: 15562

Added:
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/PuppeTorSlaveImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/RemotePuppeTorImpl.java
Removed:
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/PuppeTorSlaveImpl.java
   puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemotePuppeTorImpl.java
Log:
moved some stuff to the new impl package

Deleted: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/PuppeTorSlaveImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/PuppeTorSlaveImpl.java	2008-06-29 09:38:52 UTC (rev 15561)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/PuppeTorSlaveImpl.java	2008-06-29 09:42:41 UTC (rev 15562)
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2008, Sebastian Hahn
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- *     * Neither the names of the copyright owners nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package de.uniba.wiai.lspi.puppetor.rmi.impl;
-
-import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorSlave;
-
-/**
- * Implements a <code>PuppeTorSlave</code>. Depending on what it is used for,
- * different constructors are provided to specify the client's capabilities.
- * 
- * @author Sebastian Hahn
- */
-
-public final class PuppeTorSlaveImpl implements PuppeTorSlave {
-
-    /**
-     * Required for serialization. Needs to change for new released versions.
-     */
-    private static final long serialVersionUID = 1L;
-    
-    /**
-     * The slave's name
-     */
-    protected final String name;
-
-    /**
-     * This constructor is useful for slaves only, and only if they don't
-     * want to provide any OS-specific or otherwise capability-telling
-     * information.
-     * @param slaveName
-     *     The slave's name
-     */
-    public PuppeTorSlaveImpl(final String slaveName) {
-        name = slaveName;
-    }
-
-    /**
-     * @return
-     *     The slave's name
-     */
-    public String getName() {
-        return name;
-    }
-
-}

Deleted: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemotePuppeTorImpl.java
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemotePuppeTorImpl.java	2008-06-29 09:38:52 UTC (rev 15561)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemotePuppeTorImpl.java	2008-06-29 09:42:41 UTC (rev 15562)
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 2008, Sebastian Hahn
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- *     * Neither the names of the copyright owners nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package de.uniba.wiai.lspi.puppetor.rmi.impl;
-
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.concurrent.ConcurrentHashMap;
-
-import de.uniba.wiai.lspi.puppetor.rmi.CreateNetwork;
-import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorSlave;
-import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorTest;
-import de.uniba.wiai.lspi.puppetor.rmi.RemotePuppeTor;
-
-/**
- * Implementation for <code>RemotePuppeTor</code>. XXX Currently, this object
- * is shared for all the connecting slaves, but this may change. If this
- * changes, we don't need the slave's name for the method calls.-SH
- * 
- * @author Sebastian Hahn
- */
-public class RemotePuppeTorImpl extends UnicastRemoteObject implements
-        RemotePuppeTor {
-
-    /**
-     * Required for serialization. Needs to change for new released versions.
-     */
-    private static final long serialVersionUID = 1L;
-    
-    /**
-     * We store all the connected <code>PuppeTorSlave</code>s here
-     */
-    private static final ConcurrentHashMap<String, PuppeTorSlave> slaves =
-            new ConcurrentHashMap<String, PuppeTorSlave>();
-
-    /**
-     * empty default constructor needed because of the 
-     * <code>RemoteException</code>
-     * @throws RemoteException
-     *     RMI
-     */
-    public RemotePuppeTorImpl() throws RemoteException { }
-
-    /**
-     * A new slave that has just connected is required to call this method
-     * once and only once to register it with the server
-     * @throws IllegalArgumentException
-     *     Thrown if either slave.getName() returns NULL or the slave's name
-     *     is already registered.
-     * @throws RemoteException
-     *     RMI
-     */
-    public void announceNewSlave(final PuppeTorSlave slave)
-    throws RemoteException, IllegalArgumentException {
-        if (null != slaves.putIfAbsent(slave.getName(), slave)) {
-            throw new IllegalArgumentException(slave.getName()
-                    + " has already registered with this Server");
-        }
-    }
-
-    /**
-     * Allows the slave to poll for new work. XXX Currently, there is no logic
-     * to give back useful tasks, but if the client is known, a new 
-     * <code>CreateNetwork</code> test is submitted.-SH
-     * 
-     * @throws IllegalArgumentException
-     *     Thrown if the slave hasn't registered yet.
-     */
-    public PuppeTorTest isThereNewWork(final String slaveName)
-            throws RemoteException, IllegalArgumentException {
-        if (slaves.containsKey(slaveName)) { 
-            return new CreateNetwork();
-        } else {
-            throw new IllegalArgumentException( "The slave " + slaveName + 
-                    "has not registered yet.");
-        }
-    }
-
-//    public void repoprtResults(final String slaveName,
-//            final PuppeTorTestResult jobResult) throws RemoteException {
-        // XXX We want to let the server know that the client did some work and
-        // how it turned out to be. -SH
-//    }
-
-    /*
-     * public void unreferenced() { //XXX We would to notice when clients die.
-     * Realize that we need one object per client for this to work. I have to
-     * learn how it works ;) -SH }
-     */
-}

Copied: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/PuppeTorSlaveImpl.java (from rev 15560, puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/PuppeTorSlaveImpl.java)
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/PuppeTorSlaveImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/PuppeTorSlaveImpl.java	2008-06-29 09:42:41 UTC (rev 15562)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorSlave;
+
+/**
+ * Implements a <code>PuppeTorSlave</code>. Depending on what it is used for,
+ * different constructors are provided to specify the client's capabilities.
+ * 
+ * @author Sebastian Hahn
+ */
+
+public final class PuppeTorSlaveImpl implements PuppeTorSlave {
+
+    /**
+     * Required for serialization. Needs to change for new released versions.
+     */
+    private static final long serialVersionUID = 1L;
+    
+    /**
+     * The slave's name
+     */
+    protected final String name;
+
+    /**
+     * This constructor is useful for slaves only, and only if they don't
+     * want to provide any OS-specific or otherwise capability-telling
+     * information.
+     * @param slaveName
+     *     The slave's name
+     */
+    public PuppeTorSlaveImpl(final String slaveName) {
+        name = slaveName;
+    }
+
+    /**
+     * @return
+     *     The slave's name
+     */
+    public String getName() {
+        return name;
+    }
+
+}

Copied: puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/RemotePuppeTorImpl.java (from rev 15560, puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/RemotePuppeTorImpl.java)
===================================================================
--- puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/RemotePuppeTorImpl.java	                        (rev 0)
+++ puppetor/branches/gsoc2008/src/de/uniba/wiai/lspi/puppetor/rmi/impl/RemotePuppeTorImpl.java	2008-06-29 09:42:41 UTC (rev 15562)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2008, Sebastian Hahn
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * Neither the names of the copyright owners nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package de.uniba.wiai.lspi.puppetor.rmi.impl;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.concurrent.ConcurrentHashMap;
+
+import de.uniba.wiai.lspi.puppetor.rmi.CreateNetwork;
+import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorSlave;
+import de.uniba.wiai.lspi.puppetor.rmi.PuppeTorTest;
+import de.uniba.wiai.lspi.puppetor.rmi.RemotePuppeTor;
+
+/**
+ * Implementation for <code>RemotePuppeTor</code>. XXX Currently, this object
+ * is shared for all the connecting slaves, but this may change. If this
+ * changes, we don't need the slave's name for the method calls.-SH
+ * 
+ * @author Sebastian Hahn
+ */
+public class RemotePuppeTorImpl extends UnicastRemoteObject implements
+        RemotePuppeTor {
+
+    /**
+     * Required for serialization. Needs to change for new released versions.
+     */
+    private static final long serialVersionUID = 1L;
+    
+    /**
+     * We store all the connected <code>PuppeTorSlave</code>s here
+     */
+    private static final ConcurrentHashMap<String, PuppeTorSlave> slaves =
+            new ConcurrentHashMap<String, PuppeTorSlave>();
+
+    /**
+     * empty default constructor needed because of the 
+     * <code>RemoteException</code>
+     * @throws RemoteException
+     *     RMI
+     */
+    public RemotePuppeTorImpl() throws RemoteException { }
+
+    /**
+     * A new slave that has just connected is required to call this method
+     * once and only once to register it with the server
+     * @throws IllegalArgumentException
+     *     Thrown if either slave.getName() returns NULL or the slave's name
+     *     is already registered.
+     * @throws RemoteException
+     *     RMI
+     */
+    public void announceNewSlave(final PuppeTorSlave slave)
+    throws RemoteException, IllegalArgumentException {
+        if (null != slaves.putIfAbsent(slave.getName(), slave)) {
+            throw new IllegalArgumentException(slave.getName()
+                    + " has already registered with this Server");
+        }
+    }
+
+    /**
+     * Allows the slave to poll for new work. XXX Currently, there is no logic
+     * to give back useful tasks, but if the client is known, a new 
+     * <code>CreateNetwork</code> test is submitted.-SH
+     * 
+     * @throws IllegalArgumentException
+     *     Thrown if the slave hasn't registered yet.
+     */
+    public PuppeTorTest isThereNewWork(final String slaveName)
+            throws RemoteException, IllegalArgumentException {
+        if (slaves.containsKey(slaveName)) { 
+            return new CreateNetwork();
+        } else {
+            throw new IllegalArgumentException( "The slave " + slaveName + 
+                    "has not registered yet.");
+        }
+    }
+
+//    public void repoprtResults(final String slaveName,
+//            final PuppeTorTestResult jobResult) throws RemoteException {
+        // XXX We want to let the server know that the client did some work and
+        // how it turned out to be. -SH
+//    }
+
+    /*
+     * public void unreferenced() { //XXX We would to notice when clients die.
+     * Realize that we need one object per client for this to work. I have to
+     * learn how it works ;) -SH }
+     */
+}