|
28 | 28 | public class GenerateJfrFiles {
|
29 | 29 |
|
30 | 30 | public static void main(String... args) throws Exception {
|
31 |
| - if (args.length < 3) { |
| 31 | + if (args.length != 3) { |
32 | 32 | System.err.println("Incorrect number of command line arguments.");
|
33 | 33 | System.err.println("Usage:");
|
34 |
| - System.err.println("java GenerateJfrFiles[.java] <path-to-metadata.xsd> <output-directory> <path-to-metadata.xml> [<path-to-metadata.xml> ...]"); |
| 34 | + System.err.println("java GenerateJfrFiles[.java] <path-to-metadata.xml> <path-to-metadata.xsd> <output-directory>"); |
35 | 35 | System.exit(1);
|
36 | 36 | }
|
37 | 37 | try {
|
38 |
| - File metadataSchema = new File(args[0]); |
39 |
| - File outputDirectory = new File(args[1]); |
40 |
| - File[] metadataXml = new File[args.length - 2]; |
41 |
| - for (int i = 2; i < args.length; i++) { |
42 |
| - metadataXml[i - 2] = new File(args[i]); |
43 |
| - } |
44 |
| - Metadata metadata = new Metadata(metadataSchema, metadataXml); |
| 38 | + File metadataXml = new File(args[0]); |
| 39 | + File metadataSchema = new File(args[1]); |
| 40 | + File outputDirectory = new File(args[2]); |
| 41 | + |
| 42 | + Metadata metadata = new Metadata(metadataXml, metadataSchema); |
45 | 43 | metadata.verify();
|
46 | 44 | metadata.wireUpTypes();
|
47 | 45 |
|
@@ -77,14 +75,12 @@ static class TypeElement {
|
77 | 75 | static class Metadata {
|
78 | 76 | final Map<String, TypeElement> types = new LinkedHashMap<>();
|
79 | 77 | final Map<String, XmlType> xmlTypes = new HashMap<>();
|
80 |
| - Metadata(File metadataSchema, File[] metadataXml) throws ParserConfigurationException, SAXException, FileNotFoundException, IOException { |
| 78 | + Metadata(File metadataXml, File metadataSchema) throws ParserConfigurationException, SAXException, FileNotFoundException, IOException { |
81 | 79 | SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
82 | 80 | SAXParserFactory factory = SAXParserFactory.newInstance();
|
83 | 81 | factory.setSchema(schemaFactory.newSchema(metadataSchema));
|
84 | 82 | SAXParser sp = factory.newSAXParser();
|
85 |
| - for (File file : metadataXml) { |
86 |
| - sp.parse(file, new MetadataHandler(this)); |
87 |
| - } |
| 83 | + sp.parse(metadataXml, new MetadataHandler(this)); |
88 | 84 | }
|
89 | 85 |
|
90 | 86 | List<EventElement> getEvents() {
|
|
0 commit comments