Added toString() method
This commit is contained in:
parent
00ee938aeb
commit
38d8d824b0
|
@ -15,6 +15,7 @@ import org.gcube.smartgears.Constants;
|
|||
import org.gcube.smartgears.ContextProvider;
|
||||
import org.gcube.vremanagement.executor.SmartExecutorInitializator;
|
||||
import org.gcube.vremanagement.executor.api.types.LaunchParameter;
|
||||
import org.gcube.vremanagement.executor.json.ExtendedSEMapper;
|
||||
import org.gcube.vremanagement.executor.json.SEMapper;
|
||||
import org.gcube.vremanagement.executor.plugin.Ref;
|
||||
import org.gcube.vremanagement.executor.plugin.RunOn;
|
||||
|
@ -24,14 +25,15 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property=SEMapper.CLASS_PROPERTY)
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = SEMapper.CLASS_PROPERTY)
|
||||
public class ScheduledTask extends org.gcube.vremanagement.executor.plugin.ScheduledTask {
|
||||
|
||||
protected String token;
|
||||
protected String scope;
|
||||
protected ClientInfo clientInfo;
|
||||
|
||||
protected ScheduledTask(){}
|
||||
protected ScheduledTask() {
|
||||
}
|
||||
|
||||
public ScheduledTask(UUID uuid, LaunchParameter launchParameter) {
|
||||
this(uuid, launchParameter, generateRunOn());
|
||||
|
@ -52,7 +54,7 @@ public class ScheduledTask extends org.gcube.vremanagement.executor.plugin.Sched
|
|||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scope
|
||||
*/
|
||||
|
@ -74,7 +76,7 @@ public class ScheduledTask extends org.gcube.vremanagement.executor.plugin.Sched
|
|||
try {
|
||||
HostingNode hostingNode = ContextProvider.get().container().profile(HostingNode.class);
|
||||
hostingNodeRef = new Ref(hostingNode.id(), hostingNode.profile().description().name());
|
||||
}catch (Exception e) {
|
||||
} catch(Exception e) {
|
||||
//
|
||||
hostingNodeRef = new Ref(LOCALHOST, LOCALHOST);
|
||||
}
|
||||
|
@ -84,17 +86,17 @@ public class ScheduledTask extends org.gcube.vremanagement.executor.plugin.Sched
|
|||
GCoreEndpoint gCoreEndpoint = ContextProvider.get().profile(GCoreEndpoint.class);
|
||||
String address = "";
|
||||
Group<Endpoint> endpoints = gCoreEndpoint.profile().endpoints();
|
||||
for(Endpoint endpoint : endpoints){
|
||||
if(endpoint.name().contains(Constants.remote_management)){
|
||||
for(Endpoint endpoint : endpoints) {
|
||||
if(endpoint.name().contains(Constants.remote_management)) {
|
||||
continue;
|
||||
}else{
|
||||
} else {
|
||||
address = endpoint.uri().toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
eServiceRef = new Ref(gCoreEndpoint.id(), address);
|
||||
}catch (Exception e) {
|
||||
} catch(Exception e) {
|
||||
eServiceRef = new Ref(LOCALHOST, LOCALHOST);
|
||||
}
|
||||
|
||||
|
@ -102,5 +104,15 @@ public class ScheduledTask extends org.gcube.vremanagement.executor.plugin.Sched
|
|||
|
||||
return runOn;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return ExtendedSEMapper.getInstance().marshal(this);
|
||||
} catch(Exception e) {
|
||||
return "ScheduledTask [token=" + token + ", scope=" + scope + ", clientInfo=" + clientInfo + ", uuid="
|
||||
+ uuid + ", launchParameter=" + launchParameter + ", runOn=" + runOn + "]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue