From: Bruce H. <bh...@bh...> - 2007-07-25 19:11:22
|
You may want to consider rather than creating your own REPL using OSGi's built in extensible console. You can read about how to do that here: http://www.ibm.com/developerworks/library/os-ecl-osgiconsole/index.html (just skip to the Extending the console section). This would probably be good especially if we start to provide even more of these kind of insider utilities. Also, it should say "CIShell's Converter Tester" (though i'm not sure an introduction is really ncessary on the console...). This hasn't been stressed enough, but CIShell is the technology. The technology related stuff for our cyberinfrastructure development should be placed under the cishell umbrella. Algorithms, datasets, and converters that are specific to network science belong to Network Workbench. Sometimes its fuzzy, but that is the split for the most part. This choice has been made because of our years of experience well before network workbench even existed. We will reuse this technology over and over again on different cyberinfrastructures. And ideally other groups will create their own applications and cyberinfrastructures from this base. Lemme know if you are ever unsure of where something belongs or what it should be named. Bruce On 7/25/07, mwl...@us... <mwl...@us...> wrote: > Revision: 436 > http://cishell.svn.sourceforge.net/cishell/?rev=436&view=rev > Author: mwlinnem > Date: 2007-07-25 11:18:02 -0700 (Wed, 25 Jul 2007) > > Log Message: > ----------- > Initial import. Separates out the commandline code from the core ConverterTester. > > Added Paths: > ----------- > trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/ > trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF > trunk/testing/org.cishell.testing.convertertester.commandline/build.properties > trunk/testing/org.cishell.testing.convertertester.commandline/src/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/ > trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java > > Added: trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF > =================================================================== > --- trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF (rev 0) > +++ trunk/testing/org.cishell.testing.convertertester.commandline/META-INF/MANIFEST.MF 2007-07-25 18:18:02 UTC (rev 436) > @@ -0,0 +1,18 @@ > +Manifest-Version: 1.0 > +Bundle-ManifestVersion: 2 > +Bundle-Name: Converter Tester Command-Line > +Bundle-SymbolicName: org.cishell.testing.convertertester.commandline > +Bundle-Version: 0.0.1 > +Bundle-ClassPath: . > +Bundle-Localization: plugin > +Import-Package: org.cishell.framework, > + org.cishell.framework.algorithm, > + org.cishell.framework.data, > + org.cishell.service.conversion, > + org.osgi.framework;version="1.3.0", > + org.osgi.service.component;version="1.0.0", > + org.osgi.service.log;version="1.3.0", > + org.osgi.service.metatype;version="1.1.0", > + org.osgi.service.prefs;version="1.1.0" > +Bundle-Activator: org.cishell.testing.convertertester.commandline.Activator > +Require-Bundle: org.cishell.testing.convertertester.core.new > > Added: trunk/testing/org.cishell.testing.convertertester.commandline/build.properties > =================================================================== > --- trunk/testing/org.cishell.testing.convertertester.commandline/build.properties (rev 0) > +++ trunk/testing/org.cishell.testing.convertertester.commandline/build.properties 2007-07-25 18:18:02 UTC (rev 436) > @@ -0,0 +1,4 @@ > +source.. = src/ > +output.. = build/ > +bin.includes = META-INF/,\ > + . > > Added: trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java > =================================================================== > --- trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java (rev 0) > +++ trunk/testing/org.cishell.testing.convertertester.commandline/src/org/cishell/testing/convertertester/commandline/Activator.java 2007-07-25 18:18:02 UTC (rev 436) > @@ -0,0 +1,91 @@ > +package org.cishell.testing.convertertester.commandline; > + > +import java.io.File; > +import java.io.FileNotFoundException; > +import java.util.Scanner; > + > +import org.cishell.framework.CIShellContext; > +import org.cishell.framework.LocalCIShellContext; > +import org.cishell.testing.convertertester.core.tester.ConverterTester; > +import org.osgi.framework.BundleActivator; > +import org.osgi.framework.BundleContext; > + > + > +public class Activator implements BundleActivator{ > + private ConverterTester ct; > + private BundleContext b; > + private CIShellContext c; > + private File configFile; > + > + public static final String QUIT = "q"; > + > + public void start(BundleContext b){ > + this.b = b; > + this.c = new LocalCIShellContext(b); > + > + startCommandLine(); > + } > + > + > + > + public void stop(BundleContext b){ > + System.out.println("Goodbye!"); > + > + b = null; > + c = null; > + configFile = null; > + ct = null; > + } > + > + public void startCommandLine(){ > + Scanner in = new Scanner(System.in); > + while(true) { > + System.out.println("Welcome to NWB's Converter Tester"); > + System.out.println( "Please enter the name of a configuration " + > + "file or\n a directory of configuration files (" + QUIT + > + ") to quit): "); > + > + String s = in.nextLine(); > + if(s.trim().equalsIgnoreCase(QUIT)) > + break; > + try{ > + configFile = new File(s); > + processConfigurationFile(configFile); > + } > + catch (NullPointerException ex){ > + System.out.println("Invalid file name");; > + } > + catch(FileNotFoundException fnfe){ > + System.out.println("Could not find the specified " + > + "configuration file"); > + } > + } > + } > + > + private void processConfigurationFile(File f) > + throws FileNotFoundException { > + System.out.println("Processing " + f.getName()); > + if(!f.isHidden() && (f.getName().charAt(0) != '.')){ > + if(f.isDirectory()){ > + File[] files = f.listFiles(); > + for (int ii = 0; ii < files.length; ii++) { > + File ff = files[ii]; > + processConfigurationFile(ff); > + } > + } > + else{ > + try{ > + ct = new ConverterTester(b, c, f); > + System.out.println(ct); > + ct.testFiles(); > + ct.printResults(); > + }catch(Exception ex){ > + System.out.println("Failed to create " + > + "ConverterTester\n\n"); > + ex.printStackTrace(); > + } > + } > + } > + } > +} > + > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Cishell-svn mailing list > Cis...@li... > https://lists.sourceforge.net/lists/listinfo/cishell-svn > -- Bruce Herr Senior Software Developer Cyberinfrastructure for Network Science Center School of Library and Information Science Indiana University 10th Street & Jordan Avenue Phone: (812) 856-7034 Fax: -6166 Main Library 022 E-mail: bh...@bh... Bloomington, IN 47405, USA |