diff options
author | pdanner <pdanner@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2007-09-05 10:19:19 +0000 |
---|---|---|
committer | pdanner <pdanner@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2007-09-05 10:19:19 +0000 |
commit | ef61e7c9b4591f65ebe9abf6afad51999136e41c (patch) | |
tree | 9685b0eafa4f3793f02c96c2999fa1603fbc9e85 /erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init | |
parent | 15ff0aeee18b4f7774d65b3b6b4fdba04996efe9 (diff) | |
download | moa-id-spss-ef61e7c9b4591f65ebe9abf6afad51999136e41c.tar.gz moa-id-spss-ef61e7c9b4591f65ebe9abf6afad51999136e41c.tar.bz2 moa-id-spss-ef61e7c9b4591f65ebe9abf6afad51999136e41c.zip |
removed obsolete files
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@992 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init')
4 files changed, 0 insertions, 389 deletions
diff --git a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/Constants.java b/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/Constants.java deleted file mode 100644 index a9cfdac62..000000000 --- a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/Constants.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Created on 18.11.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package at.gv.egovernment.moa.ss.erechtclient.init; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) - */ -public class Constants -{ - // System properties - public static final String INIT_PROPS_LOC_ = - "at.gv.egovernment.moa.ss.erechtclient.PropertiesLocation"; - - // Init properties - - // TODO Revisit if constants can be removed - public static final String IP_WEBAPP_HOST_PORT_ = "location.webAppHostPort"; - public static final String IP_WEBAPP_HOST_PORT_FROM_MOA_SS_ = "location.webAppHostPortFromMOASS"; - - public static final String IP_MOA_SCHEMA_ = "location.schema.moa"; - public static final String IP_SS_REQUEST_TEMPLATE_ = "location.ss.requestTemplate"; - - public static final String IP_TEMP_DIR_ = "location.tempdir"; - public static final String IP_SS_STYLESHEET_ = "location.ss.stylesheet"; - - public static final String IP_SS_ENDPOINT_ = "service.ss.endpoint"; - public static final String IP_SS_KEYID_ = "service.ss.keyIdentifier"; - - // Logging hierarchies - - public static final String LH_BASE_ = "erechtclient"; - public static final String LH_INIT_ = LH_BASE_ + ".init"; - public static final String LH_XMLPARSER_ = LH_BASE_ + ".xmlparser"; - public static final String LH_SERVLETS_ = LH_BASE_ + ".servlets"; - public static final String LH_BEANS_ = LH_BASE_ + ".beans"; - public static final String LH_MOAINVOKER_ = LH_BASE_ + ".moainvoker"; - - // Web service context parameters - - public static final String WSCP_INIT_PROPS_ = "initProperties"; - public static final String WSCP_INITPROPS_BEAN_ = "initPropertiesBean"; - public static final String WSCP_XMLPARSER_ = "xmlParser"; - - // Session parameters - - public static final String SCP_XMLBGBL_FNAME_ = "xMLBGBl"; - public static final String SCP_STYLESHEET_FNAME_ = "stylesheet"; - public static final String SCP_IMAGE_NAMES_LIST_ = "imageNames"; - public static final String SCP_IMAGES_LIST_ = "images"; - public static final String SCP_SIGNATURE_URL_ = "signatureURL"; - - // Reqeust context parameters - - public static final String RCP_ERROR_THROWABLE_ = "throwable"; - - // Namespace URIs - - public static final String NSURI_MOA_13_ = "http://reference.e-government.gv.at/namespace/moa/20020822#"; - public static final String NSURI_NAMESPACES_ = "http://www.w3.org/2000/xmlns/"; - public static final String NSURI_XML_ = "http://www.w3.org/XML/1998/namespace"; - public static final String NSURI_DSIG_ = "http://www.w3.org/2000/09/xmldsig#"; - public static final String NSURI_XMLBGBL_ = "http://www.bka.gv.at"; - - // Namespace prefixes - - public static final String NSPRE_MOA_13_ = "moa"; - public static final String NSPRE_DSIG_ = "dsig"; - public static final String NSPRE_XMLBGBL_ = "bka"; - - // Local XML element's names - - public static final String XML_LN_XMLBGBL_ROOT_ = "erechtdok"; - public static final String XML_LN_XMLBGBL_IMG_ = "binary"; - public static final String XML_LN_XMLBGBL_IMG_SRC_ = "src"; - public static final String XML_LN_XMLBGBL_IMG_REF_ = "ref"; - - // MOA invoker constants - - public static final String MI_SS_QNAME_ = "SignatureCreation"; - - // Default values - - public static final String DV_WEBAPP_HOST_PATH_ = "http://localhost:8080"; - - // HTML form parameter names - - public static final String FPN_UPLOAD_XML_XMLBGBL_ = "xMLBGBl"; - public static final String FPN_UPLOAD_STYLESHEET_ = "stylesheet"; - public static final String FPN_UPLOAD_IMG_IMG_ = "image."; - - // JSP page names - - public static final String JSPPN_ERROR_ = "pages/Error.jsp"; - public static final String JSPPN_UPLOAD_XML_ = "pages/UploadXML.jsp"; - public static final String JSPPN_UPLOAD_IMG_ = "pages/UploadImages.jsp"; - public static final String JSPPN_DOWNLOAD_SIG_ = "pages/DownloadSignature.jsp"; - - // Servlet url names - public static final String SRVN_UPLOAD_XML_ = "/UploadXML"; - public static final String SRVN_UPLOAD_IMG_ = "/UploadImages"; -} diff --git a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/ContextListener.java b/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/ContextListener.java deleted file mode 100644 index 6cc5988ac..000000000 --- a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/ContextListener.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * (c) Siemens Business Services GmbH - */ -package at.gv.egovernment.moa.ss.erechtclient.init; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.apache.log4j.Logger; -import org.apache.xerces.parsers.DOMParser; -import org.apache.xerces.parsers.XMLGrammarPreparser; -import org.apache.xerces.util.SymbolTable; -import org.apache.xerces.util.XMLGrammarPoolImpl; -import org.apache.xerces.xni.grammars.XMLGrammarDescription; -import org.apache.xerces.xni.grammars.XMLGrammarPool; -import org.apache.xerces.xni.parser.XMLInputSource; -import org.xml.sax.SAXException; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@siemens.com) - */ -public class ContextListener implements ServletContextListener -{ - private static final String SAX_NAMESPACES_FEATURE = "http://xml.org/sax/features/namespaces"; - private static final String SAX_VALIDATION_FEATURE = "http://xml.org/sax/features/validation"; - - private static final String XERCES_SCHEMA_VALIDATION_FEATURE = - "http://apache.org/xml/features/validation/schema"; - private static final String XERCES_NORMALIZED_VALUE_FEATURE = - "http://apache.org/xml/features/validation/schema/normalized-value"; - private static final String XERCES_INCLUDE_IGNORABLE_WHITESPACE_FEATURE = - "http://apache.org/xml/features/dom/include-ignorable-whitespace"; - private static final String XERCES_CREATE_ENTITY_REF_NODES_FEATURE = - "http://apache.org/xml/features/dom/create-entity-ref-nodes"; - protected static final String XERCES_DEFER_NODE_EXPANSION_ = - "http://apache.org/xml/features/dom/defer-node-expansion"; - protected static final String XERCES_AUGMENT_PSI_ = - "http://apache.org/xml/features/validation/schema/augment-psvi"; - - private static final int BIG_PRIME = 2039; - - private static Logger logger_ = Logger.getLogger(Constants.LH_INIT_); - - /* ---------------------------------------------------------------------------------------------------- */ - - /** - * Initializes the web application. - * - * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent) - */ - public void contextInitialized(ServletContextEvent event) - { - logger_.debug("Context is being initialized."); - - ServletContext context = event.getServletContext(); - - String initPropsLoc = System.getProperty(Constants.INIT_PROPS_LOC_); - if (initPropsLoc == null) - { - logger_.fatal("System property \"" + Constants.INIT_PROPS_LOC_ + "\" not set."); - logger_.fatal("Web application initialization failed."); - return; - } - - // Load init properties - try - { - logger_.debug("Init properties location \"" + initPropsLoc + "\" will be used."); - - // Try to interpret init properties location as relative to the web application root - InputStream initPropsIS = context.getResourceAsStream(initPropsLoc); - - if (initPropsIS == null) - { - // If this does not work, try to interpret init properties location as an absolute file system path - initPropsIS = new FileInputStream(initPropsLoc); - } - - Properties initProps = new Properties(); - initProps.load(initPropsIS); - context.setAttribute(Constants.WSCP_INIT_PROPS_, initProps); - - // Prepare application bean knowing about init properties - InitPropertiesBean initPropsBean = new InitPropertiesBean(initProps); - context.setAttribute(Constants.WSCP_INITPROPS_BEAN_, initPropsBean); - } - catch (IOException e) - { - logger_.fatal("Cannot load initialization properties from location \"" + initPropsLoc + "\".", e); - logger_.fatal("Web application initialization failed."); - return; - } - - // Initialize XML parser - SymbolTable symbolTable = new SymbolTable(BIG_PRIME); - XMLGrammarPool grammarPool = new XMLGrammarPoolImpl(); - - XMLGrammarPreparser preparser = new XMLGrammarPreparser(symbolTable); - preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null); - preparser.setProperty(org.apache.xerces.impl.Constants.XERCES_PROPERTY_PREFIX - + org.apache.xerces.impl.Constants.XMLGRAMMAR_POOL_PROPERTY, grammarPool); - preparser.setFeature(SAX_NAMESPACES_FEATURE, true); - preparser.setFeature(SAX_VALIDATION_FEATURE, true); - - // Schema for MOA 1.3 - // TODO Maybe remove this? - Properties initProps = (Properties) context.getAttribute(Constants.WSCP_INIT_PROPS_); - String moaSchemaLoc = initProps.getProperty(Constants.IP_MOA_SCHEMA_); - if (!preparseSchema(context, preparser, moaSchemaLoc)) - { - logger_.fatal("Web application initialization failed."); - return; - } - - // TODO parser is not threadsafe - DOMParser xmlParser = new DOMParser(symbolTable, grammarPool); - try - { - xmlParser.setFeature(SAX_NAMESPACES_FEATURE, true); - xmlParser.setFeature(SAX_VALIDATION_FEATURE, true); - xmlParser.setFeature(XERCES_SCHEMA_VALIDATION_FEATURE, true); - xmlParser.setFeature(XERCES_NORMALIZED_VALUE_FEATURE, false); - xmlParser.setFeature(XERCES_INCLUDE_IGNORABLE_WHITESPACE_FEATURE, true); - xmlParser.setFeature(XERCES_CREATE_ENTITY_REF_NODES_FEATURE, false); - xmlParser.setFeature(XERCES_DEFER_NODE_EXPANSION_, true); - xmlParser.setFeature(XERCES_AUGMENT_PSI_, false); - xmlParser.setErrorHandler(new XMLParserErrorHandler(false, true, true)); - } - catch (SAXException e) - { - String message = "Initialization of XML parser failed."; - logger_.fatal(message, e); - logger_.fatal("Web application initialization failed."); - return; - } - context.setAttribute(Constants.WSCP_XMLPARSER_, xmlParser); - - String message = "Web application initialization succeeded."; - logger_.info(message); - } - - /* ---------------------------------------------------------------------------------------------------- */ - - /** - * Does some clean up at finalization of the web application. - * - * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent) - */ - public void contextDestroyed(ServletContextEvent event) - { - // Remove init properties from web service context - Properties initProps = (Properties) event.getServletContext().getAttribute(Constants.WSCP_INIT_PROPS_); - if (initProps != null) event.getServletContext().removeAttribute(Constants.WSCP_INIT_PROPS_); - } - - /* ---------------------------------------------------------------------------------------------------- */ - - private boolean preparseSchema(ServletContext context, XMLGrammarPreparser preparser, String schemaLoc) - { - InputStream schemaIS = context.getResourceAsStream(schemaLoc); - if (schemaIS == null) - { - String message = "Cannot load schema from location \"" + schemaLoc + "\"."; - logger_.fatal(message); - return false; - } - try - { - String schemaSystemId = context.getResource(schemaLoc).toExternalForm(); - preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, - new XMLInputSource(null, schemaSystemId, null, schemaIS, null)); - } - catch (Exception e) - { - String message = "Parsing schema loaded from location \"" + schemaLoc + "\" failed."; - logger_.fatal(message, e); - return false; - } - return true; - } -} diff --git a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/InitPropertiesBean.java b/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/InitPropertiesBean.java deleted file mode 100644 index 7b7e1eb11..000000000 --- a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/InitPropertiesBean.java +++ /dev/null @@ -1,33 +0,0 @@ -package at.gv.egovernment.moa.ss.erechtclient.init; - -import java.util.Properties; - -import org.apache.log4j.Logger; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@siemens.com) - */ -public class InitPropertiesBean -{ - private Properties initProps_; - - private static Logger logger_ = Logger.getLogger(Constants.LH_BEANS_); - - public InitPropertiesBean(Properties props) - { - initProps_ = props; - } - - public String getWebAppHostPort() - { - String webAppHostPort = initProps_.getProperty(Constants.IP_WEBAPP_HOST_PORT_); - logger_.debug("MOA SS E-Recht Client web application host/port: " + webAppHostPort); - if (webAppHostPort == null || webAppHostPort.trim().length() == 0) - { - String defaultWebAppHostPath = Constants.DV_WEBAPP_HOST_PATH_; - logger_.info("MOA SS E-Recht Client web application host/port property not available, using default (" + defaultWebAppHostPath + ")"); - return defaultWebAppHostPath; - } - else return webAppHostPort; - } -} diff --git a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/XMLParserErrorHandler.java b/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/XMLParserErrorHandler.java deleted file mode 100644 index a954d35d9..000000000 --- a/erecht.client.ss/src/at/gv/egovernment/moa/ss/erechtclient/init/XMLParserErrorHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Created on 02.12.2003 - * - * (c) Stabsstelle IKT-Strategie des Bundes - */ -package at.gv.egovernment.moa.ss.erechtclient.init; - -import org.apache.log4j.Logger; -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -import at.gv.egovernment.moa.ss.erechtclient.init.Constants; - -/** - * @author Gregor Karlinger (mailto:gregor.karlinger@cio.gv.at) - */ -public class XMLParserErrorHandler implements ErrorHandler -{ - private static Logger logger_ = Logger.getLogger(Constants.LH_XMLPARSER_); - - private boolean reportWarning_, reportError_, reportFatal_; - - /* ---------------------------------------------------------------------------------------------------- */ - - public XMLParserErrorHandler(boolean reportWarning, boolean reportError, boolean reportFatal) - { - reportWarning_ = reportWarning; - reportError_ = reportError; - reportFatal_ = reportFatal; - } - - /* ---------------------------------------------------------------------------------------------------- */ - - /** - * @see org.xml.sax.ErrorHandler#warning(org.xml.sax.SAXParseException) - */ - public void warning(SAXParseException exception) throws SAXException - { - logger_.warn("XML parser reported a warning.", exception); - if (reportWarning_) throw exception; - } - - /* ---------------------------------------------------------------------------------------------------- */ - - /** - * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) - */ - public void error(SAXParseException exception) throws SAXException - { - logger_.error("XML parser reported an error.", exception); - if (reportError_) throw exception; - } - - /* ---------------------------------------------------------------------------------------------------- */ - - /** - * @see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException) - */ - public void fatalError(SAXParseException exception) throws SAXException - { - logger_.error("XML parser reported a fatal error.", exception); - if (reportFatal_) throw exception; - } -} |