]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.runtime/src/org/argeo/slc/runtime/DefaultExecutionFlow.java
Refactor Argeo API
[gpl/argeo-slc.git] / org.argeo.slc.runtime / src / org / argeo / slc / runtime / DefaultExecutionFlow.java
index 289f660e1093d04f8acdb1cdb918a45a74e0d915..07d044b77beb5c06e47e15f2b70bc11743b502e7 100644 (file)
@@ -1,37 +1,24 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package org.argeo.slc.runtime;
 
+import static java.lang.System.Logger.Level.ERROR;
+import static java.lang.System.Logger.Level.WARNING;
+
+import java.lang.System.Logger.Level;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionContext;
-import org.argeo.slc.execution.ExecutionFlow;
-import org.argeo.slc.execution.ExecutionSpec;
-import org.argeo.slc.execution.ExecutionSpecAttribute;
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.execution.ExecutionContext;
+import org.argeo.api.slc.execution.ExecutionFlow;
+import org.argeo.api.slc.execution.ExecutionSpec;
+import org.argeo.api.slc.execution.ExecutionSpecAttribute;
 
 /** Default implementation of an execution flow. */
 public class DefaultExecutionFlow implements ExecutionFlow {
-       private final static Log log = LogFactory.getLog(DefaultExecutionFlow.class);
+       private final static System.Logger logger = System.getLogger(DefaultExecutionFlow.class.getName());
 
        private final ExecutionSpec executionSpec;
        private String name = null;
@@ -99,7 +86,7 @@ public class DefaultExecutionFlow implements ExecutionFlow {
                try {
                        for (Runnable executable : executables) {
                                if (Thread.interrupted()) {
-                                       log.error("Flow '" + getName() + "' killed before '" + executable + "'");
+                                       logger.log(ERROR, "Flow '" + getName() + "' killed before '" + executable + "'");
                                        Thread.currentThread().interrupt();
                                        return;
                                        // throw new ThreadDeath();
@@ -108,7 +95,7 @@ public class DefaultExecutionFlow implements ExecutionFlow {
                        }
                } catch (RuntimeException e) {
                        if (Thread.interrupted()) {
-                               log.error("Flow '" + getName() + "' killed while receiving an unrelated exception", e);
+                               logger.log(ERROR, "Flow '" + getName() + "' killed while receiving an unrelated exception", e);
                                Thread.currentThread().interrupt();
                                return;
                                // throw new ThreadDeath();
@@ -116,9 +103,9 @@ public class DefaultExecutionFlow implements ExecutionFlow {
                        if (failOnError)
                                throw e;
                        else {
-                               log.error("Execution flow failed," + " but process did not fail" + " because failOnError property"
-                                               + " is set to false: " + e);
-                               if (log.isTraceEnabled())
+                               logger.log(ERROR, "Execution flow failed," + " but process did not fail"
+                                               + " because failOnError property" + " is set to false: " + e);
+                               if (logger.isLoggable(Level.TRACE))
                                        e.printStackTrace();
                        }
                }
@@ -171,7 +158,7 @@ public class DefaultExecutionFlow implements ExecutionFlow {
                                        DefaultExecutionFlow flow = (DefaultExecutionFlow) executable;
                                        String newPath = path + '/' + flow.getName();
                                        flow.setPath(newPath);
-                                       log.warn(newPath + " was forcibly set on " + flow);
+                                       logger.log(WARNING, newPath + " was forcibly set on " + flow);
                                }
                        }
                }