X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=runtime%2Forg.argeo.slc.support.castor%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fxml%2Fprocess%2FFileSlcExecutionNotifier.java;h=8b110ecd2032f4302f38806929d3dd731c6c0369;hb=4acaa7b3eca85263027b1a8875cf0b1971a09c7b;hp=f16b4e7894cf06a2c0a1fccfde78e28fe0db658d;hpb=2995b63156cd89a45446422195c315e2ee96f170;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java index f16b4e789..8b110ecd2 100644 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java +++ b/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java @@ -1,9 +1,23 @@ +/* + * Copyright (C) 2010 Mathieu Baudier + * + * 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.xml.process; import java.io.File; import java.io.FileWriter; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,46 +26,38 @@ import javax.xml.transform.stream.StreamResult; import org.apache.commons.io.IOUtils; import org.argeo.slc.SlcException; +import org.argeo.slc.execution.ExecutionProcess; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionNotifier; +import org.argeo.slc.execution.ExecutionStep; import org.argeo.slc.process.SlcExecutionStep; import org.springframework.oxm.Marshaller; +/** @deprecated Probably not even working anymore */ public class FileSlcExecutionNotifier implements SlcExecutionNotifier { - private final static SimpleDateFormat sdf = new SimpleDateFormat( - "yyyyMMdd-HHmmss"); - - private String basePath; + // private final static SimpleDateFormat sdf = new SimpleDateFormat( + // "yyyyMMdd-HHmmss"); + // + // private String basePath; private Marshaller marshaller; private Map uuidToDir = new HashMap(); - public void addSteps(SlcExecution slcExecution, - List additionalSteps) { - writeSlcExecution(slcExecution); - } - - public void newExecution(SlcExecution slcExecution) { - String dirPath = basePath + File.separator + sdf.format(new Date()) - + '-' + slcExecution.getUuid(); - File dir = new File(dirPath); - dir.mkdirs(); - - uuidToDir.put(slcExecution.getUuid(), dirPath); - - writeSlcExecution(slcExecution); - } - - public void updateExecution(SlcExecution slcExecution) { + public void addSteps(ExecutionProcess slcExecution, + List additionalSteps) { writeSlcExecution(slcExecution); } - public void updateStatus(SlcExecution slcExecution, String oldStatus, + public void updateStatus(ExecutionProcess slcExecution, String oldStatus, String newStatus) { writeSlcExecution(slcExecution); } - protected void writeSlcExecution(SlcExecution slcExecution) { + protected void writeSlcExecution(ExecutionProcess process) { + if (!(process instanceof SlcExecution)) + throw new SlcException("Unsupported process type " + + process.getClass()); + SlcExecution slcExecution = (SlcExecution) process; FileWriter out = null; try { out = new FileWriter(getFilePath(slcExecution)); @@ -75,7 +81,7 @@ public class FileSlcExecutionNotifier implements SlcExecutionNotifier { } public void setBasePath(String basePath) { - this.basePath = basePath; + // this.basePath = basePath; } public void setMarshaller(Marshaller marshaller) {