From bc620256eb9b4dc6a33244b1105e58773358dbe6 Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 11 Nov 2003 22:12:44 +0000 Subject: Feature 41 implementiert. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@50 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../gv/egovernment/moa/spss/api/SPSSFactory.java | 17 +++++++++ .../egovernment/moa/spss/api/common/Content.java | 14 ++++++- .../moa/spss/api/common/ContentLocRef.java | 17 +++++++++ .../moa/spss/api/impl/ContentLocRefImpl.java | 44 ++++++++++++++++++++++ .../moa/spss/api/impl/SPSSFactoryImpl.java | 7 ++++ .../moa/spss/api/xmlbind/RequestParserUtils.java | 11 +++++- 6 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 spss.server/src/at/gv/egovernment/moa/spss/api/common/ContentLocRef.java create mode 100644 spss.server/src/at/gv/egovernment/moa/spss/api/impl/ContentLocRefImpl.java (limited to 'spss.server/src/at/gv/egovernment/moa/spss/api') 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 { @@ -778,6 +779,22 @@ public abstract class SPSSFactory { InputStream binaryData, String referenceURI); + /** + * Create a new Content 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 null. + * + * @return The Content object containing the data. + * + * @pre locationReferenceURI != null + * @post return != null + */ + public abstract Content createContent( + String locationReferenceURI, + String referenceURI); + /** * Create a new Content object containing XML data. * 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 BINARY_CONTENT or - * XML_CONTENT + * @return The type of content, one of BINARY_CONTENT, XML_CONTENT, + * REFERENCE_CONTENT or LOCREF_CONTENT. */ 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 ContentLocRef. + * + * @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); } } -- cgit v1.2.3