.getConversionContext().getConverters().getJavaConverterList();
for (final de.ddb.conversion.context.xml.JavaConverter jc : javaConverters) {
for (final String sf : jc.getSourceFormatList()) {
for (final String tf : jc.getTargetFormatList()) {
try {
final Converter converter = (Converter) Class.forName(
jc.getClassName()).newInstance();
Properties converterProps = null;
if (jc.isSetProperties()) {
final List<Property> props = jc.getProperties()
.getPropertyList();
if (!props.isEmpty()) {
converterProps = new Properties();
for (final Property prop : props) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Found property ["
+ prop.getKey() + "] = "
+ prop.getStringValue());
}
converterProps.setProperty(prop.getKey(),
prop.getStringValue());
}
}
}
context.addConverter(converter, sf, tf,
jc.getSourceEncoding(), jc.getTargetEncoding(),
converterProps);
} catch (final ClassNotFoundException e) {
LOGGER.error("Could not find class: "
+ jc.getClassName());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e, e);
}
} catch (final InstantiationException e) {
LOGGER.error("Could not instantiate converter: "
+ jc.getClassName());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e, e);
}
} catch (final IllegalAccessException e) {
LOGGER.error("Could not access converter: "
+ jc.getClassName());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e, e);
}
} catch (final Exception e) {
LOGGER.error("Unknown exception: " + jc.getClassName()
+ " : " + e.getMessage());
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e, e);
}
}
}
}
}
/*
* set piped converters
*/
final List<de.ddb.conversion.context.xml.PipedConverter> pipedConverters = contextDocument
.getConversionContext().getConverters().getPipedConverterList();
for (final de.ddb.conversion.context.xml.PipedConverter pc : pipedConverters) {
try {
Properties converterProps = null;
if (pc.isSetProperties()) {
final List<Property> props = pc.getProperties()
.getPropertyList();
if (!props.isEmpty()) {
converterProps = new Properties();
for (final Property prop : props) {
converterProps.setProperty(prop.getKey(),
prop.xmlText());
}
}
}
if (pc.getSourceFormatList().isEmpty()) {
throw new ConverterInitializationException(
"Missing source format to initialize piped converter.");
}
if (pc.getTargetFormatList().isEmpty()) {
throw new ConverterInitializationException(
"Missing target format to initialize piped converter.");
}
final Converter c1 = context.getConverter(pc
.getSourceFormatList().get(0), pc
.getIntermediateFormat(), pc.getSourceEncoding(), pc
.getIntermediateEncoding());
final Converter c2 = context.getConverter(pc
.getIntermediateFormat(),
pc.getTargetFormatList().get(0), pc
.getIntermediateEncoding(), pc
.getTargetEncoding());
final PipedConverter c = new PipedConverter(c1, c2);