1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.helger.schematron.svrl;
18
19 import javax.annotation.Nonnull;
20 import javax.annotation.Nullable;
21 import javax.annotation.concurrent.NotThreadSafe;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 import com.helger.commons.annotation.PresentForCodeCoverage;
27 import com.helger.commons.collection.ext.ICommonsList;
28 import com.helger.commons.lang.ServiceLoaderHelper;
29
30
31
32
33
34
35 @NotThreadSafe
36 public final class SVRLLocationBeautifierRegistry
37 {
38 private static final Logger s_aLogger = LoggerFactory.getLogger (SVRLLocationBeautifierRegistry.class);
39 private static final ICommonsList <ISVRLLocationBeautifierSPI> s_aList = ServiceLoaderHelper.getAllSPIImplementations (ISVRLLocationBeautifierSPI.class);
40
41 @PresentForCodeCoverage
42 private static final SVRLLocationBeautifierRegistry s_aInstance = new SVRLLocationBeautifierRegistry ();
43
44 private SVRLLocationBeautifierRegistry ()
45 {}
46
47
48
49
50
51
52
53
54
55
56 @Nullable
57 public static String getBeautifiedLocation (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalName)
58 {
59 for (final ISVRLLocationBeautifierSPI aBeautifier : s_aList)
60 {
61 final String sBeautified = aBeautifier.getReplacementText (sNamespaceURI, sLocalName);
62 if (sBeautified != null)
63 return sBeautified;
64 }
65 if (s_aLogger.isDebugEnabled ())
66 s_aLogger.debug ("Unsupported elements for beautification: " + sNamespaceURI + " -- " + sLocalName);
67 return null;
68 }
69 }