From af820473deb1d09c4386696814c93d7f17e2ec5c Mon Sep 17 00:00:00 2001 From: Imran M Yousuf Date: Sun, 20 Sep 2009 16:01:59 +0700 Subject: [PATCH] Fix constant names and singleton accessor method The singleton accessor method was not static despite being singleton, so added static modifier to it. Changed constant names to fix the namespace error and also added new constants for basic types. Signed-off-by: Imran M Yousuf --- .../java/com/smartitengineering/exim/impl/xml/ElementExporter.java | 7 +++++-- .../exim/impl/xml/GenericCollectionElementExporter.java | 6 +++--- .../com/smartitengineering/exim/impl/xml/MapElementExporter.java | 6 +++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/ElementExporter.java b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/ElementExporter.java index a85f58d..5e0b06a 100644 --- a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/ElementExporter.java +++ b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/ElementExporter.java @@ -31,9 +31,12 @@ import javax.xml.transform.sax.TransformerHandler; */ public interface ElementExporter { - public static final String EXIMCOLLECTION = "exim-collection"; - public static final String EXIM_COLLECN_NS = + public static final String EXIM_COLLECTION_NS = "exim-collection"; + public static final String EXIM_COLLECN_URI = "http://www.smartitengineering.com/smart-dao/exim/collections"; + public static final String EXIM_BASIC_TYPES_NS = "exim-basic-types"; + public static final String EXIM_BASIC_TYPES_URI = + "http://www.smartitengineering.com/smart-dao/exim/basic-types"; /** * This operation is resposnsible for exporting XML elements of type it diff --git a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/GenericCollectionElementExporter.java b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/GenericCollectionElementExporter.java index 985458a..c27377c 100644 --- a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/GenericCollectionElementExporter.java +++ b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/GenericCollectionElementExporter.java @@ -47,7 +47,7 @@ public class GenericCollectionElementExporter } } - public ElementExporter getInstance() { + public static ElementExporter getInstance() { return exporter; } @@ -66,7 +66,7 @@ public class GenericCollectionElementExporter } try { AttributesImpl atts = new AttributesImpl(); - handler.startElement(EXIM_COLLECN_NS, EXIMCOLLECTION, type. + handler.startElement(EXIM_COLLECN_URI, EXIM_COLLECTION_NS, type. getSimpleName(), atts); Collection objects; switch (type) { @@ -90,7 +90,7 @@ public class GenericCollectionElementExporter exportElement(associationType, exportObj, handler); handler.endElement("", "", "item"); } - handler.endElement(EXIM_COLLECN_NS, EXIMCOLLECTION, type. + handler.endElement(EXIM_COLLECN_URI, EXIM_COLLECTION_NS, type. getSimpleName()); } catch (Exception ex) { diff --git a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/MapElementExporter.java b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/MapElementExporter.java index 5917db9..933b29f 100644 --- a/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/MapElementExporter.java +++ b/smart-exim/smart-exim-xml-impl/src/main/java/com/smartitengineering/exim/impl/xml/MapElementExporter.java @@ -44,7 +44,7 @@ public class MapElementExporter } } - public ElementExporter getInstance() { + public static ElementExporter getInstance() { return exporter; } @@ -61,7 +61,7 @@ public class MapElementExporter } try { AttributesImpl atts = new AttributesImpl(); - handler.startElement(EXIM_COLLECN_NS, EXIMCOLLECTION, type. + handler.startElement(EXIM_COLLECN_URI, EXIM_COLLECTION_NS, type. getSimpleName(), atts); Map map = (Map) object; Set objects = map.entrySet(); @@ -83,7 +83,7 @@ public class MapElementExporter exportElement(associationType, value, handler); handler.endElement("", "", "value"); } - handler.endElement(EXIM_COLLECN_NS, EXIMCOLLECTION, type. + handler.endElement(EXIM_COLLECN_URI, EXIM_COLLECTION_NS, type. getSimpleName()); } catch (Exception ex) { -- 2.11.4.GIT