You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2014/07/11 14:01:55 UTC

svn commit: r1609703 [2/3] - in /river/jtsk/skunk/qa_refactor/trunk: ./ modularize/ qa/harness/policy/ qa/src/com/sun/jini/qa/harness/ qa/src/com/sun/jini/test/impl/end2end/e2etest/ qa/src/com/sun/jini/test/impl/start/aggregatepolicyprovider/ qa/src/co...

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/TxnManagerTransaction.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/TxnManagerTransaction.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/TxnManagerTransaction.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/TxnManagerTransaction.java Fri Jul 11 12:01:53 2014
@@ -25,20 +25,18 @@ import com.sun.jini.logging.Levels;
 import com.sun.jini.mahalo.log.ClientLog;
 import com.sun.jini.mahalo.log.LogException;
 import com.sun.jini.mahalo.log.LogManager;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
-
 import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
 import java.util.Enumeration;
 
-import java.util.Date;
 import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import java.util.Vector;
 import java.util.concurrent.ExecutorService;
-import net.jini.core.lease.UnknownLeaseException;
-
+import java.util.logging.Level;
+import java.util.logging.Logger;
 import net.jini.core.transaction.CannotAbortException;
 import net.jini.core.transaction.CannotCommitException;
 import net.jini.core.transaction.CannotJoinException;
@@ -136,7 +134,7 @@ class TxnManagerTransaction
     /**
      * @serial
      */
-    private final List parts = new Vector();
+    private final List<ParticipantHandle> parts = new Vector<ParticipantHandle>();
 
     /**
      * @serial
@@ -611,7 +609,7 @@ class TxnManagerTransaction
 	//if no one has joined, at this point, attempt to
 	//get to the COMMITTED state through valid state changes
 
-        Vector joinvec = parthandles();
+        List<ParticipantHandle> joinvec = parthandles();
  
         if (joinvec == null) {
 	    if (!modifyTxnState(VOTING))
@@ -626,10 +624,8 @@ class TxnManagerTransaction
         }
 
 	try {
-	    Enumeration joined = joinvec.elements();
 	    int numparts = joinvec.size();
-	    ParticipantHandle[] phs = new ParticipantHandle[numparts];
-	    joinvec.copyInto(phs);
+	    ParticipantHandle[] phs = joinvec.toArray(new ParticipantHandle[numparts]);
 
             long now = starttime;
             long transpired = 0;
@@ -980,7 +976,7 @@ class TxnManagerTransaction
 //TODO - Change internal, lease logic to call overload w/o expiration check
 //TODO - Add expiration check to abort for external clients     
 	try {
-            Vector joinvec = parthandles();
+            List<ParticipantHandle> joinvec = parthandles();
 
 	    if (joinvec == null) {
 		if (modifyTxnState(ABORTED))
@@ -991,8 +987,7 @@ class TxnManagerTransaction
 	    }
 
             int numparts = joinvec.size();
-            ParticipantHandle[] phs = new ParticipantHandle[numparts];
-            joinvec.copyInto(phs);
+            ParticipantHandle[] phs = joinvec.toArray(new ParticipantHandle[numparts]);
 
             ClientLog log = logmgr.logFor(str.id);
 
@@ -1199,7 +1194,7 @@ class TxnManagerTransaction
     }
 
 
-private Vector parthandles() {
+private List<ParticipantHandle> parthandles() {
         if (operationsLogger.isLoggable(Level.FINER)) {
             operationsLogger.entering(TxnManagerTransaction.class.getName(), 
 	        "parthandles");
@@ -1207,7 +1202,7 @@ private Vector parthandles() {
 	if ( (parts == null ) || ( parts.size() == 0 ) )
 	    return null;
 
-        Vector vect = new Vector(parts);
+        List<ParticipantHandle> vect = new ArrayList<ParticipantHandle>(parts);
  
         if (transactionsLogger.isLoggable(Level.FINEST)) {
             transactionsLogger.log(Level.FINEST,
@@ -1263,7 +1258,7 @@ private Vector parthandles() {
     	if ( (parts == null ) || ( parts.size() == 0 ) )
 	    return;
 
-	ParticipantHandle[] handles = (ParticipantHandle[])
+	ParticipantHandle[] handles =
 	    parts.toArray(new ParticipantHandle[parts.size()]);
         for (int i=0; i < handles.length; i++) {
 	    handles[i].restoreTransientState(preparer);

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/reggie/RegistrarImpl.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/reggie/RegistrarImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/reggie/RegistrarImpl.java Fri Jul 11 12:01:53 2014
@@ -84,9 +84,7 @@ import java.util.PriorityQueue;
 import java.util.Queue;
 import java.util.Random;
 import java.util.Set;
-import java.util.SortedMap;
 import java.util.SortedSet;
-import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentSkipListSet;

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/start/ServiceStarter.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/start/ServiceStarter.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/start/ServiceStarter.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/start/ServiceStarter.java Fri Jul 11 12:01:53 2014
@@ -29,7 +29,6 @@ import net.jini.security.ProxyPreparer;
 import java.rmi.activation.ActivationException;
 import java.rmi.activation.ActivationSystem;
 import java.rmi.Naming;
-import java.rmi.RMISecurityManager;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
@@ -161,7 +160,7 @@ public class ServiceStarter {
     }
 
     /** Array of strong references to transient services */
-    private static ArrayList transient_service_refs;
+    private static ArrayList<Object> transient_service_refs;
     
     /** Prevent instantiation */
     private ServiceStarter() { }
