diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-11-11 22:12:44 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-11-11 22:12:44 +0000 |
commit | bc620256eb9b4dc6a33244b1105e58773358dbe6 (patch) | |
tree | 288e488a376feff93fdfad4f26703549121f6da9 /spss.server/src/at/gv/egovernment/moa/spss/server | |
parent | 4ab6ea1ea67551b11a00613fdc21449f0d9c9c03 (diff) | |
download | moa-id-spss-bc620256eb9b4dc6a33244b1105e58773358dbe6.tar.gz moa-id-spss-bc620256eb9b4dc6a33244b1105e58773358dbe6.tar.bz2 moa-id-spss-bc620256eb9b4dc6a33244b1105e58773358dbe6.zip |
Feature 41 implementiert.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@50 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/server')
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java | 146 | ||||
-rw-r--r-- | spss.server/src/at/gv/egovernment/moa/spss/server/service/AxisHandler.java | 2 |
2 files changed, 114 insertions, 34 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java b/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java index 32c81dc07..6f541ed42 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/invoke/DataObjectFactory.java @@ -37,6 +37,7 @@ import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.common.Content; import at.gv.egovernment.moa.spss.api.common.ContentBinary; +import at.gv.egovernment.moa.spss.api.common.ContentLocRef; import at.gv.egovernment.moa.spss.api.common.ContentXML; import at.gv.egovernment.moa.spss.api.common.MetaInfo; import at.gv.egovernment.moa.spss.api.common.XMLDataObjectAssociation; @@ -54,6 +55,7 @@ import at.gv.egovernment.moa.spss.util.MessageProvider; * locations of the MOA XML request format. * * @author Patrick Peck + * @author Gregor Karlinger * @version $Id$ */ public class DataObjectFactory { @@ -128,6 +130,21 @@ public class DataObjectFactory { contentBytes = StreamUtils.readStream(is); break; } + case Content.LOCREF_CONTENT: + { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + try + { + InputStream is = uriResolver.resolve(locRefURI); + contentBytes = StreamUtils.readStream(is); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3203", new Object[]{reference, locRefURI}, e); + } + break; + } case Content.REFERENCE_CONTENT : { ExternalURIResolver uriResolver = new ExternalURIResolver(); @@ -245,7 +262,9 @@ public class DataObjectFactory { * their reference URI to an <code>InputStream</code> of their respective * content. */ - private static StreamEntityResolver buildSupplementEntityResolver(List supplements) { + private static StreamEntityResolver buildSupplementEntityResolver(List supplements) + throws MOAApplicationException + { Map entities = new HashMap(); Iterator iter; @@ -257,31 +276,52 @@ public class DataObjectFactory { switch (content.getContentType()) { case Content.BINARY_CONTENT : - entities.put(reference, ((ContentBinary) content).getBinaryContent()); - break; + { + entities.put(reference, ((ContentBinary) content).getBinaryContent()); + break; + } + case Content.LOCREF_CONTENT: + { + ExternalURIResolver uriResolver = new ExternalURIResolver(); + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + InputStream contentIS = null; + try + { + contentIS = uriResolver.resolve(locRefURI); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3202", new Object[]{reference, locRefURI}, e); + } + entities.put(reference, contentIS); + break; + } case Content.XML_CONTENT : - // serialize the first element node that is found in the supplement - // and make it available as a stream - NodeList nodes = ((ContentXML) content).getXMLContent(); - int i = 0; - - // find the first element node - while (i < nodes.getLength() - && nodes.item(i).getNodeType() != Node.ELEMENT_NODE) - i++; - - // serialize the node - if (i < nodes.getLength()) { - try { - byte[] serialized = - DOMUtils.serializeNode(nodes.item(i), "UTF-8"); - entities.put(reference, new ByteArrayInputStream(serialized)); - } catch (Exception e) { - // serializing the element failed - just don't put it in the map + { + // serialize the first element node that is found in the supplement + // and make it available as a stream + NodeList nodes = ((ContentXML) content).getXMLContent(); + int i = 0; + + // find the first element node + while (i < nodes.getLength() + && nodes.item(i).getNodeType() != Node.ELEMENT_NODE) + i++; + + // serialize the node + if (i < nodes.getLength()) { + try + { + byte[] serialized = DOMUtils.serializeNode(nodes.item(i), "UTF-8"); + entities.put(reference, new ByteArrayInputStream(serialized)); + } + catch (Exception e) + { + throw new MOAApplicationException("2282", new Object[]{reference}, e); + } } + break; } - - break; } } @@ -336,22 +376,42 @@ public class DataObjectFactory { checkAllowContentAndReference(content, allowContentAndReference); // ok, build the data object; use content first, if available - switch (content.getContentType()) { + switch (content.getContentType()) + { case Content.XML_CONTENT : + { ContentXML contentXml = (ContentXML) content; dataObject = createFromXmlContent(contentXml, xmlAsNodeList); break; + } case Content.BINARY_CONTENT : + { ContentBinary contentBinary = (ContentBinary) content; dataObject = createFromBinaryContent(contentBinary, binaryAsXml, false); break; + } + case Content.LOCREF_CONTENT : + { + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + try + { + dataObject = createFromURIImpl(locRefURI, referenceAsXml); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3201", new Object[]{reference, locRefURI}, e); + } + break; + } case Content.REFERENCE_CONTENT : + { dataObject = createFromURIImpl(reference, referenceAsXml); break; + } } // set URI and reference ID - dataObject.setURI(content.getReference()); + dataObject.setURI(reference); dataObject.setReferenceID(referenceID); return dataObject; @@ -417,21 +477,41 @@ public class DataObjectFactory { String mimeType = metaInfo != null ? metaInfo.getMimeType() : null; DataObjectImpl dataObject = null; - switch (content.getContentType()) { + switch (content.getContentType()) + { case Content.XML_CONTENT : - if (xmlContentAllowed) { + { + if (xmlContentAllowed) + { dataObject = createFromXmlContent((ContentXML) content, true); - } else { + } + else + { throw new MOAApplicationException("2280", null); } break; + } case Content.BINARY_CONTENT : - dataObject = - createFromBinaryContent( - (ContentBinary) content, - false, - binaryContentRepeatable); + { + dataObject = createFromBinaryContent( + (ContentBinary) content, + false, + binaryContentRepeatable); + break; + } + case Content.LOCREF_CONTENT : + { + String locRefURI = ((ContentLocRef) content).getLocationReferenceURI(); + try + { + dataObject = createFromURIImpl(locRefURI, false); + } + catch (MOAApplicationException e) + { + throw new MOAApplicationException("3201", new Object[]{content.getReference(), locRefURI}, e); + } break; + } } dataObject.setURI(content.getReference()); diff --git a/spss.server/src/at/gv/egovernment/moa/spss/server/service/AxisHandler.java b/spss.server/src/at/gv/egovernment/moa/spss/server/service/AxisHandler.java index 19e5aa9fa..64bbb8dbe 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/server/service/AxisHandler.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/server/service/AxisHandler.java @@ -44,7 +44,7 @@ import at.gv.egovernment.moa.spss.util.MessageProvider; public class AxisHandler extends BasicHandler { /** The resource names of the messages to load. */ - private static final String MOA_SPSS_WSDL_RESOURCE_ = "/resources/wsdl/MOA-SPSS-1.1.wsdl"; + private static final String MOA_SPSS_WSDL_RESOURCE_ = "/resources/wsdl/MOA-SPSS-1.2.wsdl"; /** The property name for accessing the HTTP request. */ private static final String REQUEST_PROPERTY = HTTPConstants.MC_HTTP_SERVLETREQUEST; |