+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.xml.process;\r
-\r
-import java.io.File;\r
-import java.io.FileWriter;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import javax.xml.transform.stream.StreamResult;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.execution.ExecutionProcess;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionNotifier;\r
-import org.argeo.slc.execution.ExecutionStep;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.springframework.oxm.Marshaller;\r
-\r
-/** @deprecated Probably not even working anymore */\r
-public class FileSlcExecutionNotifier implements SlcExecutionNotifier {\r
- // private final static SimpleDateFormat sdf = new SimpleDateFormat(\r
- // "yyyyMMdd-HHmmss");\r
- //\r
- // private String basePath;\r
- private Marshaller marshaller;\r
-\r
- private Map<String, String> uuidToDir = new HashMap<String, String>();\r
-\r
- public void addSteps(ExecutionProcess slcExecution,\r
- List<ExecutionStep> additionalSteps) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- public void updateStatus(ExecutionProcess slcExecution, String oldStatus,\r
- String newStatus) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- protected void writeSlcExecution(ExecutionProcess process) {\r
- if (!(process instanceof SlcExecution))\r
- throw new SlcException("Unsupported process type "\r
- + process.getClass());\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- FileWriter out = null;\r
- try {\r
- out = new FileWriter(getFilePath(slcExecution));\r
- marshaller.marshal(slcExecution, new StreamResult(out));\r
- } catch (Exception e) {\r
- throw new SlcException("Cannot marshall SlcExecution to "\r
- + getFilePath(slcExecution), e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- protected String getFileName(SlcExecution slcExecution) {\r
- return "SlcExecution-" + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- protected String getFilePath(SlcExecution slcExecution) {\r
- String dirPath = uuidToDir.get(slcExecution.getUuid());\r
- return dirPath + File.separator + "SlcExecution-"\r
- + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- public void setBasePath(String basePath) {\r
- // this.basePath = basePath;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
-}\r