1 /* This file is part of the project "Hilbert II" - http://www.qedeq.org" target="alexandria_uri">http://www.qedeq.org 2 * 3 * Copyright 2000-2014, Michael Meyling <mime@qedeq.org>. 4 * 5 * "Hilbert II" is free software; you can redistribute 6 * it and/or modify it under the terms of the GNU General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 */ 15 16 package org.qedeq.kernel.bo.module; 17 18 import java.io.File; 19 import java.io.IOException; 20 import java.io.Reader; 21 22 import org.qedeq.base.io.SourceArea; 23 import org.qedeq.kernel.bo.common.QedeqBo; 24 import org.qedeq.kernel.se.base.module.Qedeq; 25 import org.qedeq.kernel.se.common.ModuleContext; 26 import org.qedeq.kernel.se.common.SourceFileExceptionList; 27 28 /** 29 * An instance of this interface can load and save QEDEQ module files. 30 * 31 * @author Michael Meyling 32 */ 33 public interface QedeqFileDao { 34 35 /** 36 * Set kernel services. Is called by the kernel to give this loader the opportunity to 37 * use kernel services within its methods. This is the first method the kernel calls. 38 * 39 * @param services Internal kernel services. 40 */ 41 public void setServices(InternalKernelServices services); 42 43 /** 44 * Get kernel services. 45 * 46 * @return Internal kernel services. 47 */ 48 public InternalKernelServices getServices(); 49 50 /** 51 * Load a QEDEQ module from file. 52 * 53 * @param process We work for this service process. 54 * @param prop Module properties. 55 * @param localFile Load file from this location. 56 * @return Loaded QEDEQ. 57 * @throws SourceFileExceptionList Module could not be successfully loaded. 58 */ 59 public Qedeq loadQedeq(InternalServiceJob process, QedeqBo prop, File localFile) 60 throws SourceFileExceptionList; 61 62 /** 63 * Save a QEDEQ module as file. 64 * 65 * @param process We work in this service process. 66 * @param prop Module properties. 67 * @param localFile Save module in this file. 68 * @throws SourceFileExceptionList Module could not be successfully saved. 69 * @throws IOException File saving failed. 70 */ 71 public void saveQedeq(InternalServiceJob process, KernelQedeqBo prop, File localFile) 72 throws SourceFileExceptionList, IOException; 73 74 /** 75 * Get area in source file for QEDEQ module context. 76 * If the system property "qedeq.test.xmlLocationFailures" is set to "true" a runtime 77 * exception is thrown if the context is not found. 78 * 79 * @param qedeq Look at this QEDEQ module. 80 * @param context Search for this context. 81 * @return Created file area. Maybe <code>null</code>. 82 */ 83 public SourceArea createSourceArea(Qedeq qedeq, ModuleContext context); 84 85 /** 86 * Get reader for local buffered QEDEQ module. 87 * 88 * @param prop QEDEQ BO. 89 * @return Reader. 90 * @throws IOException Reading failed. 91 */ 92 public Reader getModuleReader(KernelQedeqBo prop) throws IOException; 93 94 }