@ -43,7 +43,6 @@ import org.gcube.common.storagehub.model.Metadata;
import org.gcube.data.analysis.dminvocation.ActionType ;
import org.gcube.data.analysis.dminvocation.DataMinerInvocationManager ;
import org.gcube.data.analysis.dminvocation.model.DataMinerInvocation ;
import org.gcube.datatransfer.resolver.requesthandler.RequestHandler ;
import org.gcube.datatransfer.resolver.services.error.ExceptionManager ;
import org.gcube.datatransfer.resolver.services.exceptions.InternalServerException ;
import org.gcube.datatransfer.resolver.util.ScopeUtil ;
@ -119,20 +118,11 @@ public class AnalyticsCreateResolver {
logger . debug ( "The body contains the request: " + jsonRequest . toString ( ) ) ;
String contextToken = SecurityTokenProvider . instance . get ( ) ;
String scope = ScopeProvider . instance . get ( ) ;
// logger.info("SecurityTokenProvider contextToken: "+contextToken);
logger . info ( "ScopeProvider has scope: " + scope ) ;
String appToken = req . getServletContext ( ) . getInitParameter ( RequestHandler . ROOT_APP_TOKEN ) ;
if ( contextToken . compareTo ( appToken ) = = 0 ) {
logger . error ( "Token not passed, SecurityTokenProvider contains the root app token: "
+ appToken . substring ( 0 , 10 ) + "..." ) ;
throw ExceptionManager . unauthorizedException ( req ,
"You are not authorized. You must pass a token of VRE" , this . getClass ( ) , helpURI ) ;
}
String operatorID = jsonRequest . getOperatorId ( ) ;
if ( scope = = null | | scope . isEmpty ( ) ) {
@ -148,8 +138,15 @@ public class AnalyticsCreateResolver {
"Mandatory body parameter 'operatorId' not found or empty in the JSON object" , this . getClass ( ) ,
helpURI ) ;
}
ScopeBean scopeBean = new ScopeBean ( scope ) ;
if ( scopeBean . is ( Type . INFRASTRUCTURE ) | | scopeBean . is ( Type . VO ) ) {
logger . error ( Type . INFRASTRUCTURE + "or " + Type . VO + " scope detected, you must set a scope of VRE" ) ;
throw ExceptionManager . unauthorizedException ( req ,
"You are not authorized. You must pass a token of VRE" , this . getClass ( ) , helpURI ) ;
}
String publicLinkToDMInvFile = "" ;
if ( scopeBean . is ( Type . VRE ) ) {
@ -162,7 +159,8 @@ public class AnalyticsCreateResolver {
File tempInvocationFile = null ;
try {
String contextToken = SecurityTokenProvider . instance . get ( ) ;
String xmlRequest = DataMinerInvocationManager . getInstance ( ) . marshalingXML ( jsonRequest , true , true ) ;
String uniqueName = createDMInvocationFileName ( jsonRequest . getOperatorId ( ) ) ;
tempInvocationFile = createTempFile ( uniqueName , ".xml" , xmlRequest . getBytes ( ) ) ;
@ -186,8 +184,9 @@ public class AnalyticsCreateResolver {
StorageHubManagement storageHubManagement = new StorageHubManagement ( ) ;
Metadata metadata = new Metadata ( ) ;
Map < String , String > theMap = new HashMap < String , String > ( ) ;
Map < String , Object > theMap = new HashMap < String , Object > ( ) ;
theMap . put ( "owner" , owner ) ;
metadata . setMap ( theMap ) ;
URL thePublicLink = null ;
try {