nl.dedicon.pipeline.braille.impl.DediconTranslator_Provider_SPI Maven / Gradle / Ivy
/***************************************************************/
/* This class was generated by ds-to-spi-annotations-processor */
/***************************************************************/
package nl.dedicon.pipeline.braille.impl;
public class DediconTranslator_Provider_SPI
extends nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider
implements org.daisy.common.spi.ServiceWithProperties
{
private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(DediconTranslator_Provider_SPI.class);
private final java.util.Map spi_props;
public DediconTranslator_Provider_SPI() {
super();
spi_log.trace("Creating DediconTranslator.Provider");
spi_props = new java.util.HashMap();
spi_props.put("component.name", "nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider");
{
spi_log.trace("Binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services...");
// cardinality: 0..n
int minRef = 0;
int maxRef = -1;
int refCount = 0;
try {
java.util.Iterator services
= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider.class).iterator();
while (services.hasNext()) {
try {
org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider service = services.next();
bindLiblouisTranslatorProvider(service);
refCount++;
if (maxRef > 0 && refCount == maxRef)
break;
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider service", e);
}
}
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services", e);
}
if (refCount < minRef) {
spi_log.warn("No org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider found");
throw new RuntimeException("No org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider found");
} else {
spi_log.trace("Bound " + refCount + " org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services.");
}
}
{
spi_log.trace("Binding org.daisy.pipeline.braille.common.HyphenatorProvider services...");
// cardinality: 0..n
int minRef = 0;
int maxRef = -1;
int refCount = 0;
try {
java.util.Iterator services
= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.braille.common.HyphenatorProvider.class).iterator();
while (services.hasNext()) {
try {
org.daisy.pipeline.braille.common.HyphenatorProvider service = services.next();
bindHyphenatorProvider(service);
refCount++;
if (maxRef > 0 && refCount == maxRef)
break;
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.braille.common.HyphenatorProvider service", e);
}
}
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.braille.common.HyphenatorProvider services", e);
}
if (refCount < minRef) {
spi_log.warn("No org.daisy.pipeline.braille.common.HyphenatorProvider found");
throw new RuntimeException("No org.daisy.pipeline.braille.common.HyphenatorProvider found");
} else {
spi_log.trace("Bound " + refCount + " org.daisy.pipeline.braille.common.HyphenatorProvider services.");
}
}
spi_log.trace("Activating DediconTranslator.Provider");
java.util.HashMap props = new java.util.HashMap();
props.put("component.name", "nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider");
activate(props);
}
public java.util.Map spi_getProperties() {
return spi_props;
}
}