You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
|
Sep
(46) |
Oct
(102) |
Nov
(10) |
Dec
(21) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(1) |
Feb
(3) |
Mar
(14) |
Apr
(9) |
May
(12) |
Jun
(4) |
Jul
(40) |
Aug
(60) |
Sep
(38) |
Oct
(2) |
Nov
(1) |
Dec
(42) |
2008 |
Jan
(23) |
Feb
(29) |
Mar
(107) |
Apr
(27) |
May
(3) |
Jun
(1) |
Jul
(15) |
Aug
(7) |
Sep
(19) |
Oct
|
Nov
(2) |
Dec
|
2009 |
Jan
(36) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(15) |
Jul
(30) |
Aug
(32) |
Sep
(11) |
Oct
(21) |
Nov
(12) |
Dec
(15) |
2010 |
Jan
(29) |
Feb
(9) |
Mar
(25) |
Apr
|
May
(7) |
Jun
(5) |
Jul
(21) |
Aug
(32) |
Sep
(10) |
Oct
(8) |
Nov
(29) |
Dec
(8) |
2011 |
Jan
(9) |
Feb
(35) |
Mar
(11) |
Apr
(4) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(30) |
2012 |
Jan
(5) |
Feb
(7) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mwl...@us...> - 2007-07-24 19:25:38
|
Revision: 429 http://svn.sourceforge.net/cishell/?rev=429&view=rev Author: mwlinnem Date: 2007-07-24 12:25:33 -0700 (Tue, 24 Jul 2007) Log Message: ----------- Initial import. Added Paths: ----------- trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/ trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/algorithm.properties trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/component.xml trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/l10n/ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/l10n/bundle_en.properties trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/metatype/ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/metatype/METADATA.XML trunk/testing/org.cishell.testing.convertertester.core.new/build.properties trunk/testing/org.cishell.testing.convertertester.core.new/src/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/Activator.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/ConfigurationFileParser.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLToPrefuseTographML trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLTonetTographML trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoNWBtographML.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoPrefuseGraphtoGraphML.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtographMLTest.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonet.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonwbTonet.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonetTonwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonwbTest.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtoprefuseTreetotreeML.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtotreeML.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmlToxgmml.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmltoPrefuseAlphatoxgmml.cfg trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Edge Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Edge Files/1.edge trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Edge Files/2.edge trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Edge Files/3.edge trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Full Converter.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/directedness1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/directedness2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgeattributes1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgeattributes2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgecount1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgecount2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgefrequency1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgefrequency2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgefrequency3.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/edgefrequency4.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor3.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor4.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor5.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/neighbor6.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodeattributes1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodeattributes2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodeattributes3.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodeattributes4.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodecount1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/nodecount2.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/GraphML Files/terror1.graphml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile1.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile2.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile3.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile3nocomment.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile4.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile5.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile6.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile7.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile8.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NET Files/TestFile9.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile1.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile2.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile3.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile4.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile5.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile6.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile7.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile8.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/TestFile9.net trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/NWB Files/fittestperGeneration1179169554713.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TestFile8.net.1.nwb trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TestFile8.net.1.nwb.1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TestFile8.net.1.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TreeML Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TreeML Files/mwlinnem_dir_tree.treeml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TreeML Files/nwb_dir_tree.treeml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TreeML Files/treeml_sample.treeml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/XGMML Files/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/XGMML Files/friendster.xgmml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/XGMML Files/terror.xgmml.xml trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/fullconverterGraph.png trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConfigurationFileConstants.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/ConverterTester.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/ComparisonResult.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/DefaultGraphComparer.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/GraphComparer.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/GraphComparerTester.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/GraphUtil.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/tester/graphcomparison/RunningLog.java Added: trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/META-INF/MANIFEST.MF 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Converter Tester Core +Bundle-SymbolicName: org.cishell.testing.convertertester.core.new +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.core.service.Activator +Require-Bundle: org.prefuse.lib +Export-Package: org.cishell.testing.convertertester.core.tester Added: trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/algorithm.properties =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/algorithm.properties (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/algorithm.properties 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,7 @@ +#menu_path=Visualization/SubMenu/additions +label=My Algorithm +description=This algorithm does this and this... +in_data=file:mime/type or java.lang.ClassName or null +out_data=file:mime/type or java.lang.ClassName or null +service.pid=org.my.algorithm.MyAlgorithm +remoteable=false Added: trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/component.xml =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/component.xml (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/component.xml 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.my.algorithm.MyAlgorithm.component" immediate="false"> + <implementation class="org.my.algorithm.MyAlgorithmFactory"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/l10n/bundle_en.properties 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/OSGI-INF/metatype/METADATA.XML 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="My Algorithm" id="org.my.algorithm.MyAlgorithm.OCD" + description="This algorithm does this and this... "> + </OCD> + <Designate pid="org.my.algorithm.MyAlgorithm"> + <Object ocdref="org.my.algorithm.MyAlgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: trunk/testing/org.cishell.testing.convertertester.core.new/build.properties =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/build.properties (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/build.properties 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,5 @@ +source.. = src/ +output.. = build/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterLoaderImpl.java 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,228 @@ +package org.cishell.testing.convertertester.core.converter; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Map; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.service.conversion.Converter; +import org.cishell.service.conversion.DataConversionService; +import org.osgi.framework.BundleContext; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceEvent; +import org.osgi.framework.ServiceListener; +import org.osgi.framework.ServiceReference; + + + +public class ConverterLoaderImpl implements AlgorithmProperty, DataConversionService, ServiceListener{ + //private Converter[] testConverters; //to store the chain of converters we want to test. + //private Converter[] toGraphObjectConverters; //to store the chain of converters to convert the files to prefuse or jung Graph objects. + //private BundleContext bContext; +public final static String SERVICE_LIST = "SERVICE_LIST"; + private Map converterList; + private BundleContext bContext; + private CIShellContext ciContext; + // private Map dataTypeToVertex; + // private Graph graph; + + public ConverterLoaderImpl(BundleContext bContext, CIShellContext cContext){ + this.ciContext = cContext; + this.bContext = bContext; + converterList = new Hashtable(); + + //this.graph = new DirectedSparseGraph(); + // this.dataTypeToVertex = new Hashtable(); + + String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_CONVERTER+"))"; + //printConverters(bContext); + + try { + this.bContext.addServiceListener(this, filter); + } catch (InvalidSyntaxException e) { + e.printStackTrace(); + } + assembleGraph(); + } + + private void assembleGraph() { + try { + String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_CONVERTER+"))";// + + /* "("+IN_DATA+"=*) " + + "("+OUT_DATA+"=*)" + + "(!("+REMOTE+"=*))" + + "(!("+IN_DATA+"=file-ext:*))" + + "(!("+OUT_DATA+"=file-ext:*)))";*/ + + ServiceReference[] refs = bContext.getServiceReferences( + AlgorithmFactory.class.getName(), filter); + + if (refs != null) { + for (int i = 0; i < refs.length; ++i) { + //System.out.println(refs[i]); + this.converterList.put(refs[i].getProperty("service.pid").toString(), refs[i]); + /*String inData = (String) refs[i] + .getProperty(AlgorithmProperty.IN_DATA); + String outData = (String) refs[i] + .getProperty(AlgorithmProperty.OUT_DATA); + + addServiceReference(inData, outData, refs[i]);*/ + } + } + } catch (InvalidSyntaxException e) { + throw new RuntimeException(e); + } + } + + + /* private void addServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { + if (srcDataType != null && srcDataType.length() > 0 + && tgtDataType != null && tgtDataType.length() > 0) { + Vertex srcVertex = getVertex(srcDataType); + Vertex tgtVertex = getVertex(tgtDataType); + removeServiceReference(srcDataType, tgtDataType, serviceReference); + this.converterList.put(serviceReference.getProperty("service.pid").toString(), serviceReference); + Edge directedEdge = srcVertex.findEdge(tgtVertex); + if (directedEdge == null) { + directedEdge = new DirectedSparseEdge(srcVertex, tgtVertex); + graph.addEdge(directedEdge); + } + + AbstractList serviceList = (AbstractList) directedEdge.getUserDatum(SERVICE_LIST); + if (serviceList == null) { + serviceList = new ArrayList(); + serviceList.add(serviceReference); + } + directedEdge.setUserDatum(SERVICE_LIST, serviceList, + new UserDataContainer.CopyAction.Shared()); + } + }*/ + + /* private Vertex getVertex(String dataType) { + Vertex vertex = (SparseVertex)dataTypeToVertex.get(dataType); + if (vertex== null) { + vertex = new SparseVertex(); + vertex.addUserDatum("label", dataType, + new UserDataContainer.CopyAction.Shared()); + graph.addVertex(vertex); + dataTypeToVertex.put(dataType, vertex); + } + return vertex; + } + + private void removeServiceReference(String srcDataType, String tgtDataType, ServiceReference serviceReference) { + if (srcDataType != null && tgtDataType != null) { + Vertex srcVertex = (Vertex) dataTypeToVertex.get(srcDataType); + Vertex tgtVertex = (Vertex) dataTypeToVertex.get(tgtDataType); + String pid = (String) serviceReference + .getProperty(Constants.SERVICE_PID); + + if (srcVertex != null && tgtVertex != null) { + Edge edge = srcVertex.findEdge(tgtVertex); + if (edge != null) { + AbstractList serviceList = (AbstractList) edge + .getUserDatum(SERVICE_LIST); + for (Iterator iterator = serviceList.iterator(); iterator + .hasNext();) { + ServiceReference currentServiceReference = (ServiceReference) iterator + .next(); + String currentPid = (String) currentServiceReference + .getProperty(Constants.SERVICE_PID); + + if (pid.equals(currentPid)) { + iterator.remove(); + } + } + if (serviceList.isEmpty()) { + graph.removeEdge(edge); + } + } + } + } + }*/ + + + public void serviceChanged(ServiceEvent event) { + ServiceReference inServiceRef = event.getServiceReference(); + + /*String inDataType = (String)inServiceRef.getProperty(AlgorithmProperty.IN_DATA); + String outDataType = (String)inServiceRef.getProperty(AlgorithmProperty.OUT_DATA);*/ + + if (event.getType() == ServiceEvent.MODIFIED) { + this.converterList.put(inServiceRef.getProperty("service.pid").toString(), inServiceRef); + } + else if(event.getType() == ServiceEvent.REGISTERED) { + this.converterList.put(inServiceRef.getProperty("service.pid").toString(), inServiceRef); + } + else if(event.getType() == ServiceEvent.UNREGISTERING) { + System.out.println("Unregistering service: " + inServiceRef); + this.converterList.remove(inServiceRef.getProperty("service.pid").toString()); + + } + } + +/* public Data convert(Data data, String outFormat) { + // TODO Auto-generated method stub + return null; + } + + public Converter[] findConverters(Data data, String outFormat) { + // TODO Auto-generated method stub + return null; + }*/ + + public Converter[] findConverters(String inFormat, String outFormat, int maxHops, String maxComplexity) { + // TODO Auto-generated method stub + return null; + } + + public Converter[] findConverters(String inFormat, String outFormat) { + // TODO Auto-generated method stub + return null; + } + + + + public Converter getConverter(String[] converterChain) throws Exception{ + ArrayList services = new ArrayList(); + for(int ii = 0; ii < converterChain.length; ii++){ + String s = converterChain[ii]; + ServiceReference ref = (ServiceReference) this.converterList.get(s); + if(ref == null){ + throw new Exception("Converter: " + s + " cannot be found"); + } + services.add(ref); + } + return new ConverterTesterImpl(this.bContext, this.ciContext, (ServiceReference[])services.toArray(new ServiceReference[0])); + } + + private static void printConverters(BundleContext bContext){ + String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_CONVERTER+"))"; + try{ + + ServiceReference[] refs = bContext.getAllServiceReferences(AlgorithmFactory.class.getName(), filter); + for(int ii = 0; ii < refs.length; ii++){ + ServiceReference ref = refs[ii]; + System.out.println("\t"+ref.getProperty("service.pid")); + } + + } + catch(Exception ex){ + System.err.println(ex); + } + + } + + public org.cishell.framework.data.Data convert(org.cishell.framework.data.Data data, String outFormat) { + // TODO Auto-generated method stub + return null; + } + + public Converter[] findConverters(org.cishell.framework.data.Data data, String outFormat) { + // TODO Auto-generated method stub + return null; + } + +} Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/ConverterTesterImpl.java 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,169 @@ +package org.cishell.testing.convertertester.core.converter; + +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Hashtable; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.service.conversion.Converter; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.service.metatype.MetaTypeProvider; + + + +public class ConverterTesterImpl implements Converter, AlgorithmFactory, AlgorithmProperty{ + private ServiceReference[] refs; + private BundleContext bContext; + private Dictionary props; + private CIShellContext cContext; + + public ConverterTesterImpl(BundleContext bContext, CIShellContext cContext, ServiceReference[] refs) { + this.bContext = bContext; + this.cContext = cContext; + this.refs = refs; + + props = new Hashtable(); + + props.put(IN_DATA, refs[0].getProperty(IN_DATA)); + props.put(OUT_DATA, refs[refs.length-1].getProperty(OUT_DATA)); + props.put(LABEL, props.get(IN_DATA) + " -> " + props.get(OUT_DATA)); + + String lossiness = LOSSLESS; + for (int i=0; i < refs.length; i++) { + if (LOSSY.equals(refs[i].getProperty(CONVERSION))) { + lossiness = LOSSY; + } + } + //TODO: Do the same thing for complexity + props.put(CONVERSION, lossiness); + } + + public Data convert(Data inDM) { + Data[] dm = new Data[]{inDM}; + + AlgorithmFactory factory = getAlgorithmFactory(); + Algorithm alg = factory.createAlgorithm(dm, new Hashtable(), cContext); + + dm = alg.execute(); + + Object outData = null; + if (dm != null && dm.length > 0) { + outData = dm[0].getData(); + } + + if (outData != null) { + Dictionary props = inDM.getMetaData(); + Dictionary newProps = new Hashtable(); + + for (Enumeration e=props.keys(); e.hasMoreElements();) { + Object key = e.nextElement(); + newProps.put(key, props.get(key)); + } + + String outFormat = (String)getProperties().get(AlgorithmProperty.OUT_DATA); + return new BasicData(newProps, outData, outFormat); + } else { + return null; + } + } + + public AlgorithmFactory getAlgorithmFactory() { + // TODO Auto-generated method stub + return this; + } + + public ServiceReference[] getConverterChain() { + // TODO Auto-generated method stub + return this.refs; + } + + public Dictionary getProperties() { + // TODO Auto-generated method stub + return this.props; + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { + // TODO Auto-generated method stub + return new ConverterAlgorithm(data,parameters,context); + } + + public MetaTypeProvider createParameters(Data[] data) { + // TODO Auto-generated method stub + return null; + } + + private class ConverterAlgorithm implements Algorithm { + Data[] inDM; + CIShellContext context; + Dictionary parameters; + + public ConverterAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { + this.inDM = dm; + this.parameters = parameters; + this.context = context; + } + + public Data[] execute() { + Data[] dm = inDM; + for (int i=0; i < refs.length; i++) { + AlgorithmFactory factory = (AlgorithmFactory)bContext.getService(refs[i]); + + if (factory != null) { + Algorithm alg = factory.createAlgorithm(dm, parameters, context); + System.out.println("Entering: " + refs[i].getProperty(Constants.SERVICE_PID)+ "-->"); + dm = alg.execute(); + if(dm == null){ + throw new RuntimeException("Error after " + refs[i].getProperty(Constants.SERVICE_PID)); + + } + } else { + throw new RuntimeException("Missing subconverter: " + + refs[i].getProperty(Constants.SERVICE_PID)); + } + } + + return dm; + } + } + + public int hashCode() { + return toString().hashCode(); + } + + public String toString() { + String str =""; + ServiceReference[] refs = this.refs; + for (int ii = 0; ii < refs.length; ii++) { + ServiceReference ref = refs[ii]; + str += ref.getProperty(Constants.SERVICE_ID) + " " + ref.getProperty(Constants.SERVICE_PID) + "-> "; + } + return str; + } + + public boolean equals(Object o) { + boolean equals = false; + if (o instanceof Converter) { + ServiceReference[] otherServiceReference = ((Converter)o).getConverterChain(); + if (refs.length == otherServiceReference.length) { + for (int i = 0; i < otherServiceReference.length; i++) { + if (refs[i].getProperty(Constants.SERVICE_ID).equals( + otherServiceReference[i].getProperty(Constants.SERVICE_ID))) { + equals = true; + } else { + equals = false; + break; + } + } + } + } + return equals; + } + +} Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/Activator.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/Activator.java (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/Activator.java 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,83 @@ +package org.cishell.testing.convertertester.core.service; + +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 void start(BundleContext b){ + this.b = b; + this.c = new LocalCIShellContext(b); + startUp(); + } + + + + public void stop(BundleContext b){ + System.out.println("Goodbye!"); + b = null; + c = null; + configFile = null; + ct = null; + } + + 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(); + } + } + } + } + + public void startUp(){ + Scanner in = new Scanner(System.in); + for(;;){ + System.out.println("Welcome to NWB's Converter Tester\n"+ + "Please enter the name of a configuration file \n"+ + "or a directory of configuration files (Q/q to quit): "); + String s = in.nextLine(); + if(s.trim().equalsIgnoreCase("Q")) + 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"); + } + } + } + +} + Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/ConfigurationFileParser.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/ConfigurationFileParser.java (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/service/ConfigurationFileParser.java 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,249 @@ + +package org.cishell.testing.convertertester.core.service; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Queue; + +import org.cishell.testing.convertertester.core.tester.ConfigurationFileConstants; + + +public class ConfigurationFileParser { + //files + private Queue comparisonFiles; + //strings + private Queue comparisonConverters; + //strings + private Queue testConverters; + private boolean nodeIDChange = true; + private String extension; + private String configFile; + + + private boolean processFileList = false; + private boolean processComparisonConvertersList = false; + private boolean processTestConvertersList = false; + + + public ConfigurationFileParser(){ + //strings + comparisonConverters = new LinkedList(); + //strings + testConverters = new LinkedList(); + //files + comparisonFiles = new LinkedList(); + nodeIDChange = true; + } + + public ConfigurationFileParser(File f) throws Exception{ + //strings + comparisonConverters = new LinkedList(); + //strings + testConverters = new LinkedList(); + //files + comparisonFiles = new LinkedList(); + nodeIDChange = true; + + this.parseFile(f); + } + + public void parseFile(File f){ + configFile = f.getName(); + int lineNum = 0; + String line = null; + BufferedReader reader; + try{ + reader = new BufferedReader(new FileReader(f)); + + //System.out.println("Beginning to parse."); + + while((line = reader.readLine()) != null){ + + if(!line.trim().equals("")){ + + //System.out.println("Parsing line: " + lineNum + " " + line); + if(line.startsWith(ConfigurationFileConstants.TEST_GRAPHS)){ + line = line.replace(ConfigurationFileConstants.TEST_GRAPHS, ""); + //System.out.println(line); + this.processFileList = true; + this.processComparisonConvertersList = false; + this.processTestConvertersList = false; + } + if(line.startsWith(ConfigurationFileConstants.COMPARISON_CONVERTERS)){ + line = line.replace(ConfigurationFileConstants.COMPARISON_CONVERTERS, ""); + //System.out.println(line); + this.processFileList = false; + this.processComparisonConvertersList = true; + this.processTestConvertersList = false; + } + if(line.startsWith(ConfigurationFileConstants.TEST_CONVERTERS)){ + line = line.replace(ConfigurationFileConstants.TEST_CONVERTERS, ""); + //System.out.println(line); + this.processFileList = false; + this.processComparisonConvertersList = false; + this.processTestConvertersList = true; + } + if(line.startsWith(ConfigurationFileConstants.NODE_ID_CHANGE)){ + line = line.replace(ConfigurationFileConstants.NODE_ID_CHANGE, ""); + //System.out.println(line ); + this.nodeIDChange = new Boolean(line.toLowerCase()).booleanValue(); + this.processFileList = false; + this.processComparisonConvertersList = false; + this.processTestConvertersList = false; + } + if(line.startsWith(ConfigurationFileConstants.EXTENSION)){ + line = line.replace(ConfigurationFileConstants.EXTENSION, ""); + //System.out.println(line ); + this.extension = line; + this.processFileList = false; + this.processComparisonConvertersList = false; + this.processTestConvertersList = false; + } + if(this.processFileList){ + this.processFiles(this.processLine(line)); + } + if(this.processComparisonConvertersList){ + this.processComparisonConverters(this.processLine(line)); + } + if(this.processTestConvertersList){ + this.processTestConverters(this.processLine(line)); + } + } + lineNum++; + //System.out.println("Next line"); + } + } + catch(FileNotFoundException fnfe){ + System.out.println(fnfe); + } + catch(IOException iex){ + System.out.println(iex); + } + //System.out.println("Finished parsing"); + } + + private String[] processLine(String s){ + String[] line = s.split(","); + for(int ii = 0; ii < line.length; ii++){ + String ss = (String) line[ii]; + line[ii] = ss.trim(); + } + return line; + } + + private void processFiles(String[] strings) throws FileNotFoundException{ + + for(int ii = 0; ii < strings.length; ii++) { + String s = strings[ii]; + if (! (s == null || s.length() == 0)) { + + if (s.charAt(0) != File.separatorChar) { + + /* + * relative paths are assumed to be relative to ther home + * directory + */ + s = System.getProperty("user.home") + File.separator + s; + } + File f = new File(s); + this.comparisonFiles.add(f); + } + } + } + + private void processTestConverters(String[] strings){ + for(int ii = 0; ii < strings.length; ii++) { + String s = strings[ii]; + this.testConverters.add(s); + } + } + + private void processComparisonConverters(String[] strings){ + for(int ii = 0; ii < strings.length; ii++) { + String s = strings[ii]; + this.comparisonConverters.add(s); + } + } + + public File[] getFiles(){ + File[] files = new File[this.comparisonFiles.size()]; + files = (File[]) this.comparisonFiles.toArray(files); + return files; + } + + public String[] getComparisonConverters(){ + return (String[]) this.comparisonConverters.toArray(new String[0]); + } + + public String[] getTestConverters(){ + return (String []) this.testConverters.toArray(new String[0]); + } + + public boolean getNodeIDChange(){ + return this.nodeIDChange; + } + + public static String asString(File f, String s){ + String output = s; + if(!f.isHidden()){ + if(f.isDirectory()){ + output += "Directory: "; + output += f.getName()+ "\n"; + File[] files = f.listFiles(); + for (int ii = 0; ii < files.length; ii++){ + File ff = files[ii]; + output += asString(ff, s); + } + } + else{ + output += "\t" + f.getName() + "\n"; + } + } + return output; + } + + public String toString(){ + String output = ""; + output += "Files to test:\n"; + Iterator iter0 = this.comparisonFiles.iterator(); + while (iter0.hasNext()){ + File f = (File) iter0.next(); + output += asString(f,""); + } + + output += "\nConverters to test:\n"; + Iterator iter1 = this.testConverters.iterator(); + while (iter1.hasNext()){ + String s = (String) iter1.next(); + output += s + "\n"; + } + + output += "\nConverters used to Compare files:\n"; + + Iterator ii2 = this.comparisonConverters.iterator(); + while (ii2.hasNext()){ + String s = (String) ii2.next(); + output += s +"\n"; + } + + output += "\nNode IDs are expected to change: " + this.nodeIDChange + "\n"; + + return output; + } + + public String getExtension(){ + return this.extension; + } + + public String getConfigFile(){ + return this.configFile; + } + +} + + Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLToPrefuseTographML =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLToPrefuseTographML (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLToPrefuseTographML 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/GraphML Files +test_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader, +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLWriter, +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLTonetTographML =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLTonetTographML (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLTonetTographML 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,11 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/GraphML Files +test_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.nwbgraphml.GraphMLToNWBbyStax, +edu.iu.nwb.converter.nwbpajeknet.NWBToPajeknet, +edu.iu.nwb.converter.nwbpajeknet.PajeknetToNWB, +edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoNWBtographML.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoNWBtographML.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoNWBtographML.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/GraphML Files +test_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.nwbgraphml.GraphMLToNWBbyStax, +edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoPrefuseGraphtoGraphML.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoPrefuseGraphtoGraphML.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtoPrefuseGraphtoGraphML.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/GraphML Files +test_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.junggraphml.writer.JungGraphMLWriter +edu.iu.nwb.converter.junggraphml.reader.JungGraphMLReader +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtographMLTest.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtographMLTest.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/graphMLtographMLTest.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,7 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/GraphML Files +test_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.writer.PrefuseGraphMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLValidationAlg, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.xml Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonet.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonet.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonet.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,11 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/NET Files +test_converters=edu.iu.nwb.converter.pajeknet.reader.NETValidation, +edu.iu.nwb.converter.pajeknet.writer.NETFileHandler +comparison_converters=edu.iu.nwb.converter.pajeknet.reader.NETValidation, +edu.iu.nwb.converter.nwbpajeknet.PajeknetToNWB, +edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader + +nodeid_change=false + +extension=.net \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonwbTonet.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonwbTonet.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/netTonwbTonet.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,12 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/NET Files +test_converters=edu.iu.nwb.converter.pajeknet.reader.NETValidation, +edu.iu.nwb.converter.nwbpajeknet.PajeknetToNWB, +edu.iu.nwb.converter.nwbpajeknet.NWBToPajeknet, +edu.iu.nwb.converter.pajeknet.writer.NETFileHandler +comparison_converters=edu.iu.nwb.converter.pajeknet.reader.NETValidation, +edu.iu.nwb.converter.nwbpajeknet.PajeknetToNWB,edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader + +nodeid_change=false + +extension=.net \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonetTonwb =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonetTonwb (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonetTonwb 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,10 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/NWB Files +test_converters=edu.iu.nwb.converter.nwb.reader.NWBValidation, +edu.iu.nwb.converter.nwbpajeknet.NWBToPajeknet, +edu.iu.nwb.converter.nwbpajeknet.PajeknetToNWB, +edu.iu.nwb.converter.nwb.writer.NWBFileHandler +comparison_converters=edu.iu.nwb.converter.nwb.reader.NWBValidation, +edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.nwb \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonwbTest.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonwbTest.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/nwbTonwbTest.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,8 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/NWB Files +test_converters=edu.iu.nwb.converter.nwb.reader.NWBValidation, +edu.iu.nwb.converter.nwb.writer.NWBFileHandler +comparison_converters=edu.iu.nwb.converter.nwb.reader.NWBValidation, +edu.iu.nwb.converter.nwbgraphml.NWBToGraphML, +edu.iu.nwb.converter.prefusegraphml.reader.PrefuseGraphMLReader +nodeid_change=false +extension=.nwb \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtoprefuseTreetotreeML.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtoprefuseTreetotreeML.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtoprefuseTreetotreeML.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,10 @@ +test_graphs=workspace/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/TreeML Files +test_converters=edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLValidationAlg, +edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLReader, +edu.iu.nwb.converter.prefusetreeml.writer.PrefuseTreeMLWriter, +edu.iu.nwb.converter.prefusetreeml.writer.PrefuseTreeMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLValidationAlg, +edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLReader, +edu.iu.nwb.converter.treegraph.ConverterAlgorithm +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtotreeML.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtotreeML.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/treeMLtotreeML.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,8 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/TreeML Files +test_converters=edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLValidationAlg, +edu.iu.nwb.converter.prefusetreeml.writer.PrefuseTreeMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLValidationAlg, +edu.iu.nwb.converter.prefusetreeml.reader.PrefuseTreeMLReader, +edu.iu.nwb.converter.treegraph.ConverterAlgorithm +nodeid_change=false +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmlToxgmml.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmlToxgmml.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmlToxgmml.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/XGMML Files +test_converters=edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLValidationAlg, +edu.iu.nwb.converter.prefusexgmml.writer.PrefuseXGMMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLValidationAlg, +edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLReader, +edu.iu.nwb.converter.jungprefuse.PrefuseJungConverterAlgorithm, +edu.iu.nwb.converter.jungprefuse.JungPrefuseBetaConverterAlgorithm +nodeid_change=true +extension=.xml \ No newline at end of file Added: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmltoPrefuseAlphatoxgmml.cfg =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmltoPrefuseAlphatoxgmml.cfg (rev 0) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/test_files/Configuration Files/xgmmltoPrefuseAlphatoxgmml.cfg 2007-07-24 19:25:33 UTC (rev 429) @@ -0,0 +1,9 @@ +test_graphs=workspace/edu.iu.nwb.converter.tester/test_files/XGMML Files +test_converters=edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLValidationAlg, +edu.iu.nwb.converter.prefusexgmml.writer.PrefuseXGMMLFileHandlerAlg +comparison_converters=edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLValidationAlg, +edu.iu.nwb.converter.prefusexgmml.reader.PrefuseXGMMLReader, +edu.iu.nwb.converter.jungprefuse.PrefuseJungConverterAlgorithm, +edu.iu.nwb.converter.jungprefuse.JungPrefuseBetaConverterAlgorithm +nodeid_change=false +e... [truncated message content] |
From: <mwl...@us...> - 2007-07-24 19:24:48
|
Revision: 428 http://svn.sourceforge.net/cishell/?rev=428&view=rev Author: mwlinnem Date: 2007-07-24 12:24:42 -0700 (Tue, 24 Jul 2007) Log Message: ----------- Initial import. Added Paths: ----------- trunk/testing/org.cishell.testing.convertertester.core.new/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2007-07-23 19:35:50
|
Revision: 427 http://svn.sourceforge.net/cishell/?rev=427&view=rev Author: bh2 Date: 2007-07-23 12:35:46 -0700 (Mon, 23 Jul 2007) Log Message: ----------- Updated the equinox environment feature to work with Eclipse 3.3. Modified Paths: -------------- trunk/deployment/org.cishell.environment.equinox.feature/feature.xml Modified: trunk/deployment/org.cishell.environment.equinox.feature/feature.xml =================================================================== --- trunk/deployment/org.cishell.environment.equinox.feature/feature.xml 2007-07-20 18:19:57 UTC (rev 426) +++ trunk/deployment/org.cishell.environment.equinox.feature/feature.xml 2007-07-23 19:35:46 UTC (rev 427) @@ -2,7 +2,7 @@ <feature id="org.cishell.environment.equinox.feature" label="CIShell Equinox Execution Environment" - version="0.1.0"> + version="0.0.0"> <description url="http://cishell.org"> CIShell OSGi Environment (Eclipse Equinox) @@ -266,28 +266,6 @@ unpack="false"/> <plugin - id="org.eclipse.swt.motif.hpux.PA_RISC" - os="hpux" - ws="motif" - arch="PA_RISC" - download-size="0" - install-size="0" - version="0.0.0" - fragment="true" - unpack="false"/> - - <plugin - id="org.eclipse.swt.motif.linux.x86" - os="linux" - ws="motif" - arch="x86" - download-size="0" - install-size="0" - version="0.0.0" - fragment="true" - unpack="false"/> - - <plugin id="org.eclipse.swt.win32.win32.x86" os="win32" ws="win32" @@ -367,4 +345,32 @@ version="0.0.0" unpack="false"/> + <plugin + id="org.eclipse.equinox.app" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.core.net" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.jface.databinding" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + + <plugin + id="org.eclipse.core.databinding" + download-size="0" + install-size="0" + version="0.0.0" + unpack="false"/> + </feature> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-20 18:19:59
|
Revision: 426 http://svn.sourceforge.net/cishell/?rev=426&view=rev Author: mwlinnem Date: 2007-07-20 11:19:57 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Initial import. Added Paths: ----------- trunk/testing/META-INF/ trunk/testing/META-INF/MANIFEST.MF trunk/testing/OSGI-INF/ trunk/testing/OSGI-INF/algorithm.properties trunk/testing/OSGI-INF/component.xml trunk/testing/OSGI-INF/l10n/ trunk/testing/OSGI-INF/l10n/bundle_en.properties trunk/testing/OSGI-INF/metatype/ trunk/testing/OSGI-INF/metatype/METADATA.XML trunk/testing/build.properties trunk/testing/src/ trunk/testing/src/org/ trunk/testing/src/org/cishell/ trunk/testing/src/org/cishell/testing/ trunk/testing/src/org/cishell/testing/convertertester/ trunk/testing/src/org/cishell/testing/convertertester/algorithm/ trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java Added: trunk/testing/META-INF/MANIFEST.MF =================================================================== --- trunk/testing/META-INF/MANIFEST.MF (rev 0) +++ trunk/testing/META-INF/MANIFEST.MF 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: ConverterTester Algorithm +Bundle-SymbolicName: org.cishell.testing.convertertester.algorithm +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.testing.convertertester.core.tester, + 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" +X-AutoStart: true +Service-Component: OSGI-INF/component.xml Added: trunk/testing/OSGI-INF/algorithm.properties =================================================================== --- trunk/testing/OSGI-INF/algorithm.properties (rev 0) +++ trunk/testing/OSGI-INF/algorithm.properties 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,7 @@ +#menu_path=Visualization/SubMenu/additions +label=My Algorithm +description=This algorithm does this and this... +in_data=file:mime/type or java.lang.ClassName or null +out_data=file:mime/type or java.lang.ClassName or null +service.pid=org.my.algorithm.MyAlgorithm +remoteable=false Added: trunk/testing/OSGI-INF/component.xml =================================================================== --- trunk/testing/OSGI-INF/component.xml (rev 0) +++ trunk/testing/OSGI-INF/component.xml 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.my.algorithm.MyAlgorithm.component" immediate="false"> + <implementation class="org.cishell.testing.convertertester.algorithm"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/testing/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/testing/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/testing/OSGI-INF/l10n/bundle_en.properties 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: trunk/testing/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/testing/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/testing/OSGI-INF/metatype/METADATA.XML 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="My Algorithm" id="org.my.algorithm.MyAlgorithm.OCD" + description="This algorithm does this and this... "> + </OCD> + <Designate pid="org.my.algorithm.MyAlgorithm"> + <Object ocdref="org.my.algorithm.MyAlgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: trunk/testing/build.properties =================================================================== --- trunk/testing/build.properties (rev 0) +++ trunk/testing/build.properties 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,5 @@ +source.. = src/ +output.. = build/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ Added: trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java =================================================================== --- trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java (rev 0) +++ trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithm.java 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,29 @@ +package org.cishell.testing.convertertester.algorithm; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.data.Data; +import org.cishell.testing.convertertester.core.tester.ConverterTester; +import org.osgi.framework.BundleContext; + +public class ConverterTesterAlgorithm implements Algorithm { + Data[] data; + Dictionary parameters; + CIShellContext context; + ConverterTester tester; + + public ConverterTesterAlgorithm(Data[] data, Dictionary parameters, + CIShellContext csContext, BundleContext bContext ) { + this.data = data; + this.parameters = parameters; + this.context = csContext; + + this.tester = new ConverterTester(bContext, csContext); + } + + public Data[] execute() { + return null; + } +} \ No newline at end of file Added: trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java =================================================================== --- trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java (rev 0) +++ trunk/testing/src/org/cishell/testing/convertertester/algorithm/ConverterTesterAlgorithmFactory.java 2007-07-20 18:19:57 UTC (rev 426) @@ -0,0 +1,37 @@ +package org.cishell.testing.convertertester.algorithm; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.Data; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; + + +public class ConverterTesterAlgorithmFactory implements AlgorithmFactory { + private MetaTypeProvider provider; + private BundleContext bContext; + + protected void activate(ComponentContext ctxt) { + //You may delete all references to metatype service if + //your algorithm does not require parameters and return + //null in the createParameters() method + MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + this.bContext = ctxt.getBundleContext(); + provider = mts.getMetaTypeInformation(this.bContext.getBundle()); + } + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { + return new ConverterTesterAlgorithm(data, parameters, context, bContext); + } + public MetaTypeProvider createParameters(Data[] data) { + return provider; + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-20 18:19:36
|
Revision: 425 http://svn.sourceforge.net/cishell/?rev=425&view=rev Author: mwlinnem Date: 2007-07-20 11:19:33 -0700 (Fri, 20 Jul 2007) Log Message: ----------- Initial import. Added Paths: ----------- trunk/testing/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-18 15:56:38
|
Revision: 424 http://svn.sourceforge.net/cishell/?rev=424&view=rev Author: mwlinnem Date: 2007-07-18 08:30:28 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Refactor JythonRunnerAlgorithm into 3 seperate classes. Changed JythonRunner to use the out_data property to define each result data's type, instead of always using the class name. Cleaned some other stuff up. Modified Paths: -------------- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java Added Paths: ----------- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonInterpreterInitializer.java trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonResultFormatter.java Modified: trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java =================================================================== --- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java 2007-07-18 15:20:54 UTC (rev 423) +++ trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java 2007-07-18 15:30:28 UTC (rev 424) @@ -17,7 +17,6 @@ * */ -//TODO: cleanup public class JythonAlgorithmFactory implements AlgorithmFactory { private BundleContext myBundleContext; @@ -43,8 +42,6 @@ CIShellContext context) { return new JythonRunnerAlgorithm(data, parameters, context, properties, myBundle); - - } public MetaTypeProvider createParameters(Data[] data) { Modified: trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java =================================================================== --- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java 2007-07-18 15:20:54 UTC (rev 423) +++ trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java 2007-07-18 15:30:28 UTC (rev 424) @@ -3,13 +3,10 @@ public class JythonFileProperty { public static final String SCRIPT_PATH_KEY = "script_path"; - public static final String RESULT_PREFIX = - JythonRunnerAlgorithm.SCRIPT_RESULT_PREFIX; - public static final String ARGUMENT_PREFIX = - JythonRunnerAlgorithm.SCRIPT_ARGUMENT_PREFIX; + public static final String RESULT_PREFIX = "result"; + public static final String ARGUMENT_PREFIX = "arg"; public static final String LABEL_SUFFIX = ".label"; public static final String TYPE_SUFFIX = ".type"; public static final String PARENT_SUFFIX = ".parent"; - } Added: trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonInterpreterInitializer.java =================================================================== --- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonInterpreterInitializer.java (rev 0) +++ trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonInterpreterInitializer.java 2007-07-18 15:30:28 UTC (rev 424) @@ -0,0 +1,96 @@ +package org.cishell.templates.jythonrunner; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Dictionary; +import java.util.Enumeration; + +import org.cishell.framework.data.Data; +import org.osgi.service.log.LogService; +import org.python.core.PyFile; +import org.python.core.PyJavaInstance; +import org.python.util.PythonInterpreter; + +/** + * + * @author mwlinnem + * + */ +public class JythonInterpreterInitializer { + + protected LogService logger; + + public JythonInterpreterInitializer(LogService logger) { + this.logger = logger; + } + + public PythonInterpreter initializeInterpreter(PythonInterpreter interp, + Data[] data, Dictionary parameters) { + interp = passUserProvidedArguments(interp, parameters); + interp = passCIShellProvidedArguments(interp, data); + interp = initializeLogging(interp); + return interp; + } + + protected PythonInterpreter passUserProvidedArguments( + PythonInterpreter interp, Dictionary parameters) { + + Enumeration enumer = parameters.keys(); + while (enumer.hasMoreElements()) { + String key = (String) enumer.nextElement(); + Object value = parameters.get(key); + String argName = key; + + interp = passArgument(value, argName, interp); + } + + return interp; + } + + protected PythonInterpreter passCIShellProvidedArguments( + PythonInterpreter interp, Data[] data) { + for (int ii = 0; ii < data.length; ii++) { + Data argData = data[ii]; + Object arg = argData.getData(); + String argName = JythonFileProperty.ARGUMENT_PREFIX + ii; + + interp = passArgument(arg, argName, interp); + } + + return interp; + } + + protected PythonInterpreter initializeLogging(PythonInterpreter interp) { + interp.setErr(System.err); + interp.setOut(System.out); + return interp; + } + + + + protected PythonInterpreter passArgument(Object arg, String argName, + PythonInterpreter interp) { + if (! (arg instanceof File)) { + interp.set(argName, + new PyJavaInstance(arg)); + } else { + try { + File fileArg = (File) arg; + InputStream fileStream = fileArg.toURL().openStream(); + interp.set(argName, + new PyFile(fileStream)); + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, "Problem opening file" + + " provided as an argument to jython script.", e); + e.printStackTrace(); + } + } + + return interp; + } + + + + +} Added: trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonResultFormatter.java =================================================================== --- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonResultFormatter.java (rev 0) +++ trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonResultFormatter.java 2007-07-18 15:30:28 UTC (rev 424) @@ -0,0 +1,218 @@ +package org.cishell.templates.jythonrunner; + +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; + +import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.framework.data.DataProperty; +import org.osgi.service.log.LogService; + +/** + * + * @author mwlinnem + * + */ +public class JythonResultFormatter { + + public static final String DEFAULT_LABEL_VALUE = "Data"; + + protected LogService logger; + + public JythonResultFormatter(LogService logger) { + this.logger = logger; + } + + public Data[] formatRawResults(List rawResults, Data[] inputData, + Dictionary properties) { + List dataResults; + + dataResults = convertToData(rawResults, properties); + dataResults = addMetaData(dataResults, inputData, + properties); + + Data[] resultsArray = convertToArray(dataResults); + return resultsArray; + } + + /** + * adds metadata obtained from the algorithm's .properties files + * that specify information about what the script returns. + * @param data a list of data objects, in the order + * they were returned. + * @param inputData the data passed from CIShell to this algorithm + * @param properties information about the script, such as + * the labels, types, and parents of all the returned data. + * @return a list of data objects in the order they were provided, + * now containing the appropriate metadata obtained from the + * .properties file. + */ + protected List addMetaData(List data, Data[] inputData, Dictionary properties) { + List results = new ArrayList(); + for (int ii = 0; ii < data.size(); ii++) { + Data result = ((Data) data.get(ii)); + Dictionary metadataHolder = result.getMetaData(); + + String dataLabel = getResultLabel(properties, ii); + metadataHolder.put(DataProperty.LABEL, dataLabel); + + String dataType = getResultType(properties, ii); + metadataHolder.put(DataProperty.TYPE, dataType); + + Data dataParent = getResultParent(properties, ii, inputData); + if (dataParent != null) { + metadataHolder.put(DataProperty.PARENT, dataParent); + } //it's okay to not have a parent, little Timmy. + + results.add(result); + } + return results; + } + + protected String getResultLabel(Dictionary props, int numResult) { + String labelKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.LABEL_SUFFIX; + Object labelValue = props.get(labelKey); + + String labelValueString; + if (!(labelValue == null)) { + labelValueString = (String) labelValue; + } else { + labelValueString = DEFAULT_LABEL_VALUE; + logger.log(LogService.LOG_WARNING, "Label of data returned from " + + "jython script not specified in .properties file. " + + "Assigning label to '" + labelValueString + "'."); + } + return labelValueString; + } + + protected String getResultType(Dictionary props, int numResult) { + String typeKey = JythonFileProperty.RESULT_PREFIX + + numResult + JythonFileProperty.TYPE_SUFFIX; + Object typeValue = props.get(typeKey); + + String typeValueString; + if (! (typeValue == null)) { + typeValueString = (String) typeValue; + checkType(typeValueString); + + } else { + typeValueString = DataProperty.OTHER_TYPE; + logger.log(LogService.LOG_WARNING, "Type of data returned from " + + "jython script not specified in .properties file. " + + "Assigning type to '" + typeValueString + "'."); + } + return typeValueString; + } + + /** + * Looks to see whether the result has a parent specified in the + * algorithm's .properties file. If it does, return the parent data. + * Otherwise return null. + * @param props information about the script, such as + * the labels, types, and parents of all the returned data. + * @param numResult specifies which result's information we need to look + * up + * @param inputData the data CIShell passed this algorithm. + * @return either the parent of the result data specified by numResults, + * or null, if there is no parent specified. + */ + protected Data getResultParent(Dictionary props, int numResult, Data[] inputData) { + String childKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.PARENT_SUFFIX; + Object parentName = props.get(childKey); + + Data parent; + if (! (parentName == null)) { + //TODO: more validation on parentName + char parentDataIndexChar = getLastChar((String) parentName); + int parentDataIndex = Character.digit(parentDataIndexChar, 10); + if (parentDataIndex < inputData.length) { + parent = inputData[parentDataIndex]; + } else { + logger.log(LogService.LOG_WARNING, ".properties file " + + "tried to assign result" + numResult + "the " + + "parent arg"+ parentDataIndex + ", which has an " + + "index greater than any arg provided. Cannot " + + "assign result" + numResult + " a parent."); + parent = null; + } + } else { + //it's okay not to specify a parent. + parent = null; + } + return parent; + } + + /** + * Takes java objects and wraps them in our CIShell data objects + * so that they can be returned from the algorithm. + * @param rawResults a list of java objects. + * @return a list of data objects. + */ + protected List convertToData(List rawResults, Dictionary props) { + List results = new ArrayList(); + String outData = (String) props.get(AlgorithmProperty.OUT_DATA); + + if (outData.trim().equalsIgnoreCase(AlgorithmProperty.NULL_DATA)) { + return results; + } + + String[] formats = outData.split(","); + + int numFinalResults; + if (formats.length > rawResults.size()) { + numFinalResults = rawResults.size(); + logger.log(LogService.LOG_WARNING, "More out_data formats " + + "provided than an actual data returned. Ignoring extra " + + "formats."); + } else if (rawResults.size() > formats.length) { + numFinalResults = formats.length; + logger.log(LogService.LOG_WARNING, "More data returned than " + + "out_data formats provided. Ignoring additional data " + + "returned"); + } else { + //both are the same length. + numFinalResults = rawResults.size(); + } + + for (int ii = 0; ii < numFinalResults; ii++) { + Object rawResult = rawResults.get(ii); + BasicData data = new BasicData(rawResult, formats[ii]); + results.add(data); + } + return results; + } + + protected char getLastChar(String s) { + if (s.length() > 0) { + return s.charAt(s.length() - 1); + } else { + throw new IndexOutOfBoundsException("Cannot get the last " + + "character of an empy string"); + } + } + + protected Data[] convertToArray(List dataList) { + Data[] dataArray = new Data[dataList.size()]; + for (int ii = 0; ii < dataArray.length; ii++) { + dataArray[ii] = (Data) dataList.get(ii); + } + return dataArray; + } + + protected void checkType(String ts) { + if (! (ts.equals(DataProperty.MATRIX_TYPE) || + ts.equals(DataProperty.NETWORK_TYPE) || + ts.equals(DataProperty.TEXT_TYPE) || + ts.equals(DataProperty.OTHER_TYPE))) { + logger.log(LogService.LOG_WARNING, "JythonRunnerAlgorithm: " + + "Assigning return data an unsupported data type " + + ts +". Either the type is invalid or " + + "JythonRunnerAlgorithm has not be updated to reflect " + + "types introduced in newer versions"); + } + } +} Modified: trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java =================================================================== --- trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java 2007-07-18 15:20:54 UTC (rev 423) +++ trunk/templates/org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java 2007-07-18 15:30:28 UTC (rev 424) @@ -1,23 +1,16 @@ package org.cishell.templates.jythonrunner; -import java.io.File; import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Dictionary; -import java.util.Enumeration; import java.util.List; import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; -import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; -import org.cishell.framework.data.DataProperty; import org.osgi.framework.Bundle; import org.osgi.service.log.LogService; -import org.python.core.PyFile; -import org.python.core.PyJavaInstance; import org.python.core.PyObject; import org.python.util.PythonInterpreter; @@ -27,9 +20,6 @@ * */ -//TODO:refactor me into multiple classes -//TODO:general cleanup, renaming, etc... - public class JythonRunnerAlgorithm implements Algorithm { private Data[] data; private Dictionary parameters; @@ -38,10 +28,10 @@ private LogService logger; private URL script; + + private JythonInterpreterInitializer interpInitializer; + private JythonResultFormatter resultFormatter; - public static final String SCRIPT_ARGUMENT_PREFIX = "arg"; - public static final String SCRIPT_RESULT_PREFIX = "result"; - public JythonRunnerAlgorithm(Data[] data, Dictionary parameters, CIShellContext context, Dictionary properties, Bundle myBundle) { this.data = data; @@ -54,29 +44,24 @@ this.logger = (LogService) context.getService( LogService.class.getName()); + + this.interpInitializer = new JythonInterpreterInitializer(logger); + this.resultFormatter = new JythonResultFormatter(logger); } public Data[] execute() { - PythonInterpreter interp = initializeInterpreter( + PythonInterpreter interp = interpInitializer.initializeInterpreter( new PythonInterpreter(), data, parameters); List rawResults = runScript(interp, script); - Data[] results = formatRawResults(rawResults, data, properties); + Data[] results = resultFormatter.formatRawResults(rawResults, + data, properties); return results; } - - private PythonInterpreter initializeInterpreter(PythonInterpreter interp, - Data[] data, Dictionary parameters) { - interp = passUserProvidedArguments(interp, parameters); - interp = passCIShellProvidedArguments(interp, data); - interp = initializeLogging(interp); - return interp; - } - /** * Executes the script and extracts the raw results. * @param interp The initialized python interpreter @@ -89,17 +74,6 @@ return rawResults; } - private Data[] formatRawResults(List rawResults, Data[] inputData, - Dictionary properties) { - List dataResults = convertToData(rawResults); - List dataResultsWithMetaData = addMetaData(dataResults, inputData, - properties); - Data[] resultsArray = convertToArray(dataResultsWithMetaData); - return resultsArray; - } - - - private PythonInterpreter executeFile(PythonInterpreter interp, URL script) { try { @@ -112,40 +86,6 @@ return interp; } - private PythonInterpreter passUserProvidedArguments( - PythonInterpreter interp, Dictionary parameters) { - - Enumeration enumer = parameters.keys(); - while (enumer.hasMoreElements()) { - String key = (String) enumer.nextElement(); - Object value = parameters.get(key); - String argName = key; - - interp = passArgument(value, argName, interp); - } - - return interp; - } - - private PythonInterpreter passCIShellProvidedArguments( - PythonInterpreter interp, Data[] data) { - for (int ii = 0; ii < this.data.length; ii++) { - Data argData = this.data[ii]; - Object arg = argData.getData(); - String argName = SCRIPT_ARGUMENT_PREFIX + String.valueOf(ii); - - interp = passArgument(arg, argName, interp); - } - - return interp; - } - - private PythonInterpreter initializeLogging(PythonInterpreter interp) { - interp.setErr(System.err); - interp.setOut(System.out); - return interp; - } - /** * Gets Java versions of all the results from the script. * @param interp a python interpreter that holds results (presumably @@ -153,7 +93,7 @@ * @return A list of objects, where each object is a result from * the interpreters environment. */ - private List getRawResults(PythonInterpreter interp) { + protected List getRawResults(PythonInterpreter interp) { List results = new ArrayList(); /* @@ -162,207 +102,31 @@ * variable which is not defined. */ int ii = 0; - String resultName = SCRIPT_RESULT_PREFIX + ii; + String resultName = JythonFileProperty.RESULT_PREFIX + ii; while (variableIsDefined(interp, resultName)) { results.add(interp.get(resultName, Object.class)); ii++; - resultName = SCRIPT_RESULT_PREFIX + ii; + resultName = JythonFileProperty.RESULT_PREFIX + ii; } return results; } - /** - * adds metadata obtained from the algorithm's .properties files - * that specify information about what the script returns. - * @param data a list of data objects, in the order - * they were returned. - * @param inputData the data passed from CIShell to this algorithm - * @param properties information about the script, such as - * the labels, types, and parents of all the returned data. - * @return a list of data objects in the order they were provided, - * now containing the appropriate metadata obtained from the - * .properties file. - */ - private List addMetaData(List data, Data[] inputData, Dictionary properties) { - List results = new ArrayList(); - for (int ii = 0; ii < data.size(); ii++) { - Data result = ((Data) data.get(ii)); - Dictionary metadataHolder = result.getMetaData(); - - String dataLabel = getResultLabel(properties, ii); - metadataHolder.put(DataProperty.LABEL, dataLabel); - - String dataType = getResultType(properties, ii); - metadataHolder.put(DataProperty.TYPE, dataType); - - Data dataParent = getResultParent(properties, ii, inputData); - if (dataParent != null) { - metadataHolder.put(DataProperty.PARENT, dataParent); - } //it's okay to not have a parent, little Timmy. - - results.add(result); - } - return results; - } - - public String getResultLabel(Dictionary props, int numResult) { - String labelKey = JythonFileProperty.RESULT_PREFIX + numResult - + JythonFileProperty.LABEL_SUFFIX; - Object labelValue = props.get(labelKey); - - String labelValueString; - if (!(labelValue == null)) { - labelValueString = (String) labelValue; - } else { - labelValueString = "Data"; - logger.log(LogService.LOG_WARNING, "Label of data returned from " - + "jython script not specified in .properties file. " - + "Assigning label to '" + labelValueString + "'."); - } - return labelValueString; - } - - public String getResultType(Dictionary props, int numResult) { - String typeKey = JythonFileProperty.RESULT_PREFIX + - numResult + JythonFileProperty.TYPE_SUFFIX; - Object typeValue = props.get(typeKey); - - String typeValueString; - if (! (typeValue == null)) { - typeValueString = (String) typeValue; - checkType(typeValueString); - - } else { - typeValueString = DataProperty.OTHER_TYPE; - logger.log(LogService.LOG_WARNING, "Type of data returned from " + - "jython script not specified in .properties file. " + - "Assigning type to '" + typeValueString + "'."); - } - return typeValueString; - } - - /** - * Looks to see whether the result has a parent specified in the - * algorithm's .properties file. If it does, return the parent data. - * Otherwise return null. - * @param props information about the script, such as - * the labels, types, and parents of all the returned data. - * @param numResult specifies which result's information we need to look - * up - * @param inputData the data CIShell passed this algorithm. - * @return either the parent of the result data specified by numResults, - * or null, if there is no parent specified. - */ - public Data getResultParent(Dictionary props, int numResult, Data[] inputData) { - String childKey = JythonFileProperty.RESULT_PREFIX + numResult - + JythonFileProperty.PARENT_SUFFIX; - Object parentName = props.get(childKey); - - Data parent; - if (! (parentName == null)) { - //TODO: more validation on parentName - char parentDataIndexChar = getLastChar((String) parentName); - int parentDataIndex = Character.digit(parentDataIndexChar, 10); - if (parentDataIndex < inputData.length) { - parent = inputData[parentDataIndex]; - } else { - logger.log(LogService.LOG_WARNING, ".properties file " + - "tried to assign result" + numResult + "the " + - "parent arg"+ parentDataIndex + ", which has an " + - "index greater than any arg provided. Cannot " + - "assign result" + numResult + " a parent."); - parent = null; - } - } else { - //it's okay not to specify a parent. - parent = null; - } - return parent; - } - - private PythonInterpreter passArgument(Object arg, String argName, - PythonInterpreter interp) { - if (! (arg instanceof File)) { - interp.set(argName, - new PyJavaInstance(arg)); - } else { - try { - File fileArg = (File) arg; - InputStream fileStream = fileArg.toURL().openStream(); - interp.set(argName, - new PyFile(fileStream)); - } catch (IOException e) { - logger.log(LogService.LOG_ERROR, "Problem opening file" + - " provided as an argument to jython script.", e); - e.printStackTrace(); - } - } - - return interp; - } - - /** - * Takes java objects and wraps them in our CIShell data objects - * so that they can be returned from the algorithm. - * @param rawResults a list of java objects. - * @return a list of data objects. - */ - private List convertToData(List rawResults) { - List results = new ArrayList(); - for (int ii = 0; ii < rawResults.size(); ii++) { - Object rawResult = rawResults.get(ii); - String resultClassName = rawResult.getClass().getName(); - BasicData data = new BasicData(rawResult, resultClassName); - results.add(data); - } - return results; - } - private boolean variableIsDefined(PythonInterpreter interp, + protected boolean variableIsDefined(PythonInterpreter interp, String variableName) { String predicate = "vars().has_key('" + variableName + "') or " + "globals().has_key('" + variableName + "')"; boolean result = evalPredicate(interp, predicate); return result; } - private boolean evalPredicate(PythonInterpreter interp, String predicate) { + + protected boolean evalPredicate(PythonInterpreter interp, String predicate) { PyObject pyResult = interp.eval(predicate); Boolean resultObj = (Boolean) pyResult.__tojava__(Boolean.class); boolean result = resultObj.booleanValue(); return result; } - - private Data[] convertToArray(List dataList) { - Data[] dataArray = new Data[dataList.size()]; - for (int ii = 0; ii < dataArray.length; ii++) { - dataArray[ii] = (Data) dataList.get(ii); - } - return dataArray; - } - - private void checkType(String ts) { - if (! (ts.equals(DataProperty.MATRIX_TYPE) || - ts.equals(DataProperty.NETWORK_TYPE) || - ts.equals(DataProperty.TEXT_TYPE) || - ts.equals(DataProperty.OTHER_TYPE) || - ts.equals(DataProperty.TEXT_TYPE))) { - logger.log(LogService.LOG_WARNING, "JythonRunnerAlgorithm: " + - "Assigning return data an unsupported data type " + - ts +". Either the type is invalid or " + - "JythonRunnerAlgorithm has not be updated to reflect " + - "types introduced in newer versions"); - } - } - - public char getLastChar(String s) { - if (s.length() > 0) { - return s.charAt(s.length() - 1); - } else { - throw new IndexOutOfBoundsException("Cannot get the last " + - "character of an empy string"); - } - } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-18 15:47:12
|
Revision: 423 http://svn.sourceforge.net/cishell/?rev=423&view=rev Author: mwlinnem Date: 2007-07-18 08:20:54 -0700 (Wed, 18 Jul 2007) Log Message: ----------- Initial commit. Rough template/wizard for creating jython algorithms. About as easy to use as the static executable one, which is to say not very user friendly but works if you are familiar with the project. Will need to spend some more time on this if/when we wish to expose it to outside users. Modified Paths: -------------- trunk/templates/org.cishell.templates.wizards/plugin.xml Added Paths: ----------- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmTemplate.java trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmWizard.java trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/META-INF/ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/META-INF/MANIFEST.MF trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/algorithm.properties trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/component.xml trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/l10n/ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/l10n/bundle_en.properties trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/metatype/ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/metatype/METADATA.XML trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/README.txt trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/build.properties trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/samplealgorithm.py Modified: trunk/templates/org.cishell.templates.wizards/plugin.xml =================================================================== --- trunk/templates/org.cishell.templates.wizards/plugin.xml 2007-07-13 21:18:01 UTC (rev 422) +++ trunk/templates/org.cishell.templates.wizards/plugin.xml 2007-07-18 15:20:54 UTC (rev 423) @@ -30,6 +30,16 @@ <wizard canFinishEarly="false" category="cishell" + class="org.cishell.templates.wizards.jython.NewJythonAlgorithmWizard" + hasPages="true" + icon="icons/cishell.ico" + id="org.cishell.templates.wizards.jython.NewJythonAlgorithmWizard" + name="Jython-based algorithm" + preferredPerspectives="org.eclipse.jdt.ui.JavaPerspective" + project="true"/> + <wizard + canFinishEarly="false" + category="cishell" class="org.cishell.templates.wizards.dataset.NewDatasetWizard" hasPages="true" icon="icons/cishell.ico" Added: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmTemplate.java =================================================================== --- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmTemplate.java (rev 0) +++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmTemplate.java 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,59 @@ +/* **************************************************************************** + * CIShell: Cyberinfrastructure Shell, An Algorithm Integration Framework. + * + * All rights reserved. This program and the accompanying materials are made + * available under the terms of the Apache License v2.0 which accompanies + * this distribution, and is available at: + * http://www.apache.org/licenses/LICENSE-2.0.html + * + * Created on Aug 10, 2006 at Indiana University. + * + * Contributors: + * Indiana University - + * ***************************************************************************/ +package org.cishell.templates.wizards.jython; + +import org.cishell.templates.wizards.BasicTemplate; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.pde.ui.templates.TemplateOption; +import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; + +/** + * + * @author Bruce Herr (bh...@bh...) + */ +public class NewJythonAlgorithmTemplate extends BasicTemplate { + WizardNewProjectCreationPage projectPage; + + public NewJythonAlgorithmTemplate() { + super("jython_algorithm"); + + setPageCount(1); + } + + public void addPages(Wizard wizard) { + WizardPage page = new WizardNewProjectCreationPage("projectPage"); + page.setTitle("Project Properties"); + page.setDescription("Enter the project name and location"); + wizard.addPage(page); + projectPage = (WizardNewProjectCreationPage) page; + + markPagesAdded(); + } + + protected void updateModel(IProgressMonitor monitor) throws CoreException { + + } + + public void validateOptions(TemplateOption changed) { + + } + + public IProject getProjectHandle() { + return projectPage.getProjectHandle(); + } +} Added: trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmWizard.java =================================================================== --- trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmWizard.java (rev 0) +++ trunk/templates/org.cishell.templates.wizards/src/org/cishell/templates/wizards/jython/NewJythonAlgorithmWizard.java 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,123 @@ +/* **************************************************************************** + * CIShell: Cyberinfrastructure Shell, An Algorithm Integration Framework. + * + * All rights reserved. This program and the accompanying materials are made + * available under the terms of the Apache License v2.0 which accompanies + * this distribution, and is available at: + * http://www.apache.org/licenses/LICENSE-2.0.html + * + * Created on Aug 10, 2006 at Indiana University. + * + * Contributors: + * Indiana University - + * ***************************************************************************/ +package org.cishell.templates.wizards.jython; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.pde.core.plugin.IPluginBase; +import org.eclipse.pde.core.plugin.IPluginModelBase; +import org.eclipse.pde.internal.core.bundle.BundlePluginBase; +import org.eclipse.pde.internal.core.bundle.BundlePluginModelBase; +import org.eclipse.pde.ui.templates.ITemplateSection; +import org.eclipse.pde.ui.templates.NewPluginTemplateWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWizard; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.ISetSelectionTarget; + +/** + * + * @author Bruce Herr (bh...@bh...) + */ +public class NewJythonAlgorithmWizard extends NewPluginTemplateWizard + implements IWorkbenchWizard { + NewJythonAlgorithmTemplate template; + + /** + * @see org.eclipse.pde.ui.templates.NewPluginTemplateWizard#createTemplateSections() + */ + public ITemplateSection[] createTemplateSections() { + template = new NewJythonAlgorithmTemplate(); + return new ITemplateSection[]{template}; + } + + public boolean performFinish() { + final IProject project = template.getProjectHandle(); + final IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); + + WorkspaceModifyOperation op = new WorkspaceModifyOperation() { + protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { + monitor.beginTask("", 2500); + project.create(description, monitor); + project.open(monitor); + + IPluginModelBase model = new BundlePluginModelBase(){ + private static final long serialVersionUID = 1L; + + public IPluginBase createPluginBase() { + return new BundlePluginBase(); + } + + public boolean isFragmentModel() { + return false; + }}; + + performFinish(project, model, monitor); + + monitor.done(); + } + }; + + try { + getContainer().run(true, true, op); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + final IFile file = template.getProjectHandle().getFile("README.txt"); + final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + final IWorkbenchPage page = ww.getActivePage(); + if (page != null) { + final IWorkbenchPart focusPart = page.getActivePart(); + ww.getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + if (focusPart instanceof ISetSelectionTarget) { + ISelection selection = new StructuredSelection(file); + ((ISetSelectionTarget) focusPart).selectReveal(selection); + } + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + } + } + }); + } + + return true; + } + + /** + * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + + } +} Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/META-INF/MANIFEST.MF =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/META-INF/MANIFEST.MF (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/META-INF/MANIFEST.MF 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Sample Jython Algorithm +Bundle-SymbolicName: org.cishell.templates.wizards.samplejythonalgorithm +Bundle-Version: 0.0.1 +Bundle-ClassPath: . +Bundle-Localization: plugin +Import-Package: org.cishell.templates.jythonrunner, + org.cishell.framework, + org.cishell.framework.algorithm, + org.cishell.framework.data, + 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" +X-AutoStart: true +Service-Component: OSGI-INF/component.xml Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/algorithm.properties =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/algorithm.properties (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/algorithm.properties 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,14 @@ +menu_path=Visualization/SubMenu/additions +label=Sample Jython Algorithm +description=Prints the provided attribute, and returns the original graph +in_data=prefuse.data.Graph +out_data=prefuse.data.Graph, file:text/plain +service.pid=org.cishell.templates.wizards.samplejythonalgorithm +remoteable=false +script_path=/samplealgorithm.py +result0.label=Exact same network that was passed in +result0.type=Network +result0.parent=arg0 +result1.label=Number of edges in provided network +result1.type=Text +result1.parent=arg0 Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/component.xml =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/component.xml (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/component.xml 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.templates.wizards.samplejythonalgorithm" immediate="false"> + <implementation class="org.cishell.templates.jythonrunner.JythonAlgorithmFactory"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/l10n/bundle_en.properties 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/OSGI-INF/metatype/METADATA.XML 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="Sample Jython Algorithm" id="org.cishell.templates.wizards.samplejythonalgorithm.OCD" + description="A sample jython algorithm"> + <AD name="Sample Attribute" id="sample_attr" type="Integer" description="Enter a positive integer" default="1" min="1" /> + </OCD> + <Designate pid="org.cishell.templates.wizards.samplejythonalgorithm"> + <Object ocdref="org.cishell.templates.wizards.samplejythonalgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/README.txt =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/README.txt (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/README.txt 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,40 @@ +Here is the minimum you need to know to integrate a jython script with +CIShell, working from what is already provided by default in this project. + +Arguments passed in from the Network Workbench Data Manager are passed +into your script by default as variables with the prefix "arg" and a +numeric suffix. The first argument is arg0, the next is arg1, and so on. +You may specify how many, and what type of data you want these to be by +editing the in_data property in the algorithm.properties file. + +Arguments passed in from the user at the time the algorithm is run (The +kind where a dialog box pops up and the user fills things in) can have +any valid python variable name. You can define what data you need, the +type of data, and the variable names of that data by editing the +METADATA.XML file. The id provided will be the name of the variable in +the python environment. + +To return results, assign values to variables with the prefix "result". +The first result is result0, the second is result1, and so on. You +must specify the format of the data you are returning by editing the +out_data property in the algorithm.properties file. You must also +define values for the metadata of each result you return. Look at the +algorithm.properties file to see how this is done. Each result must +specify a label and type, but parent part is optional. Label can be +any text, type must be one of the pre-define types ("Network", "Text", +"Matrix", or "Other" currently), and parent must be the variable +name of one of the provided data arguments (arg0, arg1, etc...). + +Change the menu path to something sensible too. + +NOTE: There are other things that should probably be changed if you +are doing anything more than playing around with the jython algorithm +capabilities in CIShell. The plugin name, symbolic-name, all references +to the package, the service.pid, the algorithm description, and +probably a few other things should be unique for each project. This +template is currently in a rough state. It should probably have +a wizard that asks the user to specify all the stuff that +should change between projects. This should do for now though, +especially for internal use. + + \ No newline at end of file Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/build.properties =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/build.properties (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/build.properties 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,4 @@ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/,\ + samplealgorithm.py Added: trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/samplealgorithm.py =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/samplealgorithm.py (rev 0) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/jython_algorithm/samplealgorithm.py 2007-07-18 15:20:54 UTC (rev 423) @@ -0,0 +1,29 @@ +# To see the output printed to the console in Network Workbench, use the +# switch "-console" when opening Network Workbench from the command line. +from java import io + +print "Here is the value you gave me when you ran the algorithm..." +print sample_attr + +print "Here is what I got from CIShell (the graph you highlighted)" +print arg0 +graph = arg0 +edge_count = graph.getEdgeCount() + +print "Here is the number of edges in the graph you provided..." +print edge_count + +aFile = io.File("whatever.txt") +writer = io.BufferedWriter(io.FileWriter(aFile)) +writer.write(str(edge_count)) +writer.close() + +print "I will now return the original graph, and the edge count in a file" + +aFile = io.File("whatever.txt") +writer = io.BufferedWriter(io.FileWriter(aFile)) +writer.write(str(edge_count)) +writer.close() + +result0 = arg0 +result1 = aFile \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:18:04
|
Revision: 422 http://svn.sourceforge.net/cishell/?rev=422&view=rev Author: mwlinnem Date: 2007-07-13 14:18:01 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Move along. Added Paths: ----------- trunk/templates/org.cishell.templates.jythonrunner/ Removed Paths: ------------- trunk/templates/jythonrunner/ Copied: trunk/templates/org.cishell.templates.jythonrunner (from rev 421, trunk/templates/jythonrunner) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:16:25
|
Revision: 421 http://svn.sourceforge.net/cishell/?rev=421&view=rev Author: mwlinnem Date: 2007-07-13 14:16:22 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Initial import. JythonRunner allows CIShell to support jython algorithms. Added Paths: ----------- trunk/templates/jythonrunner/META-INF/ trunk/templates/jythonrunner/META-INF/MANIFEST.MF trunk/templates/jythonrunner/OSGI-INF/ trunk/templates/jythonrunner/OSGI-INF/algorithm.properties trunk/templates/jythonrunner/OSGI-INF/component.xml trunk/templates/jythonrunner/OSGI-INF/l10n/ trunk/templates/jythonrunner/OSGI-INF/l10n/bundle_en.properties trunk/templates/jythonrunner/OSGI-INF/metatype/ trunk/templates/jythonrunner/OSGI-INF/metatype/METADATA.XML trunk/templates/jythonrunner/build.properties trunk/templates/jythonrunner/src/ trunk/templates/jythonrunner/src/org/ trunk/templates/jythonrunner/src/org/cishell/ trunk/templates/jythonrunner/src/org/cishell/templates/ trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/ trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java Added: trunk/templates/jythonrunner/META-INF/MANIFEST.MF =================================================================== --- trunk/templates/jythonrunner/META-INF/MANIFEST.MF (rev 0) +++ trunk/templates/jythonrunner/META-INF/MANIFEST.MF 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: JythonRunner +Bundle-SymbolicName: org.cishell.templates.jythonrunner +Bundle-Version: 0.0.1 +Bundle-ClassPath: . +Bundle-Localization: plugin +Import-Package: org.cishell.framework, + org.cishell.framework.algorithm, + org.cishell.framework.data, + 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", + org.python.compiler, + org.python.core, + org.python.modules, + org.python.modules.sre, + org.python.parser, + org.python.rmi, + org.python.util +Export-Package: org.cishell.templates.jythonrunner +X-AutoStart: true +Service-Component: OSGI-INF/component.xml Added: trunk/templates/jythonrunner/OSGI-INF/algorithm.properties =================================================================== --- trunk/templates/jythonrunner/OSGI-INF/algorithm.properties (rev 0) +++ trunk/templates/jythonrunner/OSGI-INF/algorithm.properties 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,6 @@ +label=Jython Script Runner +description=Runs Jython Algorithms +in_data=null +out_data=null +service.pid=edu.iu.nwb.converter.JythonRunnerAlgorithm +remoteable=true Added: trunk/templates/jythonrunner/OSGI-INF/component.xml =================================================================== --- trunk/templates/jythonrunner/OSGI-INF/component.xml (rev 0) +++ trunk/templates/jythonrunner/OSGI-INF/component.xml 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.templates.jythonrunner.component" immediate="false"> + <implementation class="org.cishell.templates.jythonrunner.JythonAlgorithmFactory"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: trunk/templates/jythonrunner/OSGI-INF/l10n/bundle_en.properties =================================================================== --- trunk/templates/jythonrunner/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ trunk/templates/jythonrunner/OSGI-INF/l10n/bundle_en.properties 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: trunk/templates/jythonrunner/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/templates/jythonrunner/OSGI-INF/metatype/METADATA.XML (rev 0) +++ trunk/templates/jythonrunner/OSGI-INF/metatype/METADATA.XML 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="My Algorithm" id="org.my.algorithm.MyAlgorithm.OCD" + description=""> + </OCD> + <Designate pid="org.my.algorithm.MyAlgorithm"> + <Object ocdref="org.my.algorithm.MyAlgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: trunk/templates/jythonrunner/build.properties =================================================================== --- trunk/templates/jythonrunner/build.properties (rev 0) +++ trunk/templates/jythonrunner/build.properties 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,6 @@ +source.. = src/ +output.. = build/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ +jars.compile.order = . Added: trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java =================================================================== --- trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java (rev 0) +++ trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,53 @@ +package org.cishell.templates.jythonrunner; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.Data; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; +/** + * + * @author mwlinnem + * + */ + +//TODO: cleanup + +public class JythonAlgorithmFactory implements AlgorithmFactory { + private BundleContext myBundleContext; + private Bundle myBundle; + private MetaTypeProvider provider; + private Dictionary properties; + + protected void activate(ComponentContext ctxt) { + + MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + this.myBundleContext = ctxt.getBundleContext(); + this.myBundle = myBundleContext.getBundle(); + this.provider = mts.getMetaTypeInformation(myBundle); + this.properties = ctxt.getProperties(); + } + + + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, + CIShellContext context) { + return new JythonRunnerAlgorithm(data, parameters, context, + properties, myBundle); + + + } + + public MetaTypeProvider createParameters(Data[] data) { + return provider; + } +} \ No newline at end of file Added: trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java =================================================================== --- trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java (rev 0) +++ trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,15 @@ +package org.cishell.templates.jythonrunner; + +public class JythonFileProperty { + public static final String SCRIPT_PATH_KEY = "script_path"; + + public static final String RESULT_PREFIX = + JythonRunnerAlgorithm.SCRIPT_RESULT_PREFIX; + public static final String ARGUMENT_PREFIX = + JythonRunnerAlgorithm.SCRIPT_ARGUMENT_PREFIX; + + public static final String LABEL_SUFFIX = ".label"; + public static final String TYPE_SUFFIX = ".type"; + public static final String PARENT_SUFFIX = ".parent"; + +} Added: trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java =================================================================== --- trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java (rev 0) +++ trunk/templates/jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java 2007-07-13 21:16:22 UTC (rev 421) @@ -0,0 +1,368 @@ +package org.cishell.templates.jythonrunner; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.List; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.framework.data.DataProperty; +import org.osgi.framework.Bundle; +import org.osgi.service.log.LogService; +import org.python.core.PyFile; +import org.python.core.PyJavaInstance; +import org.python.core.PyObject; +import org.python.util.PythonInterpreter; + +/** + * + * @author mwlinnem + * + */ + +//TODO:refactor me into multiple classes +//TODO:general cleanup, renaming, etc... + +public class JythonRunnerAlgorithm implements Algorithm { + private Data[] data; + private Dictionary parameters; + private Dictionary properties; + + private LogService logger; + + private URL script; + + public static final String SCRIPT_ARGUMENT_PREFIX = "arg"; + public static final String SCRIPT_RESULT_PREFIX = "result"; + + public JythonRunnerAlgorithm(Data[] data, Dictionary parameters, + CIShellContext context, Dictionary properties, Bundle myBundle) { + this.data = data; + this.parameters = parameters; + this.properties = properties; + + String scriptPath = (String) properties.get( + JythonFileProperty.SCRIPT_PATH_KEY); + script = myBundle.getResource(scriptPath); + + this.logger = (LogService) context.getService( + LogService.class.getName()); + } + + public Data[] execute() { + + PythonInterpreter interp = initializeInterpreter( + new PythonInterpreter(), data, parameters); + + List rawResults = runScript(interp, script); + + Data[] results = formatRawResults(rawResults, data, properties); + + return results; + } + + + private PythonInterpreter initializeInterpreter(PythonInterpreter interp, + Data[] data, Dictionary parameters) { + interp = passUserProvidedArguments(interp, parameters); + interp = passCIShellProvidedArguments(interp, data); + interp = initializeLogging(interp); + return interp; + } + + /** + * Executes the script and extracts the raw results. + * @param interp The initialized python interpreter + * @param script The jython script itself, which the interpreter will run + * @return A list of objects that the script returned. + */ + private List runScript(PythonInterpreter interp, URL script) { + interp = executeFile(interp, script); + List rawResults = getRawResults(interp); + return rawResults; + } + + private Data[] formatRawResults(List rawResults, Data[] inputData, + Dictionary properties) { + List dataResults = convertToData(rawResults); + List dataResultsWithMetaData = addMetaData(dataResults, inputData, + properties); + Data[] resultsArray = convertToArray(dataResultsWithMetaData); + return resultsArray; + } + + + + private PythonInterpreter executeFile(PythonInterpreter interp, + URL script) { + try { + interp.execfile(script.openStream()); + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, "Unable to open jython script " + + script.toString() + ".", e); + e.printStackTrace(); + } + return interp; + } + + private PythonInterpreter passUserProvidedArguments( + PythonInterpreter interp, Dictionary parameters) { + + Enumeration enumer = parameters.keys(); + while (enumer.hasMoreElements()) { + String key = (String) enumer.nextElement(); + Object value = parameters.get(key); + String argName = key; + + interp = passArgument(value, argName, interp); + } + + return interp; + } + + private PythonInterpreter passCIShellProvidedArguments( + PythonInterpreter interp, Data[] data) { + for (int ii = 0; ii < this.data.length; ii++) { + Data argData = this.data[ii]; + Object arg = argData.getData(); + String argName = SCRIPT_ARGUMENT_PREFIX + String.valueOf(ii); + + interp = passArgument(arg, argName, interp); + } + + return interp; + } + + private PythonInterpreter initializeLogging(PythonInterpreter interp) { + interp.setErr(System.err); + interp.setOut(System.out); + return interp; + } + + /** + * Gets Java versions of all the results from the script. + * @param interp a python interpreter that holds results (presumably + * after having executed a script) + * @return A list of objects, where each object is a result from + * the interpreters environment. + */ + private List getRawResults(PythonInterpreter interp) { + List results = new ArrayList(); + + /* + * gets the values held in result variables, from + * "result0" counting upward, until we reach a result + * variable which is not defined. + */ + int ii = 0; + String resultName = SCRIPT_RESULT_PREFIX + ii; + + while (variableIsDefined(interp, resultName)) { + + results.add(interp.get(resultName, Object.class)); + + ii++; + resultName = SCRIPT_RESULT_PREFIX + ii; + } + + return results; + } + + /** + * adds metadata obtained from the algorithm's .properties files + * that specify information about what the script returns. + * @param data a list of data objects, in the order + * they were returned. + * @param inputData the data passed from CIShell to this algorithm + * @param properties information about the script, such as + * the labels, types, and parents of all the returned data. + * @return a list of data objects in the order they were provided, + * now containing the appropriate metadata obtained from the + * .properties file. + */ + private List addMetaData(List data, Data[] inputData, Dictionary properties) { + List results = new ArrayList(); + for (int ii = 0; ii < data.size(); ii++) { + Data result = ((Data) data.get(ii)); + Dictionary metadataHolder = result.getMetaData(); + + String dataLabel = getResultLabel(properties, ii); + metadataHolder.put(DataProperty.LABEL, dataLabel); + + String dataType = getResultType(properties, ii); + metadataHolder.put(DataProperty.TYPE, dataType); + + Data dataParent = getResultParent(properties, ii, inputData); + if (dataParent != null) { + metadataHolder.put(DataProperty.PARENT, dataParent); + } //it's okay to not have a parent, little Timmy. + + results.add(result); + } + return results; + } + + public String getResultLabel(Dictionary props, int numResult) { + String labelKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.LABEL_SUFFIX; + Object labelValue = props.get(labelKey); + + String labelValueString; + if (!(labelValue == null)) { + labelValueString = (String) labelValue; + } else { + labelValueString = "Data"; + logger.log(LogService.LOG_WARNING, "Label of data returned from " + + "jython script not specified in .properties file. " + + "Assigning label to '" + labelValueString + "'."); + } + return labelValueString; + } + + public String getResultType(Dictionary props, int numResult) { + String typeKey = JythonFileProperty.RESULT_PREFIX + + numResult + JythonFileProperty.TYPE_SUFFIX; + Object typeValue = props.get(typeKey); + + String typeValueString; + if (! (typeValue == null)) { + typeValueString = (String) typeValue; + checkType(typeValueString); + + } else { + typeValueString = DataProperty.OTHER_TYPE; + logger.log(LogService.LOG_WARNING, "Type of data returned from " + + "jython script not specified in .properties file. " + + "Assigning type to '" + typeValueString + "'."); + } + return typeValueString; + } + + /** + * Looks to see whether the result has a parent specified in the + * algorithm's .properties file. If it does, return the parent data. + * Otherwise return null. + * @param props information about the script, such as + * the labels, types, and parents of all the returned data. + * @param numResult specifies which result's information we need to look + * up + * @param inputData the data CIShell passed this algorithm. + * @return either the parent of the result data specified by numResults, + * or null, if there is no parent specified. + */ + public Data getResultParent(Dictionary props, int numResult, Data[] inputData) { + String childKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.PARENT_SUFFIX; + Object parentName = props.get(childKey); + + Data parent; + if (! (parentName == null)) { + //TODO: more validation on parentName + char parentDataIndexChar = getLastChar((String) parentName); + int parentDataIndex = Character.digit(parentDataIndexChar, 10); + if (parentDataIndex < inputData.length) { + parent = inputData[parentDataIndex]; + } else { + logger.log(LogService.LOG_WARNING, ".properties file " + + "tried to assign result" + numResult + "the " + + "parent arg"+ parentDataIndex + ", which has an " + + "index greater than any arg provided. Cannot " + + "assign result" + numResult + " a parent."); + parent = null; + } + } else { + //it's okay not to specify a parent. + parent = null; + } + return parent; + } + + private PythonInterpreter passArgument(Object arg, String argName, + PythonInterpreter interp) { + if (! (arg instanceof File)) { + interp.set(argName, + new PyJavaInstance(arg)); + } else { + try { + File fileArg = (File) arg; + InputStream fileStream = fileArg.toURL().openStream(); + interp.set(argName, + new PyFile(fileStream)); + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, "Problem opening file" + + " provided as an argument to jython script.", e); + e.printStackTrace(); + } + } + + return interp; + } + + /** + * Takes java objects and wraps them in our CIShell data objects + * so that they can be returned from the algorithm. + * @param rawResults a list of java objects. + * @return a list of data objects. + */ + private List convertToData(List rawResults) { + List results = new ArrayList(); + for (int ii = 0; ii < rawResults.size(); ii++) { + Object rawResult = rawResults.get(ii); + String resultClassName = rawResult.getClass().getName(); + BasicData data = new BasicData(rawResult, resultClassName); + results.add(data); + } + return results; + } + private boolean variableIsDefined(PythonInterpreter interp, + String variableName) { + String predicate = "vars().has_key('" + variableName + "') or " + + "globals().has_key('" + variableName + "')"; + boolean result = evalPredicate(interp, predicate); + return result; + } + private boolean evalPredicate(PythonInterpreter interp, String predicate) { + PyObject pyResult = interp.eval(predicate); + Boolean resultObj = (Boolean) pyResult.__tojava__(Boolean.class); + boolean result = resultObj.booleanValue(); + return result; + } + + private Data[] convertToArray(List dataList) { + Data[] dataArray = new Data[dataList.size()]; + for (int ii = 0; ii < dataArray.length; ii++) { + dataArray[ii] = (Data) dataList.get(ii); + } + return dataArray; + } + + private void checkType(String ts) { + if (! (ts.equals(DataProperty.MATRIX_TYPE) || + ts.equals(DataProperty.NETWORK_TYPE) || + ts.equals(DataProperty.TEXT_TYPE) || + ts.equals(DataProperty.OTHER_TYPE) || + ts.equals(DataProperty.TEXT_TYPE))) { + logger.log(LogService.LOG_WARNING, "JythonRunnerAlgorithm: " + + "Assigning return data an unsupported data type " + + ts +". Either the type is invalid or " + + "JythonRunnerAlgorithm has not be updated to reflect " + + "types introduced in newer versions"); + } + } + + public char getLastChar(String s) { + if (s.length() > 0) { + return s.charAt(s.length() - 1); + } else { + throw new IndexOutOfBoundsException("Cannot get the last " + + "character of an empy string"); + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:15:31
|
Revision: 420 http://svn.sourceforge.net/cishell/?rev=420&view=rev Author: mwlinnem Date: 2007-07-13 14:15:29 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Initial import. JythonRunner allows CIShell to support jython algorithms. Added Paths: ----------- trunk/templates/jythonrunner/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:11:32
|
Revision: 419 http://svn.sourceforge.net/cishell/?rev=419&view=rev Author: mwlinnem Date: 2007-07-13 14:11:30 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Whoopsies Removed Paths: ------------- org.cishell.templates.jythonrunner/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:06:45
|
Revision: 418 http://svn.sourceforge.net/cishell/?rev=418&view=rev Author: mwlinnem Date: 2007-07-13 14:06:42 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Initial import. JythonRunner allows CIShell to support jython algorithms. Added Paths: ----------- org.cishell.templates.jythonrunner/META-INF/ org.cishell.templates.jythonrunner/META-INF/MANIFEST.MF org.cishell.templates.jythonrunner/OSGI-INF/ org.cishell.templates.jythonrunner/OSGI-INF/algorithm.properties org.cishell.templates.jythonrunner/OSGI-INF/component.xml org.cishell.templates.jythonrunner/OSGI-INF/l10n/ org.cishell.templates.jythonrunner/OSGI-INF/l10n/bundle_en.properties org.cishell.templates.jythonrunner/OSGI-INF/metatype/ org.cishell.templates.jythonrunner/OSGI-INF/metatype/METADATA.XML org.cishell.templates.jythonrunner/build.properties org.cishell.templates.jythonrunner/src/ org.cishell.templates.jythonrunner/src/org/ org.cishell.templates.jythonrunner/src/org/cishell/ org.cishell.templates.jythonrunner/src/org/cishell/templates/ org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/ org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java Added: org.cishell.templates.jythonrunner/META-INF/MANIFEST.MF =================================================================== --- org.cishell.templates.jythonrunner/META-INF/MANIFEST.MF (rev 0) +++ org.cishell.templates.jythonrunner/META-INF/MANIFEST.MF 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: JythonRunner +Bundle-SymbolicName: org.cishell.templates.jythonrunner +Bundle-Version: 0.0.1 +Bundle-ClassPath: . +Bundle-Localization: plugin +Import-Package: org.cishell.framework, + org.cishell.framework.algorithm, + org.cishell.framework.data, + 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", + org.python.compiler, + org.python.core, + org.python.modules, + org.python.modules.sre, + org.python.parser, + org.python.rmi, + org.python.util +Export-Package: org.cishell.templates.jythonrunner +X-AutoStart: true +Service-Component: OSGI-INF/component.xml Added: org.cishell.templates.jythonrunner/OSGI-INF/algorithm.properties =================================================================== --- org.cishell.templates.jythonrunner/OSGI-INF/algorithm.properties (rev 0) +++ org.cishell.templates.jythonrunner/OSGI-INF/algorithm.properties 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,6 @@ +label=Jython Script Runner +description=Runs Jython Algorithms +in_data=null +out_data=null +service.pid=edu.iu.nwb.converter.JythonRunnerAlgorithm +remoteable=true Added: org.cishell.templates.jythonrunner/OSGI-INF/component.xml =================================================================== --- org.cishell.templates.jythonrunner/OSGI-INF/component.xml (rev 0) +++ org.cishell.templates.jythonrunner/OSGI-INF/component.xml 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.templates.jythonrunner.component" immediate="false"> + <implementation class="org.cishell.templates.jythonrunner.JythonAlgorithmFactory"/> + <properties entry="OSGI-INF/algorithm.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Added: org.cishell.templates.jythonrunner/OSGI-INF/l10n/bundle_en.properties =================================================================== --- org.cishell.templates.jythonrunner/OSGI-INF/l10n/bundle_en.properties (rev 0) +++ org.cishell.templates.jythonrunner/OSGI-INF/l10n/bundle_en.properties 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,7 @@ +#Localization variables for OSGI-INF/metatatype/METADATA.XML +# +#Samples: +#input=Input +#desc=Enter an integer (that will be converted to a string) +#name=Input->String +#name_desc=Converts inputted integer to string Added: org.cishell.templates.jythonrunner/OSGI-INF/metatype/METADATA.XML =================================================================== --- org.cishell.templates.jythonrunner/OSGI-INF/metatype/METADATA.XML (rev 0) +++ org.cishell.templates.jythonrunner/OSGI-INF/metatype/METADATA.XML 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> + <OCD name="My Algorithm" id="org.my.algorithm.MyAlgorithm.OCD" + description=""> + </OCD> + <Designate pid="org.my.algorithm.MyAlgorithm"> + <Object ocdref="org.my.algorithm.MyAlgorithm.OCD" /> + </Designate> +</metatype:MetaData> Added: org.cishell.templates.jythonrunner/build.properties =================================================================== --- org.cishell.templates.jythonrunner/build.properties (rev 0) +++ org.cishell.templates.jythonrunner/build.properties 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,6 @@ +source.. = src/ +output.. = build/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ +jars.compile.order = . Added: org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java =================================================================== --- org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java (rev 0) +++ org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonAlgorithmFactory.java 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,53 @@ +package org.cishell.templates.jythonrunner; + +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.Data; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; +/** + * + * @author mwlinnem + * + */ + +//TODO: cleanup + +public class JythonAlgorithmFactory implements AlgorithmFactory { + private BundleContext myBundleContext; + private Bundle myBundle; + private MetaTypeProvider provider; + private Dictionary properties; + + protected void activate(ComponentContext ctxt) { + + MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + this.myBundleContext = ctxt.getBundleContext(); + this.myBundle = myBundleContext.getBundle(); + this.provider = mts.getMetaTypeInformation(myBundle); + this.properties = ctxt.getProperties(); + } + + + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, + CIShellContext context) { + return new JythonRunnerAlgorithm(data, parameters, context, + properties, myBundle); + + + } + + public MetaTypeProvider createParameters(Data[] data) { + return provider; + } +} \ No newline at end of file Added: org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java =================================================================== --- org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java (rev 0) +++ org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonFileProperty.java 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,15 @@ +package org.cishell.templates.jythonrunner; + +public class JythonFileProperty { + public static final String SCRIPT_PATH_KEY = "script_path"; + + public static final String RESULT_PREFIX = + JythonRunnerAlgorithm.SCRIPT_RESULT_PREFIX; + public static final String ARGUMENT_PREFIX = + JythonRunnerAlgorithm.SCRIPT_ARGUMENT_PREFIX; + + public static final String LABEL_SUFFIX = ".label"; + public static final String TYPE_SUFFIX = ".type"; + public static final String PARENT_SUFFIX = ".parent"; + +} Added: org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java =================================================================== --- org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java (rev 0) +++ org.cishell.templates.jythonrunner/src/org/cishell/templates/jythonrunner/JythonRunnerAlgorithm.java 2007-07-13 21:06:42 UTC (rev 418) @@ -0,0 +1,368 @@ +package org.cishell.templates.jythonrunner; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.List; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.data.BasicData; +import org.cishell.framework.data.Data; +import org.cishell.framework.data.DataProperty; +import org.osgi.framework.Bundle; +import org.osgi.service.log.LogService; +import org.python.core.PyFile; +import org.python.core.PyJavaInstance; +import org.python.core.PyObject; +import org.python.util.PythonInterpreter; + +/** + * + * @author mwlinnem + * + */ + +//TODO:refactor me into multiple classes +//TODO:general cleanup, renaming, etc... + +public class JythonRunnerAlgorithm implements Algorithm { + private Data[] data; + private Dictionary parameters; + private Dictionary properties; + + private LogService logger; + + private URL script; + + public static final String SCRIPT_ARGUMENT_PREFIX = "arg"; + public static final String SCRIPT_RESULT_PREFIX = "result"; + + public JythonRunnerAlgorithm(Data[] data, Dictionary parameters, + CIShellContext context, Dictionary properties, Bundle myBundle) { + this.data = data; + this.parameters = parameters; + this.properties = properties; + + String scriptPath = (String) properties.get( + JythonFileProperty.SCRIPT_PATH_KEY); + script = myBundle.getResource(scriptPath); + + this.logger = (LogService) context.getService( + LogService.class.getName()); + } + + public Data[] execute() { + + PythonInterpreter interp = initializeInterpreter( + new PythonInterpreter(), data, parameters); + + List rawResults = runScript(interp, script); + + Data[] results = formatRawResults(rawResults, data, properties); + + return results; + } + + + private PythonInterpreter initializeInterpreter(PythonInterpreter interp, + Data[] data, Dictionary parameters) { + interp = passUserProvidedArguments(interp, parameters); + interp = passCIShellProvidedArguments(interp, data); + interp = initializeLogging(interp); + return interp; + } + + /** + * Executes the script and extracts the raw results. + * @param interp The initialized python interpreter + * @param script The jython script itself, which the interpreter will run + * @return A list of objects that the script returned. + */ + private List runScript(PythonInterpreter interp, URL script) { + interp = executeFile(interp, script); + List rawResults = getRawResults(interp); + return rawResults; + } + + private Data[] formatRawResults(List rawResults, Data[] inputData, + Dictionary properties) { + List dataResults = convertToData(rawResults); + List dataResultsWithMetaData = addMetaData(dataResults, inputData, + properties); + Data[] resultsArray = convertToArray(dataResultsWithMetaData); + return resultsArray; + } + + + + private PythonInterpreter executeFile(PythonInterpreter interp, + URL script) { + try { + interp.execfile(script.openStream()); + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, "Unable to open jython script " + + script.toString() + ".", e); + e.printStackTrace(); + } + return interp; + } + + private PythonInterpreter passUserProvidedArguments( + PythonInterpreter interp, Dictionary parameters) { + + Enumeration enumer = parameters.keys(); + while (enumer.hasMoreElements()) { + String key = (String) enumer.nextElement(); + Object value = parameters.get(key); + String argName = key; + + interp = passArgument(value, argName, interp); + } + + return interp; + } + + private PythonInterpreter passCIShellProvidedArguments( + PythonInterpreter interp, Data[] data) { + for (int ii = 0; ii < this.data.length; ii++) { + Data argData = this.data[ii]; + Object arg = argData.getData(); + String argName = SCRIPT_ARGUMENT_PREFIX + String.valueOf(ii); + + interp = passArgument(arg, argName, interp); + } + + return interp; + } + + private PythonInterpreter initializeLogging(PythonInterpreter interp) { + interp.setErr(System.err); + interp.setOut(System.out); + return interp; + } + + /** + * Gets Java versions of all the results from the script. + * @param interp a python interpreter that holds results (presumably + * after having executed a script) + * @return A list of objects, where each object is a result from + * the interpreters environment. + */ + private List getRawResults(PythonInterpreter interp) { + List results = new ArrayList(); + + /* + * gets the values held in result variables, from + * "result0" counting upward, until we reach a result + * variable which is not defined. + */ + int ii = 0; + String resultName = SCRIPT_RESULT_PREFIX + ii; + + while (variableIsDefined(interp, resultName)) { + + results.add(interp.get(resultName, Object.class)); + + ii++; + resultName = SCRIPT_RESULT_PREFIX + ii; + } + + return results; + } + + /** + * adds metadata obtained from the algorithm's .properties files + * that specify information about what the script returns. + * @param data a list of data objects, in the order + * they were returned. + * @param inputData the data passed from CIShell to this algorithm + * @param properties information about the script, such as + * the labels, types, and parents of all the returned data. + * @return a list of data objects in the order they were provided, + * now containing the appropriate metadata obtained from the + * .properties file. + */ + private List addMetaData(List data, Data[] inputData, Dictionary properties) { + List results = new ArrayList(); + for (int ii = 0; ii < data.size(); ii++) { + Data result = ((Data) data.get(ii)); + Dictionary metadataHolder = result.getMetaData(); + + String dataLabel = getResultLabel(properties, ii); + metadataHolder.put(DataProperty.LABEL, dataLabel); + + String dataType = getResultType(properties, ii); + metadataHolder.put(DataProperty.TYPE, dataType); + + Data dataParent = getResultParent(properties, ii, inputData); + if (dataParent != null) { + metadataHolder.put(DataProperty.PARENT, dataParent); + } //it's okay to not have a parent, little Timmy. + + results.add(result); + } + return results; + } + + public String getResultLabel(Dictionary props, int numResult) { + String labelKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.LABEL_SUFFIX; + Object labelValue = props.get(labelKey); + + String labelValueString; + if (!(labelValue == null)) { + labelValueString = (String) labelValue; + } else { + labelValueString = "Data"; + logger.log(LogService.LOG_WARNING, "Label of data returned from " + + "jython script not specified in .properties file. " + + "Assigning label to '" + labelValueString + "'."); + } + return labelValueString; + } + + public String getResultType(Dictionary props, int numResult) { + String typeKey = JythonFileProperty.RESULT_PREFIX + + numResult + JythonFileProperty.TYPE_SUFFIX; + Object typeValue = props.get(typeKey); + + String typeValueString; + if (! (typeValue == null)) { + typeValueString = (String) typeValue; + checkType(typeValueString); + + } else { + typeValueString = DataProperty.OTHER_TYPE; + logger.log(LogService.LOG_WARNING, "Type of data returned from " + + "jython script not specified in .properties file. " + + "Assigning type to '" + typeValueString + "'."); + } + return typeValueString; + } + + /** + * Looks to see whether the result has a parent specified in the + * algorithm's .properties file. If it does, return the parent data. + * Otherwise return null. + * @param props information about the script, such as + * the labels, types, and parents of all the returned data. + * @param numResult specifies which result's information we need to look + * up + * @param inputData the data CIShell passed this algorithm. + * @return either the parent of the result data specified by numResults, + * or null, if there is no parent specified. + */ + public Data getResultParent(Dictionary props, int numResult, Data[] inputData) { + String childKey = JythonFileProperty.RESULT_PREFIX + numResult + + JythonFileProperty.PARENT_SUFFIX; + Object parentName = props.get(childKey); + + Data parent; + if (! (parentName == null)) { + //TODO: more validation on parentName + char parentDataIndexChar = getLastChar((String) parentName); + int parentDataIndex = Character.digit(parentDataIndexChar, 10); + if (parentDataIndex < inputData.length) { + parent = inputData[parentDataIndex]; + } else { + logger.log(LogService.LOG_WARNING, ".properties file " + + "tried to assign result" + numResult + "the " + + "parent arg"+ parentDataIndex + ", which has an " + + "index greater than any arg provided. Cannot " + + "assign result" + numResult + " a parent."); + parent = null; + } + } else { + //it's okay not to specify a parent. + parent = null; + } + return parent; + } + + private PythonInterpreter passArgument(Object arg, String argName, + PythonInterpreter interp) { + if (! (arg instanceof File)) { + interp.set(argName, + new PyJavaInstance(arg)); + } else { + try { + File fileArg = (File) arg; + InputStream fileStream = fileArg.toURL().openStream(); + interp.set(argName, + new PyFile(fileStream)); + } catch (IOException e) { + logger.log(LogService.LOG_ERROR, "Problem opening file" + + " provided as an argument to jython script.", e); + e.printStackTrace(); + } + } + + return interp; + } + + /** + * Takes java objects and wraps them in our CIShell data objects + * so that they can be returned from the algorithm. + * @param rawResults a list of java objects. + * @return a list of data objects. + */ + private List convertToData(List rawResults) { + List results = new ArrayList(); + for (int ii = 0; ii < rawResults.size(); ii++) { + Object rawResult = rawResults.get(ii); + String resultClassName = rawResult.getClass().getName(); + BasicData data = new BasicData(rawResult, resultClassName); + results.add(data); + } + return results; + } + private boolean variableIsDefined(PythonInterpreter interp, + String variableName) { + String predicate = "vars().has_key('" + variableName + "') or " + + "globals().has_key('" + variableName + "')"; + boolean result = evalPredicate(interp, predicate); + return result; + } + private boolean evalPredicate(PythonInterpreter interp, String predicate) { + PyObject pyResult = interp.eval(predicate); + Boolean resultObj = (Boolean) pyResult.__tojava__(Boolean.class); + boolean result = resultObj.booleanValue(); + return result; + } + + private Data[] convertToArray(List dataList) { + Data[] dataArray = new Data[dataList.size()]; + for (int ii = 0; ii < dataArray.length; ii++) { + dataArray[ii] = (Data) dataList.get(ii); + } + return dataArray; + } + + private void checkType(String ts) { + if (! (ts.equals(DataProperty.MATRIX_TYPE) || + ts.equals(DataProperty.NETWORK_TYPE) || + ts.equals(DataProperty.TEXT_TYPE) || + ts.equals(DataProperty.OTHER_TYPE) || + ts.equals(DataProperty.TEXT_TYPE))) { + logger.log(LogService.LOG_WARNING, "JythonRunnerAlgorithm: " + + "Assigning return data an unsupported data type " + + ts +". Either the type is invalid or " + + "JythonRunnerAlgorithm has not be updated to reflect " + + "types introduced in newer versions"); + } + } + + public char getLastChar(String s) { + if (s.length() > 0) { + return s.charAt(s.length() - 1); + } else { + throw new IndexOutOfBoundsException("Cannot get the last " + + "character of an empy string"); + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-13 21:00:31
|
Revision: 417 http://svn.sourceforge.net/cishell/?rev=417&view=rev Author: mwlinnem Date: 2007-07-13 14:00:28 -0700 (Fri, 13 Jul 2007) Log Message: ----------- Initial import. JythonRunner allows CIShell to support jython algorithms. Added Paths: ----------- org.cishell.templates.jythonrunner/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-03 14:34:35
|
Revision: 416 http://svn.sourceforge.net/cishell/?rev=416&view=rev Author: huangb Date: 2007-07-03 07:34:14 -0700 (Tue, 03 Jul 2007) Log Message: ----------- tag cishell v0.6.0 Added Paths: ----------- tags/v0.6.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-02 20:01:40
|
Revision: 415 http://svn.sourceforge.net/cishell/?rev=415&view=rev Author: mwlinnem Date: 2007-07-02 13:01:38 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Changed text wrap in dialog boxes to work correctly on Windows. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 18:31:24 UTC (rev 414) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 20:01:38 UTC (rev 415) @@ -41,6 +41,8 @@ * @author Bruce Herr (bh...@bh...) */ public class SWTGui implements GUI, UpdateListener { + public static final int TEXT_WRAP_LENGTH = 350; + private Shell shell; private SWTGuiComposite composite; private SelectionListener listener; @@ -70,12 +72,15 @@ if(message != null && !message.equals("")){ Label msg = new Label(shell, SWT.WRAP); msg.setText(message); - msg.pack(); - msg.update(); - + msg.pack(true); GridData labelData = new GridData(); - labelData.horizontalAlignment = SWT.FILL; + labelData.horizontalAlignment = GridData.CENTER; labelData.grabExcessHorizontalSpace = true; + System.out.println(msg.getSize().x); + if (msg.getSize().x > TEXT_WRAP_LENGTH) { + System.out.println(msg.getSize().x); + labelData.widthHint = TEXT_WRAP_LENGTH; + } msg.setLayoutData(labelData); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-07-02 18:31:28
|
Revision: 414 http://svn.sourceforge.net/cishell/?rev=414&view=rev Author: mwlinnem Date: 2007-07-02 11:31:24 -0700 (Mon, 02 Jul 2007) Log Message: ----------- Commiting so I can see if fix for text wrap issue works on Windows. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 16:12:55 UTC (rev 413) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-07-02 18:31:24 UTC (rev 414) @@ -70,9 +70,12 @@ if(message != null && !message.equals("")){ Label msg = new Label(shell, SWT.WRAP); msg.setText(message); + msg.pack(); + msg.update(); GridData labelData = new GridData(); - labelData.horizontalAlignment = SWT.CENTER; + labelData.horizontalAlignment = SWT.FILL; + labelData.grabExcessHorizontalSpace = true; msg.setLayoutData(labelData); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-02 16:12:57
|
Revision: 413 http://svn.sourceforge.net/cishell/?rev=413&view=rev Author: huangb Date: 2007-07-02 09:12:55 -0700 (Mon, 02 Jul 2007) Log Message: ----------- update version to v0.6.0 Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF 2007-07-02 16:12:27 UTC (rev 412) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF 2007-07-02 16:12:55 UTC (rev 413) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: GUI Builder Reference Implementation Using SWT Bundle-SymbolicName: org.cishell.reference.gui.guibuilder.swt -Bundle-Version: 0.4.0 +Bundle-Version: 0.6.0 Bundle-Localization: plugin Import-Package: org.cishell.framework, org.cishell.service.guibuilder, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-02 16:12:40
|
Revision: 412 http://svn.sourceforge.net/cishell/?rev=412&view=rev Author: huangb Date: 2007-07-02 09:12:27 -0700 (Mon, 02 Jul 2007) Log Message: ----------- update version to v0.6.0 Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF Modified: trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF 2007-07-02 16:11:58 UTC (rev 411) +++ trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF 2007-07-02 16:12:27 UTC (rev 412) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Log GUI Plug-in Bundle-SymbolicName: org.cishell.reference.gui.log;singleton:=true -Bundle-Version: 0.5.0 +Bundle-Version: 0.6.0 Bundle-Activator: org.cishell.reference.gui.log.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-02 16:12:01
|
Revision: 411 http://svn.sourceforge.net/cishell/?rev=411&view=rev Author: huangb Date: 2007-07-02 09:11:58 -0700 (Mon, 02 Jul 2007) Log Message: ----------- a small update, adjust log message layout in the console window Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF 2007-07-02 16:11:22 UTC (rev 410) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF 2007-07-02 16:11:58 UTC (rev 411) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Menu Manager Plug-in Bundle-SymbolicName: org.cishell.reference.gui.menumanager;singleton:=true -Bundle-Version: 0.5.0 +Bundle-Version: 0.6.0 Bundle-Activator: org.cishell.reference.gui.menumanager.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-07-02 16:11:22 UTC (rev 410) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-07-02 16:11:58 UTC (rev 411) @@ -116,7 +116,7 @@ String label = (String)ref.getProperty("label"); if (label != null){ acknowledgement.append("..........\n"+ - label+" was selected.\n\n"); + label+" was selected.\n"); } String authors = (String)ref.getProperty("authors"); if (authors != null) @@ -136,8 +136,9 @@ acknowledgement.append("Reference: "+reference+"\n"); String docu = (String)ref.getProperty("docu"); if (docu != null) - acknowledgement.append("Docu: "+docu); - logger.log(LogService.LOG_INFO, acknowledgement.toString()); + acknowledgement.append("Docu: "+docu+"\n"); + if(acknowledgement.length()>1) + logger.log(LogService.LOG_INFO, acknowledgement.toString()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-02 16:11:30
|
Revision: 410 http://svn.sourceforge.net/cishell/?rev=410&view=rev Author: huangb Date: 2007-07-02 09:11:22 -0700 (Mon, 02 Jul 2007) Log Message: ----------- a small update, adjust log message layout in the console window Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2007-07-01 15:00:14 UTC (rev 409) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2007-07-02 16:11:22 UTC (rev 410) @@ -188,7 +188,8 @@ if (goodMessage(message)) { //not all messages end w/ a new line, but they //need to to print properly - message += "\n"; + if (!message.endsWith("\n")) + message += "\n"; appendString(message, (Color) colorMapping.get(""+entry.getLevel())); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-07-01 15:00:22
|
Revision: 409 http://svn.sourceforge.net/cishell/?rev=409&view=rev Author: huangb Date: 2007-07-01 08:00:14 -0700 (Sun, 01 Jul 2007) Log Message: ----------- update version to v0.6.0 Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2007-06-29 20:31:32 UTC (rev 408) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2007-07-01 15:00:14 UTC (rev 409) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Persistence Plug-in Bundle-SymbolicName: org.cishell.reference.gui.persistence;singleton:=true -Bundle-Version: 0.5.0 +Bundle-Version: 0.6.0 Bundle-ClassPath: . Bundle-Localization: plugin Import-Package: org.cishell.app.service.datamanager, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-06-29 20:31:37
|
Revision: 408 http://svn.sourceforge.net/cishell/?rev=408&view=rev Author: mwlinnem Date: 2007-06-29 13:31:32 -0700 (Fri, 29 Jun 2007) Log Message: ----------- Fixed bug with suggested file names when saving. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2007-06-28 21:32:33 UTC (rev 407) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2007-06-29 20:31:32 UTC (rev 408) @@ -108,10 +108,9 @@ dialog.setText("Choose File"); String fileLabel = (String)data.getMetaData().get(DataProperty.LABEL); - String suggestedFileName = getFileName(fileLabel); + String suggestedFileName = getFileName(fileLabel); dialog.setFileName(suggestedFileName + "." + ext); -// String fileLabel = (String)data.getMetaData().get(DataProperty.LABEL); -// + // if (fileLabel == null) { // dialog.setFileName("*." + ext); // } else { @@ -179,14 +178,36 @@ } private String getFileName(String fileLabel) { + + //index variables will be -1 if index is not found. int descriptionEndIndex = fileLabel.lastIndexOf(":"); int filePathEndIndex = fileLabel.lastIndexOf(File.separator); - int extensionBeginIndex = fileLabel.indexOf("."); - + + //doesn't matter if either variable is -1, since startIndex will be + //zero and none of the string will be cut off the front. int startIndex = Math.max(descriptionEndIndex, filePathEndIndex) + 1; - int endIndex = Math.min(extensionBeginIndex, fileLabel.length()); - String fileName = fileLabel.substring(startIndex, endIndex); + String fileNameWithExtension = fileLabel.substring(startIndex); + + + //find the first character of the file name extension. + int extensionBeginIndex = fileNameWithExtension.indexOf("."); + + int endIndex; + + if (extensionBeginIndex != -1) { + //we found a period in the file name. + endIndex = extensionBeginIndex; //cut off everything after + //first period. + } else { + //we didn't find an extension on the file name. + endIndex = fileLabel.length(); // don't cut any off the end. + } + endIndex = Math.min(extensionBeginIndex, fileLabel.length()); + + String fileNameWithoutExtension = fileNameWithExtension.substring(0, endIndex); + + String fileName = fileNameWithoutExtension; return fileName; } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-06-28 21:32:38
|
Revision: 407 http://svn.sourceforge.net/cishell/?rev=407&view=rev Author: mwlinnem Date: 2007-06-28 14:32:33 -0700 (Thu, 28 Jun 2007) Log Message: ----------- Changed suggested name for saved files to be more reasonable. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2007-06-27 18:55:18 UTC (rev 406) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/FileSaver.java 2007-06-28 21:32:33 UTC (rev 407) @@ -108,11 +108,15 @@ dialog.setText("Choose File"); String fileLabel = (String)data.getMetaData().get(DataProperty.LABEL); - if (fileLabel == null) { - dialog.setFileName("*." + ext); - } else { - dialog.setFileName(fileLabel + '.' + ext); - } + String suggestedFileName = getFileName(fileLabel); + dialog.setFileName(suggestedFileName + "." + ext); +// String fileLabel = (String)data.getMetaData().get(DataProperty.LABEL); +// +// if (fileLabel == null) { +// dialog.setFileName("*." + ext); +// } else { +// dialog.setFileName(fileLabel + '.' + ext); +// } boolean done = false; @@ -173,4 +177,16 @@ return false; } } + + private String getFileName(String fileLabel) { + int descriptionEndIndex = fileLabel.lastIndexOf(":"); + int filePathEndIndex = fileLabel.lastIndexOf(File.separator); + int extensionBeginIndex = fileLabel.indexOf("."); + + int startIndex = Math.max(descriptionEndIndex, filePathEndIndex) + 1; + int endIndex = Math.min(extensionBeginIndex, fileLabel.length()); + + String fileName = fileLabel.substring(startIndex, endIndex); + return fileName; + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 406 http://svn.sourceforge.net/cishell/?rev=406&view=rev Author: mwlinnem Date: 2007-06-27 11:55:18 -0700 (Wed, 27 Jun 2007) Log Message: ----------- Fixed issue with error dialog boxes where error details text area would not expand when window was enlarged. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/builder/AbstractDialog.java Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/builder/AbstractDialog.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/builder/AbstractDialog.java 2007-06-27 18:54:31 UTC (rev 405) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/builder/AbstractDialog.java 2007-06-27 18:55:18 UTC (rev 406) @@ -264,10 +264,6 @@ if ((description != null) && !description.equals("")) { desc.setText(description); } - - GridData data = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_CENTER); - data.widthHint = 300; - desc.setLayoutData(data); } /* @@ -319,10 +315,14 @@ detailsText.setText(""); details.setText("Details >>"); data.heightHint = 0; + data.grabExcessHorizontalSpace = false; + data.grabExcessVerticalSpace = false; } else { - detailsText.setText(detailsString); + detailsText.setText(detailsString); details.setText("Details <<"); data.heightHint = DETAILS_HEIGHT; + data.grabExcessHorizontalSpace = true; + data.grabExcessVerticalSpace = true; } detailsText.setLayoutData(data); @@ -345,12 +345,9 @@ detailsText.setEditable(false); detailsText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); - data.grabExcessHorizontalSpace = true; - data.horizontalSpan = 2; - data.grabExcessVerticalSpace = false; + GridData data = new GridData(GridData.FILL_BOTH | + GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL); data.widthHint = 400; - data.heightHint = 0; detailsText.setLayoutData(data); detailsText.setVisible(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-06-27 18:54:33
|
Revision: 405 http://svn.sourceforge.net/cishell/?rev=405&view=rev Author: mwlinnem Date: 2007-06-27 11:54:31 -0700 (Wed, 27 Jun 2007) Log Message: ----------- fixed display issue for visualization with annotation dialog boxes, where lack of text wrap would cause the box to be huge. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-05-17 20:29:22 UTC (rev 404) +++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/src/org/cishell/reference/gui/guibuilder/swt/SWTGui.java 2007-06-27 18:54:31 UTC (rev 405) @@ -68,7 +68,7 @@ //stuff to display a message String message = ocd.getDescription(); if(message != null && !message.equals("")){ - Label msg = new Label(shell, SWT.CENTER); + Label msg = new Label(shell, SWT.WRAP); msg.setText(message); GridData labelData = new GridData(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |