No jira, fixed formating.
diff --git a/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CASImporter.java b/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CASImporter.java
index 55d48cf..145502c 100644
--- a/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CASImporter.java
+++ b/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CASImporter.java
@@ -28,44 +28,42 @@
public class CASImporter {
- public static void main(String[] args) throws Exception {
-
- if (args.length != 2) {
- System.out.println("WikinewsImporter address xmiFileOrFolder");
- System.exit(-1);
- }
-
- Client c = Client.create();
-
- WebResource r = c.resource(args[0]);
-
- File xmiFileOrFolder = new File(args[1]);
-
- File xmiFiles[];
-
- if (xmiFileOrFolder.isFile()) {
- xmiFiles = new File[]{xmiFileOrFolder};
- }
- else {
- xmiFiles = xmiFileOrFolder.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.toLowerCase().endsWith(".xmi");
- }
- });
- }
-
- for (File xmiFile : xmiFiles) {
- byte xmiBytes[] = FileUtil.fileToBytes(xmiFile);
-
- ClientResponse response = r
- .path(xmiFile.getName())
- .accept(MediaType.TEXT_XML)
- // TODO: How to fix this? Shouldn't accept do it?
- .header("Content-Type", MediaType.TEXT_XML)
- .post(ClientResponse.class, xmiBytes);
-
- System.out.println(xmiFile.getName() + " " + response.getStatus());
- }
- }
+ public static void main(String[] args) throws Exception {
+
+ if (args.length != 2) {
+ System.out.println("WikinewsImporter address xmiFileOrFolder");
+ System.exit(-1);
+ }
+
+ Client c = Client.create();
+
+ WebResource r = c.resource(args[0]);
+
+ File xmiFileOrFolder = new File(args[1]);
+
+ File xmiFiles[];
+
+ if (xmiFileOrFolder.isFile()) {
+ xmiFiles = new File[] { xmiFileOrFolder };
+ } else {
+ xmiFiles = xmiFileOrFolder.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.toLowerCase().endsWith(".xmi");
+ }
+ });
+ }
+
+ for (File xmiFile : xmiFiles) {
+ byte xmiBytes[] = FileUtil.fileToBytes(xmiFile);
+
+ ClientResponse response = r.path(xmiFile.getName())
+ .accept(MediaType.TEXT_XML)
+ // TODO: How to fix this? Shouldn't accept do it?
+ .header("Content-Type", MediaType.TEXT_XML)
+ .post(ClientResponse.class, xmiBytes);
+
+ System.out.println(xmiFile.getName() + " " + response.getStatus());
+ }
+ }
}
diff --git a/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CreateCorpus.java b/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CreateCorpus.java
index de17350..45d4f51 100644
--- a/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CreateCorpus.java
+++ b/corpus-server-tools/src/main/java/org/apache/opennlp/corpus_server/tools/CreateCorpus.java
@@ -40,52 +40,54 @@
* Command Line Tool to create a new corpus in the corpus server.
*/
public class CreateCorpus {
- public static void main(String[] args) throws Exception {
-
- if (args.length != 4) {
- System.out.println("CreateCorpus address corpusName typeSystemFile mappingFile");
- System.exit(-1);
- }
-
- String corpusName = args[1];
-
- ClientConfig clientConfig = new DefaultClientConfig();
- clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
-
- Client c = Client.create(clientConfig);
-
- WebResource r = c.resource(args[0]);
-
- byte[][] resources = new byte[2][];
+ public static void main(String[] args) throws Exception {
- // Load and resolve type system before importing it
- InputStream typeSystemIn = new FileInputStream(new File(args[2]));
-
- XMLInputSource xmlTypeSystemSource = new XMLInputSource(typeSystemIn, new File(args[2]));
+ if (args.length != 4) {
+ System.out
+ .println("CreateCorpus address corpusName typeSystemFile mappingFile");
+ System.exit(-1);
+ }
- XMLParser xmlParser = UIMAFramework.getXMLParser();
+ String corpusName = args[1];
- TypeSystemDescription typeSystemDesciptor = (TypeSystemDescription) xmlParser
- .parse(xmlTypeSystemSource);
-
- typeSystemDesciptor.resolveImports();
-
- ByteArrayOutputStream typeSystemBytes = new ByteArrayOutputStream();
- typeSystemDesciptor.toXML(typeSystemBytes);
-
- resources[0] = typeSystemBytes.toByteArray();
-
- byte indexMappingBytes[] = FileUtil.fileToBytes(new File(args[3]));
- resources[1] = indexMappingBytes;
-
- ClientResponse response = r
- .path("_createCorpus")
- .queryParam("corpusName", corpusName)
- .accept(MediaType.APPLICATION_JSON)
- // TODO: How to fix this? Shouldn't accept do it?
- .header("Content-Type", MediaType.APPLICATION_JSON_TYPE)
- .post(ClientResponse.class, resources);
-
- System.out.println("Result: " + response.getStatus());
- }
+ ClientConfig clientConfig = new DefaultClientConfig();
+ clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
+ Boolean.TRUE);
+
+ Client c = Client.create(clientConfig);
+
+ WebResource r = c.resource(args[0]);
+
+ byte[][] resources = new byte[2][];
+
+ // Load and resolve type system before importing it
+ InputStream typeSystemIn = new FileInputStream(new File(args[2]));
+
+ XMLInputSource xmlTypeSystemSource = new XMLInputSource(typeSystemIn,
+ new File(args[2]));
+
+ XMLParser xmlParser = UIMAFramework.getXMLParser();
+
+ TypeSystemDescription typeSystemDesciptor = (TypeSystemDescription) xmlParser
+ .parse(xmlTypeSystemSource);
+
+ typeSystemDesciptor.resolveImports();
+
+ ByteArrayOutputStream typeSystemBytes = new ByteArrayOutputStream();
+ typeSystemDesciptor.toXML(typeSystemBytes);
+
+ resources[0] = typeSystemBytes.toByteArray();
+
+ byte indexMappingBytes[] = FileUtil.fileToBytes(new File(args[3]));
+ resources[1] = indexMappingBytes;
+
+ ClientResponse response = r.path("_createCorpus")
+ .queryParam("corpusName", corpusName)
+ .accept(MediaType.APPLICATION_JSON)
+ // TODO: How to fix this? Shouldn't accept do it?
+ .header("Content-Type", MediaType.APPLICATION_JSON_TYPE)
+ .post(ClientResponse.class, resources);
+
+ System.out.println("Result: " + response.getStatus());
+ }
}