//find file-friendly format to convert to
String format = dm.getFormat();
String finalOutFormat = null;
if (format == null || !format.startsWith("file:")) {
DataConversionService converter = (DataConversionService)
ciContext.getService(DataConversionService.class.getName());
Converter[] converters = converter.findConverters(dm, "file:*");
if (converters.length > 0) {
//see if the server has a converter to convert from a file back
//to the data model's original format
Set inFormats = new HashSet();
Set outFormats = new HashSet();
for (int i=0; i < converters.length; i++) {
inFormats.add(converters[i].getProperties().get(AlgorithmProperty.IN_DATA));
outFormats.add(converters[i].getProperties().get(AlgorithmProperty.OUT_DATA));
}
Vector inF = new Vector(inFormats);
Vector outF = new Vector(outFormats);
//give them the format that will come in (the out format on the client)
//and what it will need to convert back to on the other side (the in
//format on the client)
Vector conversion = remoteConverter.findConverter(outF, inF);
if (conversion != null && conversion.size() > 0) {
format = (String)conversion.get(0);
finalOutFormat = (String)conversion.get(1);
try {
dm = converter.convert(dm, format);
} catch (ConversionException e) {
dm = null;
}
}
} else {