From: <bh...@us...> - 2008-03-25 18:06:55
|
Revision: 706 http://cishell.svn.sourceforge.net/cishell/?rev=706&view=rev Author: bh2 Date: 2008-03-25 11:05:28 -0700 (Tue, 25 Mar 2008) Log Message: ----------- updated to be cishell 1.0 compliant Modified Paths: -------------- trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/META-INF/MANIFEST.MF trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTest.java trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTestFactory.java trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java trunk/examples/org.cishell.tests.conversion1/META-INF/MANIFEST.MF trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgA.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgB.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgC.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2Integer.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2String.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/Integer2File.java trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/String2File.java trunk/examples/org.cishell.tests.guibuilder1/META-INF/MANIFEST.MF trunk/examples/org.cishell.tests.guibuilder1/src/org/cishell/tests/guibuilder1/GUIBuilderTester1AlgorithmFactory.java Modified: trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/META-INF/MANIFEST.MF =================================================================== --- trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/META-INF/MANIFEST.MF 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/META-INF/MANIFEST.MF 2008-03-25 18:05:28 UTC (rev 706) @@ -2,12 +2,11 @@ Bundle-ManifestVersion: 2 Bundle-Name: ProgressTrackableAlgorithm Bundle-SymbolicName: org.cishell.tests.ProgressTrackableAlgorithm -Bundle-Version: 0.3.0 +Bundle-Version: 1.0.0 Bundle-ClassPath: . -Bundle-Localization: plugin -Import-Package: org.cishell.framework, - org.cishell.framework.algorithm, - org.cishell.framework.data, +Import-Package: org.cishell.framework;version="1.0.0", + org.cishell.framework.algorithm;version="1.0.0", + org.cishell.framework.data;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.0.0", org.osgi.service.log;version="1.3.0", Modified: trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTest.java =================================================================== --- trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTest.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTest.java 2008-03-25 18:05:28 UTC (rev 706) @@ -4,12 +4,12 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.ProgressMonitor; import org.cishell.framework.algorithm.ProgressTrackable; import org.cishell.framework.data.Data; public class AlgorithmTest implements Algorithm, ProgressTrackable { -//public class AlgorithmTest implements Algorithm { public static final int TOTAL_WORK_UNITS = 100; Data[] data; @@ -21,45 +21,34 @@ this.data = data; this.parameters = parameters; this.context = context; + this.monitor = ProgressMonitor.NULL_MONITOR; } - public Data[] execute() { - if (monitor != null) { - monitor.start(ProgressMonitor.CANCELLABLE | - ProgressMonitor.PAUSEABLE | - ProgressMonitor.WORK_TRACKABLE, TOTAL_WORK_UNITS); - for (int i = 0; i < TOTAL_WORK_UNITS; ++i) { - if (monitor.isCanceled()) { - break; - } - else if (monitor.isPaused()) { - --i; - } - monitor.worked(i); - try { + public Data[] execute() throws AlgorithmExecutionException { + monitor.start(ProgressMonitor.CANCELLABLE | + ProgressMonitor.PAUSEABLE | + ProgressMonitor.WORK_TRACKABLE, TOTAL_WORK_UNITS); + + for (int i = 0; i < TOTAL_WORK_UNITS; ++i) { + if (monitor.isCanceled()) { + break; + } + else if (monitor.isPaused()) { + --i; + } + monitor.worked(i); + try { Thread.sleep(1000); } catch (InterruptedException e) { - e.printStackTrace(); + throw new AlgorithmExecutionException(e); } - } - monitor.done(); - return null; - } - else { - for (int i = 0; i < TOTAL_WORK_UNITS; ++i) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - return null; - } + } + + monitor.done(); + return null; } public ProgressMonitor getProgressMonitor() { - // TODO Auto-generated method stub return this.monitor; } Modified: trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTestFactory.java =================================================================== --- trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTestFactory.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.ProgressTrackableAlgorithm/src/org/cishell/tests/ProgressTrackableAlgorithm/AlgorithmTestFactory.java 2008-03-25 18:05:28 UTC (rev 706) @@ -6,29 +6,10 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; -import org.osgi.service.component.ComponentContext; -import org.osgi.service.metatype.MetaTypeProvider; -import org.osgi.service.metatype.MetaTypeService; public class AlgorithmTestFactory implements AlgorithmFactory { - private MetaTypeProvider provider; - - 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"); - provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { - provider = null; - } - public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { return new AlgorithmTest(data, parameters, context); } - public MetaTypeProvider createParameters(Data[] data) { - return provider; - } } \ No newline at end of file Modified: trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF =================================================================== --- trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.alg1/META-INF/MANIFEST.MF 2008-03-25 18:05:28 UTC (rev 706) @@ -2,13 +2,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: Alg1 Plug-in Bundle-SymbolicName: org.cishell.tests.alg1 -Bundle-Version: 0.0.1 -Bundle-Localization: plugin +Bundle-Version: 1.0.0 Service-Component: OSGI-INF/component1.xml, OSGI-INF/component2.xml X-AutoStart: true -Import-Package: org.cishell.framework, - org.cishell.framework.algorithm, - org.cishell.framework.data, +Import-Package: org.cishell.framework;version="1.0.0", + org.cishell.framework.algorithm;version="1.0.0", + org.cishell.framework.data;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.0.0", org.osgi.service.log;version="1.3.0", Modified: trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java =================================================================== --- trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg1Factory.java 2008-03-25 18:05:28 UTC (rev 706) @@ -6,25 +6,9 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; -import org.osgi.service.component.ComponentContext; -import org.osgi.service.metatype.MetaTypeProvider; -import org.osgi.service.metatype.MetaTypeService; public class Alg1Factory implements AlgorithmFactory { - private MetaTypeProvider provider; - - protected void activate(ComponentContext ctxt) { - MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); - provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { - provider = null; - } - public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { return new Alg(context, parameters); } - public MetaTypeProvider createParameters(Data[] dm) { - return provider; - } } Modified: trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java =================================================================== --- trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.alg1/src/org/cishell/tests/alg1/Alg2Factory.java 2008-03-25 18:05:28 UTC (rev 706) @@ -6,25 +6,9 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; -import org.osgi.service.component.ComponentContext; -import org.osgi.service.metatype.MetaTypeProvider; -import org.osgi.service.metatype.MetaTypeService; public class Alg2Factory implements AlgorithmFactory { - private MetaTypeProvider provider; - - protected void activate(ComponentContext ctxt) { - MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); - provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { - provider = null; - } - public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { return new Alg(context, parameters); } - public MetaTypeProvider createParameters(Data[] dm) { - return provider; - } } Modified: trunk/examples/org.cishell.tests.conversion1/META-INF/MANIFEST.MF =================================================================== --- trunk/examples/org.cishell.tests.conversion1/META-INF/MANIFEST.MF 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/META-INF/MANIFEST.MF 2008-03-25 18:05:28 UTC (rev 706) @@ -2,13 +2,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: CIShell Algorithms to test auto-conversion Bundle-SymbolicName: org.cishell.tests.conversion1 -Bundle-Version: 0.1.0 -Bundle-Localization: plugin +Bundle-Version: 1.0.0 Service-Component: OSGI-INF/componentA.xml, OSGI-INF/componentB.xml, OSGI-INF/componentC.xml, OSGI-INF/file2string.xml, OSGI-INF/string2file.xml, OSGI-INF/file2integer.xml, OSGI-INF/integer2file.xml X-AutoStart: true -Import-Package: org.cishell.framework, - org.cishell.framework.algorithm, - org.cishell.framework.data, +Import-Package: org.cishell.framework;version="1.0.0", + org.cishell.framework.algorithm;version="1.0.0", + org.cishell.framework.data;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.0.0", org.osgi.service.log;version="1.3.0", Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgA.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgA.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgA.java 2008-03-25 18:05:28 UTC (rev 706) @@ -30,24 +30,7 @@ * @author Bruce Herr */ public class AlgA implements AlgorithmFactory { - private MetaTypeProvider provider; - - protected void activate(ComponentContext ctxt) { - MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); - provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { - provider = null; - } - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return provider; - } - - /** * @see org.cishell.framework.algorithm.AlgorithmFactory#createAlgorithm(org.cishell.framework.data.Data[], java.util.Dictionary, org.cishell.framework.CIShellContext) */ public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, @@ -66,7 +49,7 @@ String i = (String) parameters.get("org.cishell.tests.conversion1.AlgA.myInput"); Data[] dm = new Data[]{ new BasicData(i, String.class.getName()) }; - dm[0].getMetaData().put(DataProperty.LABEL, "My String: " + i); + dm[0].getMetadata().put(DataProperty.LABEL, "My String: " + i); return dm; } Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgB.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgB.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgB.java 2008-03-25 18:05:28 UTC (rev 706) @@ -29,15 +29,7 @@ * @author Bruce Herr */ public class AlgB implements AlgorithmFactory, DataValidator { - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } - - /** * @see org.cishell.framework.algorithm.AlgorithmFactory#createAlgorithm(org.cishell.framework.data.Data[], java.util.Dictionary, org.cishell.framework.CIShellContext) */ public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, @@ -65,7 +57,7 @@ Integer i = new Integer(dm[0].getData().toString()); Data[] dm1 = new Data[]{ new BasicData(i, Integer.class.getName()) }; - dm1[0].getMetaData().put(DataProperty.LABEL, "My Integer: " + i); + dm1[0].getMetadata().put(DataProperty.LABEL, "My Integer: " + i); //dm1[0].getProperties().put(DataProperty.PARENT, dm[0]); return dm1; Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgC.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgC.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/AlgC.java 2008-03-25 18:05:28 UTC (rev 706) @@ -27,15 +27,7 @@ * @author Bruce Herr */ public class AlgC implements AlgorithmFactory { - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } - - /** * @see org.cishell.framework.algorithm.AlgorithmFactory#createAlgorithm(org.cishell.framework.data.Data[], java.util.Dictionary, org.cishell.framework.CIShellContext) */ public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2Integer.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2Integer.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2Integer.java 2008-03-25 18:05:28 UTC (rev 706) @@ -21,11 +21,11 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; -import org.osgi.service.metatype.MetaTypeProvider; /** * @@ -41,13 +41,6 @@ return new File2IntegerAlgorithm(dm[0]); } - - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } private static class File2IntegerAlgorithm implements Algorithm { File file; @@ -55,10 +48,10 @@ public File2IntegerAlgorithm(Data dm) { file = (File) dm.getData(); - label = (String)dm.getMetaData().get(DataProperty.LABEL); + label = (String)dm.getMetadata().get(DataProperty.LABEL); } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { try { if (file.exists()) { BufferedReader reader = new BufferedReader(new FileReader(file)); @@ -71,15 +64,15 @@ } Data dm = new BasicData(new Integer(outString.trim()), Integer.class.getName()); - dm.getMetaData().put(DataProperty.LABEL, "Integer for "+label); + dm.getMetadata().put(DataProperty.LABEL, "Integer for "+label); return new Data[]{dm}; + } else { + throw new AlgorithmExecutionException("File does not exist!"); } } catch (IOException e) { - e.printStackTrace(); + throw new AlgorithmExecutionException(e); } - - return null; } } } Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2String.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2String.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/File2String.java 2008-03-25 18:05:28 UTC (rev 706) @@ -21,11 +21,11 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; -import org.osgi.service.metatype.MetaTypeProvider; /** * @@ -41,13 +41,6 @@ return new File2StringAlgorithm(dm[0]); } - - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } private static class File2StringAlgorithm implements Algorithm { File file; @@ -55,10 +48,10 @@ public File2StringAlgorithm(Data dm) { file = (File) dm.getData(); - label = (String)dm.getMetaData().get(DataProperty.LABEL); + label = (String)dm.getMetadata().get(DataProperty.LABEL); } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { try { if (file.exists()) { BufferedReader reader = new BufferedReader(new FileReader(file)); @@ -71,15 +64,15 @@ } Data dm = new BasicData(outString, String.class.getName()); - dm.getMetaData().put(DataProperty.LABEL, "String for "+label); + dm.getMetadata().put(DataProperty.LABEL, "String for "+label); return new Data[]{dm}; + } else { + throw new AlgorithmExecutionException("File does not exist!"); } } catch (IOException e) { - e.printStackTrace(); + throw new AlgorithmExecutionException(e); } - - return null; } } } Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/Integer2File.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/Integer2File.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/Integer2File.java 2008-03-25 18:05:28 UTC (rev 706) @@ -20,11 +20,11 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; -import org.osgi.service.metatype.MetaTypeProvider; /** * @@ -37,16 +37,8 @@ */ public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { - return new Integer2FileAlgorithm(dm[0]); } - - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } private static class Integer2FileAlgorithm implements Algorithm { Integer i; @@ -54,10 +46,10 @@ public Integer2FileAlgorithm(Data dm) { i = (Integer)dm.getData(); - label = (String)dm.getMetaData().get(DataProperty.LABEL); + label = (String)dm.getMetadata().get(DataProperty.LABEL); } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { try { File file = File.createTempFile("String2File-", "txt"); FileWriter fw = new FileWriter(file); @@ -66,14 +58,12 @@ fw.close(); Data dm = new BasicData(file, "file:text/plain"); - dm.getMetaData().put(DataProperty.LABEL, "File of "+label); + dm.getMetadata().put(DataProperty.LABEL, "File of "+label); return new Data[]{dm}; } catch (IOException e) { - e.printStackTrace(); + throw new AlgorithmExecutionException(e); } - - return null; } } } Modified: trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/String2File.java =================================================================== --- trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/String2File.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.conversion1/src/org/cishell/tests/conversion1/String2File.java 2008-03-25 18:05:28 UTC (rev 706) @@ -20,11 +20,11 @@ import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmExecutionException; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.BasicData; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; -import org.osgi.service.metatype.MetaTypeProvider; /** * @@ -37,27 +37,19 @@ */ public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) { - return new String2FileAlgorithm(dm[0]); } - /** - * @see org.cishell.framework.algorithm.AlgorithmFactory#createParameters(org.cishell.framework.data.Data[]) - */ - public MetaTypeProvider createParameters(Data[] dm) { - return null; - } - private static class String2FileAlgorithm implements Algorithm { String string; String label; public String2FileAlgorithm(Data dm) { string = (String)dm.getData(); - label = (String)dm.getMetaData().get(DataProperty.LABEL); + label = (String)dm.getMetadata().get(DataProperty.LABEL); } - public Data[] execute() { + public Data[] execute() throws AlgorithmExecutionException { try { File file = File.createTempFile("String2File-", "txt"); FileWriter fw = new FileWriter(file); @@ -66,14 +58,12 @@ fw.close(); Data dm = new BasicData(file, "file:text/plain"); - dm.getMetaData().put(DataProperty.LABEL, "File of "+label); + dm.getMetadata().put(DataProperty.LABEL, "File of "+label); return new Data[]{dm}; } catch (IOException e) { - e.printStackTrace(); + throw new AlgorithmExecutionException(e); } - - return null; } } } Modified: trunk/examples/org.cishell.tests.guibuilder1/META-INF/MANIFEST.MF =================================================================== --- trunk/examples/org.cishell.tests.guibuilder1/META-INF/MANIFEST.MF 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.guibuilder1/META-INF/MANIFEST.MF 2008-03-25 18:05:28 UTC (rev 706) @@ -2,13 +2,12 @@ Bundle-ManifestVersion: 2 Bundle-Name: GUIBuilder Tester Bundle-SymbolicName: org.cishell.tests.guibuilder1 -Bundle-Version: 0.1.0 +Bundle-Version: 1.0.0 Bundle-ClassPath: . -Bundle-Localization: plugin -Import-Package: org.cishell.framework, - org.cishell.framework.algorithm, - org.cishell.framework.data, - org.cishell.service.guibuilder, +Import-Package: org.cishell.framework;version="1.0.0", + org.cishell.framework.algorithm;version="1.0.0", + org.cishell.framework.data;version="1.0.0", + org.cishell.service.guibuilder;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.0.0", org.osgi.service.log;version="1.3.0", Modified: trunk/examples/org.cishell.tests.guibuilder1/src/org/cishell/tests/guibuilder1/GUIBuilderTester1AlgorithmFactory.java =================================================================== --- trunk/examples/org.cishell.tests.guibuilder1/src/org/cishell/tests/guibuilder1/GUIBuilderTester1AlgorithmFactory.java 2008-03-25 17:20:18 UTC (rev 705) +++ trunk/examples/org.cishell.tests.guibuilder1/src/org/cishell/tests/guibuilder1/GUIBuilderTester1AlgorithmFactory.java 2008-03-25 18:05:28 UTC (rev 706) @@ -6,29 +6,10 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; -import org.osgi.service.component.ComponentContext; -import org.osgi.service.metatype.MetaTypeProvider; -import org.osgi.service.metatype.MetaTypeService; public class GUIBuilderTester1AlgorithmFactory implements AlgorithmFactory { - private MetaTypeProvider provider; - - 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"); - provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - } - protected void deactivate(ComponentContext ctxt) { - provider = null; - } - public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { return new GUIBuilderTester1Algorithm(data, parameters, context); } - 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...> - 2008-04-02 18:21:12
|
Revision: 765 http://cishell.svn.sourceforge.net/cishell/?rev=765&view=rev Author: mwlinnem Date: 2008-04-02 11:21:09 -0700 (Wed, 02 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/examples/org.cishell.tests.userprefs.local1/ Removed Paths: ------------- trunk/examples/org.cishell.testalgorithm2/ Copied: trunk/examples/org.cishell.tests.userprefs.local1 (from rev 764, trunk/examples/org.cishell.testalgorithm2) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-04-02 18:22:02
|
Revision: 766 http://cishell.svn.sourceforge.net/cishell/?rev=766&view=rev Author: mwlinnem Date: 2008-04-02 11:21:59 -0700 (Wed, 02 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/examples/org.cishell.tests.userprefs.global1/ Removed Paths: ------------- trunk/examples/org.cishell.testalgorithm3/ Copied: trunk/examples/org.cishell.tests.userprefs.global1 (from rev 765, trunk/examples/org.cishell.testalgorithm3) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-04-02 18:22:54
|
Revision: 767 http://cishell.svn.sourceforge.net/cishell/?rev=767&view=rev Author: mwlinnem Date: 2008-04-02 11:22:51 -0700 (Wed, 02 Apr 2008) Log Message: ----------- Added Paths: ----------- trunk/examples/org.cishell.tests.userprefs.localandparam1/ Removed Paths: ------------- trunk/examples/org.cishell.testalgorithm4/ Copied: trunk/examples/org.cishell.tests.userprefs.localandparam1 (from rev 766, trunk/examples/org.cishell.testalgorithm4) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |