1
2
3
4
5 package org.daisy.pipeline.audio.saxon.impl;
6
7 public class TranscodeAudioFileDefinition_SPI
8 implements org.daisy.common.spi.ServiceWithProperties
9 , org.daisy.common.xpath.saxon.ExtensionFunctionProvider
10 {
11
12 private static final org.slf4j.Logger spi_log = org.slf4j.LoggerFactory.getLogger(TranscodeAudioFileDefinition_SPI.class);
13
14 private final java.util.Map spi_props;
15 private boolean spi_deactivated = false;
16
17 private final org.daisy.pipeline.audio.saxon.impl.TranscodeAudioFileDefinition delegate;
18
19 public TranscodeAudioFileDefinition_SPI() {
20 delegate = new org.daisy.pipeline.audio.saxon.impl.TranscodeAudioFileDefinition();
21 spi_log.trace("Creating TranscodeAudioFileDefinition");
22 spi_props = new java.util.HashMap();
23 spi_props.put("component.name", "TranscodeAudioFile");
24 {
25 spi_log.trace("Binding org.daisy.pipeline.audio.AudioServices services...");
26
27 int minRef = 1;
28 int maxRef = 1;
29 int refCount = 0;
30 try {
31 java.util.Iterator<org.daisy.pipeline.audio.AudioServices> services
32 = org.daisy.common.spi.ServiceLoader.load(org.daisy.pipeline.audio.AudioServices.class).iterator();
33 while (services.hasNext()) {
34 try {
35 org.daisy.pipeline.audio.AudioServices service = services.next();
36 delegate.setAudioServices(service);
37 spi_log.trace("Bound org.daisy.pipeline.audio.AudioServices 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.audio.AudioServices service", e);
45 }
46 }
47 } catch (Throwable e) {
48 spi_log.error("Error while binding org.daisy.pipeline.audio.AudioServices services", e);
49 }
50 if (refCount < minRef) {
51 spi_log.warn("No org.daisy.pipeline.audio.AudioServices found");
52 throw new RuntimeException("No org.daisy.pipeline.audio.AudioServices found");
53 } else {
54 spi_log.trace("Bound " + refCount + " org.daisy.pipeline.audio.AudioServices 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 java.util.Collection<net.sf.saxon.lib.ExtensionFunctionDefinition> getDefinitions() {
68 return delegate.getDefinitions();
69 }
70
71 @Override
72 public String toString() {
73 return delegate.toString();
74 }
75
76 @Override
77 public int hashCode() {
78 return delegate.hashCode();
79 }
80
81 @Override
82 public boolean equals(Object o) {
83 return delegate.equals(o);
84 }
85 }