Author: thobbs
Date: Fri Jan 27 22:01:42 2012
New Revision: 1236904

URL: http://svn.apache.org/viewvc?rev=1236904&view=rev
Log:
Added first, very rough, draft of sugar coating config

Added:
    river/jtsk/skunk/easystart/src-extra/build.xml
    river/jtsk/skunk/easystart/src-extra/empty.config
    river/jtsk/skunk/easystart/src-extra/instructions.txt
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbsolutePath.java
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbstractEasyConfiguration.java
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/LookupServiceConfiguration.java
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/MahaloServiceConfiguration.java
    
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/OutriggerServiceConfiguration.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
    river/jtsk/skunk/easystart/src-extra/policy.all
Modified:
    river/jtsk/skunk/easystart/build.xml

Modified: river/jtsk/skunk/easystart/build.xml
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/build.xml?rev=1236904&r1=1236903&r2=1236904&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/build.xml (original)
+++ river/jtsk/skunk/easystart/build.xml Fri Jan 27 22:01:42 2012
@@ -2300,4 +2300,8 @@
         </junit>
     </target>
 
+    <target name="build.extras">
+       <ant dir="src-extra" target="build"/>
+    </target>
+    
 </project>

Added: river/jtsk/skunk/easystart/src-extra/build.xml
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/build.xml?rev=1236904&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/build.xml (added)
+++ river/jtsk/skunk/easystart/src-extra/build.xml Fri Jan 27 22:01:42 2012
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ! 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.
+ !-->
+
+<project name="river-extras" basedir="." default="build"
+        xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+       
+       <property name="extras.classes" value="./classes"/>
+       <property name="river.jars" value="../lib"/>
+       <property name="river.extras.jar" 
value="${river.jars}/river-extras.jar"/>
+       
+       <path id="river.lib">
+               <pathelement path="../lib/jsk-platform.jar"/>
+               <pathelement path="../lib/jsk-lib.jar"/>
+               <pathelement path="../lib/tools.jar"/>
+       </path>
+       
+       <target name="clean">
+               <delete dir="${extras.classes}"/>
+       </target>
+       
+       <target name="init" depends="clean">
+               <mkdir dir="${extras.classes}"/>
+       </target>
+       
+       <target name="compile" depends="init">
+               <javac srcdir="." 
+                          destdir="${extras.classes}"
+                          source="6"
+                          target="6">
+                       <classpath refid="river.lib"/>
+               </javac>
+       </target>
+       
+       <target name="jar" depends="compile">
+               <jar destfile="${river.extras.jar}">
+                       <fileset dir="${extras.classes}" includes="**/*.class"/>
+                       <fileset dir="." includes="**/*.config"/>
+                       <fileset dir="." includes="**/*.policy"/>
+               </jar>
+       </target>
+       
+       <target name="build" depends="init,compile,jar,clean">
+               <antcall target="clean"/>
+       </target>
+       
+</project>
\ No newline at end of file

Added: river/jtsk/skunk/easystart/src-extra/empty.config
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/empty.config?rev=1236904&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/empty.config (added)
+++ river/jtsk/skunk/easystart/src-extra/empty.config Fri Jan 27 22:01:42 2012
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+import net.jini.jrmp.JrmpExporter;
+
+river.empty {
+
+// Everything must now be overridden
+
+}

