Skip to content

Commit

Permalink
Fall back to the local oxgarage.properties if there's none at /etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
hcayless committed Jan 18, 2018
1 parent 90bb3bb commit 30693db
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/main/java/pl/psnc/dl/ege/configuration/EGEConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,34 @@

public final class EGEConstants {
public static final Properties oxgProps = new Properties();
String whereami = EGEConstants.class.getProtectionDomain().getCodeSource().getLocation().getPath();
String PATH = whereami.substring(0, whereami.lastIndexOf(File.separator));
static String whereami = EGEConstants.class.getProtectionDomain().getCodeSource().getLocation().getPath();
static String PATH = whereami.substring(0, whereami.lastIndexOf(File.separator));
private final static Logger LOGGER = Logger.getLogger(EGEConfigurationManager.class.getName());

static {
try {
oxgProps.load(new FileInputStream("/etc/oxgarage.properties"));
}
catch (java.io.IOException e) {
LOGGER.error("Could not read file /etc/oxgarage.properties");
}
try {
System.out.println(PATH);
oxgProps.load(new FileInputStream(PATH + File.separator + "oxgarage.properties"));
} catch (java.io.IOException e) {
try {
oxgProps.load(new FileInputStream(PATH + File.separator + "oxgarage.properties"));
} catch (java.io.IOException ex) {
LOGGER.error("Could not read file /etc/oxgarage.properties or " + PATH
+ File.separator + "oxgarage.properties" );
}
}

}


/**
* EGE temporary files directory
*/
public static final String OXGAPP = oxgProps.getProperty("OXGARAGE","/var/cache/oxgarage/");
public static final String TEIROOT = oxgProps.getProperty("TEI","/usr/share/xml/tei/");
public static final String OpenOfficeConfig = oxgProps.getProperty("OpenOfficeConfig","/usr/lib/libreoffice/");
public static final String DEFAULT_LOCALE = oxgProps.getProperty("defaultLocale","en");
public static final String DEFAULT_PROFILE = oxgProps.getProperty("defaultProfile","default");
public static final String OXGAPP = oxgProps.getProperty("OXGARAGE","/var/cache/oxgarage/");
public static final String TEIROOT = oxgProps.getProperty("TEI","/usr/share/xml/tei/");
public static final String OpenOfficeConfig = oxgProps.getProperty("OpenOfficeConfig","/usr/lib/libreoffice/");
public static final String DEFAULT_LOCALE = oxgProps.getProperty("defaultLocale","en");
public static final String DEFAULT_PROFILE = oxgProps.getProperty("defaultProfile","default");
// name for document family consisting of text documents
public static final String TEXTFAMILY = "Documents";
public static final String TEXTFAMILYCODE = "text";
Expand Down

0 comments on commit 30693db

Please sign in to comment.