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 | |
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')
8 files changed, 220 insertions, 38 deletions
diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java b/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java index 178a45273..dfa8927e1 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/SPSSFactory.java @@ -57,6 +57,7 @@ import at.gv.egovernment.moa.spss.api.xmlverify.VerifyXMLSignatureResponse; * this instance, concrete MOA SP/SS API object can be created. * * @author Patrick Peck + * @author Gregor Karlinger * @version $Id$ */ public abstract class SPSSFactory { @@ -779,6 +780,22 @@ public abstract class SPSSFactory { String referenceURI); /** + * Create a new <code>Content</code> object containing location reference data. + * + * @param locationReferenceURI a URI pointing to the actual remote location of the content. + * + * @param referenceURI An URI identifying the data. May be <code>null</code>. + * + * @return The <code>Content</code> object containing the data. + * + * @pre locationReferenceURI != null + * @post return != null + */ + public abstract Content createContent( + String locationReferenceURI, + String referenceURI); + + /** * Create a new <code>Content</code> object containing XML data. * * @param xmlData The XML data contained in the new <code>Content</code>. diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/common/Content.java b/spss.server/src/at/gv/egovernment/moa/spss/api/common/Content.java index 173e9d395..0777c3d65 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/api/common/Content.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/common/Content.java @@ -5,29 +5,39 @@ package at.gv.egovernment.moa.spss.api.common; * * @author Patrick Peck * @author Stephan Grill + * @author Gregor Karlinger * @version $Id$ */ public interface Content { + /** * Indicates that this object contains a URI reference to some content. */ public static final int REFERENCE_CONTENT = 0; + /** * Indicates that this object contains binary content. */ public static final int BINARY_CONTENT = 1; + /** * Indicates that this object contains XML content. */ public static final int XML_CONTENT = 2; + + /** + * Indicates that this object contains a location reference content. + */ + public static final int LOCREF_CONTENT = 3; /** * Gets the type of content contained in this object. * - * @return The type of content, either <code>BINARY_CONTENT</code> or - * <code>XML_CONTENT</code> + * @return The type of content, one of <code>BINARY_CONTENT</code>, <code>XML_CONTENT</code>, <code> + * REFERENCE_CONTENT</code> or <code>LOCREF_CONTENT</code>. */ public int getContentType(); + /** * Gets the reference to the content data (a URI). * diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java b/spss.server/src/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java new file mode 100644 index 000000000..f640f2b92 --- /dev/null +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java @@ -0,0 +1,17 @@ +package at.gv.egovernment.moa.spss.api.common; + +/** + * Encapsulates location reference content. + * + * @author Gregor Karlinger + * @version $Id$ + */ +public interface ContentLocRef extends Content +{ + /** + * Gets the location reference URI pointing to the actual remote location of the content. + * + * @return the location reference URI. + */ + public String getLocationReferenceURI(); +} diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java b/spss.server/src/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java new file mode 100644 index 000000000..902f7bd72 --- /dev/null +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java @@ -0,0 +1,44 @@ +package at.gv.egovernment.moa.spss.api.impl; + +import at.gv.egovernment.moa.spss.api.common.ContentLocRef; + +/** + * Default implementation of <code>ContentLocRef</code>. + * + * @author Gregor Karlinger + * @version $Id$ + */ +public class ContentLocRefImpl extends ContentImpl implements ContentLocRef +{ + /** + * The location reference URI pointing to the actual remote location of the content. + */ + private String locationReferenceURI_; + + /** + * @see at.gv.egovernment.moa.spss.api.common.ContentLocRef#getLocationReference() + */ + public String getLocationReferenceURI() + { + return locationReferenceURI_; + } + + /** + * Sets the location reference URI pointing to the actual remote location of the content. + * + * @param locationReferenceURI the location reference URI. + */ + public void setLocationReferenceURI(String locationReferenceURI) + { + locationReferenceURI_ = locationReferenceURI; + } + + /** + * Gets the type of content. + * + * @return LOCREF_CONTENT. + */ + public int getContentType() { + return LOCREF_CONTENT; + } +} diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java b/spss.server/src/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java index ab6240f79..a953c2af3 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/impl/SPSSFactoryImpl.java @@ -439,6 +439,13 @@ public class SPSSFactoryImpl extends SPSSFactory { return content; } + public Content createContent(String locationReferenceURI, String referenceURI) { + ContentLocRefImpl content = new ContentLocRefImpl(); + content.setLocationReferenceURI(locationReferenceURI); + content.setReference(referenceURI); + return content; + } + public Content createContent(String referenceURI) { ContentReferenceImpl content = new ContentReferenceImpl(); content.setReference(referenceURI); diff --git a/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java b/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java index 0fff949b1..a41b14df0 100644 --- a/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java +++ b/spss.server/src/at/gv/egovernment/moa/spss/api/xmlbind/RequestParserUtils.java @@ -34,7 +34,7 @@ public class RequestParserUtils { private static final String DESCRIPTION_XPATH = MOA + "Description"; private static final String XML_ASSOC_CONTENT_XPATH = MOA + "Content"; private static final String CONTENT_XPATH = - MOA + "Base64Content | " + MOA + "XMLContent"; + MOA + "Base64Content | " + MOA + "XMLContent |" + MOA + "LocRefContent"; private static final String ANY_OTHER_XPATH = "*[namespace-uri() != \"" + Constants.MOA_NS_URI + "\"]"; @@ -101,8 +101,15 @@ public class RequestParserUtils { return factory.createContent( Base64Utils.decodeToStream(base64String, true), referenceURI); + } else if ("LocRefContent".equals(contentElem.getLocalName())) { + String locationReferenceURI = DOMUtils.getText(contentElem); + return factory.createContent( + locationReferenceURI, + referenceURI); } else { // "XMLContent".equals(contentElem.getLocalName()) - return factory.createContent(contentElem.getChildNodes(), referenceURI); + return factory.createContent( + contentElem.getChildNodes(), + referenceURI); } } 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; |