integrated with new dataminer-invocation-model

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@176038 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-12-20 16:18:34 +00:00
parent 8f808293fd
commit ef5e8b2c90
2 changed files with 11 additions and 9 deletions

View File

@ -4,6 +4,9 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="dataminer-invocation-model-0.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/dataminer-invocation-model/dataminer-invocation-model">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="uri-resolver"/> <property name="context-root" value="uri-resolver"/>
<property name="java-output-path" value="/uri-resolver/target/classes"/> <property name="java-output-path" value="/uri-resolver/target/classes"/>
</wb-module> </wb-module>

View File

@ -7,7 +7,6 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@ -99,7 +98,7 @@ public class AnalyticsCreateResolver {
DataMinerInvocation jsonRequest = null; DataMinerInvocation jsonRequest = null;
try { try {
jsonRequest = DataMinerInvocationManager.getInstance().unmarshaling(IOUtils.toInputStream(body), org.gcube.data.analysis.dminvocation.MediaType.ApplicationJSON, true); jsonRequest = DataMinerInvocationManager.getInstance().unmarshalingJSON(IOUtils.toInputStream(body), true);
} }
catch (IOException | JAXBException | SAXException e1) { catch (IOException | JAXBException | SAXException e1) {
logger.error("The body is not a valid DataMinerInvocation JSON request",e1); logger.error("The body is not a valid DataMinerInvocation JSON request",e1);
@ -147,9 +146,9 @@ public class AnalyticsCreateResolver {
File tempInvocationFile = null; File tempInvocationFile = null;
try { try {
ByteArrayOutputStream xmlByteArray = DataMinerInvocationManager.getInstance().marshaling(jsonRequest, org.gcube.data.analysis.dminvocation.MediaType.ApplicationXML, true); String xmlRequest = DataMinerInvocationManager.getInstance().marshalingXML(jsonRequest, true, true);
String uniqueName = createDMInvocationFileName(jsonRequest.getOperatorId()); String uniqueName = createDMInvocationFileName(jsonRequest.getOperatorId());
tempInvocationFile = createTempFile(uniqueName, ".xml", xmlByteArray.toByteArray()); tempInvocationFile = createTempFile(uniqueName, ".xml", xmlRequest.getBytes());
logger.info("Created StorageHubClient Instance, uploading file: "+tempInvocationFile.getName()); logger.info("Created StorageHubClient Instance, uploading file: "+tempInvocationFile.getName());
AuthorizationEntry entry = authorizationService().get(contextToken); AuthorizationEntry entry = authorizationService().get(contextToken);
@ -338,10 +337,10 @@ public class AnalyticsCreateResolver {
} }
public static void main(String[] args) { // public static void main(String[] args) {
//
System.out.println(readApplicationTokenFromSE(null, "/gcube")); // System.out.println(readApplicationTokenFromSE(null, "/gcube"));
//
} // }
} }