You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by th...@apache.org on 2012/04/19 14:10:37 UTC

svn commit: r1327920 - in /river/jtsk/skunk/easystart: scala-src/org/apache/river/scala/ src-extra-examples/org/apache/river/extra/examples/easystart/ src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/ src-extra/ src-extra/org/...

Author: thobbs
Date: Thu Apr 19 12:10:36 2012
New Revision: 1327920

URL: http://svn.apache.org/viewvc?rev=1327920&view=rev
Log:
Moved some files around, deleted ones no longer used.  Added some javadocs.

Added:
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/CheckServices.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartAll.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartHttpServer.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartLookupService.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartMahaloService.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartOutriggerService.java
Removed:
    river/jtsk/skunk/easystart/src-extra/empty.config
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartAll.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartHttpServer.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartLookupService.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartMahaloService.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartOutriggerService.java
Modified:
    river/jtsk/skunk/easystart/scala-src/org/apache/river/scala/Djinn.scala
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/AbstractEasyConfiguration.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ApplicationOptions.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ConfigurationFactory.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/DefaultOptions.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/JavaSpaceConfiguration.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/LookupServiceConfiguration.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/TransactionServiceConfiguration.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config

Modified: river/jtsk/skunk/easystart/scala-src/org/apache/river/scala/Djinn.scala
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/scala-src/org/apache/river/scala/Djinn.scala?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/scala-src/org/apache/river/scala/Djinn.scala (original)
+++ river/jtsk/skunk/easystart/scala-src/org/apache/river/scala/Djinn.scala Thu Apr 19 12:10:36 2012
@@ -156,8 +156,7 @@ object Djinn {
   def main(args: Array[String]) = {
     println("Starting djinn")
     
-    val locators = Array[LookupLocator] (new LookupLocator("jini://localhost"))
-    val djinn = new Djinn(new UnicastDiscovery (locators))
+    val djinn = new Djinn(new UnicastDiscovery (new LookupLocator("jini://localhost")))
 //    val djinn = new Djinn(new MulticastDiscovery)
     
     djinn.handleNewService({event: ServiceDiscoveryEvent => println("Found one!")})

Modified: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java (original)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java Thu Apr 19 12:10:36 2012
@@ -19,7 +19,7 @@ package org.apache.river.extra.examples.
 
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.List;
+import java.util.Collection;
 import java.util.logging.Logger;
 
 import net.jini.admin.Administrable;
@@ -55,7 +55,7 @@ public class LookupServices {
 													   new Class<?>[] { ExampleService.class },
 													   null);
 		
-		List<ServiceItem> serviceItems = disco.lookupAll(template);
+		Collection<ServiceItem> serviceItems = disco.lookupAll(template);
 		log.severe("Found "+serviceItems.size()+" services");
 		for(ServiceItem si : serviceItems) {
 			log.severe("\tAttributes: "+Arrays.toString(si.attributeSets));

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/CheckServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/CheckServices.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/CheckServices.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/CheckServices.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Socket;
+import java.rmi.RMISecurityManager;
+import java.util.Arrays;
+import java.util.logging.Logger;
+
+import net.jini.admin.Administrable;
+import net.jini.admin.JoinAdmin;
+import net.jini.core.discovery.LookupLocator;
+import net.jini.core.lookup.ServiceItem;
+import net.jini.core.lookup.ServiceMatches;
+import net.jini.core.lookup.ServiceRegistrar;
+import net.jini.core.lookup.ServiceTemplate;
+import net.jini.core.transaction.server.TransactionManager;
+import net.jini.lookup.DiscoveryAdmin;
+import net.jini.space.JavaSpace;
+
+public class CheckServices {
+
+	private static final Logger log = Logger.getLogger(CheckServices.class.getName());
+	
+	public static void main(String[] args) throws IOException, ClassNotFoundException {
+		int port = 8080;
+		
+		System.setSecurityManager(new RMISecurityManager());
+		
+		checkHttpServer(port);
+		
+		checkLookupServices();
+		checkSpaces();
+		checkTransactionManagers();
+		
+		checkLookupServices("jini://localhost:4161");
+		checkSpaces("jini://localhost:4161");
+		checkTransactionManagers("jini://localhost:4161");
+//		
+//		checkAll();
+	}
+
+	private static void checkHttpServer(int port) throws IOException {
+		Socket s = new Socket("localhost", 8080);
+		InputStream in = s.getInputStream();
+		if(null != in) {
+			log.info("HTTP server is up on port "+port);
+		} else {
+			log.warning("HTTP server is not up on port "+port);
+		}
+		in.close();
+	}
+
+	private static void checkLookupServices() throws IOException, ClassNotFoundException {
+		checkLookupServices("jini://localhost");
+	}
+	private static void checkLookupServices(String lus) throws IOException, ClassNotFoundException {
+		LookupLocator ll = new LookupLocator(lus);
+		ServiceRegistrar sr = ll.getRegistrar();
+		
+		if(null != sr) {
+			log.info("Lookup service found with ID "+sr.getServiceID());
+			
+			ServiceTemplate st = new ServiceTemplate(sr.getServiceID(), null, null);
+			ServiceMatches sms = sr.lookup(st, 1);
+			for(ServiceItem sm : sms.items) {
+				log.info("Lookup service found: "+Arrays.toString(sm.attributeSets));
+				JoinAdmin jAdmin = (JoinAdmin) ((Administrable)sm.service).getAdmin();
+				log.info("Lookup groups: "+Arrays.toString(jAdmin.getLookupGroups()));
+				log.info("Lookup Attributes: "+Arrays.toString(jAdmin.getLookupAttributes()));
+				DiscoveryAdmin dAdmin = (DiscoveryAdmin) ((Administrable)sm.service).getAdmin();
+				log.info("Member groups: "+Arrays.toString(dAdmin.getMemberGroups()));
+			}
+		} else {
+			log.warning("Lookup service could not be found");
+		}
+					
+	}
+	
+	private static void checkSpaces() throws IOException, ClassNotFoundException {
+		checkSpaces("jini://localhost");
+	}
+	private static void checkSpaces(String lus) throws IOException, ClassNotFoundException {
+		LookupLocator ll = new LookupLocator(lus);
+		ServiceRegistrar sr = ll.getRegistrar();
+		
+		if(null != sr) {
+			
+			ServiceTemplate tmpl = new ServiceTemplate(null, new Class[] { JavaSpace.class }, null);
+			ServiceMatches sms =sr.lookup(tmpl, Integer.MAX_VALUE);
+			
+			if(0 == sms.items.length) {
+				log.severe("No spaces found");
+			} else {
+				log.info("Found "+sms.items.length+" spaces");
+			}
+			
+			for(ServiceItem sm : sms.items) {
+				log.info("Space found: "+Arrays.toString(sm.attributeSets));
+			}
+		} else {
+			log.warning("Lookup service could not be found");
+		}
+	}
+	
+	private static void checkTransactionManagers() throws IOException, ClassNotFoundException {
+		checkTransactionManagers("jini://localhost");
+	}
+	private static void checkTransactionManagers(String lus) throws IOException, ClassNotFoundException {
+		LookupLocator ll = new LookupLocator(lus);
+		ServiceRegistrar sr = ll.getRegistrar();
+		
+		if(null != sr) {
+			
+			ServiceTemplate tmpl = new ServiceTemplate(null, new Class[] { TransactionManager.class }, null);
+			ServiceMatches sms =sr.lookup(tmpl, Integer.MAX_VALUE);
+			
+			if(0 == sms.items.length) {
+				log.severe("No Transaction Managers found");
+			} else {
+				log.info("Found "+sms.items.length+" transaction managers");
+			}
+			
+			for(ServiceItem sm : sms.items) {
+				log.info("Transaction Manager found: "+Arrays.toString(sm.attributeSets));
+			}
+		} else {
+			log.warning("Lookup service could not be found");
+		}
+	}
+	
+	private static void checkAll() throws IOException, ClassNotFoundException {
+		LookupLocator ll = new LookupLocator("jini://localhost");
+		ServiceRegistrar sr = ll.getRegistrar();
+		
+		if(null != sr) {
+
+			ServiceTemplate tmpl = new ServiceTemplate(null, null, null);
+			ServiceMatches sms =sr.lookup(tmpl, Integer.MAX_VALUE);
+
+			if(0 == sms.items.length) {
+				log.severe("No services found");
+			} else {
+				log.info("Found "+sms.items.length+" services");
+			}
+			
+			for(ServiceItem sm : sms.items) {
+				log.info("Service found: "+Arrays.toString(sm.attributeSets));
+			}
+		} else {
+			log.warning("Lookup service could not be found");
+		}
+	}
+
+}
\ No newline at end of file

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartAll.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartAll.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartAll.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartAll.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+import org.apache.river.extra.easystart.config.ApplicationOptions;
+import org.apache.river.extra.easystart.config.ConfigurationFactory;
+import org.apache.river.extra.easystart.config.LookupServiceConfiguration;
+
+import com.sun.jini.start.ServiceStarter;
+
+public class StartAll {
+
+	private static final Logger log = Logger.getLogger(StartAll.class.getName());
+	
+	private static final int RIVER_HOME_INDEX = 0;
+	private static final int HTTP_PORT_INDEX = 1;
+	
+	public static void main(String[] args) throws ConfigurationException, IOException {
+		validateArgs(args);
+		
+		final String RIVER_HOME = args[RIVER_HOME_INDEX];
+		final int HTTP_PORT = Integer.parseInt(args[HTTP_PORT_INDEX]);
+		
+		System.getProperties().setProperty("RIVER_HOME", RIVER_HOME);
+		
+		log.info("Using RIVER_HOME="+RIVER_HOME);
+		log.info("Using HTTP_PORT="+HTTP_PORT);
+		
+		ApplicationOptions options = new ApplicationOptions();
+		options.setHttpOptions("localhost", HTTP_PORT, true);
+		options.setJiniPort(4161);
+		options.addLookupGroup("example");
+		
+		ConfigurationFactory configFac = new ConfigurationFactory(options);
+		
+		LookupServiceConfiguration config = configFac.lookupServiceConfig();
+		config.addMemberGroup("example");
+		ServiceStarter.main(config.riverConfig());
+		
+		ServiceStarter.main(configFac.transactionServiceConfig().riverConfig());
+		ServiceStarter.main(configFac.spaceConfig().riverConfig());
+	}
+	
+	private static void validateArgs(String[] args) {
+		if(null == args || 2 != args.length) {
+			throw new IllegalArgumentException("Expected first value of array to be RIVER_HOME");
+		}
+		
+		File riverHomeDir = new File(args[RIVER_HOME_INDEX]);
+		if(!(riverHomeDir.exists() && riverHomeDir.isDirectory())) {
+			throw new IllegalArgumentException("River home ["+args[RIVER_HOME_INDEX]+"] either doesn't exist or is not a directory");
+		}
+		
+		try {
+			Integer.parseInt(args[HTTP_PORT_INDEX]);
+		} catch (NumberFormatException nfe) {
+			throw new IllegalArgumentException("Unexpected value found for HTTP port", nfe);
+		}
+		
+	}
+	
+}

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartHttpServer.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartHttpServer.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartHttpServer.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartHttpServer.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import com.sun.jini.tool.ClassServer;
+
+public class StartHttpServer {
+
+	private static final Logger log = Logger.getLogger(StartHttpServer.class.getName());
+	
+	private static final int RIVER_HOME_INDEX = 0;
+	private static final int HTTP_PORT_INDEX = 1;
+	
+	/**
+	 * The first value in args must be the value of $RIVER_HOME
+	 * 
+	 * @param args
+	 * @throws IOException 
+	 */
+	public static void main(String[] args) throws IOException {
+		validateArgs(args);
+
+		final String RIVER_HOME = args[RIVER_HOME_INDEX];
+		final int HTTP_PORT = Integer.parseInt(args[HTTP_PORT_INDEX]);
+		log.info("Using RIVER_HOME="+RIVER_HOME);
+		log.info("Using HTTP_PORT="+HTTP_PORT);
+		
+		final boolean trees = false;
+		final boolean stoppable = false;
+		final boolean verbose = true;
+		
+		ClassServer cs = new ClassServer(HTTP_PORT,
+                RIVER_HOME+File.separator+"lib-dl",
+                trees,
+                stoppable,
+                verbose);
+
+//        cs.setDaemon(true);
+        cs.start();
+
+	}
+	
+	private static void validateArgs(String[] args) {
+		if(null == args || 2 != args.length) {
+			throw new IllegalArgumentException("Expected first value of array to be RIVER_HOME");
+		}
+		
+		File riverHomeDir = new File(args[RIVER_HOME_INDEX]);
+		if(!(riverHomeDir.exists() && riverHomeDir.isDirectory())) {
+			throw new IllegalArgumentException("River home ["+args[RIVER_HOME_INDEX]+"] either doesn't exist or is not a directory");
+		}
+		
+		try {
+			Integer.parseInt(args[HTTP_PORT_INDEX]);
+		} catch (NumberFormatException nfe) {
+			throw new IllegalArgumentException("Unexpected value found for HTTP port", nfe);
+		}
+	}
+
+}

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartLookupService.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartLookupService.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartLookupService.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartLookupService.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+import org.apache.river.extra.easystart.config.ApplicationOptions;
+import org.apache.river.extra.easystart.config.ConfigurationFactory;
+import org.apache.river.extra.easystart.config.LookupServiceConfiguration;
+
+import com.sun.jini.start.ServiceStarter;
+
+public class StartLookupService {
+
+
+	private static final Logger log = Logger.getLogger(StartLookupService.class.getName());
+	
+	private static final int RIVER_HOME_INDEX = 0;
+	private static final int HTTP_PORT_INDEX = 1;
+	
+	/**
+	 * @param args
+	 * @throws ConfigurationException 
+	 * @throws IOException 
+	 */
+	public static void main(String[] args) throws ConfigurationException, IOException {
+		validateArgs(args);
+		
+		final String RIVER_HOME = args[RIVER_HOME_INDEX];
+		final int HTTP_PORT = Integer.parseInt(args[HTTP_PORT_INDEX]);
+		
+		log.info("Using RIVER_HOME="+RIVER_HOME);
+		log.info("Using HTTP_PORT="+HTTP_PORT);
+		
+		ApplicationOptions options = new ApplicationOptions();
+		
+		ConfigurationFactory configFac = new ConfigurationFactory(options);
+		LookupServiceConfiguration config = configFac.lookupServiceConfig();
+		config.addMemberGroup("Lester").addMemberGroup("Jeff");
+		config.addLookupGroup("Sarah").addLookupGroup("Chuck");
+		config.setRiverPort(4160);
+		
+		ServiceStarter.main(config.riverConfig());
+		
+	}
+
+	private static void validateArgs(String[] args) {
+		if(null == args || 2 != args.length) {
+			throw new IllegalArgumentException("Expected first value of array to be RIVER_HOME");
+		}
+		
+		File riverHomeDir = new File(args[RIVER_HOME_INDEX]);
+		if(!(riverHomeDir.exists() && riverHomeDir.isDirectory())) {
+			throw new IllegalArgumentException("River home ["+args[RIVER_HOME_INDEX]+"] either doesn't exist or is not a directory");
+		}
+		
+		try {
+			Integer.parseInt(args[HTTP_PORT_INDEX]);
+		} catch (NumberFormatException nfe) {
+			throw new IllegalArgumentException("Unexpected value found for HTTP port", nfe);
+		}
+		
+	}
+	
+}

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartMahaloService.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartMahaloService.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartMahaloService.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartMahaloService.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+import org.apache.river.extra.easystart.config.ApplicationOptions;
+import org.apache.river.extra.easystart.config.ConfigurationFactory;
+import org.apache.river.extra.easystart.config.TransactionServiceConfiguration;
+
+import com.sun.jini.start.ServiceStarter;
+
+public class StartMahaloService {
+
+
+	private static final Logger log = Logger.getLogger(StartMahaloService.class.getName());
+	
+	private static final int RIVER_HOME_INDEX = 0;
+	private static final int HTTP_PORT_INDEX = 1;
+	
+	/**
+	 * @param args
+	 * @throws ConfigurationException 
+	 * @throws IOException 
+	 */
+	public static void main(String[] args) throws ConfigurationException, IOException {
+		validateArgs(args);
+		
+		final String RIVER_HOME = args[RIVER_HOME_INDEX];
+		final int HTTP_PORT = Integer.parseInt(args[HTTP_PORT_INDEX]);
+		
+		log.info("Using RIVER_HOME="+RIVER_HOME);
+		log.info("Using HTTP_PORT="+HTTP_PORT);
+		
+		ApplicationOptions options = new ApplicationOptions();
+		
+		ConfigurationFactory configFac = new ConfigurationFactory(options);
+		TransactionServiceConfiguration config = configFac.transactionServiceConfig();
+		config.addLookupGroup("Lester").addLookupGroup("Jeff");
+		
+		ServiceStarter.main(config.riverConfig());
+	}
+
+	private static void validateArgs(String[] args) {
+		if(null == args || 2 != args.length) {
+			throw new IllegalArgumentException("Expected first value of array to be RIVER_HOME");
+		}
+		
+		File riverHomeDir = new File(args[RIVER_HOME_INDEX]);
+		if(!(riverHomeDir.exists() && riverHomeDir.isDirectory())) {
+			throw new IllegalArgumentException("River home ["+args[RIVER_HOME_INDEX]+"] either doesn't exist or is not a directory");
+		}
+		
+		try {
+			Integer.parseInt(args[HTTP_PORT_INDEX]);
+		} catch (NumberFormatException nfe) {
+			throw new IllegalArgumentException("Unexpected value found for HTTP port", nfe);
+		}
+		
+	}
+	
+}

Added: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartOutriggerService.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartOutriggerService.java?rev=1327920&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartOutriggerService.java (added)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/riverservices/StartOutriggerService.java Thu Apr 19 12:10:36 2012
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.examples.easystart.riverservices;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+import org.apache.river.extra.easystart.config.ApplicationOptions;
+import org.apache.river.extra.easystart.config.ConfigurationFactory;
+import org.apache.river.extra.easystart.config.JavaSpaceConfiguration;
+
+import com.sun.jini.start.ServiceStarter;
+
+public class StartOutriggerService {
+
+
+	private static final Logger log = Logger.getLogger(StartOutriggerService.class.getName());
+	
+	private static final int RIVER_HOME_INDEX = 0;
+	private static final int HTTP_PORT_INDEX = 1;
+	
+	/**
+	 * @param args
+	 * @throws ConfigurationException 
+	 * @throws IOException 
+	 */
+	public static void main(String[] args) throws ConfigurationException, IOException {
+		validateArgs(args);
+		
+		final String RIVER_HOME = args[RIVER_HOME_INDEX];
+		final int HTTP_PORT = Integer.parseInt(args[HTTP_PORT_INDEX]);
+		
+		log.info("Using RIVER_HOME="+RIVER_HOME);
+		log.info("Using HTTP_PORT="+HTTP_PORT);
+		
+		ApplicationOptions options = new ApplicationOptions();
+		
+		ConfigurationFactory configFac = new ConfigurationFactory(options);
+		JavaSpaceConfiguration config = configFac.spaceConfig();
+		config.addLookupGroup("Lester").addLookupGroup("Jeff");
+		
+		ServiceStarter.main(config.riverConfig());
+	}
+
+	private static void validateArgs(String[] args) {
+		if(null == args || 2 != args.length) {
+			throw new IllegalArgumentException("Expected first value of array to be RIVER_HOME");
+		}
+		
+		File riverHomeDir = new File(args[RIVER_HOME_INDEX]);
+		if(!(riverHomeDir.exists() && riverHomeDir.isDirectory())) {
+			throw new IllegalArgumentException("River home ["+args[RIVER_HOME_INDEX]+"] either doesn't exist or is not a directory");
+		}
+		
+		try {
+			Integer.parseInt(args[HTTP_PORT_INDEX]);
+		} catch (NumberFormatException nfe) {
+			throw new IllegalArgumentException("Unexpected value found for HTTP port", nfe);
+		}
+		
+	}
+	
+}

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/AbstractEasyConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/AbstractEasyConfiguration.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/AbstractEasyConfiguration.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/AbstractEasyConfiguration.java Thu Apr 19 12:10:36 2012
@@ -34,28 +34,53 @@ import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
 
+import com.sun.jini.start.ServiceStarter;
+
+/**
+ * Base class which knows how to convert from the user defined {@link Setting}
+ * and {@link DefaultOptions} to a {@link Configuration} implementation that
+ * can be successfully used with the standard {@link ServiceStarter}
+ * 
+ * @author Tom Hobbs
+ *
+ */
 public class AbstractEasyConfiguration {
 
 	private static final Logger LOGGER = Logger.getLogger(AbstractEasyConfiguration.class.getName());
 	
-	private final DefaultOptions options;
+	private final ApplicationOptions options;
 	
-	protected AbstractEasyConfiguration(DefaultOptions opts) {
-		this.options = (DefaultOptions) opts.clone();
+	protected AbstractEasyConfiguration(ApplicationOptions opts) {
+		if(null == opts) {
+			throw new IllegalArgumentException("Input opts cannot be null");
+		}
+		this.options = (ApplicationOptions) opts.clone();
 	}
-	
 
-	protected DefaultOptions getDefaultOptions() {
+	protected ApplicationOptions getDefaultOptions() {
 		return options;
 	}
 	
 	public AbstractEasyConfiguration addLookupGroup(String grp) {
-		getGroupSetting(DefaultOptions.LOOKUP_GROUP).add(grp);
+		options.addLookupGroup(grp);
 		return this;
 	}
-
+	
 	public AbstractEasyConfiguration setRiverPort(int port) {
-		getSetting(DefaultOptions.RIVER_PORT).setOverride(String.valueOf(port));
+		options.setJiniPort(port);
+		return this;
+	}
+
+	/**
+	 * See comments on {@link ApplicationOptions.setHttpOptions}
+	 *  
+	 * @param host
+	 * @param port
+	 * @param stringLiteral
+	 * @return
+	 */
+	public AbstractEasyConfiguration setHttpOptions(String host, int port, boolean stringLiteral) {
+		options.setHttpOptions(host, port, stringLiteral);
 		return this;
 	}
 

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ApplicationOptions.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ApplicationOptions.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ApplicationOptions.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ApplicationOptions.java Thu Apr 19 12:10:36 2012
@@ -19,12 +19,21 @@ package org.apache.river.extra.easystart
 
 import java.util.Collection;
 
+import net.jini.config.ConfigurationFile;
 import net.jini.lookup.entry.Name;
 
 import org.apache.river.extra.easystart.config.settings.Setting;
 
-
-
+/**
+ * A more convenient and easy to use version of {@link DefaultOptions} users 
+ * are encouraged to use or extend this class when adapting easystart 
+ * configuration to their own needs.
+ * 
+ * Largely, this class just provides easy to understand convenience methods.
+ * 
+ * @author Tom Hobbs
+ *
+ */
 public class ApplicationOptions extends DefaultOptions {
 
 	public ApplicationOptions() {
@@ -36,6 +45,40 @@ public class ApplicationOptions extends 
 		return this;
 	}
 	
+	/**
+	 * Self explanitory class, with the exception of one of the arguments.
+	 * 
+	 * Specifically, <code>stringLiteral</code> is used to determine what type
+	 * of content is supplied as the value of the <code>server</code> argument.
+	 * 
+	 * E.g. 
+	 * <code>
+	 * String server = "localhost";
+	 * int port = 8080;
+	 * boolean stringLiteral = true;
+	 * options.setHttpOptions(server, port, stringLiteral);
+	 * </code>
+	 * 
+	 * Or
+	 * <code>
+	 * String server = "ConfigUtil.getHostName()";
+	 * int port = 8080;
+	 * boolean stringLiteral = false;
+	 * options.setHttpOptions(server, port, stringLiteral);
+	 * </code>
+	 * 
+	 * In the second one, the value of <code>server</code> is actually a 
+	 * {@link ConfigurationFile} command to ascertain the hostname of server
+	 * on which the code is running.  Here, the value of 
+	 * <code>stringLiteral</code> is set to <code>false</code>. 
+	 * 
+	 * @param server
+	 * @param port
+	 * @param stringLiteral
+	 * 		  
+	 *    
+	 * @return
+	 */
 	public ApplicationOptions setHttpOptions(String server, int port, boolean stringLiteral) {
 		super.get(DefaultOptions.HTTP_SERVER).setOverride(String.valueOf(server), stringLiteral);
 		super.get(DefaultOptions.HTTP_PORT).setOverride(String.valueOf(port));
@@ -66,11 +109,21 @@ public class ApplicationOptions extends 
 		return this;
 	}
 	
+	/**
+	 * This class needs to be extended to support more {@link Entry}s than
+	 * just {@link Name}.
+	 * 
+	 * @param name
+	 * @return
+	 */
 	public ApplicationOptions addInitialLookupAttribute(Name name) {
 		super.getInitialLookupAttributes().add(name);
 		return this;
 	}
 	
+	/**
+	 * Provides a deep clone of the object.
+	 */
 	@Override
 	public Object clone() {
 		ApplicationOptions clone = new ApplicationOptions();
@@ -82,4 +135,5 @@ public class ApplicationOptions extends 
 		
 		return clone;
 	}
+
 }

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ConfigurationFactory.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ConfigurationFactory.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/ConfigurationFactory.java Thu Apr 19 12:10:36 2012
@@ -17,12 +17,30 @@
  */
 package org.apache.river.extra.easystart.config;
 
-
+/**
+ * Convenience class which allows for the easy creation of different types of
+ * configuration according to the supplied djinn options.
+ * 
+ * Users are encouraged to extend this class to provide additional configuration
+ * methods for their own services.
+ * 
+ * @author Tom Hobbs
+ *
+ */
 public class ConfigurationFactory {
 
 	private final ApplicationOptions options;
 	
+	/**
+	 * Creates such a configuration factory, and clones the supplied options
+	 * before it starts to use them.
+	 * 
+	 * @param options
+	 */
 	public ConfigurationFactory(ApplicationOptions options) {
+		if(null == options) {
+			throw new IllegalArgumentException("Input options cannot be null");
+		}
 		this.options = (ApplicationOptions) options.clone();
 	}
 
@@ -38,6 +56,11 @@ public class ConfigurationFactory {
 		return new TransactionServiceConfiguration(options);
 	}
 	
+	/**
+	 * Convenience method for extending classes to be able to get access to a 
+	 * clone of the supplied options.
+	 * @return
+	 */
 	protected ApplicationOptions getDefaultOptions() {
 		return (ApplicationOptions) this.options.clone();
 	}

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/DefaultOptions.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/DefaultOptions.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/DefaultOptions.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/DefaultOptions.java Thu Apr 19 12:10:36 2012
@@ -32,17 +32,83 @@ import org.apache.river.extra.easystart.
 import org.apache.river.extra.easystart.config.settings.ServerExporterSetting;
 import org.apache.river.extra.easystart.config.settings.Setting;
 
+/**
+ * Base implementation of the concept of creating a series of options to which
+ * a djinn's services should be started as.  Jini ports, lookup groups and so
+ * on.
+ * 
+ * Users are encouraged to use the more convenient {@link ApplicationOptions}
+ * version, or extend that class, instead of using this one directly.  However, 
+ * it is likely that in some instances it will be inevitable that this class must
+ * be extended or enhanced in some fashion.
+ * 
+ * At time of writing, it is only possible to reconfigure the most simplest and 
+ * common options for service starting.
+ * 
+ * For configuring specific classes of service, it is recommended that such 
+ * specialisations be made in specific implementations of 
+ * {@link AbstractEasyConfiguration}.  Follow links below for examples.
+ * 
+ * Typically, classes that pass implementations of DefaultOptions around should
+ * either clone their input argument before modification or a contract between
+ * classes should somehow be enforced so that they only receive a cloned object.
+ * 
+ * <b>Important:</b><br/>
+ * This class expects that the system environment <code>RIVER_HOME</code> has 
+ * been set.  The value should be the directory of the root of the River 
+ * installation.  For example, assuming the River distribution has been 
+ * downloaded and extracted to <code>/home/tom/java/river/River2.1/</code> such
+ * that <code>src</code>, <code>lib</code>, <code>lib-dl</code> etc are 
+ * immediately under that directory then <code>RIVER_HOME</code> should be set
+ * to <code>/home/tom/java/river/River2.1/</code>.
+ * 
+ * 
+ * Many of the static String fields specify <em>unique</em> names of different 
+ * configuration items for every service in the djinn.  In some instances, 
+ * e.g. <code>MEMBER_GROUPS</code> the value is set to a meaningful Jini
+ * epecification configuration entry, but this is not the case for all such
+ * fields.
+ * 
+ * @author Tom Hobbs
+ * 
+ * @see {@link LookupServiceConfiguration}
+ * @see {@link JavaSpaceConfiguration}
+ * @see {@link TransactionServiceConfiguration}
+ *
+ */
 public class DefaultOptions implements Cloneable {
 
 	private static final Logger LOGGER = Logger.getLogger(DefaultOptions.class.getName());
 
+	/**
+	 * String format which does not provide any markup.
+	 */
 	public static final String NO_FORMAT = "%s";
+	
+	/**
+	 * String format which puts double quotes around a supplied String.
+	 */
 	public static final String STRING_FORMAT = "\"%s\"";
+	
+	/**
+	 * String format which puts escaped quotes around a supplied String.
+	 * E.g. 
+	 * <code>
+	 * String s = "foo";
+	 * String formatted = String.format(ESCAPPED_STRING_FORMAT, s);
+	 * System.out.println(formatted);
+	 * </code>
+	 * would print <code>\"foo\"</code>
+	 * 
+	 */
 	public static final String ESCAPED_STRING_FORMAT = "\\\"%s\\\"";
+	
+	/**
+	 * String format for an integer
+	 */
 	public static final String INTEGER_FORMAT = "%s";
 	
-	private static final String RIVER_HOME_ENV_NAME = "RIVER_HOME";
-
+    // unique setting keys start
 	public static final String MEMBER_GROUP = "initialMemberGroups";
 	public static final String LOOKUP_GROUP = "initialLookupGroups";
 	public static final String RIVER_PORT = "initialUnicastDiscoveryPort";
@@ -55,17 +121,25 @@ public class DefaultOptions implements C
 	public static final String HTTP_SERVER = "httpServer";
 	public static final String SERVICE_NAME = "serviceName";
 	public static final String INITIAL_ATTRIBS = "initialLookupAttributes";
+	// unique setting keys end
 
+	public static final String DEFAULT_JINI_PORT = "4160";
+	public static final String DEFAULT_HTTP_PORT = "8080";
 	
-	private static String RIVER_HOME_DIR;
+	private static final String RIVER_HOME_ENV_NAME = "RIVER_HOME";
+	private static final String RIVER_HOME_DIR;
+	/**
+	 * Checks that the <code>RIVER_HOME</code> environment variable has been set
+	 */
 	static {
-		RIVER_HOME_DIR = (String) System.getProperties().get(RIVER_HOME_ENV_NAME);
-		if(null == RIVER_HOME_DIR) {
+		final String rh = (String) System.getProperties().get(RIVER_HOME_ENV_NAME);
+		if(null == rh) {
 			LOGGER.severe(RIVER_HOME_ENV_NAME+" has not been set");
 			RIVER_HOME_DIR = ".";
 		} else {
-			LOGGER.severe("Using "+RIVER_HOME_ENV_NAME+"="+RIVER_HOME_DIR);
+			RIVER_HOME_DIR = rh;
 		}
+		LOGGER.severe("Using "+RIVER_HOME_ENV_NAME+"="+RIVER_HOME_DIR);
 	}
 	
 	private final Map<String, Setting> options = new HashMap<String, Setting>();
@@ -73,8 +147,8 @@ public class DefaultOptions implements C
 	protected DefaultOptions() {
 		options.put(RIVER_HOME, new Setting(RIVER_HOME, RIVER_HOME_DIR, STRING_FORMAT, false));
 		options.put("servicePackageName", new Setting("servicePackageName", "org.apache.river", NO_FORMAT, false));
-		options.put(RIVER_PORT, new Setting(RIVER_PORT, "4160", INTEGER_FORMAT, true));
-		options.put(HTTP_PORT, new Setting(HTTP_PORT, "8080", INTEGER_FORMAT, false));
+		options.put(RIVER_PORT, new Setting(RIVER_PORT, DEFAULT_JINI_PORT, INTEGER_FORMAT, true));
+		options.put(HTTP_PORT, new Setting(HTTP_PORT, DEFAULT_HTTP_PORT, INTEGER_FORMAT, false));
 		options.put(MEMBER_GROUP, new GroupedSetting(MEMBER_GROUP,
 														new LinkedList<String>(),
 														NO_FORMAT, 
@@ -118,22 +192,66 @@ public class DefaultOptions implements C
 		}
 	}
 	
+	/**
+	 * 
+	 * @param key
+	 * @return
+	 * @throws IllegalArgumentException
+	 * 		   If no setting is found for that key
+	 */
 	protected Setting get(String key) {
-		return options.get(key);
+		Setting setting = options.get(key);
+		if(null != setting) {
+			return setting; 
+		} else {
+			throw new IllegalArgumentException("No Setting found for key ["+key+"]");
+		}
 	}
 	
+	/**
+	 * Convenience method to return the GroupedSetting for a given key.
+	 * 
+	 * @param key
+	 * @return
+	 * @throws IllegalArgumentException 
+	 * 			If no Setting was found for that key or if the object at that
+	 * 			key is not a GroupedSetting 
+	 */
 	protected GroupedSetting getGrouped(String key) {
-		return (GroupedSetting) get(key);
+		Setting setting = get(key);
+		if(setting instanceof GroupedSetting) {
+			return (GroupedSetting) setting;
+		} else {
+			throw new IllegalArgumentException("Setting for ["+key+"] was not a GroupedSetting.  Was "+setting.getClass().getName());
+		}
 	}
 	
+	/**
+	 * Convenience method to return the initial lookup attributes setting
+	 * 
+	 * @return
+	 */
 	protected InitialLookupAttributesSetting getInitialLookupAttributes() {
-		return (InitialLookupAttributesSetting) get(INITIAL_ATTRIBS);
+		Setting setting = get(INITIAL_ATTRIBS);
+		if(setting instanceof InitialLookupAttributesSetting) {
+			return (InitialLookupAttributesSetting) setting;
+		} else {
+			throw new IllegalArgumentException("Critical problem with settings.  Setting for initial lookup attributes was not of class "+InitialLookupAttributesSetting.class+" was "+setting.getClass().getName());
+		}
 	}
 	
+	/**
+	 * Returns all the options that have been set.
+	 * 
+	 * @return
+	 */
 	public Collection<Setting> getOptions() {
 		return options.values();
 	}
 	
+	/**
+	 * Does a deep clone of this class.
+	 */
 	@Override
 	public Object clone() {
 		Map<String, Setting> clonedOptions = new HashMap<String, Setting>();
@@ -146,8 +264,15 @@ public class DefaultOptions implements C
 		return new DefaultOptions(clonedOptions);
 	}
 
+	/**
+	 * Adds an extra setting to the DefaultOptions.  Ignores null input.
+	 * 
+	 * @param n
+	 */
 	public void add(Setting n) {
-		options.put(n.getName(), n);
+		if(null != n) {
+			options.put(n.getName(), n);
+		}
 	}
 	
 }

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/JavaSpaceConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/JavaSpaceConfiguration.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/JavaSpaceConfiguration.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/JavaSpaceConfiguration.java Thu Apr 19 12:10:36 2012
@@ -20,7 +20,11 @@ package org.apache.river.extra.easystart
 
 public class JavaSpaceConfiguration extends AbstractEasyConfiguration {
 
-	public JavaSpaceConfiguration(DefaultOptions opts) {
+	/**
+	 * Provides sufficient configuration options to start outrigger.
+	 * @param opts
+	 */
+	public JavaSpaceConfiguration(ApplicationOptions opts) {
 		super(opts);
 		
 		getDefaultOptions().get(DefaultOptions.PACKAGE_NAME).setOverride("com.sun.jini.outrigger");

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/LookupServiceConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/LookupServiceConfiguration.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/LookupServiceConfiguration.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/LookupServiceConfiguration.java Thu Apr 19 12:10:36 2012
@@ -20,7 +20,11 @@ package org.apache.river.extra.easystart
 
 public class LookupServiceConfiguration extends AbstractEasyConfiguration {
 
-	public LookupServiceConfiguration(DefaultOptions opts) {
+	/**
+	 * Provides sufficient configuration options to start reggie.
+	 * @param opts
+	 */
+	public LookupServiceConfiguration(ApplicationOptions opts) {
 		super(opts);
 		
 		getDefaultOptions().get(DefaultOptions.PACKAGE_NAME).setOverride("com.sun.jini.reggie");
@@ -31,6 +35,13 @@ public class LookupServiceConfiguration 
 		getDefaultOptions().getGrouped(DefaultOptions.CLASSPATH).add(opts.get(DefaultOptions.RIVER_HOME).getOverride()+"/lib/jsk-platform.jar");
 	}
 
+	/**
+	 * Remember that <em>member</em> and <em>lookup</em> groups behave different
+	 * for service registrars than they do for "normal" services.
+	 * 
+	 * @param grp
+	 * @return
+	 */
 	public LookupServiceConfiguration addMemberGroup(String grp) {
 		getGroupSetting(DefaultOptions.MEMBER_GROUP).add(grp);
 		return this;

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/TransactionServiceConfiguration.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/TransactionServiceConfiguration.java?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/TransactionServiceConfiguration.java (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/TransactionServiceConfiguration.java Thu Apr 19 12:10:36 2012
@@ -20,7 +20,11 @@ package org.apache.river.extra.easystart
 
 public class TransactionServiceConfiguration extends AbstractEasyConfiguration {
 
-	protected TransactionServiceConfiguration(DefaultOptions opts) {
+	/**
+	 * Provides sufficient configuration options to start mahalo.
+	 * @param opts
+	 */
+	protected TransactionServiceConfiguration(ApplicationOptions opts) {
 		super(opts);
 		
 		getDefaultOptions().get(DefaultOptions.PACKAGE_NAME).setOverride("com.sun.jini.mahalo");

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config?rev=1327920&r1=1327919&r2=1327920&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config Thu Apr 19 12:10:36 2012
@@ -22,6 +22,12 @@ import com.sun.jini.config.ConfigUtil;
 import com.sun.jini.start.NonActivatableServiceDescriptor;
 import com.sun.jini.start.ServiceDescriptor;
 
+/*
+ * An empty configuration to be overwritten programmatically by replacing 
+ * certain tokens.
+ *
+ */
+
 com.sun.jini.start {
 
     private static codebase = ${codebase};