-/*
- * 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;
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();
}
} 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();
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();
}
}
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);
}
}
}