The got context have now additional information apart ScopeBean such as
UUID
This commit is contained in:
parent
d638d53d1e
commit
24df156d96
|
@ -2,8 +2,8 @@ package org.gcube.context;
|
|||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.resourcemanagement.support.server.managers.context.ContextManager;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.D4SEnvironment;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -20,22 +20,21 @@ public abstract class ContextElaborator {
|
|||
|
||||
public void all() throws Exception{
|
||||
try {
|
||||
LinkedHashMap<String,ScopeBean> map = ContextManager.readContexts();
|
||||
for(String scope : map.keySet()) {
|
||||
try {
|
||||
String context = map.get(scope).toString();
|
||||
LinkedHashMap<String, D4SEnvironment> contexts = ContextManager.readContextsWithUUIDs();
|
||||
for (String context : contexts.keySet()) {
|
||||
D4SEnvironment d4sEnvironment = contexts.get(context);
|
||||
try {
|
||||
logger.debug("Going to elaborate {}", context);
|
||||
elaborateContext(map.get(scope));
|
||||
elaborateContext(d4sEnvironment);
|
||||
}catch (Exception e) {
|
||||
logger.error("Error while elaborating {}", scope, e);
|
||||
logger.error("Error while elaborating {}", context, e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void elaborateContext(ScopeBean scopeBean) throws Exception;
|
||||
|
||||
protected abstract void elaborateContext(D4SEnvironment d4sEnvironment) throws Exception;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.io.FileWriter;
|
|||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.context.ContextElaborator;
|
||||
import org.gcube.resourcemanagement.support.shared.types.datamodel.D4SEnvironment;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -36,8 +36,8 @@ public class ContextList extends ContextElaborator {
|
|||
|
||||
|
||||
@Override
|
||||
protected void elaborateContext(ScopeBean scopeBean) throws Exception {
|
||||
printLine(outputFile, scopeBean.toString());
|
||||
protected void elaborateContext(D4SEnvironment d4sEnvironment) throws Exception {
|
||||
printLine(outputFile, d4sEnvironment.getContext().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue