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;fp=runtime%2Forg.argeo.slc.support.castor%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fxml%2Fprocess%2FFileSlcExecutionNotifier.java;h=0000000000000000000000000000000000000000;hb=41fd475a3fc32148851affb6979ab8aa2d3c2959;hp=ad6bcdc24cb0597fe84b07cd1528abef826bda2b;hpb=c1cadd631138302ddd6700aa2eb7376eb657002d;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 deleted file mode 100644 index ad6bcdc24..000000000 --- a/runtime/org.argeo.slc.support.castor/src/main/java/org/argeo/slc/xml/process/FileSlcExecutionNotifier.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2007-2012 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.util.HashMap; -import java.util.List; -import java.util.Map; - -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 Marshaller marshaller; - - private Map uuidToDir = new HashMap(); - - public void addSteps(ExecutionProcess slcExecution, - List additionalSteps) { - writeSlcExecution(slcExecution); - } - - public void updateStatus(ExecutionProcess slcExecution, String oldStatus, - String newStatus) { - writeSlcExecution(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)); - marshaller.marshal(slcExecution, new StreamResult(out)); - } catch (Exception e) { - throw new SlcException("Cannot marshall SlcExecution to " - + getFilePath(slcExecution), e); - } finally { - IOUtils.closeQuietly(out); - } - } - - protected String getFileName(SlcExecution slcExecution) { - return "SlcExecution-" + slcExecution.getUuid() + ".xml"; - } - - protected String getFilePath(SlcExecution slcExecution) { - String dirPath = uuidToDir.get(slcExecution.getUuid()); - return dirPath + File.separator + "SlcExecution-" - + slcExecution.getUuid() + ".xml"; - } - - public void setBasePath(String basePath) { - // this.basePath = basePath; - } - - public void setMarshaller(Marshaller marshaller) { - this.marshaller = marshaller; - } - -}