1
2
3
4
5 package org.daisy.pipeline.tts.impl;
6
7 public class VoicesWebServiceExtension_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(VoicesWebServiceExtension_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.VoicesWebServiceExtension delegate;
18
19 public VoicesWebServiceExtension_SPI() {
20 delegate = new org.daisy.pipeline.tts.impl.VoicesWebServiceExtension();
21 spi_log.trace("Creating VoicesWebServiceExtension");
22 spi_props = new java.util.HashMap();
23 spi_props.put("component.name", "voices-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 spi_log.trace("Binding org.daisy.pipeline.audio.AudioServices services...");
59
60 int minRef = 1;
61 int maxRef = 1;
62 int refCount = 0;
63 try {
64 java.util.Iterator<org.daisy.pipeline.audio.AudioServices> services
65 = org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.audio.AudioServices.class).iterator();
66 while (services.hasNext()) {
67 try {
68 org.daisy.pipeline.audio.AudioServices service = services.next();
69 delegate.setAudioServices(service);
70 spi_log.trace("Bound org.daisy.pipeline.audio.AudioServices 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.audio.AudioServices service", e);
78 }
79 }
80 } catch (Throwable e) {
81 spi_log.error("Error while binding org.daisy.pipeline.audio.AudioServices services", e);
82 }
83 if (refCount < minRef) {
84 spi_log.warn("No org.daisy.pipeline.audio.AudioServices found");
85 throw new RuntimeException("No org.daisy.pipeline.audio.AudioServices found");
86 } else {
87 spi_log.trace("Bound " + refCount + " org.daisy.pipeline.audio.AudioServices services.");
88 }
89 }
90 }
91
92 public void spi_deactivate() {
93 }
94
95 public java.util.Map spi_getProperties() {
96 return spi_props;
97 }
98
99 @Override
100 public void attachTo(
101 org.restlet.routing.Router arg1
102 ) {
103 delegate.attachTo(
104 arg1
105 );
106 }
107
108 @Override
109 public String toString() {
110 return delegate.toString();
111 }
112
113 @Override
114 public int hashCode() {
115 return delegate.hashCode();
116 }
117
118 @Override
119 public boolean equals(Object o) {
120 return delegate.equals(o);
121 }
122 }