diff --git a/design/D4S-InformationCollector.vpp b/design/D4S-InformationCollector.vpp index 2ee29de..2d74093 100644 Binary files a/design/D4S-InformationCollector.vpp and b/design/D4S-InformationCollector.vpp differ diff --git a/design/IC skeleton.png b/design/IC skeleton.png index ff79acd..f443c5f 100644 Binary files a/design/IC skeleton.png and b/design/IC skeleton.png differ diff --git a/etc/build.properties b/etc/build.properties index 96cfde6..cdf2eef 100755 --- a/etc/build.properties +++ b/etc/build.properties @@ -6,6 +6,7 @@ wsdl.1 = XMLCollectionAccess wsdl.2 = Sink_service wsdl.3 = SinkEntry_service wsdl.4 = DISICService +wsdl.5 = XQueryAccess namespace.1=http://gcube-system.org/namespaces/informationsystem/collector namespace.2=http://gcube-system.org/namespaces/informationsystem/collector/Sink namespace.3=http://mds.globus.org/index/2004/07/12 diff --git a/etc/deploy-jndi-config.xml b/etc/deploy-jndi-config.xml index 9efdc8a..65bac54 100755 --- a/etc/deploy-jndi-config.xml +++ b/etc/deploy-jndi-config.xml @@ -10,6 +10,9 @@ + + @@ -68,6 +71,15 @@ type="java.lang.String" override="false" /> + + + + + diff --git a/etc/deploy-server.wsdd b/etc/deploy-server.wsdd index 8bc6722..aeae175 100755 --- a/etc/deploy-server.wsdd +++ b/etc/deploy-server.wsdd @@ -15,6 +15,15 @@ share/schema/org.gcube.informationsystem.collector/XMLCollectionAccess_service.wsdl + + + + + + + share/schema/org.gcube.informationsystem.collector/XQueryAccess_service.wsdl + + InformationCollector Stubs diff --git a/schema/XMLCollectionAccess.wsdl b/schema/XMLCollectionAccess.wsdl index 2a7ab2b..9699c97 100755 --- a/schema/XMLCollectionAccess.wsdl +++ b/schema/XMLCollectionAccess.wsdl @@ -1,7 +1,4 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/org/gcube/informationsystem/collector/impl/porttypes/Sink.java b/src/org/gcube/informationsystem/collector/impl/porttypes/Sink.java index 8e8c480..dcfa4b9 100755 --- a/src/org/gcube/informationsystem/collector/impl/porttypes/Sink.java +++ b/src/org/gcube/informationsystem/collector/impl/porttypes/Sink.java @@ -10,7 +10,10 @@ import org.globus.wsrf.impl.ReflectionResourceProperty; import org.globus.wsrf.impl.SimpleResourcePropertyMetaData; import org.globus.wsrf.impl.SimpleResourcePropertySet; +import org.gcube.common.core.contexts.GCUBEServiceContext; +import org.gcube.common.core.porttypes.GCUBEPortType; import org.gcube.common.core.utils.logging.GCUBELog; +import org.gcube.informationsystem.collector.impl.contexts.ICServiceContext; /** * Sink PortType's implementation class. It's the registration PortType @@ -19,7 +22,7 @@ import org.gcube.common.core.utils.logging.GCUBELog; * @author Manuele Simi (ISTI-CNR) * */ -public class Sink implements ResourceLifetime, ResourceProperties { +public class Sink extends GCUBEPortType implements ResourceLifetime, ResourceProperties { // WS-Lifetime Properties protected Calendar terminationTime, currentTime; @@ -28,6 +31,12 @@ public class Sink implements ResourceLifetime, ResourceProperties { private ResourcePropertySet propSet; + /** {@inheritDoc} */ + @Override + protected GCUBEServiceContext getServiceContext() { + return ICServiceContext.getContext(); + } + /** * Initializes a new Sink PortType by creating its * {@link SimpleResourcePropertySet} diff --git a/src/org/gcube/informationsystem/collector/impl/porttypes/SinkEntry.java b/src/org/gcube/informationsystem/collector/impl/porttypes/SinkEntry.java index 5caa9f1..37e48a4 100755 --- a/src/org/gcube/informationsystem/collector/impl/porttypes/SinkEntry.java +++ b/src/org/gcube/informationsystem/collector/impl/porttypes/SinkEntry.java @@ -11,6 +11,10 @@ import org.oasis.wsrf.properties.GetResourcePropertyResponse; import org.oasis.wsrf.servicegroup.ServiceGroupEntry; import org.globus.wsrf.impl.properties.GetResourcePropertyProvider; +import org.gcube.common.core.contexts.GCUBEServiceContext; +import org.gcube.common.core.porttypes.GCUBEPortType; +import org.gcube.informationsystem.collector.impl.contexts.ICServiceContext; + /** * A ServiceGroupEntry implemenation.
@@ -20,7 +24,7 @@ import org.globus.wsrf.impl.properties.GetResourcePropertyProvider; * */ -public class SinkEntry implements ServiceGroupEntry { +public class SinkEntry extends GCUBEPortType implements ServiceGroupEntry { private GetResourcePropertyProvider getResourcePropertyProvider = new GetResourcePropertyProvider(); @@ -28,6 +32,11 @@ public class SinkEntry implements ServiceGroupEntry { // WS-Lifetime Properties protected Calendar terminationTime, currentTime; + /** {@inheritDoc} */ + @Override + protected GCUBEServiceContext getServiceContext() { + return ICServiceContext.getContext(); + } /** * Gets WS-Resource property by using the {@link GetResourcePropertyProvider} diff --git a/src/org/gcube/informationsystem/collector/impl/porttypes/XMLStorageAccess.java b/src/org/gcube/informationsystem/collector/impl/porttypes/XMLStorageAccess.java index aa979a2..e0dfca7 100644 --- a/src/org/gcube/informationsystem/collector/impl/porttypes/XMLStorageAccess.java +++ b/src/org/gcube/informationsystem/collector/impl/porttypes/XMLStorageAccess.java @@ -9,8 +9,9 @@ import org.gcube.informationsystem.collector.impl.contexts.ICServiceContext; import org.gcube.informationsystem.collector.impl.xmlstorage.exist.State; /** - * TODO: Manuele, don't forget to add a comment for this new type!! - * + * XMLStorageAccess portType implementation.
+ * It gives remote access to administration features of the XML Storage + * * @author Manuele Simi (ISTI-CNR) * */ diff --git a/src/org/gcube/informationsystem/collector/impl/porttypes/XQueryAccess.java b/src/org/gcube/informationsystem/collector/impl/porttypes/XQueryAccess.java index ef43aca..1b7a0f2 100644 --- a/src/org/gcube/informationsystem/collector/impl/porttypes/XQueryAccess.java +++ b/src/org/gcube/informationsystem/collector/impl/porttypes/XQueryAccess.java @@ -1,7 +1,6 @@ package org.gcube.informationsystem.collector.impl.porttypes; import org.globus.wsrf.utils.FaultHelper; -import org.oasis.wsrf.faults.BaseFaultType; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.modules.XMLResource; @@ -11,49 +10,58 @@ import org.gcube.common.core.utils.logging.GCUBELog; import org.gcube.informationsystem.collector.impl.contexts.ICServiceContext; import org.gcube.informationsystem.collector.impl.xmlstorage.exist.State; import org.gcube.informationsystem.collector.impl.xmlstorage.exist.XQuery; +import org.gcube.informationsystem.collector.stubs.XQueryExecuteRequest; +import org.gcube.informationsystem.collector.stubs.XQueryExecuteResponse; +import org.gcube.informationsystem.collector.stubs.XQueryFaultType; /** * XQueryAccess portType implementation - * + * * @author Manuele Simi (ISTI-CNR) - * + * */ public class XQueryAccess extends GCUBEPortType { private final GCUBELog logger = new GCUBELog(XQueryAccess.class); - + /** {@inheritDoc} */ @Override - protected GCUBEServiceContext getServiceContext() { + protected GCUBEServiceContext getServiceContext() { return ICServiceContext.getContext(); } - /* - public XQueryExecuteResponse XQueryExecute(XQueryExecuteRequest XQueryExecuteRequest) throw XQueryFaultType { - StringBuilder response = new StringBuilder(); + /** + * Executes a XQuery expression in the XML storage + * @param XQueryExpression the XQuery expression + * @return a formatted XML document + * @throws XQueryFaultType if the execution fails + */ + public XQueryExecuteResponse XQueryExecute(XQueryExecuteRequest request) throws XQueryFaultType { + StringBuilder dataset = new StringBuilder(); + XQueryExecuteResponse response = new XQueryExecuteResponse(); try { + logger.debug("executing XQuery: " + request.getXQueryExpression()); - logger.debug("executing XQuery: " + xquery); - - XQuery q = new XQuery(xquery); + XQuery q = new XQuery(request.getXQueryExpression()); ResourceSet result = State.query_manager.executeXQuery(q); + response.setSize(result.getSize()); logger.debug("number of returned documents: " + result.getSize()); - response.append("\n"); + dataset.append("\n"); for (int i = 0; i < (int) result.getSize(); i++) { XMLResource xmlres = (XMLResource) result.getResource((long) i); - // logger.debug("retrieved resource - " + xmlres.getContent()); - response.append("\n" + xmlres.getContent()+ "\n\n"); + dataset.append("\n" + xmlres.getContent() + "\n\n"); } - response.append(""); + dataset.append(""); + response.setDataset(dataset.toString()); } catch (Exception e) { - BaseFaultType fault = new BaseFaultType(); + XQueryFaultType fault = new XQueryFaultType(); FaultHelper faultHelper = new FaultHelper(fault); faultHelper.addFaultCause(e); faultHelper.addDescription("IC service: Exception when executing the requested XQuery"); throw fault; } - }*/ + return response; + } - }