org.daisy.pipeline.nlp.lexing.LexServiceRegistry_SPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nlp-common Show documentation
Show all versions of nlp-common Show documentation
Common API for NLP functionality and XProc steps
The newest version!
/***************************************************************/
/* This class was generated by ds-to-spi-annotations-processor */
/***************************************************************/
package org.daisy.pipeline.nlp.lexing;
public class LexServiceRegistry_SPI
extends org.daisy.pipeline.nlp.lexing.LexServiceRegistry
implements org.daisy.common.spi.ServiceWithProperties
{
private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(LexServiceRegistry_SPI.class);
private final java.util.Map spi_props;
private boolean spi_deactivated = false;
public LexServiceRegistry_SPI() {
super();
spi_log.trace("Creating LexServiceRegistry");
spi_props = new java.util.HashMap();
spi_props.put("component.name", "lexer-registry");
{
spi_log.trace("Binding org.daisy.pipeline.nlp.lexing.LexService 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.nlp.lexing.LexService.class).iterator();
while (services.hasNext()) {
try {
org.daisy.pipeline.nlp.lexing.LexService service = services.next();
addLexService(service);
spi_log.trace("Bound org.daisy.pipeline.nlp.lexing.LexService service: "
+ service.getClass().getName() + "@"
+ Integer.toHexString(System.identityHashCode(service)));
refCount++;
if (maxRef > 0 && refCount == maxRef)
break;
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.nlp.lexing.LexService service", e);
}
}
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.nlp.lexing.LexService services", e);
}
if (refCount < minRef) {
spi_log.warn("No org.daisy.pipeline.nlp.lexing.LexService found");
throw new RuntimeException("No org.daisy.pipeline.nlp.lexing.LexService found");
} else {
spi_log.trace("Bound " + refCount + " org.daisy.pipeline.nlp.lexing.LexService services.");
}
}
}
public void spi_deactivate() {
}
public java.util.Map spi_getProperties() {
return spi_props;
}
}