]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java
Update license header
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / ExecutionThread.java
index 5e288f264f0de75447afbbbfbeecff7fa82c7392..075a851dc8af90e99f7fc63b07041f637b92d27f 100644 (file)
@@ -40,6 +40,13 @@ public class ExecutionThread extends Thread {
        }
 
        public void run() {
+               // authenticate thread
+//             Authentication authentication = getProcessThreadGroup()
+//                             .getAuthentication();
+//             if (authentication == null)
+//                     throw new SlcException("Can only execute authenticated threads");
+//             SecurityContextHolder.getContext().setAuthentication(authentication);
+
                if (getContextClassLoader() != null) {
                        if (log.isTraceEnabled())
                                log.trace("Context class loader set to "
@@ -51,8 +58,8 @@ public class ExecutionThread extends Thread {
                                .getFlowDescriptor();
                String flowName = executionFlowDescriptor.getName();
 
-               dispatchAddStep(new ExecutionStep(ExecutionStep.PHASE_START, "Flow "
-                               + flowName));
+               dispatchAddStep(new ExecutionStep(realizedFlow.getModuleName(),
+                               ExecutionStep.PHASE_START, "Flow " + flowName));
 
                try {
                        String autoUpgrade = System
@@ -68,13 +75,13 @@ public class ExecutionThread extends Thread {
                        // TODO: re-throw exception ?
                        String msg = "Execution of flow " + flowName + " failed.";
                        log.error(msg, e);
-                       dispatchAddStep(new ExecutionStep(ExecutionStep.ERROR, msg + " "
-                                       + e.getMessage()));
+                       dispatchAddStep(new ExecutionStep(realizedFlow.getModuleName(),
+                                       ExecutionStep.ERROR, msg + " " + e.getMessage()));
                        processThread.notifyError();
                } finally {
                        processThread.flowCompleted();
-                       dispatchAddStep(new ExecutionStep(ExecutionStep.PHASE_END, "Flow "
-                                       + flowName));
+                       dispatchAddStep(new ExecutionStep(realizedFlow.getModuleName(),
+                                       ExecutionStep.PHASE_END, "Flow " + flowName));
                }
        }
 
@@ -82,4 +89,12 @@ public class ExecutionThread extends Thread {
                processThread.getProcessThreadGroup().dispatchAddStep(step);
        }
 
+       protected ProcessThreadGroup getProcessThreadGroup() {
+               return processThread.getProcessThreadGroup();
+       }
+
+       public RealizedFlow getRealizedFlow() {
+               return realizedFlow;
+       }
+
 }