1   /***************************************************************/
2   /* This class was generated by ds-to-spi-annotations-processor */
3   /***************************************************************/
4   
5   package org.daisy.pipeline.css.calabash.impl;
6   
7   public class CssAnalyzeStep_Provider_SPI
8          implements org.daisy.common.spi.ServiceWithProperties
9                   , org.daisy.common.xproc.calabash.XProcStepProvider
10  {
11  	
12  	private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(CssAnalyzeStep_Provider_SPI.class);
13  	
14  	private final java.util.Map spi_props;
15  	private boolean spi_deactivated = false;
16  	
17  	private final org.daisy.pipeline.css.calabash.impl.CssAnalyzeStep.Provider delegate;
18  
19  	public CssAnalyzeStep_Provider_SPI() {
20  		delegate = new org.daisy.pipeline.css.calabash.impl.CssAnalyzeStep.Provider();
21  		spi_log.trace("Creating CssAnalyzeStep.Provider");
22  		spi_props = new java.util.HashMap();
23  		spi_props.put("component.name", "pxi:css-analyze");
24  		spi_props.put("type", "{http://www.daisy.org/ns/pipeline/xproc/internal}css-analyze");
25  		{
26  			spi_log.trace("Binding javax.xml.transform.URIResolver services...");
27  			// cardinality: 1..1
28  			int minRef = 1;
29  			int maxRef = 1;
30  			int refCount = 0;
31  			try {
32  				java.util.Iterator<javax.xml.transform.URIResolver> services
33  					= org.daisy.common.spi.ServiceLoader.load(javax.xml.transform.URIResolver.class).iterator();
34  				while (services.hasNext()) {
35  					try {
36  						javax.xml.transform.URIResolver service = services.next();
37  						delegate.setUriResolver(service);
38  						spi_log.trace("Bound javax.xml.transform.URIResolver service: "
39  						              + service.getClass().getName() + "@"
40  						              + Integer.toHexString(System.identityHashCode(service)));
41  						refCount++;
42  						if (maxRef > 0 && refCount == maxRef)
43  							break;
44  					} catch (Throwable e) {
45  						spi_log.error("Error while binding javax.xml.transform.URIResolver service", e);
46  					}
47  				}
48  			} catch (Throwable e) {
49  				spi_log.error("Error while binding javax.xml.transform.URIResolver services", e);
50  			}
51  			if (refCount < minRef) {
52  				spi_log.warn("No javax.xml.transform.URIResolver found");
53  				throw new RuntimeException("No javax.xml.transform.URIResolver found");
54  			} else {
55  				spi_log.trace("Bound " + refCount + " javax.xml.transform.URIResolver services.");
56  			}
57  		}
58  		{
59  			spi_log.trace("Binding org.daisy.pipeline.css.UserAgentStylesheetRegistry services...");
60  			// cardinality: 1..1
61  			int minRef = 1;
62  			int maxRef = 1;
63  			int refCount = 0;
64  			try {
65  				java.util.Iterator<org.daisy.pipeline.css.UserAgentStylesheetRegistry> services
66  					= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.css.UserAgentStylesheetRegistry.class).iterator();
67  				while (services.hasNext()) {
68  					try {
69  						org.daisy.pipeline.css.UserAgentStylesheetRegistry service = services.next();
70  						delegate.setUserAgentStylesheetRegistry(service);
71  						spi_log.trace("Bound org.daisy.pipeline.css.UserAgentStylesheetRegistry service: "
72  						              + service.getClass().getName() + "@"
73  						              + Integer.toHexString(System.identityHashCode(service)));
74  						refCount++;
75  						if (maxRef > 0 && refCount == maxRef)
76  							break;
77  					} catch (Throwable e) {
78  						spi_log.error("Error while binding org.daisy.pipeline.css.UserAgentStylesheetRegistry service", e);
79  					}
80  				}
81  			} catch (Throwable e) {
82  				spi_log.error("Error while binding org.daisy.pipeline.css.UserAgentStylesheetRegistry services", e);
83  			}
84  			if (refCount < minRef) {
85  				spi_log.warn("No org.daisy.pipeline.css.UserAgentStylesheetRegistry found");
86  				throw new RuntimeException("No org.daisy.pipeline.css.UserAgentStylesheetRegistry found");
87  			} else {
88  				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.css.UserAgentStylesheetRegistry services.");
89  			}
90  		}
91  	}
92  	
93  	public void spi_deactivate() {
94  	}
95  	
96  	public java.util.Map spi_getProperties() {
97  		return spi_props;
98  	}
99  
100 	@Override
101 	public org.daisy.common.xproc.calabash.XProcStep newStep(
102 		com.xmlcalabash.core.XProcRuntime arg1,
103 		com.xmlcalabash.runtime.XAtomicStep arg2,
104 		org.daisy.common.xproc.XProcMonitor arg3,
105 		java.util.Map<java.lang.String,java.lang.String> arg4
106 	) {
107 		return delegate.newStep(
108 			arg1,
109 			arg2,
110 			arg3,
111 			arg4
112 		);
113 	}
114 
115 	@Override
116 	public String toString() {
117 		return delegate.toString();
118 	}
119 
120 	@Override
121 	public int hashCode() {
122 		return delegate.hashCode();
123 	}
124 
125 	@Override
126 	public boolean equals(Object o) {
127 		return delegate.equals(o);
128 	}
129 }