1   /***************************************************************/
2   /* This class was generated by ds-to-spi-annotations-processor */
3   /***************************************************************/
4   
5   package org.daisy.pipeline.css.impl;
6   
7   public class StylesheetParametersWebServiceExtension_SPI
8          implements org.daisy.common.spi.ServiceWithProperties
9                   , org.daisy.pipeline.webservice.restlet.WebServiceExtension
10  {
11  	
12  	private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(StylesheetParametersWebServiceExtension_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.impl.StylesheetParametersWebServiceExtension delegate;
18  
19  	public StylesheetParametersWebServiceExtension_SPI() {
20  		delegate = new org.daisy.pipeline.css.impl.StylesheetParametersWebServiceExtension();
21  		spi_log.trace("Creating StylesheetParametersWebServiceExtension");
22  		spi_props = new java.util.HashMap();
23  		spi_props.put("component.name", "stylesheet-parameters-service-extension");
24  		{
25  			spi_log.trace("Binding javax.xml.transform.URIResolver services...");
26  			// cardinality: 1..1
27  			int minRef = 1;
28  			int maxRef = 1;
29  			int refCount = 0;
30  			try {
31  				java.util.Iterator<javax.xml.transform.URIResolver> services
32  					= org.daisy.common.spi.ServiceLoader.load(javax.xml.transform.URIResolver.class).iterator();
33  				while (services.hasNext()) {
34  					try {
35  						javax.xml.transform.URIResolver service = services.next();
36  						delegate.setURIResolver(service);
37  						spi_log.trace("Bound javax.xml.transform.URIResolver service: "
38  						              + service.getClass().getName() + "@"
39  						              + Integer.toHexString(System.identityHashCode(service)));
40  						refCount++;
41  						if (maxRef > 0 && refCount == maxRef)
42  							break;
43  					} catch (Throwable e) {
44  						spi_log.error("Error while binding javax.xml.transform.URIResolver service", e);
45  					}
46  				}
47  			} catch (Throwable e) {
48  				spi_log.error("Error while binding javax.xml.transform.URIResolver services", e);
49  			}
50  			if (refCount < minRef) {
51  				spi_log.warn("No javax.xml.transform.URIResolver found");
52  				throw new RuntimeException("No javax.xml.transform.URIResolver found");
53  			} else {
54  				spi_log.trace("Bound " + refCount + " javax.xml.transform.URIResolver services.");
55  			}
56  		}
57  		{
58  			spi_log.trace("Binding org.daisy.pipeline.datatypes.DatatypeRegistry services...");
59  			// cardinality: 1..1
60  			int minRef = 1;
61  			int maxRef = 1;
62  			int refCount = 0;
63  			try {
64  				java.util.Iterator<org.daisy.pipeline.datatypes.DatatypeRegistry> services
65  					= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.datatypes.DatatypeRegistry.class).iterator();
66  				while (services.hasNext()) {
67  					try {
68  						org.daisy.pipeline.datatypes.DatatypeRegistry service = services.next();
69  						delegate.setDatatypeRegistry(service);
70  						spi_log.trace("Bound org.daisy.pipeline.datatypes.DatatypeRegistry service: "
71  						              + service.getClass().getName() + "@"
72  						              + Integer.toHexString(System.identityHashCode(service)));
73  						refCount++;
74  						if (maxRef > 0 && refCount == maxRef)
75  							break;
76  					} catch (Throwable e) {
77  						spi_log.error("Error while binding org.daisy.pipeline.datatypes.DatatypeRegistry service", e);
78  					}
79  				}
80  			} catch (Throwable e) {
81  				spi_log.error("Error while binding org.daisy.pipeline.datatypes.DatatypeRegistry services", e);
82  			}
83  			if (refCount < minRef) {
84  				spi_log.warn("No org.daisy.pipeline.datatypes.DatatypeRegistry found");
85  				throw new RuntimeException("No org.daisy.pipeline.datatypes.DatatypeRegistry found");
86  			} else {
87  				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.datatypes.DatatypeRegistry services.");
88  			}
89  		}
90  		{
91  			spi_log.trace("Binding org.daisy.pipeline.css.UserAgentStylesheetRegistry services...");
92  			// cardinality: 1..1
93  			int minRef = 1;
94  			int maxRef = 1;
95  			int refCount = 0;
96  			try {
97  				java.util.Iterator<org.daisy.pipeline.css.UserAgentStylesheetRegistry> services
98  					= org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.css.UserAgentStylesheetRegistry.class).iterator();
99  				while (services.hasNext()) {
100 					try {
101 						org.daisy.pipeline.css.UserAgentStylesheetRegistry service = services.next();
102 						delegate.setUserAgentStylesheetRegistry(service);
103 						spi_log.trace("Bound org.daisy.pipeline.css.UserAgentStylesheetRegistry service: "
104 						              + service.getClass().getName() + "@"
105 						              + Integer.toHexString(System.identityHashCode(service)));
106 						refCount++;
107 						if (maxRef > 0 && refCount == maxRef)
108 							break;
109 					} catch (Throwable e) {
110 						spi_log.error("Error while binding org.daisy.pipeline.css.UserAgentStylesheetRegistry service", e);
111 					}
112 				}
113 			} catch (Throwable e) {
114 				spi_log.error("Error while binding org.daisy.pipeline.css.UserAgentStylesheetRegistry services", e);
115 			}
116 			if (refCount < minRef) {
117 				spi_log.warn("No org.daisy.pipeline.css.UserAgentStylesheetRegistry found");
118 				throw new RuntimeException("No org.daisy.pipeline.css.UserAgentStylesheetRegistry found");
119 			} else {
120 				spi_log.trace("Bound " + refCount + " org.daisy.pipeline.css.UserAgentStylesheetRegistry services.");
121 			}
122 		}
123 	}
124 	
125 	public void spi_deactivate() {
126 	}
127 	
128 	public java.util.Map spi_getProperties() {
129 		return spi_props;
130 	}
131 
132 	@Override
133 	public void attachTo(
134 		org.restlet.routing.Router arg1
135 	) {
136 		delegate.attachTo(
137 			arg1
138 		);
139 	}
140 
141 	@Override
142 	public String toString() {
143 		return delegate.toString();
144 	}
145 
146 	@Override
147 	public int hashCode() {
148 		return delegate.hashCode();
149 	}
150 
151 	@Override
152 	public boolean equals(Object o) {
153 		return delegate.equals(o);
154 	}
155 }