@@ -229,10 +228,11 @@ public class ServiceStarter {
 	loginContext.login();
 	Result[] results = null;
 	    try {
-	        results = (Result[])Subject.doAsPrivileged(
+	        results = Subject.doAsPrivileged(
 	            loginContext.getSubject(),
-                    new PrivilegedExceptionAction() {
-                        public Object run()
+                    new PrivilegedExceptionAction<Result[]>() {
+                        @Override
+                        public Result[] run()
                             throws Exception
                         {
                             return create(descs, config);
@@ -274,7 +274,7 @@ public class ServiceStarter {
     {
         logger.entering(ServiceStarter.class.getName(), "create", 
 	    new Object[] {descs, config});
-	ArrayList proxies = new ArrayList();
+	ArrayList<Result> proxies = new ArrayList<Result>();
 
 	Object result = null;
 	Exception problem = null;
@@ -295,7 +295,7 @@ public class ServiceStarter {
 	}
 	    
         logger.exiting(ServiceStarter.class.getName(), "create", proxies);
-        return (Result[])proxies.toArray(new Result[proxies.size()]);
+        return proxies.toArray(new Result[proxies.size()]);
     }
     
     /**
@@ -379,7 +379,7 @@ public class ServiceStarter {
            "maintainNonActivatableReferences", (Object[])results);
         if (results.length == 0) 
 	    return;
-        transient_service_refs = new ArrayList();
+        transient_service_refs = new ArrayList<Object>();
         for (int i=0; i < results.length; i++) {
 	    if (results[i] != null &&
 	        results[i].result != null &&

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/PreferredListGen.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/PreferredListGen.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/PreferredListGen.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/PreferredListGen.java Fri Jul 11 12:01:53 2014
@@ -54,7 +54,6 @@ import java.util.jar.Manifest;
 
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import org.apache.river.api.net.RFC3986URLClassLoader;
 
 /**
  * Tool used to generate the preferred class information for downloadable JAR
@@ -1152,7 +1151,7 @@ public class PreferredListGen {
 	    if (cl != null) {
 		cl = cl.getParent(); // the extension classloader
 	    }
-	    loader = new RFC3986URLClassLoader(urls, cl);
+	    loader = new URLClassLoader(urls, cl);
 	}
 	loadJars();
 	Collection roots = getRoots();

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckActivationSystem.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckActivationSystem.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckActivationSystem.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckActivationSystem.java Fri Jul 11 12:01:53 2014
@@ -18,21 +18,12 @@
 package com.sun.jini.tool.envcheck.plugins;
 
 import com.sun.jini.tool.envcheck.AbstractPlugin;
-import com.sun.jini.tool.envcheck.Plugin;
 import com.sun.jini.tool.envcheck.EnvCheck;
 import com.sun.jini.tool.envcheck.Reporter;
 import com.sun.jini.tool.envcheck.Reporter.Message;
 import com.sun.jini.tool.envcheck.SubVMTask;
-import com.sun.jini.tool.envcheck.Util;
-import java.net.InetAddress;
 import java.rmi.activation.ActivationGroup;
-import java.rmi.activation.ActivationException;
-import java.rmi.RMISecurityManager;
 import java.security.AccessControlException;
-import net.jini.config.ConfigurationException;
-import net.jini.config.NoSuchEntryException;
-import com.sun.jini.start.ServiceDescriptor;
-import com.sun.jini.start.SharedActivatableServiceDescriptor;
 
 /**
  * Plugin which checks the liveness of the activation system. The

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPersistence.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPersistence.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPersistence.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPersistence.java Fri Jul 11 12:01:53 2014
@@ -17,39 +17,25 @@
  */
 package com.sun.jini.tool.envcheck.plugins;
 
-import com.sun.jini.start.NonActivatableServiceDescriptor;
+import com.sun.jini.start.ServiceDescriptor;
 import com.sun.jini.start.SharedActivatableServiceDescriptor;
 import com.sun.jini.start.SharedActivationGroupDescriptor;
-import com.sun.jini.start.ServiceDescriptor;
-
 import com.sun.jini.tool.envcheck.AbstractPlugin;
 import com.sun.jini.tool.envcheck.EnvCheck;
-import com.sun.jini.tool.envcheck.Plugin;
 import com.sun.jini.tool.envcheck.Reporter;
 import com.sun.jini.tool.envcheck.Reporter.Message;
 import com.sun.jini.tool.envcheck.SubVMTask;
 import com.sun.jini.tool.envcheck.Util;
-
 import java.io.File;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.rmi.activation.ActivationException;
-import java.rmi.activation.ActivationGroup;
-import java.rmi.RMISecurityManager;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Iterator;
-import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.Set;
-
 import net.jini.config.Configuration;
 import net.jini.config.ConfigurationException;
 import net.jini.config.ConfigurationFile;
 import net.jini.config.ConfigurationProvider;
-import net.jini.config.NoSuchEntryException;
+import org.apache.river.api.security.CombinerSecurityManager;
 
 /**
  * Check that the persistence directory supplied by any
@@ -177,7 +163,7 @@ public class CheckPersistence extends Ab
 	    Util.getResourceBundle(CheckPersistence.class);
 
 	public Object run(String[] args) {
-	    System.setSecurityManager(new RMISecurityManager());
+	    System.setSecurityManager(new CombinerSecurityManager());
 	    String dir = args[0];
 	    File dirFile = new File(dir);
 	    if (!dirFile.exists()) {
@@ -230,19 +216,18 @@ public class CheckPersistence extends Ab
 	 */
 	private Object getEntries(Configuration conf) {
 	    ConfigurationFile cf = (ConfigurationFile) conf;
-	    ArrayList list = new ArrayList();
-	    Set names = cf.getEntryNames();
-	    Iterator it = names.iterator();
+	    ArrayList<String> list = new ArrayList<String>();
+	    Set<String> names = cf.getEntryNames();
+	    Iterator<String> it = names.iterator();
 	    String s = "";
 	    while (it.hasNext()) {
-		String name = (String) it.next();
+		String name = it.next();
 		s += name + "\n";
 		int lastDot = name.lastIndexOf(".persistenceDirectory");
 		if (lastDot > 0) {
 		    String component = name.substring(0, lastDot);
 		    try {
-			String dir =
-			    (String) conf.getEntry(component, 
+			String dir = conf.getEntry(component, 
 						   "persistenceDirectory",
 						   String.class,
 						   null);

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPolicy.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPolicy.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPolicy.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/CheckPolicy.java Fri Jul 11 12:01:53 2014
@@ -18,27 +18,19 @@
 package com.sun.jini.tool.envcheck.plugins;
 
 import com.sun.jini.tool.envcheck.AbstractPlugin;
-import com.sun.jini.tool.envcheck.Plugin;
 import com.sun.jini.tool.envcheck.EnvCheck;
 import com.sun.jini.tool.envcheck.Reporter;
 import com.sun.jini.tool.envcheck.Reporter.Message;
 import com.sun.jini.tool.envcheck.SubVMTask;
 import com.sun.jini.tool.envcheck.Util;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.io.PrintStream;
 import java.net.URL;
-import java.net.MalformedURLException;
-import java.rmi.RMISecurityManager;
 import java.security.AllPermission;
 import java.security.CodeSource;
 import java.security.Policy;
 import java.security.PermissionCollection;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.Enumeration;
 import com.sun.jini.start.ServiceDescriptor;
-import com.sun.jini.start.SharedActivatableServiceDescriptor;
 import com.sun.jini.start.SharedActivationGroupDescriptor;
 import com.sun.jini.start.NonActivatableServiceDescriptor;
 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/FileAccessCheckTask.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/FileAccessCheckTask.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/FileAccessCheckTask.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/tool/envcheck/plugins/FileAccessCheckTask.java Fri Jul 11 12:01:53 2014
@@ -19,8 +19,7 @@ package com.sun.jini.tool.envcheck.plugi
 
 import com.sun.jini.tool.envcheck.SubVMTask;
 import com.sun.jini.tool.envcheck.Util;
-
-import java.rmi.RMISecurityManager;
+import org.apache.river.api.security.CombinerSecurityManager;
 
 /**
  * A subtask which checks for the accessibility of a file identified
@@ -41,7 +40,7 @@ public class FileAccessCheckTask impleme
      * @return the result of the check
      */
     public Object run(String[] args) {
-	System.setSecurityManager(new RMISecurityManager());
+	System.setSecurityManager(new CombinerSecurityManager());
 	return Util.checkSystemPropertyFile(args[0], args[1]);
     }
 }	

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/AbstractConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/AbstractConfiguration.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/AbstractConfiguration.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/AbstractConfiguration.java Fri Jul 11 12:01:53 2014
@@ -93,13 +93,13 @@ public abstract class AbstractConfigurat
      *
      * @since 2.0
      */
-    public static final class Primitive {
+    public static final class Primitive<T> {
 
 	/** The value, as a wrapper instance. */
-	private final Object value;
+	private final T value;
 
 	/** The primitive type. */
-	private final Class type;
+	private final Class<T> type;
 
 	/**
 	 * Creates an object that represents a primitive value of the type
@@ -109,7 +109,7 @@ public abstract class AbstractConfigurat
 	 * @throws IllegalArgumentException if <code>value</code> is not an
 	 * instance of a primitive wrapper class
 	 */
-	public Primitive(Object value) {
+	public Primitive(T value) {
 	    this.value = value;
 	    type = (value != null)
 		? Utilities.getPrimitiveType(value.getClass()) : null;
@@ -125,7 +125,7 @@ public abstract class AbstractConfigurat
 	 *
 	 * @return the value of this object, as a primitive wrapper instance
 	 */
-	public Object getValue() {
+	public T getValue() {
 	    return value;
 	}
 
@@ -134,11 +134,12 @@ public abstract class AbstractConfigurat
 	 *
 	 * @return the primitive type of the value associated with this object
 	 */
-	public Class getType() {
+	public Class<T> getType() {
 	    return type;
 	}
 
 	/** Returns a string representation of this object. */
+        @Override
 	public String toString() {
 	    return "Primitive[(" + type + ") " + value + "]";
 	}
@@ -149,12 +150,14 @@ public abstract class AbstractConfigurat
 	 * <code>getValue</code> is the same as the value for this instance,
 	 * otherwise <code>false</code>.
 	 */
+        @Override
 	public boolean equals(Object obj) {
 	    return obj instanceof Primitive &&
 		value.equals(((Primitive) obj).value);
 	}
 
 	/** Returns a hash code value for this object. */
+        @Override
 	public int hashCode() {
 	    return value.hashCode();
 	}
@@ -187,7 +190,8 @@ public abstract class AbstractConfigurat
      * @throws IllegalArgumentException {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
      */
-    public Object getEntry(String component, String name, Class type)
+    @Override
+    public <T> T getEntry(String component, String name, Class<T> type)
 	throws ConfigurationException
     {
 	return getEntryInternal(component, name, type, NO_DEFAULT, NO_DATA);
@@ -219,9 +223,10 @@ public abstract class AbstractConfigurat
      * @throws IllegalArgumentException {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
      */
-    public Object getEntry(String component,
+    @Override
+    public <T> T getEntry(String component,
 			   String name,
-			   Class type,
+			   Class<T> type,
 			   Object defaultValue)
 	throws ConfigurationException
     {
@@ -254,9 +259,10 @@ public abstract class AbstractConfigurat
      * @throws IllegalArgumentException {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
      */
-    public Object getEntry(String component,
+    @Override
+    public <T> T getEntry(String component,
 			   String name,
-			   Class type,
+			   Class<T> type,
 			   Object defaultValue,
 			   Object data)
 	throws ConfigurationException
@@ -279,6 +285,7 @@ public abstract class AbstractConfigurat
      * made to this method by those methods will have arguments that are not
      * <code>null</code> and that have the correct syntax.
      *
+     * @param <T>
      * @param component the component being configured
      * @param name the name of the entry for the component
      * @param type the type of object requested
@@ -294,9 +301,9 @@ public abstract class AbstractConfigurat
      * <code>name</code>, or <code>type</code> is <code>null</code>
      * @see Configuration#getEntry(String,String,Class) Configuration.getEntry
      */
-    protected abstract Object getEntryInternal(String component,
+    protected abstract <T> Object getEntryInternal(String component,
 					       String name,
-					       Class type,
+					       Class<T> type,
 					       Object data)
 	throws ConfigurationException;
 
@@ -305,9 +312,9 @@ public abstract class AbstractConfigurat
      * which checks for null or illegal arguments, and logs and wraps
      * exceptions.
      */
-    private Object getEntryInternal(String component,
+    private <T> T getEntryInternal(String component,
 				    String name,
-				    Class type,
+				    Class<T> type,
 				    Object defaultValue,
 				    Object data)
 	throws ConfigurationException
@@ -338,12 +345,12 @@ public abstract class AbstractConfigurat
 	ConfigurationException configEx;
 	try {
 	    Object result = getEntryInternal(component, name, type, data);
-	    Class resultType;
+	    Class<T> resultType;
 	    if (result instanceof Primitive) {
-		resultType = ((Primitive) result).getType();
-		result = ((Primitive) result).getValue();
+		resultType = ((Primitive<T>) result).getType();
+		result = ((Primitive<T>) result).getValue();
 	    } else if (result != null) {
-		resultType = result.getClass();
+		resultType = (Class<T>) result.getClass();
 	    } else {
 		resultType = null;
 	    }
@@ -365,7 +372,7 @@ public abstract class AbstractConfigurat
 			       new Double(data == NO_DATA ? 0 : 1), data, result
 			   });
 	    }
-	    return result;
+	    return (T) result;
 	} catch (NoSuchEntryException e) {
 	    if (defaultValue == NO_DEFAULT) {
 		if (logger.isLoggable(Levels.FAILED)) {
@@ -381,7 +388,24 @@ public abstract class AbstractConfigurat
 			"{0}, component {1}, name {2}: returns default {3}",
 			new Object[] { this, component, name, defaultValue });
 		}
-		return defaultValue;
+                if (type.isInstance(defaultValue)) {
+                    return (T) defaultValue;
+                } else if (defaultValue == null){
+                    return null;
+                } else if (type.isPrimitive()){
+                    if (type == boolean.class && defaultValue instanceof Boolean||
+                        type == byte.class && defaultValue instanceof Byte||
+                        type == char.class && defaultValue instanceof Character||
+                        type == short.class && defaultValue instanceof Short||
+                        type == int.class && defaultValue instanceof Integer||
+                        type == long.class && defaultValue instanceof Long||
+                        type == float.class && defaultValue instanceof Float||
+                        type == double.class && defaultValue instanceof Double) 
+                        return ((T)defaultValue) ;
+                }
+                throw new ClassCastException("default value not instance of " 
+                        + type.toString() + " found " 
+                        + defaultValue.getClass() + " instead");
 	    }
 	} catch (ConfigurationException e) {
 	    configEx = e;

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/ConfigurationFile.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/ConfigurationFile.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/ConfigurationFile.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/ConfigurationFile.java Fri Jul 11 12:01:53 2014
@@ -417,8 +417,8 @@ public class ConfigurationFile extends A
      * there would be more kinds of security holes if ConfigurationFile
      * permitted calls to instance methods.  -tjb[5.Aug.2002]
      */
-    private static final Set prohibitedMethods =
-	new HashSet(Arrays.asList(new String[] {
+    private static final Set<String> prohibitedMethods =
+	new HashSet<String>(Arrays.asList(new String[] {
 	    "java.lang.Class.forName",
 	    "java.lang.ClassLoader.getSystemClassLoader",
 	    "java.lang.Package.getPackage",
@@ -481,8 +481,8 @@ public class ConfigurationFile extends A
 
     /** Returns the current context class loader. */
     private static final PrivilegedAction contextClassLoader =
-	new PrivilegedAction() {
-	    public Object run() {
+	new PrivilegedAction<ClassLoader>() {
+	    public ClassLoader run() {
 		return Thread.currentThread().getContextClassLoader();
 	    }
 	};
@@ -492,13 +492,13 @@ public class ConfigurationFile extends A
 	new RuntimePermission("getClassLoader");
 
     /** Map from entry names to Entry instances. */
-    final Map entries = new HashMap(11);
+    final Map<String,Entry> entries = new HashMap<String,Entry>(11);
 
     /**
      * Map of simple class names to the full class names that were explicitly
      * imported.
      */
-    final Map classImports = new HashMap(1);
+    final Map<String,String> classImports = new HashMap<String,String>(1);
 
     /**
      * List of packages or classes whose member classes should be imported on
@@ -608,7 +608,7 @@ public class ConfigurationFile extends A
 	 * Calculates and returns the declared type of the parse node, as
 	 * referred to by the specified entry.
 	 */
-	abstract Class resolve(Entry inEntry) throws ConfigurationException;
+	abstract <T> Class<T> resolve(Entry inEntry) throws ConfigurationException;
 
 	/** Returns true if the value is a constant. */
 	abstract boolean isConstant() throws ConfigurationException;
@@ -690,7 +690,8 @@ public class ConfigurationFile extends A
 	    refersToData = true;
 	}
 
-	Class resolve(Entry inEntry) throws ConfigurationException {
+        @Override
+	<T> Class<T> resolve(Entry inEntry) throws ConfigurationException {
 	    /*
 	     * Grab a single lock when resolving any entry.  Until we know that
 	     * the entry contains no textually circular references, which is
@@ -944,7 +945,8 @@ public class ConfigurationFile extends A
 	    this.arg = arg;
 	}
 
-	Class resolve(Entry inEntry) throws ConfigurationException {
+        @Override
+	<T> Class<T> resolve(Entry inEntry) throws ConfigurationException {
 	    type = findClass(typeName, lineno, override);
 	    if (isArray) {
 		type = Array.newInstance(type, 0).getClass();
@@ -987,10 +989,12 @@ public class ConfigurationFile extends A
 	    return null;	/* Not reached */
 	}
 
+        @Override
 	boolean isConstant() throws ConfigurationException {
 	    return arg.isConstant();
 	}
 
+        @Override
 	Object eval(Object data) throws ConfigurationException {
 	    Object val = arg.eval(data);
 	    if (type.isPrimitive()) {
@@ -1018,6 +1022,7 @@ public class ConfigurationFile extends A
 	    this.args = args;
 	}
 
+        @Override
 	boolean isConstant() {
 	    return false;
 	}
@@ -1047,6 +1052,7 @@ public class ConfigurationFile extends A
             super(args,lineno);
         }
         
+        @Override
         Class resolve(Entry inEntry) throws ConfigurationException {
             Class[] types = resolveArgs(inEntry);
             if (!(types[0] == String.class || types[1] == String.class)) {
@@ -1060,12 +1066,14 @@ public class ConfigurationFile extends A
             return String.class;
         }
         
+        @Override
         boolean isConstant() {
             return false;
         }
         
+        @Override
         Object eval(Object data) throws ConfigurationException {
-            StringBuffer value = new StringBuffer();
+            StringBuilder value = new StringBuilder();
             Object[] evaledArgs = evalArgs(data);
             for (int i = 0; i < evaledArgs.length; i++) {
                 Object o1 = evaledArgs[i];
@@ -1088,12 +1096,14 @@ public class ConfigurationFile extends A
 	    this.typeName = typeName;
 	}
 
+        @Override
 	Class resolve(Entry inEntry) throws ConfigurationException {
 	    constructor = findConstructor(
 		typeName, resolveArgs(inEntry), lineno, override);
 	    return constructor.getDeclaringClass();
 	}
 
+        @Override
 	Object eval(Object data) throws ConfigurationException {
 	    Object[] evaluatedArgs = evalArgs(data);
 	    Throwable except;
@@ -1125,6 +1135,7 @@ public class ConfigurationFile extends A
 	    this.fullName = fullName;
 	}
 
+        @Override
 	Class resolve(Entry inEntry) throws ConfigurationException {
 	    method = findMethod(
 		fullName, resolveArgs(inEntry), lineno, override);
@@ -1135,6 +1146,7 @@ public class ConfigurationFile extends A
 	    return c;
 	}
 
+        @Override
 	Object eval(Object data) throws ConfigurationException {
 	    Object[] evaluatedArgs = evalArgs(data);
 	    Throwable except;
@@ -1167,6 +1179,7 @@ public class ConfigurationFile extends A
 	    this.typeName = typeName;
 	}
 
+        @Override
 	Class resolve(Entry inEntry) throws ConfigurationException {
 	    type = findClass(typeName, lineno, override);
 	    Class[] types = resolveArgs(inEntry);
@@ -1190,6 +1203,7 @@ public class ConfigurationFile extends A
 	    return Array.newInstance(type, 0).getClass();
 	}
 
+        @Override
 	Object eval(Object data) throws ConfigurationException {
 	    Object[] contents = evalArgs(data);
 	    Object result = Array.newInstance(type, args.length);
@@ -2020,12 +2034,14 @@ public class ConfigurationFile extends A
      * return the identical object.<p>
      *   
      *
+     * @return T or Primitive
      * @throws NoSuchEntryException {@inheritDoc}
      * @throws NullPointerException {@inheritDoc}
      */
-    protected Object getEntryInternal(String component,
+    @Override
+    protected <T> Object getEntryInternal(String component,
 				      String name,
-				      Class type,
+				      Class<T> type,
 				      Object data)
 	throws ConfigurationException
     {
@@ -2045,9 +2061,9 @@ public class ConfigurationFile extends A
 		entry.isConstant())
 	    {
 		/* Handle primitive narrowing conversion */
-		Object narrow = narrowingAssignable(entry.eval(NO_DATA), type);
+		T narrow = narrowingAssignable(entry.eval(NO_DATA), type);
 		if (narrow != null) {
-		    return new Primitive(narrow);
+		    return new Primitive<T>(narrow);
 		}
 	    }
             oops("entry of wrong type for component " + component +
@@ -2061,7 +2077,7 @@ public class ConfigurationFile extends A
 	    if (entryType != type) {
 		result = convertPrimitive(result, type);
 	    }
-	    return new Primitive(result);
+	    return new Primitive<T>((T) result);
 	} else {
 	    return result;
 	}
@@ -2074,10 +2090,10 @@ public class ConfigurationFile extends A
      * @return a set containing the fully qualified names of all non-private
      * entries defined for this instance
      */
-    public Set getEntryNames() {
-	Set result = new HashSet(entries.size());
-	for (Iterator iter = entries.values().iterator(); iter.hasNext(); ) {
-	    Entry entry = (Entry) iter.next();
+    public Set<String> getEntryNames() {
+	Set<String> result = new HashSet<String>(entries.size());
+	for (Iterator<Entry> iter = entries.values().iterator(); iter.hasNext(); ) {
+	    Entry entry = iter.next();
 	    if (!entry.isPrivate) {
 		result.add(entry.fullName);
 	    }
@@ -2104,7 +2120,7 @@ public class ConfigurationFile extends A
      * <i>Identifier</i>
      * @throws NullPointerException if either argument is <code>null</code>
      */
-    public Class getEntryType(String component, String name)
+    public <T> Class<T> getEntryType(String component, String name)
 	throws ConfigurationException
     {
 	if (component == null) {
@@ -2118,7 +2134,7 @@ public class ConfigurationFile extends A
 	    throw new IllegalArgumentException(
 		"name must be a valid identifier");
 	}
-	Entry entry = (Entry) entries.get(component + '.' + name);
+	Entry entry = entries.get(component + '.' + name);
 	if (entry == null || entry.isPrivate) {
 	    if (logger.isLoggable(Levels.FAILED)) {
 		logger.log(
@@ -2131,7 +2147,7 @@ public class ConfigurationFile extends A
 	}
 	ConfigurationException configEx;
 	try {
-	    Class result = entry.resolve(null);
+	    Class<T> result = entry.resolve(null);
 	    if (logger.isLoggable(Level.FINER)) {
 		logger.log(Level.FINER,
 			   "{0}, component {1}, name {2}: returns {3}",
@@ -2589,7 +2605,7 @@ public class ConfigurationFile extends A
      * wrapper object in "from" can be assigned to parameters of type "to"
      * using a narrowing primitive conversion, else null.
      */
-    Object narrowingAssignable(Object from, Class to) {
+    <T> T narrowingAssignable(Object from, Class<T> to) {
 	if (from instanceof Byte ||
 	    from instanceof Character ||
 	    from instanceof Short ||
@@ -2599,17 +2615,17 @@ public class ConfigurationFile extends A
 		((Character) from).charValue() : ((Number) from).intValue();
 	    if (to == Byte.TYPE) {
 		if (val >= Byte.MIN_VALUE && val <= Byte.MAX_VALUE) {
-		    return Byte.valueOf((byte) val);
+		    return (T) Byte.valueOf((byte) val);
 		}
 	    } else if (to == Character.TYPE) {
 		if (val >= Character.MIN_VALUE &&
 		    val <= Character.MAX_VALUE)
 		{
-		    return Character.valueOf((char) val);
+		    return (T) Character.valueOf((char) val);
 		}
 	    } else if (to == Short.TYPE) {
 		if (val >= Short.MIN_VALUE && val <= Short.MAX_VALUE) {
-		    return Short.valueOf((short) val);
+		    return (T) Short.valueOf((short) val);
 		}
 	    }
 	}

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/EmptyConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/EmptyConfiguration.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/EmptyConfiguration.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/config/EmptyConfiguration.java Fri Jul 11 12:01:53 2014
@@ -67,8 +67,9 @@ public class EmptyConfiguration extends 
      * @throws NoSuchEntryException unless <code>component</code>,
      * <code>name</code>, or <code>type</code> is <code>null</code>
      */
-    protected Object getEntryInternal(
-	String component, String name, Class type, Object data)
+    @Override
+    protected <T> T getEntryInternal(
+	String component, String name, Class<T> type, Object data)
 	throws NoSuchEntryException
     {
 	if (component == null || name == null || type == null) {

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/ConstraintAlternatives.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/ConstraintAlternatives.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/ConstraintAlternatives.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/ConstraintAlternatives.java Fri Jul 11 12:01:53 2014
@@ -104,9 +104,9 @@ public final class ConstraintAlternative
      * instances of <code>InvocationConstraint</code>, or if fewer than two
      * elements remain after duplicate constraints are removed
      */
-    public ConstraintAlternatives(Collection c) {
+    public ConstraintAlternatives(Collection<InvocationConstraint> c) {
 	try {
-	    constraints = reduce((InvocationConstraint[]) c.toArray(
+	    constraints = reduce( c.toArray(
 					  new InvocationConstraint[c.size()]));
 	} catch (ArrayStoreException e) {
 	    throw new IllegalArgumentException(
@@ -157,11 +157,9 @@ public final class ConstraintAlternative
      * or if the elements are not all instances of
      * <code>InvocationConstraint</code>
      */
-    public static InvocationConstraint create(Collection c) {
+    public static InvocationConstraint create(Collection<InvocationConstraint> c) {
 	try {
-	    return reduce((InvocationConstraint[]) c.toArray(
-					  new InvocationConstraint[c.size()]),
-			  false);
+	    return reduce( c.toArray( new InvocationConstraint[c.size()]), false);
 	} catch (ArrayStoreException e) {
 	    throw new IllegalArgumentException(
 		       "element of collection is not an InvocationConstraint");

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/InvocationConstraints.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/InvocationConstraints.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/InvocationConstraints.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/constraint/InvocationConstraints.java Fri Jul 11 12:01:53 2014
@@ -157,16 +157,13 @@ public final class InvocationConstraints
      * @throws IllegalArgumentException if any element of an argument is not
      * an instance of <code>InvocationConstraint</code>
      */
-    public InvocationConstraints(Collection reqs, Collection prefs) {
+    public InvocationConstraints(Collection<InvocationConstraint> reqs, Collection<InvocationConstraint> prefs) {
 	try {
 	    if (reqs != null) {
-		this.reqs =
-		    (InvocationConstraint[]) reqs.toArray(
-				       new InvocationConstraint[reqs.size()]);
+		this.reqs = reqs.toArray(new InvocationConstraint[reqs.size()]);
 	    }
 	    if (prefs != null) {
-		this.prefs =
-		    (InvocationConstraint[]) prefs.toArray(
+		this.prefs = prefs.toArray(
 				       new InvocationConstraint[prefs.size()]);
 	    }
 	} catch (ArrayStoreException e) {

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/discovery/LookupLocator.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/discovery/LookupLocator.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/discovery/LookupLocator.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/core/discovery/LookupLocator.java Fri Jul 11 12:01:53 2014
@@ -17,29 +17,31 @@
  */
 package net.jini.core.discovery;
 
-import com.sun.jini.jeri.internal.runtime.Util;
-import java.io.DataOutputStream;
+import com.sun.jini.discovery.Discovery;
+import com.sun.jini.discovery.DiscoveryConstraints;
+import com.sun.jini.discovery.UnicastResponse;
+import com.sun.jini.discovery.UnicastSocketTimeout;
+import com.sun.jini.discovery.internal.MultiIPDiscovery;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
-import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.Socket;
-import java.net.SocketException;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.UnknownHostException;
-import java.rmi.MarshalledObject;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import net.jini.core.constraint.InvocationConstraints;
 import net.jini.core.lookup.ServiceRegistrar;
 import net.jini.discovery.ConstrainableLookupLocator;
-import net.jini.io.MarshalledInstance;
 import org.apache.river.api.net.Uri;
 
 /**
- * LookupLocator supports unicast discovery, using only version 1 of the
- * unicast discovery protocol, which is deprecated.  
+ * LookupLocator supports unicast discovery, using either Discovery V1 or V2.
+ * 
+ * Version 1 of the unicast discovery protocol is deprecated.  
  * <p>
  * It's main purpose now is to contain a host name and port number, it is now
  * immutable, since River 2.2.1, this may break overriding classes.
@@ -85,8 +87,9 @@ public class LookupLocator implements Se
      * the lookup service.
      */
     static final int defaultTimeout =
-	((Integer)AccessController.doPrivileged(new PrivilegedAction() {
-	    public Object run() {
+	AccessController.doPrivileged(new PrivilegedAction<Integer>() {
+            @Override
+	    public Integer run() {
 		Integer timeout = Integer.valueOf(60 * 1000);
 		try {
 		    Integer val = Integer.getInteger(
@@ -97,7 +100,7 @@ public class LookupLocator implements Se
 		    return timeout;
 		}
 	    }
-	})).intValue();
+	}).intValue();
 
     /**
      * Construct a new <code>LookupLocator</code> object, set up to perform
@@ -165,10 +168,12 @@ public class LookupLocator implements Se
      * @throws NullPointerException if <code>host</code> is <code>null</code>
      */
     public LookupLocator(String host, int port) {
-        if (host == null) throw new NullPointerException("null host");
-	StringBuilder sb = new StringBuilder();
+        if (host == null) {
+            throw new NullPointerException("null host");
+        }
+        StringBuilder sb = new StringBuilder();
         sb.append("jini://").append(host);
-        if ( port != -1 ) { //URI compliance -1 is converted to discoveryPort.
+        if (port != -1) { //URI compliance -1 is converted to discoveryPort.
             sb.append(":").append(port);
         }
         try {
@@ -179,56 +184,61 @@ public class LookupLocator implements Se
             throw new IllegalArgumentException("host cannot be parsed", ex);
         }
     }
-    
-    private URI parseURI(String url) throws MalformedURLException{
+
+    private URI parseURI(String url) throws MalformedURLException {
         if (url == null) {
-	    throw new NullPointerException("url is null");
-	}
-	URI uri = null;
-	try {
+            throw new NullPointerException("url is null");
+        }
+        URI uri = null;
+        try {
             uri = Uri.uriToURI(Uri.parseAndCreate(url));
-//            url = UriString.escapeIllegalCharacters(url);
-//	    uri = new URI(url);
-//            uri = UriString.normalise(uri);
-	} catch (URISyntaxException e) {
-	    MalformedURLException mue =
-		new MalformedURLException("URI parsing failure: " + url);
-	    mue.initCause(e);
-	    throw mue;
-	}
+        } catch (URISyntaxException e) {
+            MalformedURLException mue
+                    = new MalformedURLException("URI parsing failure: " + url);
+            mue.initCause(e);
+            throw mue;
+        }
 	if (!uri.isAbsolute()) throw new MalformedURLException("no scheme specified: " + url);
 	if (uri.isOpaque()) throw new MalformedURLException("not a hierarchical url: " + url);
 	if (!uri.getScheme().toLowerCase().equals("jini")) throw new MalformedURLException("Invalid URL scheme: " + url);
-	
-	String uriPath = uri.getPath();
-	if ((uriPath.length() != 0) && (!uriPath.equals("/"))) {
-	    throw new MalformedURLException(
-		"URL path contains path segments: " + url);
-	}
+
+        String uriPath = uri.getPath();
+        if ((uriPath.length() != 0) && (!uriPath.equals("/"))) {
+            throw new MalformedURLException(
+                    "URL path contains path segments: " + url);
+        }
 	if (uri.getQuery() != null) throw new MalformedURLException("invalid character, '?', in URL: " + url);
 	if (uri.getFragment() != null) throw new MalformedURLException("invalid character, '#', in URL: " + url);
         if (uri.getUserInfo() != null) throw new MalformedURLException("invalid character, '@', in URL host: " + url);
         if ((uri.getHost()) == null) {
             // authority component does not exist - not a hierarchical URL
             throw new MalformedURLException(
-                "Not a hierarchical URL: " + url);
+                    "Not a hierarchical URL: " + url);
         }
         int port = uri.getPort();
         if (port == -1) {
             port = discoveryPort;
             try {
-                uri = new URI(uri.getScheme(), uri.getRawUserInfo(), uri.getHost(), port, uri.getRawPath(), uri.getRawQuery(), uri.getRawFragment());
+                uri = new URI(
+                        uri.getScheme(),
+                        uri.getRawUserInfo(),
+                        uri.getHost(), 
+                        port, 
+                        uri.getRawPath(),
+                        uri.getRawQuery(),
+                        uri.getRawFragment()
+                );
             } catch (URISyntaxException e) {
-                MalformedURLException mue =
-		new MalformedURLException("recreation of URI with discovery port failed");
+                MalformedURLException mue
+                        = new MalformedURLException("recreation of URI with discovery port failed");
                 mue.initCause(e);
                 throw mue;
             }
         }
-	
-	if ((uri.getPort() <= 0) || (uri.getPort() >= 65536)) {
-	    throw new MalformedURLException("port number out of range: " + url);
-	}
+
+        if ((uri.getPort() <= 0) || (uri.getPort() >= 65536)) {
+            throw new MalformedURLException("port number out of range: " + url);
+        }
         return uri;
     }
 
@@ -302,79 +312,25 @@ public class LookupLocator implements Se
     public ServiceRegistrar getRegistrar(int timeout)
 	throws IOException, ClassNotFoundException
     {
-	InetAddress[] addrs = null;
-	try {
-	    addrs = InetAddress.getAllByName(host);
-	} catch (UnknownHostException uhe) {
-	    // Cannot resolve the host name, maybe the socket implementation
-	    // can do it for us.
-	    Socket sock = new Socket(host, port);
-	    return getRegistrarFromSocket(sock, timeout);
-	}
-	IOException ioEx = null;
-	SecurityException secEx = null;
-	ClassNotFoundException cnfEx = null;
-	for (int i = 0; i < addrs.length; i++) {
-	    try {
-                Socket sock = new Socket(addrs[i], port);
-		return getRegistrarFromSocket(sock, timeout);
-	    } catch (ClassNotFoundException ex) {
-		cnfEx = ex;
-	    } catch (IOException ex) {
-		ioEx = ex;
-	    } catch (SecurityException ex) {
-		secEx = ex;
-	    }
-	}
-	// All our attempts failed. Throw ClassNotFoundException, IOException,
-	// SecurityException in that order of preference.
-	if (cnfEx != null) {
-	    throw cnfEx;
-	}
-	if (ioEx != null) {
-	    throw ioEx;
-	}
-	assert (secEx != null);
-	throw secEx;
-    }
-
-    // Convenience method to do unicast discovery on a socket
-    private static ServiceRegistrar getRegistrarFromSocket(Socket sock,
-							   int timeout)
-	throws IOException, ClassNotFoundException
-    {
-	try {
-	    sock.setSoTimeout(timeout);
-	    try {
-		sock.setTcpNoDelay(true);
-	    } catch (SocketException e) {
-		// ignore possible failures and proceed anyway
-	    }
-	    try {
-		sock.setKeepAlive(true);
-	    } catch (SocketException e) {
-		// ignore possible failures and proceed anyway
-	    }
-	    DataOutputStream dstr =
-		new DataOutputStream(sock.getOutputStream());
-	    dstr.writeInt(protoVersion);
-	    dstr.flush();
-	    ObjectInputStream istr =
-		new ObjectInputStream(sock.getInputStream());
-	    ServiceRegistrar registrar =
-		(ServiceRegistrar) new MarshalledInstance(
-                        (MarshalledObject)istr.readObject()).get(false);
-	    for (int grpCount = istr.readInt(); --grpCount >= 0; ) {
-		istr.readUTF(); // ensure proper format, then discard
-	    }
-	    return registrar;
-	} finally {
-	    try {
-		sock.close();
-	    } catch (IOException e) {
-		// ignore
-	    }
-	}
+	InvocationConstraints ic = InvocationConstraints.EMPTY;
+	Collection reqs = new ArrayList(ic.requirements());
+	reqs.add(new UnicastSocketTimeout(timeout));
+	return getRegistrar(new InvocationConstraints(reqs, ic.preferences()));
+    }
+
+    private ServiceRegistrar getRegistrar(InvocationConstraints constraints)
+            throws IOException, ClassNotFoundException {
+        UnicastResponse resp = new MultiIPDiscovery() {
+            @Override
+            protected UnicastResponse performDiscovery(Discovery disco,
+                    DiscoveryConstraints dc,
+                    Socket s)
+                    throws IOException, ClassNotFoundException {
+                return disco.doUnicastDiscovery(
+                        s, dc.getUnfulfilledConstraints(), null, null, null);
+            }
+        }.getResponse(host, port, constraints);
+        return resp.getRegistrar();
     }
     
     /**

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/discovery/ConstrainableLookupLocator.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/discovery/ConstrainableLookupLocator.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/discovery/ConstrainableLookupLocator.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/discovery/ConstrainableLookupLocator.java Fri Jul 11 12:01:53 2014
@@ -228,6 +228,7 @@ public final class ConstrainableLookupLo
      * discovery-related constraints contain conflicts, or otherwise cannot be
      * processed
      */
+    @Override
     public ServiceRegistrar getRegistrar(int timeout)
 	throws IOException, ClassNotFoundException
     {

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalInputStream.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalInputStream.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalInputStream.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalInputStream.java Fri Jul 11 12:01:53 2014
@@ -31,7 +31,7 @@ import java.util.HashMap;
 import java.util.Map;
 import net.jini.loader.ClassLoading;
 import net.jini.security.Security;
-import org.apache.river.api.io.DistributedObjectInputStream;
+import org.apache.river.api.io.PortableObjectInputStream;
 
 /**
  * An extension of <code>ObjectInputStream</code> that implements the
@@ -85,8 +85,7 @@ import org.apache.river.api.io.Distribut
  * @since 2.0
  **/
 public class MarshalInputStream
-    extends DistributedObjectInputStream
-    implements ObjectStreamContext
+    extends PortableObjectInputStream implements ObjectStreamContext
 {
     /**
      * maps keywords for primitive types and void to corresponding

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalOutputStream.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalOutputStream.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalOutputStream.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalOutputStream.java Fri Jul 11 12:01:53 2014
@@ -26,7 +26,7 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Collection;
 import net.jini.loader.ClassLoading;
-import org.apache.river.api.io.DistributedObjectOutputStream;
+import org.apache.river.api.io.PortableObjectOutputStream;
 
 /**
  * An extension of <code>ObjectOutputStream</code> that implements the
@@ -58,7 +58,7 @@ import org.apache.river.api.io.Distribut
  * @since 2.0
  **/
 public class MarshalOutputStream
-    extends DistributedObjectOutputStream
+    extends PortableObjectOutputStream
     implements ObjectStreamContext
 {
     /** context for ObjectStreamContext implementation */

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalledInstance.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalledInstance.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalledInstance.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/io/MarshalledInstance.java Fri Jul 11 12:01:53 2014
@@ -558,15 +558,16 @@ public class MarshalledInstance implemen
      */
     private static class FromMOInputStream extends ObjectInputStream {
 
-	public FromMOInputStream(InputStream in) throws IOException {
+	FromMOInputStream(InputStream in) throws IOException {
 	    super(in);
-	}
- 
+        }
+
 	/**
 	 * Overrides <code>ObjectInputStream.resolveClass</code> to change
 	 * an occurence of class <code>java.rmi.MarshalledObject</code> to
 	 * class <code>net.jini.io.MarshalledObject</code>.
 	 */
+        @Override
 	protected Class resolveClass(ObjectStreamClass desc)
 	    throws IOException, ClassNotFoundException
 	{
@@ -584,16 +585,17 @@ public class MarshalledInstance implemen
      */
     private static class ToMOInputStream extends ObjectInputStream {
 
-	public ToMOInputStream(InputStream in) throws IOException {
+	ToMOInputStream(InputStream in) throws IOException {
 	    super(in);
-	}
- 
+        }
+
 	/**
 	 * Overrides <code>ObjectInputStream.resolveClass</code>
 	 * to change an occurence of class
 	 * <code>net.jini.io.MarshalledObject</code>
 	 * to class <code>java.rmi.MarshalledObject</code>.
 	 */
+        @Override
 	protected Class resolveClass(ObjectStreamClass desc)
 	    throws IOException, ClassNotFoundException
 	{

Modified: river/jtsk/skunk/qa_refactor/trunk/src/net/jini/loader/pref/PreferredClassLoader.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/net/jini/loader/pref/PreferredClassLoader.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/net/jini/loader/pref/PreferredClassLoader.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/net/jini/loader/pref/PreferredClassLoader.java Fri Jul 11 12:01:53 2014
@@ -48,16 +48,12 @@ import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
-import java.util.NavigableSet;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import net.jini.loader.ClassAnnotation;
 import net.jini.loader.DownloadPermission;
 import org.apache.river.api.net.RFC3986URLClassLoader;
-import org.apache.river.api.security.PermissionComparator;
-import org.apache.river.api.security.PermissionGrant;
 
 /**
  * A class loader that supports preferred classes.
@@ -401,10 +397,9 @@ public class PreferredClassLoader extend
          * PreferredClassLoader, and it must not be invoked again after it
          * has completed successfully.
          * 
-         * This was called from privileged context when it as part of a method,
-         * but we shouldn't need to do that here, any code that can construct
-         * a ClassLoader has privilege.  Note that InputStream is not subject
-         * to deserialization attacks like ObjectInputStream.
+         * This was called from privileged context when it as part of a method.  
+         * Note that InputStream is not subject to deserialization attacks 
+         * like ObjectInputStream.
          * 
          * Also synchronization is not required as it is called from within
          * the constructor now, this change was made to remove any possiblity
@@ -413,31 +408,17 @@ public class PreferredClassLoader extend
         IOException except = null;
         PreferredResources pref = null;
 	if (firstURL != null) {
-            InputStream prefIn = null;
             try {
-                prefIn = getPreferredInputStream(firstURL);
-                if (prefIn != null) {
-                    try {
-                        pref = new PreferredResources(prefIn);
-                    } finally {
-                        try {
-                            prefIn.close();
-                        } catch (IOException e) {
-                        }
-                    }
+                pref = AccessController.doPrivileged(
+                    new PreferredResourcesPrivilegedExceptionAction(firstURL)
+                );
+            } catch (PrivilegedActionException ex) {
+                Exception e = ex.getException();
+                if (e instanceof IOException){
+                    except = (IOException) e;
+                } else {
+                    except = new IOException(e);
                 }
-            } catch (IOException ex) {
-                Logger.getLogger(PreferredClassLoader.class.getName()).log(Level.SEVERE, "Unable to access preferred resources", ex);
-                except = ex;
-            } finally {
-                try {
-                    if (prefIn != null){
-                        prefIn.close();
-                    }
-                } catch (IOException ex) {
-                    Logger.getLogger(PreferredClassLoader.class.getName()).log(Level.SEVERE, "Problem closing preferred resources input stream", ex);
-                } 
-                
             }
 	}
         exceptionWhileLoadingPreferred = except;
@@ -446,7 +427,7 @@ public class PreferredClassLoader extend
         Enumeration<Permission> en = permissions.elements();
         while(en.hasMoreElements()){
             this.permissions.add(en.nextElement());
-    }
+        }
     }
 
     /**
@@ -1382,4 +1363,36 @@ public class PreferredClassLoader extend
             }
 	}
     }
+    
+    private class PreferredResourcesPrivilegedExceptionAction 
+                implements PrivilegedExceptionAction<PreferredResources>{
+        
+        private URL firstURL;
+        
+        PreferredResourcesPrivilegedExceptionAction(URL first){
+            firstURL = first;
+        }
+
+        @Override
+        public PreferredResources run() throws Exception {
+            PreferredResources pref = null;
+            InputStream prefIn = null;
+            try {
+                prefIn = getPreferredInputStream(firstURL);
+                if (prefIn != null) pref = new PreferredResources(prefIn);
+            } catch (IOException ex) {
+                Logger.getLogger(PreferredClassLoader.class.getName()).log(Level.CONFIG, "Unable to access preferred resources", ex);
+                throw ex;
+            } finally {
+                try {
+                    if (prefIn != null){
+                        prefIn.close();
+                    }
+                } catch (IOException ex) {
+                    Logger.getLogger(PreferredClassLoader.class.getName()).log(Level.CONFIG, "Problem closing preferred resources input stream", ex);
+                } 
+            }
+            return pref;
+        }
+    }
 }

Copied: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Portable.java (from r1599197, river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Distributed.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Portable.java?p2=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Portable.java&p1=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Distributed.java&r1=1599197&r2=1609703&rev=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Distributed.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/Portable.java Fri Jul 11 12:01:53 2014
@@ -17,19 +17,21 @@
 package org.apache.river.api.io;
 
 /**
- * Distributed objects are suitable for use as immutable value objects with 
+ * Portable is an extension to the Java Serialization Framework.
+ * 
+ * Portable objects are suitable for use as immutable value objects with 
  * final fields that may be freely replicated, alternatively they are also 
  * suited as safely published thread safe mutable objects used 
  * to store service snapshots in a {@link net.jini.io.MarshalledInstance} for 
  * fail over replication to other nodes, or to upgrade a service.
  * <p>
- * Distributed objects are not serialized, instead they are only created using an 
+ * Portable objects are not serialized, instead they are only created using an 
  * accessible constructor, public static factory method or builder object making them
  * more suitable for security; validating class invariants and concurrent code
  * that relies on immutability and safe publication of fields using final or
  * volatile.
  * <p>
- * Distributed Objects are created remotely with an AccessControlContext
+ * Portable Objects are created remotely with an AccessControlContext
  * containing one ProtectionDomain with a CodeSource that has a null location 
  * and null Certificates.  
  * Only minimal permissions granted to any location by the administrator will apply.  
@@ -39,73 +41,74 @@ package org.apache.river.api.io;
  * use privileged access, including login context from within constructors and
  * methods.
  * <p>
- * The serial form of a Distributed object is managed by SerialReflectionFactory
+ * The serial form of a Portable object is managed by PortableFactory
  * and is solely dependant on the classes, parameters and signatures of methods
  * or constructors.  
  * <p>
- * Distributed Objects with equal SerialReflectionFactory's shall be identical 
+ * Portable Objects with equal PortableFactory's shall be identical 
  * in Object form after un-marshaling within an identical jvm and one 
  * may be substituted for the other to reduce network traffic.
  * <p>
- * Distributed Objects that are equal in Object form are not guaranteed to be equal
+ * Portable Objects that are equal in Object form are not guaranteed to be equal
  * in serial form.  The implementor may enforce serial form equality by ensuring
  * identical methods of creation are used for equal objects and document it in 
- * javadoc. Distributed objects equal in Object form at one node should also be
+ * Javadoc. Portable objects equal in Object form at one node should also be
  * equal after un-marshaling to a second remote node even when serial form differs. 
  * <p>
- * Distributed Objects (boomerangs) that are duplicated across 
+ * Portable Objects (boomerangs) that are duplicated across 
  * nodes may not be equal when returning to a local node after construction and 
  * redistribution on different nodes.  Later versions of code may elect to 
  * use different classes, constructors or method signatures that result in
  * inequality.
  * <p>
- * Distributed objects while free to evolve and possibly having completely different 
+ * Portable objects while free to evolve and possibly having completely different 
  * classes or being completely unequal after distribution to separate nodes, 
  * must always share a common public interface or superclass for referential
  * purposes, this may of course be Object, however if it is, it should be stated
  * clearly in Javadoc to avoid ClassCastException's upon un-marshaling.
  * <p>
- * Distributed objects have no version, instead SerialReflectionFactory contains all 
- * information required to distribute and recreate any Distributed Object using
- * reflection.  For this reason, Distributed objects cannot be used as Entry
+ * Portable objects have no version, instead PortableFactory contains all 
+ * information required to recreate any Portable Object.  
+ * For this reason, Portable objects cannot be used as Entry
  * objects, as they are dependant on published serial form.  It may be possible
- * in a later release to use Distributed objects as fields in Entry objects, this
+ * in a later release to use Portable objects as fields in Entry objects, this
  * is not supported presently.
  * <p>
- * Distributed objects are recommended for use as value objects in domain 
- * driven design.
- * <p>
+ * Portable objects are highly recommended for use as value objects in domain 
+ * driven design, they may also be used for value objects.  PortableFactory can
+ * be used to create the root entity in an aggregate.
+ <p>
  * Although final is not enforced, all fields should be final or volatile, safe
  * construction must be honored 'this' must not be allowed to 
- * escape during construction, distributed objects will be exposed to multiple
+ * escape during construction, Portable objects will be exposed to multiple
  * threads on multiple nodes, without external synchronization.
  * <p>
- * Distributed objects are thread safe.
+ * Portable objects are thread safe.
  * <p>
- * Do not use Distributed if you don't intend to honor this contract, use
+ * Do not use Portable if you don't intend to honor this contract, use
  * Serializable instead.
  * <p>
  * Caveat:<br>
- * Distributed Objects cannot be stored directly in a 
+ * Portable Objects cannot be stored directly in a 
  * {@link java.rmi.MarshalledObject}, a {@link net.jini.io.MarshalledInstance}
- * must first be created and converted, also a Distributed Object will be
- * returned as a {@link SerialReflectionFactory} when {@link java.rmi.MarshalledObject}
+ * must first be created and converted, also a Portable Object will be
+ * returned as a {@link PortableFactory} when {@link java.rmi.MarshalledObject}
  * is un-marshaled, a {@link java.rmi.MarshalledObject} must first be
  * converted to {@link net.jini.io.MarshalledInstance} before un-marshaling.
  * <p>
  * @author Peter Firmstone.
  * @since 3.0.0
  */
-public interface Distributed {
+public interface Portable {
     
     /**
-     * Substitutes an Object in an ObjectOutput with a SerialReflectionFactory,
-     * ObjectInput uses SerialReflectionFactory to reconstruct the Object at the 
-     * remote end using reflection to call a constructor, static method or
-     * object method.
+     * Prepare for transport in a PortableObjectOutputStream. 
+     * ObjectInput uses PortableFactory to create the Portable Object at the 
+     * remote end using a constructor, static method or object method.
      * 
-     * @return SerialReflectionFactory for object remote instantiation using
-     * reflection to call a constructor, static method or object method.
+     * @return A PortableFactory, PortableObjectInputStream uses PortableFactory
+     * to create a Portable Object at the remote end using a constructor,
+     * static method or an object method.
      */
-    SerialReflectionFactory substitute();
+    PortableFactory factory();
 }

Copied: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableFactory.java (from r1599197, river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/SerialReflectionFactory.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableFactory.java?p2=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableFactory.java&p1=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/SerialReflectionFactory.java&r1=1599197&r2=1609703&rev=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/SerialReflectionFactory.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableFactory.java Fri Jul 11 12:01:53 2014
@@ -38,29 +38,29 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * Distributed form, required for reflective calls to instantiate objects remotely, 
+ * Portable form, required to create objects during de-serialization, 
  * using a constructor, static method or an Object method.
  * 
  * This object must be Thread confined, it is not thread safe.  It should be
- * created on demand, it is primarily for use by {@link DistributedObjectInputStream}
- * and {@link DistributedObjectOutputStream}, it is created by {@link Distributed}
- * Object implementations and {@link DistributedObjectInputStream}
+ * created on demand, it is primarily for use by {@link PortableObjectInputStream}
+ * and {@link PortableObjectOutputStream}, it is created by {@link Portable}
+ * implementations.
  * 
  * Internal state is guarded, arrays are not defensively copied.
  * 
  * This is compatible with Version 2 of the Java Serialization Protocol.
  * 
  * @author Peter Firmstone.
- * @see Distributed
- * @see DistributePermission
+ * @see Portable
+ * @see PortablePermission
  * @see Serializable
  * @see Externalizable
  * @since 3.0.0
  */
-public final class SerialReflectionFactory implements Externalizable {
+public final class PortableFactory implements Externalizable {
     private static final long serialVersionUID = 1L;
     /* Guard private state */
-    private static final Guard distributable = new DistributePermission();
+    private static final Guard distributable = new PortablePermission();
     
     /* Minimal protocol to write primitives directly to stream, only for parameters.
      * Strings are written as Objects, since they are a special case, identical
@@ -98,18 +98,18 @@ public final class SerialReflectionFacto
     /**
      * Public method provided for java serialization framework.
      */
-    public SerialReflectionFactory(){
+    public PortableFactory(){
         constructed = false;
     }
     
     /**
      * Reflection is used at the remote end, with information provided to
-     * SerialReflectionFactory, to call a constructor, static method
-     * or an object method after de-serialization by DistributedObjectInputStream.
+     * PortableFactory, to call a constructor, static method
+     * or an object method after de-serialization by PortableObjectInputStream.
      * <p>
-     * Information given to SerialReflectionFactory is guarded by DistributePermission.
+     * Information given to PortableFactory is guarded by PortablePermission.
      * <p>
-     * Instantiation of a Distributed object at a remote endpoint proceeds as follows:
+     * Instantiation of a Portable object at a remote endpoint proceeds as follows:
      * <ul><li>
      * If factoryClassOrObject is a Class and methodName is null, a constructor
      * of that Class is called reflectively with parameterTypes and parameters.
@@ -129,7 +129,7 @@ public final class SerialReflectionFacto
      * as primitives.
      * <p>
      * Constructor parameters must either be Serializable, Externalizable or
-     * Distributed objects.
+     * Portable objects.
      * <p>
      * Creation is performed using only privileges granted to all CodeSource's,
      * if there are no default grants set by the policy administrator, the
@@ -144,9 +144,9 @@ public final class SerialReflectionFacto
      * @param methodName name of static factory method, null if using a constructor.
      * @param parameterTypes Type signature of method or constructor, or null.
      * @param parameters array of Objects to be passed to constructor, or null.
-     * @see DistributePermission
+     * @see PortablePermission
      */
-    public SerialReflectionFactory(Object factoryClassOrObject, String methodName, Class[] parameterTypes, Object [] parameters){
+    public PortableFactory(Object factoryClassOrObject, String methodName, Class[] parameterTypes, Object [] parameters){
         classOrObject = factoryClassOrObject;
         method = methodName;
         this.parameterTypes = parameterTypes;
@@ -203,7 +203,7 @@ public final class SerialReflectionFacto
             }
                     , acc);
         } catch (PrivilegedActionException ex) {
-            Logger.getLogger(SerialReflectionFactory.class.getName()).log(Level.SEVERE, null, ex);
+            Logger.getLogger(PortableFactory.class.getName()).log(Level.SEVERE, null, ex);
             throw new IOException(ex);
         }
     }
@@ -211,7 +211,7 @@ public final class SerialReflectionFacto
     // Inherit documentation
     public void writeExternal(ObjectOutput out) throws IOException {
         distributable.checkGuard(null);
-        if (! constructed) throw new IOException("Attempt to write blank SerialReflectionFactory");
+        if (! constructed) throw new IOException("Attempt to write blank PortableFactory");
         out.writeByte(VERSION);
         out.writeObject(classOrObject);
         out.writeObject(method);
@@ -326,14 +326,14 @@ public final class SerialReflectionFacto
         if (constructed) throw new IllegalStateException("Object already constructed");
         constructed = true;
         /* Don't defensively copy arrays, the object is used immediately after
-         * deserialization to construct the Distributed Object, the fields are
+         * deserialization to construct the Portable Object, the fields are
          * not accessed again, it is up to creator methods themselves to 
          * preserve invariants.
          */
         byte version = in.readByte();
         // In future we could potentially handle different versions, but for now,
         // bail out.
-        if (version != VERSION) throw new ProtocolException("Incompatible SerialReflectionFactory protocol");
+        if (version != VERSION) throw new ProtocolException("Incompatible PortableFactory protocol");
         classOrObject = in.readObject();
         method = (String) in.readObject();
         parameterTypes = (Class[]) in.readObject();
@@ -345,7 +345,7 @@ public final class SerialReflectionFacto
         int hash = 7;
         hash = 89 * hash + (this.classOrObject != null ? this.classOrObject.hashCode() : 0);
         hash = 89 * hash + (this.method != null ? this.method.hashCode() : 0);
-        hash = 89 * hash + Arrays.deepHashCode(this.parameterTypes);
+        hash = 89 * hash + Arrays.hashCode(this.parameterTypes);
         hash = 89 * hash + Arrays.deepHashCode(this.parameters);
         this.hash = hash;
     }
@@ -359,9 +359,9 @@ public final class SerialReflectionFacto
     
     @Override
     public boolean equals(Object o){
-        if (!(o instanceof SerialReflectionFactory)) return false;
+        if (!(o instanceof PortableFactory)) return false;
         if ( hash != o.hashCode()) return false;
-        SerialReflectionFactory other = (SerialReflectionFactory) o;
+        PortableFactory other = (PortableFactory) o;
         if ( classOrObject == null && other.classOrObject != null) return false;
         if ( classOrObject != null && ! classOrObject.equals(other.classOrObject)) return false;
         if ( method == null && other.method != null) return false;

Copied: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectInputStream.java (from r1599197, river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectInputStream.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectInputStream.java?p2=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectInputStream.java&p1=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectInputStream.java&r1=1599197&r2=1609703&rev=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectInputStream.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectInputStream.java Fri Jul 11 12:01:53 2014
@@ -23,16 +23,16 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 
 /**
- * DistributedObjectInputStream, an extension to Java serialization that allows
+ * PortableObjectInputStream, an extension to Java serialization that allows
  * for immutable and safely constructed objects
  * 
  * @author Peter.
  * @since 3.0.0
  */
-public class DistributedObjectInputStream extends ObjectInputStream {
+public class PortableObjectInputStream extends ObjectInputStream {
     
     public static ObjectInputStream create(InputStream in) throws IOException{
-        DistributedObjectInputStream result = new DistributedObjectInputStream(in);
+        PortableObjectInputStream result = new PortableObjectInputStream(in);
         AccessController.doPrivileged(new EnableResolveObject(result));
         return result;
     }
@@ -44,7 +44,7 @@ public class DistributedObjectInputStrea
      * @param in
      * @throws IOException 
      */
-    protected DistributedObjectInputStream(InputStream in) throws IOException{
+    protected PortableObjectInputStream(InputStream in) throws IOException{
         super(in);
     }
     
@@ -53,14 +53,14 @@ public class DistributedObjectInputStrea
     }
     
     protected Object resolveObject(Object o) throws IOException{
-        if (o instanceof SerialReflectionFactory) return ((SerialReflectionFactory)o).create();
+        if (o instanceof PortableFactory) return ((PortableFactory)o).create();
         return o;
     }
     
     private static class EnableResolveObject implements PrivilegedAction{
-        private final DistributedObjectInputStream in;
+        private final PortableObjectInputStream in;
         
-        EnableResolveObject(DistributedObjectInputStream in){
+        EnableResolveObject(PortableObjectInputStream in){
             this.in = in;
         }
         

Copied: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectOutputStream.java (from r1599197, river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectOutputStream.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectOutputStream.java?p2=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectOutputStream.java&p1=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectOutputStream.java&r1=1599197&r2=1609703&rev=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributedObjectOutputStream.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortableObjectOutputStream.java Fri Jul 11 12:01:53 2014
@@ -23,27 +23,28 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 
 /**
- * DistributedObjectOutputStream replaces @ref{Distributed} instances
- * in the OutputStream with a SerialReflectionFactory that recreates the 
- * Distributed Object during unmarshalling.
+ * PortableObjectOutputStream replaces @ref{Portable} instances
+ * in the OutputStream with a PortableFactory that recreates the 
+ * Portable Object during unmarshalling.
  * 
  * @author peter
  * @since 3.0.0
  */
-public class DistributedObjectOutputStream extends ObjectOutputStream {
+public class PortableObjectOutputStream extends ObjectOutputStream {
     
      public static ObjectOutputStream create(OutputStream out) throws IOException{
-        DistributedObjectOutputStream result = new DistributedObjectOutputStream(out);
+        PortableObjectOutputStream result = new PortableObjectOutputStream(out);
         AccessController.doPrivileged(new EnableReplaceObject(result));
         return result;
     }
     
-    protected DistributedObjectOutputStream (OutputStream out) throws IOException{
+    protected PortableObjectOutputStream (OutputStream out) throws IOException{
         super(out);
     }
     
+     @Override
     protected Object replaceObject(Object o){
-        if (o instanceof Distributed) return ((Distributed)o).substitute();
+        if (o instanceof Portable) return ((Portable)o).factory();
         return o;
     }
     
@@ -52,9 +53,9 @@ public class DistributedObjectOutputStre
     }
     
     private static class EnableReplaceObject implements PrivilegedAction{
-        private final DistributedObjectOutputStream out;
+        private final PortableObjectOutputStream out;
         
-        EnableReplaceObject(DistributedObjectOutputStream out){
+        EnableReplaceObject(PortableObjectOutputStream out){
             this.out = out;
         }
         

Copied: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortablePermission.java (from r1599197, river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributePermission.java)
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortablePermission.java?p2=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortablePermission.java&p1=river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributePermission.java&r1=1599197&r2=1609703&rev=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/DistributePermission.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/PortablePermission.java Fri Jul 11 12:01:53 2014
@@ -20,19 +20,19 @@ import java.io.ObjectOutput;
 import java.security.BasicPermission;
 
 /**
- * This Permission allows an object to be Distributed by an implementation of
+ * This Permission allows an object to be Portable by an implementation of
  * ObjectOutput
  * 
  * @author peter
- * @see SerialReflectionFactory
+ * @see PortableFactory
  * @see ObjectOutput
  * @since 3.0.0
  */
-public class DistributePermission  extends BasicPermission{
+public class PortablePermission  extends BasicPermission{
     private static final long serialVersionUID = 1L;
 
-    public DistributePermission(){
-        super("DISTRIBUTE");
+    public PortablePermission(){
+        super("Portable");
     }
 
 }
\ No newline at end of file

Modified: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/package.html
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/package.html?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/package.html (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/io/package.html Fri Jul 11 12:01:53 2014
@@ -25,36 +25,36 @@
 
 Provides I/O interfaces and utility classes.
 
-<h2><code>Distributed</code></h2>
+<h2><code>Portable</code></h2>
 
-<p>The interface {@link org.apache.river.api.io.Distributed} may be
+<p>The interface {@link org.apache.river.api.io.Portable} may be
 implemented by an object that is required to be immutable and thread safe
-immediately after un-marshalling, <code>Distributed</code> object's do not
+immediately after un-marshalling, <code>Portable</code> object's do not
 implement {@link java.io.Serializable}, their fields may be private and they 
 are created by a single reflective invocation of a public constructor, static
 method or <code>Serializable</code> object's builder method.
 
-<h2><code>DistributedObjectOutputStream</code> and <code>DistributedObjectInputStream</code></h2>
+<h2><code>PortableObjectOutputStream</code> and <code>PortableObjectInputStream</code></h2>
 
 <p>The classes {@link net.jini.io.MarshalOutputStream} and {@link
-net.jini.io.MarshalInputStream} extend the Distributed object serialization stream
-classes {@link org.apache.river.api.io.DistributedObjectOutputStream} and {@link
-org.apache.river.api.io.DistributedObjectInputStream} that implement replacement of
-{@link org.apache.river.api.io.Distributed} objects with 
-{@link org.apache.river.api.io.SerialReflectionFactory} during marshalling and
-substitution of <code>SerialReflectionFactory</code> with an object created by
-<code>SerialReflectionFactory</code>upon unmarshalling.
+net.jini.io.MarshalInputStream} extend the Portable object serialization stream
+classes {@link org.apache.river.api.io.PortableObjectOutputStream} and {@link
+org.apache.river.api.io.PortableObjectInputStream} that implement replacement of
+{@link org.apache.river.api.io.Portable} objects with 
+{@link org.apache.river.api.io.PortableFactory} during marshalling and
+substitution of <code>PortableFactory</code> with an object created by
+<code>PortableFactory</code>upon unmarshalling.
 
-<h2><code>SerialReflectionFactory</code></h2>
+<h2><code>PortableFactory</code></h2>
 
-<p>A {@link org.apache.river.api.io.SerialReflectionFactory} contains Externalized 
+<p>A {@link org.apache.river.api.io.PortableFactory} contains Externalized 
 instructions for creating an Object using reflection upon unmarshalling.
 
-<h2><code>DistributePermission</code></h2>
+<h2><code>PortablePermission</code></h2>
 
-<p>A {@link org.apache.river.api.io.DistributePermission} guards the 
+<p>A {@link org.apache.river.api.io.PortablePermission} guards the 
     {@link java.io.Externalizable#writeExternal} method of 
-    <code>SerialReflectionFactory</code>, preventing unauthorised marshalling.
+    <code>PortableFactory</code>, preventing unauthorised marshalling.
 
 @since 3.0.0
 @version 3.0.0

Modified: river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/lookup/StreamServiceRegistrar.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/lookup/StreamServiceRegistrar.java?rev=1609703&r1=1609702&r2=1609703&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/lookup/StreamServiceRegistrar.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/org/apache/river/api/lookup/StreamServiceRegistrar.java Fri Jul 11 12:01:53 2014
@@ -22,6 +22,7 @@ import net.jini.core.lookup.ServiceItem;
 import net.jini.core.lookup.ServiceRegistrar;
 import net.jini.core.lookup.ServiceRegistration;
 import net.jini.core.lookup.ServiceTemplate;
+import org.apache.river.api.common.Beta;
 import org.apache.river.api.util.ResultStream;
 
 /**
@@ -48,6 +49,7 @@ import org.apache.river.api.util.ResultS
  * @author Peter Firmstone
  * @since 3.0.0
  */
+@Beta
 public interface StreamServiceRegistrar extends ServiceRegistrar{
 
     /**
@@ -65,6 +67,7 @@ public interface StreamServiceRegistrar 
      *
      * @param tmpl template to match
      * specified template
+     * @param entryClasses
      * 
      * @param maxBatchSize held locally, larger batch sizes reduce network 
      * traffic, but may delay processing locally depending on implementation.