16
16
17
17
import org .hibernate .boot .MappingNotFoundException ;
18
18
import org .hibernate .boot .archive .spi .InputStreamAccess ;
19
- import org .hibernate .boot .jaxb .JaxbLogger ;
20
19
import org .hibernate .boot .jaxb .Origin ;
21
20
import org .hibernate .boot .jaxb .SourceType ;
22
21
import org .hibernate .boot .jaxb .spi .XmlSource ;
23
22
import org .hibernate .boot .registry .classloading .spi .ClassLoaderService ;
24
23
25
24
import org .w3c .dom .Document ;
26
25
26
+ import static org .hibernate .boot .jaxb .JaxbLogger .JAXB_LOGGER ;
27
+
27
28
/**
28
29
* Helper for building and handling {@link XmlSource} references.
29
30
* <p>
@@ -38,7 +39,7 @@ public class XmlSources {
38
39
* Create an {@link XmlSource} from a named resource
39
40
*/
40
41
public static XmlSource fromResource (String resourceName , ClassLoaderService classLoaderService ) {
41
- JaxbLogger . JAXB_LOGGER .tracef ( "reading mappings from resource : %s" , resourceName );
42
+ JAXB_LOGGER .tracef ( "Reading mappings from resource: %s" , resourceName );
42
43
43
44
final Origin origin = new Origin ( SourceType .RESOURCE , resourceName );
44
45
final URL url = classLoaderService .locateResource ( resourceName );
@@ -54,15 +55,15 @@ public static XmlSource fromResource(String resourceName, ClassLoaderService cla
54
55
*/
55
56
public static XmlSource fromUrl (URL url ) {
56
57
final String urlExternalForm = url .toExternalForm ();
57
- JaxbLogger . JAXB_LOGGER .tracef ( "Reading mapping document from URL : %s" , urlExternalForm );
58
+ JAXB_LOGGER .tracef ( "Reading mapping document from URL: %s" , urlExternalForm );
58
59
59
60
final Origin origin = new Origin ( SourceType .URL , urlExternalForm );
60
61
return new UrlXmlSource ( origin , url );
61
62
}
62
63
63
64
public static XmlSource fromFile (File file ) {
64
65
final String filePath = file .getPath ();
65
- JaxbLogger . JAXB_LOGGER .tracef ( "reading mappings from file : %s" , filePath );
66
+ JAXB_LOGGER .tracef ( "Reading mappings from file: %s" , filePath );
66
67
67
68
final Origin origin = new Origin ( SourceType .FILE , filePath );
68
69
@@ -87,29 +88,29 @@ public static XmlSource fromCacheableFile(File file, boolean strict) {
87
88
88
89
public static XmlSource fromCacheableFile (File file , File cacheableDir , boolean strict ) {
89
90
final String filePath = file .getPath ();
90
- JaxbLogger . JAXB_LOGGER .tracef ( "reading mappings from cacheable-file : %s" , filePath );
91
+ JAXB_LOGGER .tracef ( "Reading mappings from cacheable file : %s" , filePath );
91
92
92
93
final Origin origin = new Origin ( SourceType .FILE , filePath );
93
94
return new CacheableFileXmlSource ( origin , file , cacheableDir , strict );
94
95
}
95
96
96
97
public static XmlSource fromStream (InputStreamAccess inputStreamAccess ) {
97
98
final String streamName = inputStreamAccess .getStreamName ();
98
- JaxbLogger . JAXB_LOGGER .tracef ( "reading mappings from InputStreamAccess : %s" , streamName );
99
+ JAXB_LOGGER .tracef ( "Reading mappings from InputStreamAccess: %s" , streamName );
99
100
100
101
final Origin origin = new Origin ( SourceType .INPUT_STREAM , streamName );
101
102
return new InputStreamAccessXmlSource ( origin , inputStreamAccess );
102
103
}
103
104
104
105
public static XmlSource fromStream (InputStream inputStream ) {
105
- JaxbLogger . JAXB_LOGGER .trace ( "reading mappings from InputStream" );
106
+ JAXB_LOGGER .trace ( "reading mappings from InputStream" );
106
107
107
108
final Origin origin = new Origin ( SourceType .INPUT_STREAM , null );
108
109
return new InputStreamXmlSource ( origin , inputStream , false );
109
110
}
110
111
111
112
public static XmlSource fromDocument (Document document ) {
112
- JaxbLogger . JAXB_LOGGER .trace ( "reading mappings from DOM" );
113
+ JAXB_LOGGER .trace ( "reading mappings from DOM" );
113
114
final Origin origin = new Origin ( SourceType .DOM , Origin .UNKNOWN_FILE_PATH );
114
115
return new JaxpSourceXmlSource ( origin , new DOMSource ( document ) );
115
116
}
@@ -125,7 +126,7 @@ public static XmlSource fromDocument(Document document) {
125
126
* @param consumer a consumer of the resulting {@linkplain XmlSource XML sources}
126
127
*/
127
128
public static void fromJar (File jar , Consumer <XmlSource > consumer ) {
128
- JaxbLogger . JAXB_LOGGER .tracef ( "Seeking mapping documents in jar file : %s" , jar .getName () );
129
+ JAXB_LOGGER .tracef ( "Seeking mapping documents in jar file: %s" , jar .getName () );
129
130
130
131
final Origin origin = new Origin ( SourceType .JAR , jar .getAbsolutePath () );
131
132
@@ -134,7 +135,7 @@ public static void fromJar(File jar, Consumer<XmlSource> consumer) {
134
135
while ( entries .hasMoreElements () ) {
135
136
final JarEntry jarEntry = entries .nextElement ();
136
137
if ( jarEntry .getName ().endsWith (".hbm.xml" ) ) {
137
- JaxbLogger . JAXB_LOGGER .tracef ( "Found hbm.xml mapping in jar : %s" , jarEntry .getName () );
138
+ JAXB_LOGGER .tracef ( "Found ' hbm.xml' mapping in jar: %s" , jarEntry .getName () );
138
139
consumer .accept ( new JarFileEntryXmlSource ( origin , jarFile , jarEntry ) );
139
140
}
140
141
}
0 commit comments