org.daisy.pipeline.tts.impl.TTSEnginesWebServiceExtension_SPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tts-common Show documentation
Show all versions of tts-common Show documentation
Common API for TTS functionality
The newest version!
/***************************************************************/
/* This class was generated by ds-to-spi-annotations-processor */
/***************************************************************/
package org.daisy.pipeline.tts.impl;
public class TTSEnginesWebServiceExtension_SPI
implements org.daisy.common.spi.ServiceWithProperties
, org.daisy.pipeline.webservice.restlet.WebServiceExtension
{
private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(TTSEnginesWebServiceExtension_SPI.class);
private final java.util.Map spi_props;
private boolean spi_deactivated = false;
private final org.daisy.pipeline.tts.impl.TTSEnginesWebServiceExtension delegate;
public TTSEnginesWebServiceExtension_SPI() {
delegate = new org.daisy.pipeline.tts.impl.TTSEnginesWebServiceExtension();
spi_log.trace("Creating TTSEnginesWebServiceExtension");
spi_props = new java.util.HashMap();
spi_props.put("component.name", "tts-engines-web-service-extension");
{
spi_log.trace("Binding org.daisy.pipeline.tts.TTSRegistry services...");
// cardinality: 1..1
int minRef = 1;
int maxRef = 1;
int refCount = 0;
try {
java.util.Iterator services
= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.tts.TTSRegistry.class).iterator();
while (services.hasNext()) {
try {
org.daisy.pipeline.tts.TTSRegistry service = services.next();
delegate.setTTSRegistry(service);
spi_log.trace("Bound org.daisy.pipeline.tts.TTSRegistry 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.tts.TTSRegistry service", e);
}
}
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.tts.TTSRegistry services", e);
}
if (refCount < minRef) {
spi_log.warn("No org.daisy.pipeline.tts.TTSRegistry found");
throw new RuntimeException("No org.daisy.pipeline.tts.TTSRegistry found");
} else {
spi_log.trace("Bound " + refCount + " org.daisy.pipeline.tts.TTSRegistry services.");
}
}
}
public void spi_deactivate() {
}
public java.util.Map spi_getProperties() {
return spi_props;
}
@Override
public void attachTo(
org.restlet.routing.Router arg1
) {
delegate.attachTo(
arg1
);
}
@Override
public String toString() {
return delegate.toString();
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public boolean equals(Object o) {
return delegate.equals(o);
}
}