Added: river/jtsk/skunk/easystart/src-extra/instructions.txt
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/instructions.txt?rev=1236904&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/instructions.txt (added)
+++ river/jtsk/skunk/easystart/src-extra/instructions.txt Fri Jan 27 22:01:42 
2012
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+ 
+1. Download the River source and expand to an Eclipse workspace
+2. Open Eclipse, "New Project", give it the name that you've downloaded to for 
project home
+3. Open the Ant view, and move the build.xml into it
+4. Run the all.build Ant task, on my laptop this takes approximately 6.5 
minutes
+5. Run the build.extras Ant task to build the additional JARs
+
+This has built the River distribution and put it all in lib, lib-dl and 
lib-ext directories inside your project.
+
+So let's call your project directory $RIVER_HOME.  We now have the dirs
+ - $RIVER_HOME/lib
+ - $RIVER_HOME/lib-dl
+ - $RIVER_HOME/lib-ext
+ 
+It's important to know what the value of these directories are because we'll 
need them later.
+
+= Starting The HTTP Server =
+
+Supplying the correct arguments, run the StartHttpServer.java found in ...
+
+The correct arguments are;
+
+args[0] = $RIVER_HOME
+args[1] = HTTP port to use
+
+You should get some nice output.  You can validate that it's working correctly 
by using a browser (or wget) and trying to download 
"http://localhost:8081/reggie-dl.jar";
+
+= Starting a Lookup Service = 
+
+Notice the difference between the lookup service's memberGroups and 
lookupGroups and the lookuoGroups as specified for different services
\ No newline at end of file

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbsolutePath.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbsolutePath.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbsolutePath.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbsolutePath.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.river.extra.easystart;
+
+public class AbsolutePath {
+
+       private final String path;
+       
+       public AbsolutePath(String path) {
+               this.path = path;
+       }
+       
+       public String getPath() {
+               return path;
+       }
+       
+}

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbstractEasyConfiguration.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbstractEasyConfiguration.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbstractEasyConfiguration.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/AbstractEasyConfiguration.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,222 @@
+/*
+ * 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.easystart;
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.util.LinkedList;
+import java.util.List;
+
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.core.entry.Entry;
+import net.jini.lookup.entry.ServiceInfo;
+import net.jini.security.BasicProxyPreparer;
+import net.jini.security.ProxyPreparer;
+
+import com.sun.jini.config.ConfigUtil;
+import com.sun.jini.start.NonActivatableServiceDescriptor;
+import com.sun.jini.start.ServiceDescriptor;
+
+public abstract class AbstractEasyConfiguration implements Configuration  {
+
+       public static final int DEFAULT_HTTP_PORT = 8080;
+       public static final String DEFAULT_EMPTY_CONFIG = "empty.config";
+       
+       private final int httpPort;
+       private final String riverHome;
+       private final AbsolutePath pathToStartConfig;
+       private final AbsolutePath pathToPolicy;
+       private final AbsolutePath[] serviceClasspath;
+       private final List<String> lookupGroups = new LinkedList<String>();
+       private final List<String> requiredJars = new LinkedList<String>();
+       private final List<Entry> entries = new LinkedList<Entry>();
+       private ServiceInfo serviceInfo;
+       
+//     protected AbstractEasyConfiguration() {
+//             this(DEFAULT_HTTP_PORT, 
+//                      System.getProperty("RIVER_HOME"),
+//                      DEFAULT_EMPTY_CONFIG);
+//     }
+       
+       protected AbstractEasyConfiguration(int httpPort,
+                                                                               
String riverHome,
+                                                                               
AbsolutePath pathToStartConfig,
+                                                                               
AbsolutePath pathToPolicy,
+                                                                               
AbsolutePath[] serviceClasspath) {
+               this.httpPort = httpPort;
+               this.riverHome = validateRiverHome(riverHome);
+               this.pathToStartConfig = pathToStartConfig;
+               this.pathToPolicy = pathToPolicy;
+               this.serviceClasspath = serviceClasspath;
+       }
+       
+       public void addLookupGroup(String grpName) {
+               lookupGroups.add(grpName);
+       }
+
+       public void addRequiredJar(String jarName) {
+               requiredJars.add(jarName);
+       }
+       
+       public void addEntry(Entry entry) {
+               entries.add(entry);
+       }
+       
+       public void setServiceInfo(ServiceInfo si) {
+               this.serviceInfo = si;
+       }
+       
+       protected String buildCodebase() throws UnknownHostException {
+               StringBuilder sb = new StringBuilder();
+               int count = 0;
+               for(String jarName : requiredJars) {
+                       sb.append("http://";)
+                         .append(ConfigUtil.getHostName())
+                         .append(':')
+                         .append(this.httpPort)
+                         .append('/')
+                         .append(jarName);
+                       if(++count < requiredJars.size()) {
+                               sb.append(' ');
+                       }
+               }
+               
+               return sb.toString();
+       }
+       
+       private String buildLookupGroups() {
+               StringBuilder sb = new StringBuilder();
+               sb.append("com.sun.jini.outrigger.initialLookupGroups=new 
String[] {");
+               int count = 0;
+               for(String grp : lookupGroups) {
+                       sb.append('\"')
+                       .append(grp)
+                       .append('\"');
+                       if(++count < lookupGroups.size()) {
+                               sb.append(',');
+                       }
+               }
+               sb.append('}');
+               
+               return sb.toString();
+       }
+       private String buildClasspath() {
+               StringBuilder sb = new StringBuilder();
+               int count = 0;
+               for(AbsolutePath cp : serviceClasspath) {
+                       sb.append('\"')
+                         .append(cp.getPath())
+                         .append('\"');
+                       if(++count < serviceClasspath.length) {
+                               sb.append(';');
+                       }
+               }
+               
+               return sb.toString();
+       }
+       
+       protected ServiceDescriptor[] serviceDescriptorArray() {
+               
+               try {
+                       String codebase = buildCodebase();
+                       final String policy = this.pathToPolicy.getPath();
+                       final String classpath = buildClasspath();
+                       final String config = this.pathToStartConfig.getPath();
+               
+                       return new ServiceDescriptor[] {        
+                               new NonActivatableServiceDescriptor(
+                                   codebase,   
+                                   policy, 
+                                   classpath,
+                                   
"com.sun.jini.outrigger.TransientOutriggerImpl",
+                                   new String[] { config, 
+                                                      
"com.sun.jini.mahalo.serverExporter=new net.jini.jrmp.JrmpExporter()",
+                                                      buildLookupGroups(),
+                                                      
//"com.sun.jini.mahalo.nameEntry=new net.jini.lookup.entry.Name(\"transName\")",
+                                                      
//"com.sun.jini.mahalo.serviceInfo=new 
net.jini.lookup.entry.ServiceInfo(\"transName\", \"manufacturer\", \"vendor\", 
\"version\", \"model\", \"serialNumber\")",
+                                                      
//"com.sun.jini.mahalo.initialLookupAttributes = new 
net.jini.core.entry.Entry[] { serviceInfo, nameEntry }"
+                                                      }
+                                   )
+                               };
+               
+               } catch (UnknownHostException e) {
+                       throw new RuntimeException(e);
+               }
+               
+       }
+       
+       @Override
+       public Object getEntry(String component, String name, Class type)
+                       throws ConfigurationException {
+               return null;
+       }
+
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue) throws ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("serviceDescriptors".equals(name)) {
+                               return serviceDescriptorArray();
+                       } else if ("loginContext".equals(name)) {
+                               return null;
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+       
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue, Object data) throws 
ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("servicePreparer".equals(name)) {
+                               return servicePreparer();
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+
+       private ProxyPreparer servicePreparer() {
+               return new BasicProxyPreparer();
+       }
+       
+       private String validateRiverHome(String dirName) {
+               if(null == dirName || 0 == dirName.trim().length()) {
+                       throw new IllegalArgumentException("RIVER_HOME has not 
been set");
+               }
+               
+               File dir = new File(dirName);
+               if(!dir.exists() || !dir.isDirectory()) {
+                       throw new IllegalArgumentException(dirName + " 
(RIVER_HOME) does not exist or is not a directory");
+               }
+               
+               return dirName;
+       }
+       
+       private String validateConfig(String pathToConfig) {
+               return pathToConfig;
+       }
+       
+}

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/CheckServices.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,134 @@
+/*
+ * 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.easystart;
+
+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();
+       }
+
+       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 {
+               LookupLocator ll = new LookupLocator("jini://localhost");
+               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 {
+               LookupLocator ll = new LookupLocator("jini://localhost");
+               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 {
+               LookupLocator ll = new LookupLocator("jini://localhost");
+               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");
+               }
+       }
+
+}
\ No newline at end of file

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/LookupServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/LookupServiceConfiguration.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/LookupServiceConfiguration.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/LookupServiceConfiguration.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,110 @@
+/*
+ * 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.easystart;
+
+import java.net.UnknownHostException;
+
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.security.BasicProxyPreparer;
+import net.jini.security.ProxyPreparer;
+
+import com.sun.jini.config.ConfigUtil;
+import com.sun.jini.start.NonActivatableServiceDescriptor;
+import com.sun.jini.start.ServiceDescriptor;
+
+public class LookupServiceConfiguration implements Configuration {
+
+       @Override
+       public Object getEntry(String component, String name, Class type)
+                       throws ConfigurationException {
+               return null;
+       }
+
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue) throws ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("serviceDescriptors".equals(name)) {
+                               return serviceDescriptorArray();
+                       } else if ("loginContext".equals(name)) {
+                               return null;
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+       
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue, Object data) throws 
ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("servicePreparer".equals(name)) {
+                               return servicePreparer();
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+
+       private ProxyPreparer servicePreparer() {
+               return new BasicProxyPreparer();
+       }
+
+       
+       private ServiceDescriptor[] serviceDescriptorArray() {
+               final String port = "8080";
+               try {
+                       String codebase = ConfigUtil.concat(
+                                   new Object[] { 
+                                               "http://";, 
ConfigUtil.getHostName(), ":"+port+"/reggie-dl.jar",
+                                               " ",
+                                           "http://";, 
ConfigUtil.getHostName(), ":"+port+"/jsk-dl.jar" } );
+               
+               final String policy = 
"/home/tom/projects/river/easystart/src-extra/reggie.policy";
+               final String classpath = 
"/home/tom/projects/river/easystart/lib/reggie.jar";
+               final String config = 
"/home/tom/projects/river/easystart/src-extra/empty.config";
+//             final String config = 
"/home/tom/projects/river/easystart/src-extra/jrmp-reggie.config";
+               
+               
+               return new ServiceDescriptor[] {        
+                       new NonActivatableServiceDescriptor(
+                           codebase,   
+                           policy, 
+                           classpath,
+                           "com.sun.jini.reggie.TransientRegistrarImpl",
+                           new String[] { config, 
+                                              
"com.sun.jini.reggie.serverExporter=new net.jini.jrmp.JrmpExporter()",
+                                              
"com.sun.jini.reggie.initialMemberGroups=new String[] { \"Lester\", \"Jeff\" }",
+                                              
"com.sun.jini.reggie.initialLookupGroups=new String[] { \"LUG1\", \"LUG2\" }",
+                                              "com.sun.jini.reggie.port="+port,
+                                              
"com.sun.jini.reggie.nameEntry=new net.jini.lookup.entry.Name(\"newName\")",
+                                              
"com.sun.jini.reggie.initialLookupAttributes = new net.jini.core.entry.Entry[] 
{ nameEntry }"/*,
+                                              
"com.sun.jini.reggie.initialUnicastDiscoveryPort=4144"*/})};
+               
+               } catch (UnknownHostException e) {
+                       throw new RuntimeException(e);
+               }
+       }
+       
+}

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/MahaloServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/MahaloServiceConfiguration.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/MahaloServiceConfiguration.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/MahaloServiceConfiguration.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,108 @@
+/*
+ * 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.easystart;
+
+import java.net.UnknownHostException;
+
+import net.jini.config.Configuration;
+import net.jini.config.ConfigurationException;
+import net.jini.security.BasicProxyPreparer;
+import net.jini.security.ProxyPreparer;
+
+import com.sun.jini.config.ConfigUtil;
+import com.sun.jini.start.NonActivatableServiceDescriptor;
+import com.sun.jini.start.ServiceDescriptor;
+
+public class MahaloServiceConfiguration implements Configuration {
+
+       @Override
+       public Object getEntry(String component, String name, Class type)
+                       throws ConfigurationException {
+               return null;
+       }
+
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue) throws ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("serviceDescriptors".equals(name)) {
+                               return serviceDescriptorArray();
+                       } else if ("loginContext".equals(name)) {
+                               return null;
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+       
+       @Override
+       public Object getEntry(String component, String name, Class type,
+                       Object defaultValue, Object data) throws 
ConfigurationException {
+               if("com.sun.jini.start".equals(component)) {
+                       if("servicePreparer".equals(name)) {
+                               return servicePreparer();
+                       } else {
+                               return null;
+                       }
+               } else {
+                       return null;
+               }
+       }
+
+       private ProxyPreparer servicePreparer() {
+               return new BasicProxyPreparer();
+       }
+
+       
+       private ServiceDescriptor[] serviceDescriptorArray() {
+               final String port = "8081";
+               try {
+                       String codebase = ConfigUtil.concat(
+                                   new Object[] { 
+                                               "http://";, 
ConfigUtil.getHostName(), ":"+port+"/mahalo-dl.jar",
+                                               " ",
+                                           "http://";, 
ConfigUtil.getHostName(), ":"+port+"/jsk-dl.jar" } );
+               
+               final String policy = 
"/home/tom/projects/river/easystart/src-extra/mahalo.policy";
+               final String classpath = 
"/home/tom/projects/river/easystart/lib/mahalo.jar";
+               final String config = 
"/home/tom/projects/river/easystart/src-extra/empty.config";
+//             final String config = 
"/home/tom/projects/river/easystart/src-extra/jrmp-outrigger-group.config";
+//             final String config = 
"/home/tom/projects/river/easystart/src-extra/jrmp-reggie.config";
+               
+               return new ServiceDescriptor[] {        
+                       new NonActivatableServiceDescriptor(
+                           codebase,   
+                           policy, 
+                           classpath,
+                           "com.sun.jini.mahalo.TransientMahaloImpl",
+                           new String[] { config, 
+                                              
"com.sun.jini.mahalo.serverExporter=new net.jini.jrmp.JrmpExporter()",
+                                              
"com.sun.jini.mahalo.initialLookupGroups=new String[] { \"Lester\", \"Jeff\" }",
+                                              
"com.sun.jini.mahalo.nameEntry=new net.jini.lookup.entry.Name(\"transName\")",
+                                              
"com.sun.jini.mahalo.serviceInfo=new 
net.jini.lookup.entry.ServiceInfo(\"transName\", \"manufacturer\", \"vendor\", 
\"version\", \"model\", \"serialNumber\")",
+                                              
"com.sun.jini.mahalo.initialLookupAttributes = new net.jini.core.entry.Entry[] 
{ serviceInfo, nameEntry }"})};
+               
+               } catch (UnknownHostException e) {
+                       throw new RuntimeException(e);
+               }
+       }
+       
+}

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/OutriggerServiceConfiguration.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/OutriggerServiceConfiguration.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/OutriggerServiceConfiguration.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/OutriggerServiceConfiguration.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,68 @@
+/*
+ * 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.easystart;
+
+
+public class OutriggerServiceConfiguration extends AbstractEasyConfiguration {
+
+
+       
+       protected OutriggerServiceConfiguration(int httpPort, 
+                                                                               
        String riverHome,
+                                                                               
        AbsolutePath pathToStartConfig, 
+                                                                               
        AbsolutePath pathToPolicy,
+                                                                               
        AbsolutePath[] serviceClasspath) {
+               super(httpPort, riverHome, pathToStartConfig, pathToPolicy, 
serviceClasspath);
+       }
+
+//     @Override
+//     protected ServiceDescriptor[] serviceDescriptorArray() {
+//             final String port = "8081";
+//             try {
+//                     String codebase = ConfigUtil.concat(
+//                                 new Object[] { 
+//                                             "http://";, 
ConfigUtil.getHostName(), ":"+port+"/outrigger-dl.jar",
+//                                             " ",
+//                                         "http://";, 
ConfigUtil.getHostName(), ":"+port+"/jsk-dl.jar" } );
+//             
+//             final String policy = 
"/home/tom/projects/river/easystart/src-extra/outrigger.policy";
+//             final String classpath = 
"/home/tom/projects/river/easystart/lib/outrigger.jar";
+//             final String config = 
"/home/tom/projects/river/easystart/src-extra/empty.config";
+////           final String config = 
"/home/tom/projects/river/easystart/src-extra/jrmp-outrigger-group.config";
+////           final String config = 
"/home/tom/projects/river/easystart/src-extra/jrmp-reggie.config";
+//             
+//             return new ServiceDescriptor[] {        
+//                     new NonActivatableServiceDescriptor(
+//                         codebase,   
+//                         policy, 
+//                         classpath,
+//                         "com.sun.jini.outrigger.TransientOutriggerImpl",
+//                         new String[] { config, 
+//                                            
"com.sun.jini.outrigger.serverExporter=new net.jini.jrmp.JrmpExporter()",
+//                                            
"com.sun.jini.outrigger.initialLookupGroups=new String[] { \"Lester\", \"Jeff\" 
}",
+//                                            
"com.sun.jini.outrigger.nameEntry=new 
net.jini.lookup.entry.Name(\"spaceName\")",
+//                                            
"com.sun.jini.outrigger.serviceInfo=new 
net.jini.lookup.entry.ServiceInfo(\"spaceName\", \"manufacturer\", \"vendor\", 
\"version\", \"model\", \"serialNumber\")",
+//                                            
"com.sun.jini.outrigger.initialLookupAttributes = new 
net.jini.core.entry.Entry[] { serviceInfo, nameEntry }"})};
+//             
+//             } catch (UnknownHostException e) {
+//                     throw new RuntimeException(e);
+//             }
+//     }
+       
+}

Added: 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartHttpServer.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartHttpServer.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartHttpServer.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartHttpServer.java
 Fri Jan 27 22:01:42 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.easystart;
+
+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/org/apache/river/extra/easystart/StartLookupService.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartLookupService.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartLookupService.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartLookupService.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.easystart;
+
+import java.io.File;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+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 
+        */
+       public static void main(String[] args) throws ConfigurationException {
+               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);
+               
+               ServiceStarter.main(new LookupServiceConfiguration());
+       }
+
+       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/org/apache/river/extra/easystart/StartMahaloService.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartMahaloService.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartMahaloService.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartMahaloService.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,70 @@
+/*
+ * 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.easystart;
+
+import java.io.File;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+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 
+        */
+       public static void main(String[] args) throws ConfigurationException {
+               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);
+               
+               ServiceStarter.main(new MahaloServiceConfiguration());
+       }
+
+       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/org/apache/river/extra/easystart/StartOutriggerService.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartOutriggerService.java?rev=1236904&view=auto
==============================================================================
--- 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartOutriggerService.java
 (added)
