org.daisy.pipeline.css.UserAgentStylesheetRegistry_SPI Maven / Gradle / Ivy
/***************************************************************/
/* This class was generated by ds-to-spi-annotations-processor */
/***************************************************************/
package org.daisy.pipeline.css;
public class UserAgentStylesheetRegistry_SPI
extends org.daisy.pipeline.css.UserAgentStylesheetRegistry
implements org.daisy.common.spi.ServiceWithProperties
{
private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(UserAgentStylesheetRegistry_SPI.class);
private final java.util.Map spi_props;
private boolean spi_deactivated = false;
public UserAgentStylesheetRegistry_SPI() {
super();
spi_log.trace("Creating UserAgentStylesheetRegistry");
spi_props = new java.util.HashMap();
spi_props.put("component.name", "UserAgentStylesheetRegistry");
{
spi_log.trace("Binding org.daisy.pipeline.css.UserAgentStylesheet 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.css.UserAgentStylesheet.class).iterator();
while (services.hasNext()) {
try {
org.daisy.pipeline.css.UserAgentStylesheet service = services.next();
addStylesheet(service);
spi_log.trace("Bound org.daisy.pipeline.css.UserAgentStylesheet 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.css.UserAgentStylesheet service", e);
}
}
} catch (Throwable e) {
spi_log.error("Error while binding org.daisy.pipeline.css.UserAgentStylesheet services", e);
}
if (refCount < minRef) {
spi_log.warn("No org.daisy.pipeline.css.UserAgentStylesheet found");
throw new RuntimeException("No org.daisy.pipeline.css.UserAgentStylesheet found");
} else {
spi_log.trace("Bound " + refCount + " org.daisy.pipeline.css.UserAgentStylesheet services.");
}
}
}
public void spi_deactivate() {
}
public java.util.Map spi_getProperties() {
return spi_props;
}
}