/*******************************************************************************
* Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria
* PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
* joint initiative of the Federal Chancellery Austria and Graz University of
* Technology.
*
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
* the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
* http://www.osor.eu/eupl/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*
* This product combines work with different licenses. See the "NOTICE" text
* file for details on the various modules and licenses.
* The "NOTICE" text file is part of the distribution. Any derivative works
* that you distribute must include a readable copy of the "NOTICE" text file.
******************************************************************************/
package at.gv.egiz.pdfas.web.config;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WebConfiguration {
public static final String PUBLIC_URL = "public.url";
public static final String LOCAL_BKU_URL = "bku.local.url";
public static final String ONLINE_BKU_URL = "bku.online.url";
public static final String MOBILE_BKU_URL = "bku.mobile.url";
public static final String ERROR_DETAILS = "error.showdetails";
public static final String PDF_AS_WORK_DIR = "pdfas.dir";
public static final String MOA_SS_ENABLED = "moa.enabled";
public static final String SOAP_SIGN_ENABLED = "soap.sign.enabled";
public static final String SOAP_VERIFY_ENABLED = "soap.verify.enabled";
public static final String RELOAD_PASSWORD = "reload.pwd";
public static final String RELOAD_ENABLED = "reload.enabled";
public static final String KEYSTORE_ENABLED = "ks.enabled";
public static final String KEYSTORE_FILE = "ks.file";
public static final String KEYSTORE_TYPE = "ks.type";
public static final String KEYSTORE_PASS = "ks.pass";
public static final String KEYSTORE_ALIAS = "ks.key.alias";
public static final String KEYSTORE_KEY_PASS = "ks.key.pass";
public static final String WHITELIST_ENABLED = "whitelist.enabled";
public static final String WHITELIST_VALUE_PRE = "whitelist.url.";
public static final String REQUEST_STORE = "request.store";
public static final String REQUEST_STORE_INMEM = "at.gv.egiz.pdfas.web.store.InMemoryRequestStore";
public static final String REQUEST_STORE_DB = "at.gv.egiz.pdfas.web.store.DBRequestStore";
public static final String DB_REQUEST_TIMEOUT = "request.db.timeout";
public static final String HIBERNATE_PREFIX = "hibernate.props.";
private static Properties properties = new Properties();
private static Properties hibernateProps = new Properties();
private static final Logger logger = LoggerFactory
.getLogger(WebConfiguration.class);
private static List whiteListregEx = new ArrayList();
public static void configure(String config) {
properties.clear();
whiteListregEx.clear();
try {
properties.load(new FileInputStream(config));
} catch (Exception e) {
logger.error("Failed to load configuration: " + e.getMessage());
throw new RuntimeException(e);
}
if (isWhiteListEnabled()) {
Iterator