|
From: <bh...@us...> - 2008-03-25 14:37:53
|
Revision: 687
http://cishell.svn.sourceforge.net/cishell/?rev=687&view=rev
Author: bh2
Date: 2008-03-25 07:37:39 -0700 (Tue, 25 Mar 2008)
Log Message:
-----------
initial fix for the reference bundle to update to cishell 1.0
Modified Paths:
--------------
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2008-03-25 14:34:48 UTC (rev 686)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2008-03-25 14:37:39 UTC (rev 687)
@@ -53,12 +53,12 @@
if(model == null){
return;
}
- String label = (String)model.getMetaData().get(DataProperty.LABEL);
- String type = (String)model.getMetaData().get(DataProperty.TYPE);
+ String label = (String)model.getMetadata().get(DataProperty.LABEL);
+ String type = (String)model.getMetadata().get(DataProperty.TYPE);
if(type == null){
type = DataProperty.OTHER_TYPE;
- model.getMetaData().put(DataProperty.TYPE, type);
+ model.getMetadata().put(DataProperty.TYPE, type);
}
//generate label if needed
@@ -98,9 +98,9 @@
private void addModel(Data model, String label) {
label = findUniqueLabel(label);
- model.getMetaData().put(DataProperty.LABEL, label);
+ model.getMetadata().put(DataProperty.LABEL, label);
//set the model to be unsaved initially
- model.getMetaData().put(DataProperty.MODIFIED, new Boolean(true));
+ model.getMetadata().put(DataProperty.MODIFIED, new Boolean(true));
modelToLabelMap.put(model, label);
labelToModelMap.put(label, model);
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2008-03-25 14:34:48 UTC (rev 686)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2008-03-25 14:37:39 UTC (rev 687)
@@ -19,10 +19,12 @@
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.algorithm.AlgorithmProperty;
import org.cishell.framework.data.BasicData;
import org.cishell.framework.data.Data;
+import org.cishell.service.conversion.ConversionException;
import org.cishell.service.conversion.Converter;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -63,13 +65,17 @@
/**
* @see org.cishell.service.conversion.Converter#convert(org.cishell.framework.data.Data)
*/
- public Data convert(Data inDM) {
+ public Data convert(Data inDM) throws ConversionException {
Data[] dm = new Data[]{inDM};
AlgorithmFactory factory = getAlgorithmFactory();
Algorithm alg = factory.createAlgorithm(dm, new Hashtable(), ciContext);
- dm = alg.execute();
+ try {
+ dm = alg.execute();
+ } catch (AlgorithmExecutionException e1) {
+ throw new ConversionException(e1);
+ }
Object outData = null;
if (dm != null && dm.length > 0) {
@@ -77,7 +83,7 @@
}
if (outData != null) {
- Dictionary props = inDM.getMetaData();
+ Dictionary props = inDM.getMetadata();
Dictionary newProps = new Hashtable();
for (Enumeration e=props.keys(); e.hasMoreElements();) {
@@ -165,7 +171,7 @@
this.context = context;
}
- public Data[] execute() {
+ public Data[] execute() throws AlgorithmExecutionException {
Data[] dm = inDM;
for (int i=0; i < refs.length; i++) {
AlgorithmFactory factory = (AlgorithmFactory)bContext.getService(refs[i]);
@@ -175,7 +181,7 @@
dm = alg.execute();
} else {
- throw new RuntimeException("Missing subconverter: "
+ throw new AlgorithmExecutionException("Missing subconverter: "
+ refs[i].getProperty(Constants.SERVICE_PID));
}
}
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2008-03-25 14:34:48 UTC (rev 686)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/DataConversionServiceImpl.java 2008-03-25 14:37:39 UTC (rev 687)
@@ -30,6 +30,7 @@
import org.cishell.framework.algorithm.AlgorithmFactory;
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.cishell.framework.data.Data;
+import org.cishell.service.conversion.ConversionException;
import org.cishell.service.conversion.Converter;
import org.cishell.service.conversion.DataConversionService;
import org.osgi.framework.BundleContext;
@@ -370,7 +371,7 @@
* @return The final data type
* @see org.cishell.service.conversion.DataConversionService#convert(org.cishell.framework.data.Data, java.lang.String)
*/
- public Data convert(Data inDM, String outFormat) {
+ public Data convert(Data inDM, String outFormat) throws ConversionException {
String inFormat = inDM.getFormat();
if (inFormat != null && inFormat.equals(outFormat)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|