1
2
3
4
5 package nl.dedicon.pipeline.braille.impl;
6
7 public class DediconTranslator_Provider_SPI
8 extends nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider
9 implements org.daisy.common.spi.ServiceWithProperties
10 {
11
12 private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(DediconTranslator_Provider_SPI.class);
13
14 private final java.util.Map spi_props;
15
16 public DediconTranslator_Provider_SPI() {
17 super();
18 spi_log.trace("Creating DediconTranslator.Provider");
19 spi_props = new java.util.HashMap();
20 spi_props.put("component.name", "nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider");
21 {
22 spi_log.trace("Binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services...");
23
24 int minRef = 0;
25 int maxRef = -1;
26 int refCount = 0;
27 try {
28 java.util.Iterator<org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider> services
29 = org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider.class).iterator();
30 while (services.hasNext()) {
31 try {
32 org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider service = services.next();
33 bindLiblouisTranslatorProvider(service);
34 refCount++;
35 if (maxRef > 0 && refCount == maxRef)
36 break;
37 } catch (Throwable e) {
38 spi_log.error("Error while binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider service", e);
39 }
40 }
41 } catch (Throwable e) {
42 spi_log.error("Error while binding org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services", e);
43 }
44 if (refCount < minRef) {
45 spi_log.warn("No org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider found");
46 throw new RuntimeException("No org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider found");
47 } else {
48 spi_log.trace("Bound " + refCount + " org.daisy.pipeline.braille.liblouis.LiblouisTranslator.Provider services.");
49 }
50 }
51 {
52 spi_log.trace("Binding org.daisy.pipeline.braille.common.HyphenatorProvider services...");
53
54 int minRef = 0;
55 int maxRef = -1;
56 int refCount = 0;
57 try {
58 java.util.Iterator<org.daisy.pipeline.braille.common.HyphenatorProvider> services
59 = org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.braille.common.HyphenatorProvider.class).iterator();
60 while (services.hasNext()) {
61 try {
62 org.daisy.pipeline.braille.common.HyphenatorProvider service = services.next();
63 bindHyphenatorProvider(service);
64 refCount++;
65 if (maxRef > 0 && refCount == maxRef)
66 break;
67 } catch (Throwable e) {
68 spi_log.error("Error while binding org.daisy.pipeline.braille.common.HyphenatorProvider service", e);
69 }
70 }
71 } catch (Throwable e) {
72 spi_log.error("Error while binding org.daisy.pipeline.braille.common.HyphenatorProvider services", e);
73 }
74 if (refCount < minRef) {
75 spi_log.warn("No org.daisy.pipeline.braille.common.HyphenatorProvider found");
76 throw new RuntimeException("No org.daisy.pipeline.braille.common.HyphenatorProvider found");
77 } else {
78 spi_log.trace("Bound " + refCount + " org.daisy.pipeline.braille.common.HyphenatorProvider services.");
79 }
80 }
81 spi_log.trace("Activating DediconTranslator.Provider");
82 java.util.HashMap props = new java.util.HashMap();
83 props.put("component.name", "nl.dedicon.pipeline.braille.impl.DediconTranslator.Provider");
84 activate(props);
85 }
86
87 public java.util.Map spi_getProperties() {
88 return spi_props;
89 }
90 }