All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.daisy.pipeline.gui.ServiceRegistry_ServiceBinder_SPI Maven / Gradle / Ivy

The newest version!
/***************************************************************/
/* This class was generated by ds-to-spi-annotations-processor */
/***************************************************************/

package org.daisy.pipeline.gui;

public class ServiceRegistry_ServiceBinder_SPI
       extends org.daisy.pipeline.gui.ServiceRegistry.ServiceBinder
       implements org.daisy.common.spi.ServiceWithProperties
                , org.daisy.common.spi.CreateOnStart {
	
	private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(ServiceRegistry_ServiceBinder_SPI.class);
	
	private final java.util.Map spi_props;
	private boolean spi_deactivated = false;
	
	public ServiceRegistry_ServiceBinder_SPI() {
		super();
		spi_log.trace("Creating ServiceRegistry.ServiceBinder");
		spi_props = new java.util.HashMap();
		spi_props.put("component.name", "");
		{
			spi_log.trace("Binding org.daisy.pipeline.script.ScriptRegistry 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.script.ScriptRegistry.class).iterator();
				while (services.hasNext()) {
					try {
						org.daisy.pipeline.script.ScriptRegistry service = services.next();
						setScriptRegistry(service);
						refCount++;
						if (maxRef > 0 && refCount == maxRef)
							break;
					} catch (Throwable e) {
						spi_log.error("Error while binding org.daisy.pipeline.script.ScriptRegistry service", e);
					}
				}
			} catch (Throwable e) {
				spi_log.error("Error while binding org.daisy.pipeline.script.ScriptRegistry services", e);
			}
			if (refCount < minRef) {
				spi_log.warn("No org.daisy.pipeline.script.ScriptRegistry found");
				throw new RuntimeException("No org.daisy.pipeline.script.ScriptRegistry found");
			} else {
				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.script.ScriptRegistry services.");
			}
		}
		{
			spi_log.trace("Binding org.daisy.pipeline.job.JobManagerFactory 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.job.JobManagerFactory.class).iterator();
				while (services.hasNext()) {
					try {
						org.daisy.pipeline.job.JobManagerFactory service = services.next();
						setJobManagerFactory(service);
						refCount++;
						if (maxRef > 0 && refCount == maxRef)
							break;
					} catch (Throwable e) {
						spi_log.error("Error while binding org.daisy.pipeline.job.JobManagerFactory service", e);
					}
				}
			} catch (Throwable e) {
				spi_log.error("Error while binding org.daisy.pipeline.job.JobManagerFactory services", e);
			}
			if (refCount < minRef) {
				spi_log.warn("No org.daisy.pipeline.job.JobManagerFactory found");
				throw new RuntimeException("No org.daisy.pipeline.job.JobManagerFactory found");
			} else {
				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.job.JobManagerFactory services.");
			}
		}
		{
			spi_log.trace("Binding org.daisy.pipeline.datatypes.DatatypeRegistry 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.datatypes.DatatypeRegistry.class).iterator();
				while (services.hasNext()) {
					try {
						org.daisy.pipeline.datatypes.DatatypeRegistry service = services.next();
						setDatatypeRegistry(service);
						refCount++;
						if (maxRef > 0 && refCount == maxRef)
							break;
					} catch (Throwable e) {
						spi_log.error("Error while binding org.daisy.pipeline.datatypes.DatatypeRegistry service", e);
					}
				}
			} catch (Throwable e) {
				spi_log.error("Error while binding org.daisy.pipeline.datatypes.DatatypeRegistry services", e);
			}
			if (refCount < minRef) {
				spi_log.warn("No org.daisy.pipeline.datatypes.DatatypeRegistry found");
				throw new RuntimeException("No org.daisy.pipeline.datatypes.DatatypeRegistry found");
			} else {
				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.datatypes.DatatypeRegistry services.");
			}
		}
	}
	
	public void spi_deactivate() {
	}
	
	public java.util.Map spi_getProperties() {
		return spi_props;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy