1
2
3
4
5 package org.daisy.pipeline.tts.impl;
6
7 public class TTSEnginesWebServiceExtension_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(TTSEnginesWebServiceExtension_SPI.class);
13
14 private final java.util.Map spi_props;
15 private boolean spi_deactivated = false;
16
17 private final org.daisy.pipeline.tts.impl.TTSEnginesWebServiceExtension delegate;
18
19 public TTSEnginesWebServiceExtension_SPI() {
20 delegate = new org.daisy.pipeline.tts.impl.TTSEnginesWebServiceExtension();
21 spi_log.trace("Creating TTSEnginesWebServiceExtension");
22 spi_props = new java.util.HashMap();
23 spi_props.put("component.name", "tts-engines-web-service-extension");
24 {
25 spi_log.trace("Binding org.daisy.pipeline.tts.TTSRegistry services...");
26
27 int minRef = 1;
28 int maxRef = 1;
29 int refCount = 0;
30 try {
31 java.util.Iterator<org.daisy.pipeline.tts.TTSRegistry> services
32 = org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.tts.TTSRegistry.class).iterator();
33 while (services.hasNext()) {
34 try {
35 org.daisy.pipeline.tts.TTSRegistry service = services.next();
36 delegate.setTTSRegistry(service);
37 spi_log.trace("Bound org.daisy.pipeline.tts.TTSRegistry 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 org.daisy.pipeline.tts.TTSRegistry service", e);
45 }
46 }
47 } catch (Throwable e) {
48 spi_log.error("Error while binding org.daisy.pipeline.tts.TTSRegistry services", e);
49 }
50 if (refCount < minRef) {
51 spi_log.warn("No org.daisy.pipeline.tts.TTSRegistry found");
52 throw new RuntimeException("No org.daisy.pipeline.tts.TTSRegistry found");
53 } else {
54 spi_log.trace("Bound " + refCount + " org.daisy.pipeline.tts.TTSRegistry services.");
55 }
56 }
57 }
58
59 public void spi_deactivate() {
60 }
61
62 public java.util.Map spi_getProperties() {
63 return spi_props;
64 }
65
66 @Override
67 public void attachTo(
68 org.restlet.routing.Router arg1
69 ) {
70 delegate.attachTo(
71 arg1
72 );
73 }
74
75 @Override
76 public String toString() {
77 return delegate.toString();
78 }
79
80 @Override
81 public int hashCode() {
82 return delegate.hashCode();
83 }
84
85 @Override
86 public boolean equals(Object o) {
87 return delegate.equals(o);
88 }
89 }