From b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 5 May 2010 15:29:01 +0000 Subject: Merged feature branch mocca-1.2.13-id@r724 back to trunk. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@725 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/stal/service/STALService.java | 2 - .../stal/service/translator/STALTranslator.java | 43 ++++++++++++---------- .../service/translator/TranslationException.java | 9 ++++- 3 files changed, 30 insertions(+), 24 deletions(-) (limited to 'STALService/src/main/java/at/gv') diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java index ba4b541e..ae0e77d3 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/STALService.java @@ -3,7 +3,6 @@ package at.gv.egiz.stal.service; import java.net.MalformedURLException; import java.net.URL; -import java.util.logging.Logger; import javax.xml.namespace.QName; import javax.xml.ws.Service; import javax.xml.ws.WebEndpoint; @@ -24,7 +23,6 @@ public class STALService { // private final static URL STALSERVICE_WSDL_LOCATION; - private final static Logger logger = Logger.getLogger(at.gv.egiz.stal.service.STALService.class.getName()); // static { // URL url = null; diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java index 1e6f4133..88a6fa4c 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java @@ -16,6 +16,16 @@ */ package at.gv.egiz.stal.service.translator; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.JAXBElement; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.InfoboxReadResponse; @@ -37,13 +47,6 @@ import at.gv.egiz.stal.service.types.SignRequestType; import at.gv.egiz.stal.service.types.SignResponseType; import at.gv.egiz.stal.service.types.StatusRequestType; import at.gv.egiz.stal.service.types.StatusResponseType; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.xml.bind.JAXBElement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -51,8 +54,8 @@ import org.apache.commons.logging.LogFactory; */ public class STALTranslator { - private static final Log log = LogFactory.getLog(STALTranslator.class); - protected Map handlerMap = new HashMap(); + private final Logger log = LoggerFactory.getLogger(STALTranslator.class); + protected Map, TranslationHandler> handlerMap = new HashMap, TranslationHandler>(); public STALTranslator() { registerTranslationHandler(new DefaultTranslationHandler()); @@ -63,9 +66,9 @@ public class STALTranslator { * @param handler */ public void registerTranslationHandler(TranslationHandler handler) { - for (Class t : handler.getSupportedTypes()) { - if (log.isDebugEnabled()) { - log.debug("register " + t + " with translation handler " + handler.getClass()); + for (Class t : handler.getSupportedTypes()) { + if (log.isTraceEnabled()) { + log.trace("Register {} with translation handler {}.", t, handler.getClass()); } handlerMap.put(t, handler); } @@ -85,7 +88,7 @@ public class STALTranslator { return r; } } - log.error("unknown STAL request type " + request.getClass()); + log.error("Unknown STAL request type {}.", request.getClass()); throw new TranslationException(request.getClass()); } @@ -107,7 +110,7 @@ public class STALTranslator { return stalRequest; } } - log.error("unknown request type " + req.getClass()); + log.error("Unknown request type {}.", req.getClass()); throw new TranslationException(req.getClass()); } @@ -125,7 +128,7 @@ public class STALTranslator { return r; } } - log.error("unknown STAL response type " + response.getClass()); + log.error("Unknown STAL response type {}.", response.getClass()); throw new TranslationException(response.getClass()); } @@ -147,7 +150,7 @@ public class STALTranslator { return stalResponse; } } - log.error("unknown response type " + resp.getClass()); + log.error("Unknown response type {}.", resp.getClass()); throw new TranslationException(resp.getClass()); } @@ -156,7 +159,7 @@ public class STALTranslator { */ public static interface TranslationHandler { - List getSupportedTypes(); + List> getSupportedTypes(); JAXBElement translate(STALRequest request) throws TranslationException; @@ -173,7 +176,7 @@ public class STALTranslator { */ protected static class DefaultTranslationHandler implements TranslationHandler { - private static final Log log = LogFactory.getLog(DefaultTranslationHandler.class); + private final Logger log = LoggerFactory.getLogger(DefaultTranslationHandler.class); private ObjectFactory of; public DefaultTranslationHandler() { @@ -181,8 +184,8 @@ public class STALTranslator { } @Override - public List getSupportedTypes() { - return Arrays.asList(new Class[]{InfoboxReadRequest.class, + public List> getSupportedTypes() { + return Arrays.asList(new Class[]{InfoboxReadRequest.class, SignRequest.class, QuitRequest.class, StatusRequest.class, diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java index fd9da988..5fe3735b 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java +++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java @@ -22,13 +22,18 @@ package at.gv.egiz.stal.service.translator; */ public class TranslationException extends Exception { - private Class unknownClass; + /** + * + */ + private static final long serialVersionUID = 1L; + + private Class unknownClass; /** * Creates a new instance of TranslationException without detail message. * @param unknownClass the class that could not be translated */ - public TranslationException(Class unkownClass) { + public TranslationException(Class unkownClass) { this.unknownClass = unkownClass; } -- cgit v1.2.3