diff options
Diffstat (limited to 'common')
5 files changed, 191 insertions, 146 deletions
diff --git a/common/pom.xml b/common/pom.xml index 468ecaf2d..46f26501f 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -1,94 +1,148 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>MOA</groupId> - <artifactId>MOA</artifactId> - <version>2.0.0</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>moa-common</artifactId> - <!-- <version>2.0.0</version> --> - <packaging>jar</packaging> - <name>MOA common library</name> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <groupId>MOA</groupId> + <artifactId>MOA</artifactId> + <version>2.0.0</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>moa-common</artifactId> + <!-- <version>2.0.0</version> --> + <packaging>jar</packaging> + <name>MOA common library</name> - <properties> - <repositoryPath>${basedir}/../repository</repositoryPath> - </properties> + <properties> + <repositoryPath>${basedir}/../repository</repositoryPath> + </properties> + + <dependencies> + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + </dependency> + <dependency> + <groupId>iaik.prod</groupId> + <artifactId>iaik_jce_full</artifactId> + </dependency> + <dependency> + <groupId>iaik.prod</groupId> + <artifactId>iaik_moa</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>jaxen</groupId> + <artifactId>jaxen</artifactId> + </dependency> + <dependency> + <groupId>saxpath</groupId> + <artifactId>saxpath</artifactId> + </dependency> + <dependency> + <groupId>xalan-bin-dist</groupId> + <artifactId>xalan</artifactId> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>xalan-bin-dist</groupId> + <artifactId>xml-apis</artifactId> + <scope>compile</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>xalan-bin-dist</groupId> + <artifactId>serializer</artifactId> + <scope>runtime</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <version>1.6.2</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.5</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>1.7.5</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>1.7.5</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>log4j-over-slf4j</artifactId> + <version>1.7.5</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jul-to-slf4j</artifactId> + <version>1.7.5</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <addMavenDescriptor>false</addMavenDescriptor> + </archive> + </configuration> + <executions> + <execution> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-enforcer-plugin</artifactId> + <version>1.1.1</version> + <executions> + <execution> + <id>enforce-banned-dependencies</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <bannedDependencies> + <searchTransitive>true</searchTransitive> + <excludes> + <!-- <exclude>commons-logging</exclude> --> + <exclude>org.slf4j:1.5*</exclude> + <exclude>org.slf4j:1.6*</exclude> + <!-- <exclude>org.springframework:2.*</exclude> + <exclude>org.springframework:3.0.*</exclude> --> + </excludes> + </bannedDependencies> + </rules> + <fail>true</fail> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> - <dependencies> - <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - </dependency> - <dependency> - <groupId>iaik.prod</groupId> - <artifactId>iaik_jce_full</artifactId> - </dependency> - <dependency> - <groupId>iaik.prod</groupId> - <artifactId>iaik_moa</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>jaxen</groupId> - <artifactId>jaxen</artifactId> - </dependency> - <dependency> - <groupId>saxpath</groupId> - <artifactId>saxpath</artifactId> - </dependency> - <dependency> - <groupId>xalan-bin-dist</groupId> - <artifactId>xalan</artifactId> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>xerces</groupId> - <artifactId>xercesImpl</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>xalan-bin-dist</groupId> - <artifactId>xml-apis</artifactId> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>xalan-bin-dist</groupId> - <artifactId>serializer</artifactId> - <scope>runtime</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>1.6.2</version> - </dependency> - - </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <addMavenDescriptor>false</addMavenDescriptor> - </archive> - </configuration> - <executions> - <execution> - <goals> - <goal>test-jar</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> </project> diff --git a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java index 07f9e27af..2e76325a5 100644 --- a/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java +++ b/common/src/main/java/at/gv/egovernment/moa/logging/Logger.java @@ -24,9 +24,6 @@ package at.gv.egovernment.moa.logging; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - /** * A utility class acting as a facade to the logging subsystem. * @@ -39,35 +36,13 @@ import org.apache.commons.logging.LogFactory; */ public class Logger { - /** The default logging hierarchy. */ - private static String defaultHierarchy = ""; - - /** - * Get the <code>Log</code> object for the default hierarchy. - * - * @return The <code>Log</code> object to write log messages to. - */ - private static Log getLog() { - return LogFactory.getLog(defaultHierarchy); - } - - /** - * Get the <code>Log</code> object for a given hierarchy. - * - * @param hierarchy The logging hierarchy for which to return the logger. - * @return The <code>Log</code> object to write log messages to. - */ - private static Log getLog(String hierarchy) { - return LogFactory.getLog(hierarchy); - } - /** * Set the default hierarchy to which the <code>Logger</code> should send its * logging output. * @param hierarchy The logging defaultHierarchy. */ public static void setHierarchy(String hierarchy) { - defaultHierarchy = hierarchy; + // there is no need for that anymore } /** @@ -77,7 +52,8 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isTraceEnabled() { - return getLog().isTraceEnabled(); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + return logger.isTraceEnabled(); } /** @@ -88,7 +64,8 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isTraceEnabled(String hierarchy) { - return getLog(hierarchy).isTraceEnabled(); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + return logger.isTraceEnabled(); } /** @@ -97,7 +74,8 @@ public class Logger { * @param message The message to trace. */ public static void trace(Object message) { - getLog().trace(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.trace(message); } /** @@ -107,7 +85,8 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isDebugEnabled() { - return getLog().isDebugEnabled(); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + return logger.isDebugEnabled(); } /** @@ -118,7 +97,8 @@ public class Logger { * <code>false</code> otherwise. */ public static boolean isDebugEnabled(String hierarchy) { - return getLog(hierarchy).isDebugEnabled(); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + return logger.isDebugEnabled(); } /** @@ -127,7 +107,8 @@ public class Logger { * @param message The message to log. */ public static void debug(Object message) { - getLog().debug(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.debug(message); } /** @@ -136,7 +117,8 @@ public class Logger { * @param message The message to log. */ public static void info(Object message) { - getLog().info(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.info(message); } /** @@ -145,7 +127,8 @@ public class Logger { * @param message The message to log. */ public static void warn(Object message) { - getLog().warn(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.warn(message); } /** @@ -155,7 +138,8 @@ public class Logger { * @param t An exception that may be the cause of the warning. */ public static void warn(Object message, Throwable t) { - getLog().warn(message, t); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.warn(message, t); } /** @@ -164,7 +148,8 @@ public class Logger { * @param message The message to log. */ public static void error(Object message) { - getLog().error(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.error(message); } /** @@ -174,7 +159,8 @@ public class Logger { * @param t An exception that may be the cause of the error. */ public static void error(Object message, Throwable t) { - getLog().error(message, t); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.error(message, t); } /** @@ -183,7 +169,8 @@ public class Logger { * @param message The message to log. */ public static void fatal(Object message) { - getLog().fatal(message); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.fatal(message); } /** @@ -193,7 +180,7 @@ public class Logger { * @param t An exception that may be the cause of the error. */ public static void fatal(Object message, Throwable t) { - getLog().fatal(message, t); + org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Thread.currentThread().getStackTrace()[2].getClassName()); + logger.fatal(message, t); } - } diff --git a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java index 213eb6242..ed75768ba 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/Constants.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/Constants.java @@ -429,7 +429,10 @@ public interface Constants { /** URN prefix for context dependent id (wbPK). */ public static final String URN_PREFIX_WBPK = URN_PREFIX + ":wbpk"; - + + /** URN prefix for context dependent id (stork). */ + public static final String URN_PREFIX_STORK = URN_PREFIX + ":storkid"; + /** URN prefix for context dependent id. */ public static final String URN_PREFIX_BASEID = URN_PREFIX + ":baseid"; diff --git a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java index cac179a75..ff22c7313 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/FileUtils.java @@ -133,7 +133,8 @@ public class FileUtils { keyFile = new File(url); if (!keyFile.isAbsolute()) { keyFile = new File(root, url); - newURL = keyFile.getPath(); + newURL = keyFile.toURI().toString(); + } return newURL; } diff --git a/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java b/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java index 043baea0e..c2f2c9f47 100644 --- a/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java +++ b/common/src/main/java/at/gv/egovernment/moa/util/MiscUtil.java @@ -143,20 +143,20 @@ public class MiscUtil { return out.toByteArray(); } - public static Document parseDocument(InputStream inputStream) - throws IOException { - try { - DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory - .newInstance(); - docBuilderFactory.setNamespaceAware(true); - DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); - return docBuilder.parse(inputStream); - } catch (ParserConfigurationException e) { - throw new IOException(e); - } catch (SAXException e) { - throw new IOException(e); - } - } +// public static Document parseDocument(InputStream inputStream) +// throws IOException { +// try { +// DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory +// .newInstance(); +// docBuilderFactory.setNamespaceAware(true); +// DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); +// return docBuilder.parse(inputStream); +// } catch (ParserConfigurationException e) { +// throw new IOException(e); +// } catch (SAXException e) { +// throw new IOException(e); +// } +// } public static String removePrecedingSlash(String path, String slash) { assertNotEmpty(slash, "Shash"); |