From: <bh...@us...> - 2006-10-19 17:46:55
|
Revision: 301 http://svn.sourceforge.net/cishell/?rev=301&view=rev Author: bh2 Date: 2006-10-19 10:46:36 -0700 (Thu, 19 Oct 2006) Log Message: ----------- fixed File/View to work on Linux correctly Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-19 16:21:36 UTC (rev 300) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-19 17:46:36 UTC (rev 301) @@ -60,6 +60,9 @@ AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); Algorithm alg = factory.createAlgorithm(data, parameters, ciContext); + + //TODO: Print input parameters/metadata here using log service + Data[] outData = alg.execute(); if (outData != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2006-10-24 14:35:24
|
Revision: 313 http://svn.sourceforge.net/cishell/?rev=313&view=rev Author: bh2 Date: 2006-10-24 07:35:20 -0700 (Tue, 24 Oct 2006) Log Message: ----------- added another null check Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-24 14:34:55 UTC (rev 312) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-24 14:35:20 UTC (rev 313) @@ -110,14 +110,16 @@ if (outData != null && data != null && originalData != null && originalData.length == data.length) { for (int i=0; i < outData.length; i++) { - Object parent = outData[i].getMetaData().get(DataProperty.PARENT); - - if (parent != null) { - for (int j=0; j < data.length; i++) { - if (parent == data[j]) { - outData[i].getMetaData().put(DataProperty.PARENT, - originalData[j]); - break; + if (outData[i] != null) { + Object parent = outData[i].getMetaData().get(DataProperty.PARENT); + + if (parent != null) { + for (int j=0; j < data.length; i++) { + if (parent == data[j]) { + outData[i].getMetaData().put(DataProperty.PARENT, + originalData[j]); + break; + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bea...@us...> - 2006-10-25 17:18:06
|
Revision: 317 http://svn.sourceforge.net/cishell/?rev=317&view=rev Author: bearsfan Date: 2006-10-25 10:17:55 -0700 (Wed, 25 Oct 2006) Log Message: ----------- Added support to output the parameters given to the algorithm to the console. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-25 16:52:56 UTC (rev 316) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-25 17:17:55 UTC (rev 317) @@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.Dictionary; +import java.util.Enumeration; import java.util.List; import org.cishell.app.service.datamanager.DataManagerService; @@ -28,6 +29,7 @@ import org.cishell.service.guibuilder.GUIBuilderService; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; +import org.osgi.service.log.LogService; public class AlgorithmWrapper implements Algorithm, AlgorithmProperty { @@ -66,7 +68,16 @@ AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); Algorithm alg = factory.createAlgorithm(data, parameters, ciContext); - //TODO: Print input parameters/metadata here using log service + LogService logger = getLogService(); + if (logger != null) { + logger.log(LogService.LOG_INFO, ""); + logger.log(LogService.LOG_INFO, "Input Parameters Used:"); + for (Enumeration e = this.parameters.keys(); + e.hasMoreElements();) { + String key = (String)e.nextElement(); + logger.log(LogService.LOG_INFO, key + ": " + this.parameters.get(key)); + } + } Data[] outData = alg.execute(); @@ -144,4 +155,16 @@ } } } + + private LogService getLogService() { + ServiceReference serviceReference = bContext.getServiceReference(DataManagerService.class.getName()); + LogService log = null; + + if (serviceReference != null) { + log = (LogService) bContext.getService( + bContext.getServiceReference(LogService.class.getName())); + } + + return log; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bea...@us...> - 2006-10-26 15:51:17
|
Revision: 319 http://svn.sourceforge.net/cishell/?rev=319&view=rev Author: bearsfan Date: 2006-10-26 08:51:06 -0700 (Thu, 26 Oct 2006) Log Message: ----------- Added check for an empty parameter list Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-26 14:04:09 UTC (rev 318) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-10-26 15:51:06 UTC (rev 319) @@ -70,14 +70,17 @@ LogService logger = getLogService(); if (logger != null) { - logger.log(LogService.LOG_INFO, ""); - logger.log(LogService.LOG_INFO, "Input Parameters Used:"); - for (Enumeration e = this.parameters.keys(); - e.hasMoreElements();) { - String key = (String)e.nextElement(); - logger.log(LogService.LOG_INFO, key + ": " + this.parameters.get(key)); - } - } + if (!this.parameters.isEmpty()) { + logger.log(LogService.LOG_INFO, ""); + logger.log(LogService.LOG_INFO, "Input Parameters Used:"); + for (Enumeration e = this.parameters.keys(); e + .hasMoreElements();) { + String key = (String) e.nextElement(); + logger.log(LogService.LOG_INFO, key + ": " + + this.parameters.get(key)); + } + } + } Data[] outData = alg.execute(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bea...@us...> - 2006-11-21 22:05:32
|
Revision: 336 http://svn.sourceforge.net/cishell/?rev=336&view=rev Author: bearsfan Date: 2006-11-21 14:05:30 -0800 (Tue, 21 Nov 2006) Log Message: ----------- Implemented the ProcessTrackable interface for the AlgorithmWrapper Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-11-21 22:04:58 UTC (rev 335) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2006-11-21 22:05:30 UTC (rev 336) @@ -25,6 +25,8 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.algorithm.ProgressMonitor; +import org.cishell.framework.algorithm.ProgressTrackable; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; import org.cishell.service.conversion.Converter; @@ -38,7 +40,7 @@ import org.osgi.service.metatype.ObjectClassDefinition; -public class AlgorithmWrapper implements Algorithm, AlgorithmProperty { +public class AlgorithmWrapper implements Algorithm, AlgorithmProperty, ProgressTrackable { protected ServiceReference ref; protected BundleContext bContext; protected CIShellContext ciContext; @@ -48,6 +50,8 @@ protected Dictionary parameters; protected Map idToLabelMap; protected MetaTypeProvider provider; + protected ProgressMonitor progressMonitor; + protected Algorithm algorithm; public AlgorithmWrapper(ServiceReference ref, BundleContext bContext, CIShellContext ciContext, Data[] originalData, Data[] data, @@ -62,6 +66,10 @@ this.parameters = parameters; this.provider = provider; this.idToLabelMap = new HashMap(); + this.progressMonitor = null; + + AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); + algorithm = factory.createAlgorithm(data, parameters, ciContext); } /** @@ -75,14 +83,15 @@ converters[i] = null; } } + + printParameters(); - AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); - Algorithm alg = factory.createAlgorithm(data, parameters, ciContext); + if (progressMonitor != null && algorithm instanceof ProgressTrackable) { + ((ProgressTrackable)algorithm).setProgressMonitor(progressMonitor); + } - printParameters(); + Data[] outData = algorithm.execute(); - Data[] outData = alg.execute(); - if (outData != null) { DataManagerService dataManager = (DataManagerService) bContext.getService(bContext.getServiceReference( @@ -212,4 +221,17 @@ return log; } + + public ProgressMonitor getProgressMonitor() { + if (algorithm instanceof ProgressTrackable) { + return progressMonitor; + } + else { + return null; + } + } + + public void setProgressMonitor(ProgressMonitor monitor) { + progressMonitor = monitor; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-03-15 21:33:42
|
Revision: 380 http://svn.sourceforge.net/cishell/?rev=380&view=rev Author: huangb Date: 2007-03-15 14:33:40 -0700 (Thu, 15 Mar 2007) Log Message: ----------- modify printParameters method -- adjust to log all input parameters in one block Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2007-03-15 21:32:35 UTC (rev 379) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2007-03-15 21:33:40 UTC (rev 380) @@ -147,17 +147,19 @@ if (logger != null) { if (!this.parameters.isEmpty()) { - logger.log(LogService.LOG_INFO, ""); - logger.log(LogService.LOG_INFO, "Input Parameters:"); + //adjust to log all input parameters in one block + StringBuffer inputParams = new StringBuffer("\n"+"Input Parameters:"); + for (Enumeration e = this.parameters.keys(); e .hasMoreElements();) { String key = (String) e.nextElement(); Object value = this.parameters.get(key); key = (String) idToLabelMap.get(key); + inputParams.append("\n"+key+": "+value); - logger.log(LogService.LOG_INFO, key+": "+value); } + logger.log(LogService.LOG_INFO, inputParams.toString()); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-01-10 20:59:49
|
Revision: 595 http://cishell.svn.sourceforge.net/cishell/?rev=595&view=rev Author: mwlinnem Date: 2008-01-10 12:59:40 -0800 (Thu, 10 Jan 2008) Log Message: ----------- Now throws exception if, in a chain of conversion, a non-terminal converter returns a null result. This is so that the error is pre-emptively caught, as oppose to feeding that null value to the next converter while will inevitably choke on it. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-01-09 22:33:54 UTC (rev 594) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-01-10 20:59:40 UTC (rev 595) @@ -78,6 +78,14 @@ for (int i=0; i < data.length; i++) { if (converters[i] != null) { data[i] = converters[i][0].convert(data[i]); + + if (data[i] == null && i < (data.length - 1)) { + Exception e = + new Exception("The converter " + + converters[i].getClass().getName() + + " returned a null result where data was expected."); + throw e; + } converters[i] = null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2008-02-27 19:05:47
|
Revision: 641 http://cishell.svn.sourceforge.net/cishell/?rev=641&view=rev Author: bh2 Date: 2008-02-27 11:04:07 -0800 (Wed, 27 Feb 2008) Log Message: ----------- Re-enabled use of DataValidators for algorithms. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-02-26 23:31:15 UTC (rev 640) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-02-27 19:04:07 UTC (rev 641) @@ -26,6 +26,7 @@ import org.cishell.framework.algorithm.Algorithm; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; +import org.cishell.framework.algorithm.DataValidator; import org.cishell.framework.algorithm.ProgressMonitor; import org.cishell.framework.algorithm.ProgressTrackable; import org.cishell.framework.data.Data; @@ -94,6 +95,21 @@ ciContext.getService(GUIBuilderService.class.getName()); AlgorithmFactory factory = (AlgorithmFactory) bContext.getService(ref); + + if (factory instanceof DataValidator) { + String validation = ((DataValidator) factory).validate(data); + + if (validation != null && validation.length() > 0) { + String label = (String) ref.getProperty(LABEL); + if (label == null) { + label = "Algorithm"; + } + + builder.showError("Invalid Data", "The data given to \""+label+"\" is incompatible for this reason: "+validation , (String) null); + return null; + } + } + this.provider = factory.createParameters(data); String pid = (String)ref.getProperty(Constants.SERVICE_PID); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bh...@us...> - 2008-03-27 18:46:04
|
Revision: 730 http://cishell.svn.sourceforge.net/cishell/?rev=730&view=rev Author: bh2 Date: 2008-03-27 11:46:00 -0700 (Thu, 27 Mar 2008) Log Message: ----------- used log service instead of gui builder in the case where a data validator doesn't like a given set of data. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-03-27 18:35:36 UTC (rev 729) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2008-03-27 18:46:00 UTC (rev 730) @@ -114,7 +114,7 @@ label = "Algorithm"; } - builder.showError("Invalid Data", "The data given to \""+label+"\" is incompatible for this reason: "+validation , (String) null); + log(LogService.LOG_ERROR,"INVALID DATA: The data given to \""+label+"\" is incompatible for this reason: "+validation); return null; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |