diff options
Diffstat (limited to 'spss.server/src/at/gv/egovernment/moa/spss/api')
6 files changed, 106 insertions, 4 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); } } |