+++ 
river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/StartOutriggerService.java
 Fri Jan 27 22:01:42 2012
@@ -0,0 +1,86 @@
+/*
+ * 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.easystart;
+
+import java.io.File;
+import java.util.logging.Logger;
+
+import net.jini.config.ConfigurationException;
+
+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 
+        */
+       public static void main(String[] args) throws ConfigurationException {
+               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 String riverHome = "/home/tom/projects/river/easystart";
+               final String pathToConfig = 
"/home/tom/projects/river/easystart/src-extra/empty.config";
+               final String pathToPolicy = 
"/home/tom/projects/river/easystart/src-extra/outrigger.policy";
+               final String classpath = 
"/home/tom/projects/river/easystart/lib/outrigger.jar";
+               
+               OutriggerServiceConfiguration config = new 
OutriggerServiceConfiguration(8080,
+                               riverHome,
+                               new AbsolutePath(pathToConfig),
+                               new AbsolutePath(pathToPolicy),
+                               new AbsolutePath[] {
+                                       new AbsolutePath(classpath)
+                               }
+               );
+               config.addLookupGroup("Lester");
+               config.addLookupGroup("Jeff");
+               
+               ServiceStarter.main(config);
+       }
+
+       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/policy.all
URL: 
http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/policy.all?rev=1236904&view=auto
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/policy.all (added)
+++ river/jtsk/skunk/easystart/src-extra/policy.all Fri Jan 27 22:01:42 2012
@@ -0,0 +1,3 @@
+grant {
+    permission java.security.AllPermission "", "";
+};


Reply via email to