globallified directory constants
This commit is contained in:
parent
e61311a48a
commit
8b6e2a4094
4 changed files with 15 additions and 5 deletions
|
@ -22,6 +22,12 @@ public class Main {
|
|||
private static final FileObjectFactory xmlFactory = FileObjectFactory.getFactory();
|
||||
private static final MongoObjectFactory mongoFactory = MongoObjectFactory.getFactory();
|
||||
|
||||
public static final String CONFIG_DIR = "src/main/resources/config";
|
||||
public static final String JAVALIN_TEMPLATE_DIR = "src/main/resources/templates";
|
||||
public static final String JAVALIN_STATIC_FILES_DIR = "src/main/resources/public";
|
||||
public static final String JCAS_SPEECHES_TYPESYSTEM_DIR = "src/main/resources/speeches/TypeSystem";
|
||||
public static final String MEMBER_IMAGES_DIR = "src/main/resources/membersOfParliamentImages/";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
UPLOAD_MEMBER_PHOTOS = Arrays.asList(args).contains("uploadMemberPhotos");
|
||||
FORCE_UPLOAD_MEMBERS = Arrays.asList(args).contains("forceUploadMembers");
|
||||
|
|
|
@ -30,12 +30,12 @@ import java.util.*;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.mongodb.client.model.Filters.eq;
|
||||
import static org.texttechnologylab.project.gruppe_05_1.Main.MEMBER_IMAGES_DIR;
|
||||
|
||||
public class MongoDBHandler {
|
||||
|
||||
public static final String propertiesFileName = "mongoDB.properties";
|
||||
public static final String DEFAULT_ID_FIELD_NAME = "_id";
|
||||
public static final String MEMBER_IMAGES_DIR = "src/main/resources/membersOfParliamentImages/";
|
||||
private final MongoClient mongoClient;
|
||||
private final MongoDatabase database;
|
||||
private static MongoDatabase mongoDatabase = null;
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.texttechnologylab.project.gruppe_05_1.database.MongoDBHandler;
|
|||
import org.hucompute.textimager.uima.type.category.CategoryCoveredTagged;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
|
||||
import static org.texttechnologylab.project.gruppe_05_1.Main.JCAS_SPEECHES_TYPESYSTEM_DIR;
|
||||
|
||||
|
||||
public class XmiExtractor {
|
||||
|
||||
|
@ -65,7 +67,7 @@ public class XmiExtractor {
|
|||
private void processXmiGzStream(InputStream inputStream, String filename) {
|
||||
JCas jCas = null;
|
||||
try (GZIPInputStream gis = new GZIPInputStream(inputStream)) {
|
||||
jCas = JCasFactory.createJCas("src/main/resources/speeches/TypeSystem");
|
||||
jCas = JCasFactory.createJCas(JCAS_SPEECHES_TYPESYSTEM_DIR);
|
||||
XmiCasDeserializer.deserialize(gis, jCas.getCas(), true);
|
||||
|
||||
// Build structured analysisResults Document
|
||||
|
|
|
@ -12,8 +12,10 @@ import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.texttechnologylab.project.gruppe_05_1.Main.JAVALIN_STATIC_FILES_DIR;
|
||||
import static org.texttechnologylab.project.gruppe_05_1.Main.JAVALIN_TEMPLATE_DIR;
|
||||
|
||||
public class RESTHandler {
|
||||
public static final String TEMPLATE_DIR = "src/main/java/org/texttechnologylab/project/gruppe_05_1/website/templates";
|
||||
|
||||
public void startJavalin() {
|
||||
|
||||
|
@ -25,7 +27,7 @@ public class RESTHandler {
|
|||
Configuration fmConfig = new Configuration(Configuration.VERSION_2_3_33);
|
||||
fmConfig.setDefaultEncoding("UTF-8");
|
||||
try {
|
||||
fmConfig.setDirectoryForTemplateLoading(new File(TEMPLATE_DIR));
|
||||
fmConfig.setDirectoryForTemplateLoading(new File(JAVALIN_TEMPLATE_DIR));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ public class RESTHandler {
|
|||
|
||||
// Erzeuge die Javalin app
|
||||
Javalin app = Javalin.create(config -> {
|
||||
config.staticFiles.add("src/main/resources/public", Location.EXTERNAL); // momentan nicht benutzt
|
||||
config.staticFiles.add(JAVALIN_STATIC_FILES_DIR, Location.EXTERNAL); // momentan nicht benutzt
|
||||
|
||||
config.fileRenderer(new JavalinFreemarker(fmConfig));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue