001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.bo.module;
017
018 import java.io.File;
019 import java.io.IOException;
020
021 import org.qedeq.kernel.bo.common.KernelProperties;
022 import org.qedeq.kernel.bo.common.KernelServices;
023 import org.qedeq.kernel.se.base.module.Specification;
024 import org.qedeq.kernel.se.common.ModuleAddress;
025 import org.qedeq.kernel.se.common.SourceFileExceptionList;
026
027 /**
028 * The kernel internal service methods are assembled here. Needed by the kernel and its helpers.
029 *
030 * @author Michael Meyling
031 */
032 public interface InternalKernelServices extends KernelServices, KernelProperties {
033
034 /**
035 * Get buffer directory for QEDEQ module files.
036 *
037 * @return buffer directory.
038 */
039 public File getBufferDirectory();
040
041 /**
042 * Get directory for generated files.
043 *
044 * @return Generation directory.
045 */
046 public File getGenerationDirectory();
047
048 /**
049 * Get {@link KernelQedeqBo} for an address.
050 *
051 * @param address Look for this address.
052 * @return Existing or new {@link KernelQedeqBo}, if address is malformed
053 * <code>null</code> is returned.
054 */
055 public KernelQedeqBo getKernelQedeqBo(ModuleAddress address);
056
057 /**
058 * Transform an URL address into a local file path where the QEDEQ module is buffered.
059 * If the QEDEQ module is a local file the path to that file is given.
060 *
061 * @param address Get local address for this QEDEQ module address.
062 * @return Local file path for that <code>address</code>.
063 */
064 public File getLocalFilePath(ModuleAddress address);
065
066 /**
067 * Load specified QEDEQ module from QEDEQ parent module.
068 *
069 * @param parent Parent module address.
070 * @param spec Specification for another QEDEQ module.
071 * @return Loaded module.
072 * @throws SourceFileExceptionList Loading failed.
073 */
074 public KernelQedeqBo loadModule(ModuleAddress parent, Specification spec)
075 throws SourceFileExceptionList;
076
077 /**
078 * Get DAO for reading and writing QEDEQ modules from or to a file.
079 *
080 * @return DAO.
081 */
082 public QedeqFileDao getQedeqFileDao();
083
084 /**
085 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
086 * position.
087 *
088 * @param address This source had a problem.
089 * @param code Failure code.
090 * @param message Textual description of failure.
091 * @param e Wrapped exception.
092 * @return Created list.
093 */
094 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
095 String address, IOException e);
096
097 /**
098 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
099 * position.
100 *
101 * @param address This source had a problem.
102 * @param code Failure code.
103 * @param message Textual description of failure.
104 * @param e Wrapped exception.
105 * @return Created list.
106 */
107 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
108 String address, RuntimeException e);
109
110 /**
111 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
112 * position.
113 *
114 * @param address This source had a problem.
115 * @param code Failure code.
116 * @param message Textual description of failure.
117 * @param e Wrapped exception.
118 * @return Created list.
119 */
120 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
121 String address, Exception e);
122
123 }
|