aboutsummaryrefslogtreecommitdiff
path: root/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java')
-rw-r--r--spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java130
1 files changed, 130 insertions, 0 deletions
diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
new file mode 100644
index 000000000..61dd423b3
--- /dev/null
+++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/init/SystemInitializer.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2003 Federal Chancellery Austria
+ * MOA-SPSS has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, 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.egovernment.moa.spss.server.init;
+
+import java.io.IOException;
+
+import iaik.ixsil.init.IXSILInit;
+
+import at.gv.egovernment.moa.logging.LogMsg;
+import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.logging.LoggingContext;
+import at.gv.egovernment.moa.logging.LoggingContextManager;
+import at.gv.egovernment.moa.util.Constants;
+import at.gv.egovernment.moa.util.DOMUtils;
+
+import at.gv.egovernment.moa.spss.MOAException;
+import at.gv.egovernment.moa.spss.server.config.ConfigurationProvider;
+import at.gv.egovernment.moa.spss.server.iaik.config.IaikConfigurator;
+import at.gv.egovernment.moa.spss.server.logging.IaikLog;
+import at.gv.egovernment.moa.spss.server.service.RevocationArchiveCleaner;
+import at.gv.egovernment.moa.spss.util.MessageProvider;
+
+/**
+ * MOA SP/SS web service initialization.
+ *
+ * @author Patrick Peck
+ * @version $Id$
+ */
+public class SystemInitializer {
+ /** Interval between archive cleanups in seconds */
+ private static final long ARCHIVE_CLEANUP_INTERVAL = 60 * 60; // 1h
+ /** The MOA SP/SS logging hierarchy. */
+ private static final String LOGGING_HIERARCHY = "moa.spss.server";
+ /** Whether XML schema grammars have been initialized. */
+ private static boolean grammarsInitialized = false;
+
+ /**
+ * Initialize the MOA SP/SS webservice.
+ */
+ public static void init() {
+ MessageProvider msg = MessageProvider.getInstance();
+
+ Thread archiveCleaner;
+
+ // set up the MOA SPSS logging hierarchy
+ Logger.setHierarchy(LOGGING_HIERARCHY);
+
+ // set up a logging context for logging the startup
+ LoggingContextManager.getInstance().setLoggingContext(
+ new LoggingContext("startup"));
+
+// AxisProperties.setProperty("enableNamespacePrefixOptimization","false");
+// AxisProperties.setProperty("disablePrettyXML", "true");
+// AxisProperties.setProperty("axis.doAutoTypes", "true");
+
+ // initialize preparsed Xerces grammar pool for faster XML
+ // parsing/validating
+ try {
+ if (!grammarsInitialized) {
+ Class clazz = SystemInitializer.class;
+ // preparse XML schema
+ DOMUtils.addSchemaToPool(
+ clazz.getResourceAsStream(Constants.XML_SCHEMA_LOCATION),
+ Constants.XML_NS_URI);
+ // preparse XMLDsig Filter2 schema
+ DOMUtils.addSchemaToPool(
+ clazz.getResourceAsStream(Constants.DSIG_FILTER2_SCHEMA_LOCATION),
+ Constants.DSIG_FILTER2_NS_URI);
+ // preparse XMLDsig schema
+ DOMUtils.addSchemaToPool(
+ clazz.getResourceAsStream(Constants.DSIG_SCHEMA_LOCATION),
+ Constants.DSIG_NS_URI);
+ // preparse MOA schema
+ DOMUtils.addSchemaToPool(
+ clazz.getResourceAsStream(Constants.MOA_SCHEMA_LOCATION),
+ Constants.MOA_NS_URI);
+ grammarsInitialized = true;
+ }
+ } catch (IOException e) {
+ Logger.warn(new LogMsg(msg.getMessage("init.04", null)), e);
+ }
+
+ // initialize configuration
+ try {
+ ConfigurationProvider config = ConfigurationProvider.getInstance();
+ new IaikConfigurator().configure(config);
+ Logger.info(new LogMsg(msg.getMessage("init.01", null)));
+ } catch (MOAException e) {
+ Logger.fatal(new LogMsg(msg.getMessage("init.00", null)), e);
+ }
+
+ // set IXSIL debug output
+ IXSILInit.setPrintDebugLog(
+ Logger.isDebugEnabled(IaikLog.IAIK_LOG_HIERARCHY));
+
+ // start the archive cleanup thread
+ archiveCleaner =
+ new Thread(new RevocationArchiveCleaner(ARCHIVE_CLEANUP_INTERVAL));
+ archiveCleaner.setName("RevocationArchiveCleaner");
+ archiveCleaner.setDaemon(true);
+ archiveCleaner.setPriority(Thread.MIN_PRIORITY);
+ archiveCleaner.start();
+
+ // unset the startup logging context
+ LoggingContextManager.getInstance().setLoggingContext(null);
+ }
+
+}