001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2014, 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.se.base.module.Specification;
023 import org.qedeq.kernel.se.common.ModuleAddress;
024 import org.qedeq.kernel.se.common.SourceFileExceptionList;
025 import org.qedeq.kernel.se.config.QedeqConfig;
026 import org.qedeq.kernel.se.visitor.ContextChecker;
027 import org.qedeq.kernel.se.visitor.InterruptException;
028
029 /**
030 * The kernel internal service methods are assembled here. Needed by the kernel and its helpers.
031 *
032 * @author Michael Meyling
033 */
034 public interface InternalKernelServices extends KernelProperties {
035
036 /**
037 * Get access to configuration parameters.
038 *
039 * @return Configuration access.
040 */
041 public QedeqConfig getConfig();
042
043 /**
044 * Get buffer directory for QEDEQ module files.
045 *
046 * @return buffer directory.
047 */
048 public File getBufferDirectory();
049
050 /**
051 * Get directory for generated files.
052 *
053 * @return Generation directory.
054 */
055 public File getGenerationDirectory();
056
057 /**
058 * Get {@link KernelQedeqBo} for an address.
059 *
060 * @param address Look for this address.
061 * @return Existing or new {@link KernelQedeqBo}. Never <code>null</code>.
062 */
063 public KernelQedeqBo getKernelQedeqBo(ModuleAddress address);
064
065 /**
066 * Transform an URL address into a local file path where the QEDEQ module is buffered.
067 * If the QEDEQ module is a local file the path to that file is given.
068 *
069 * @param address Get local address for this QEDEQ module address.
070 * @return Local file path for that <code>address</code>.
071 */
072 public File getLocalFilePath(ModuleAddress address);
073
074 /**
075 * Load QEDEQ module.
076 *
077 * @param process Working process.
078 * @param address Load module from this address.
079 * @return BO for QEDEQ module. Loading still might have failed. Check status.
080 * @throws InterruptException User canceled request.
081 */
082 public KernelQedeqBo loadKernelModule(final InternalServiceJob process, final ModuleAddress address)
083 throws InterruptException;
084
085 /**
086 * Load specified QEDEQ module from QEDEQ parent module.
087 *
088 * @param process Working process.
089 * @param parent Parent module address.
090 * @param spec Specification for another QEDEQ module.
091 * @return Loaded module.
092 * @throws SourceFileExceptionList Loading failed.
093 * @throws InterruptException User canceled request.
094 */
095 public KernelQedeqBo loadKernelModule(InternalServiceJob process, ModuleAddress parent,
096 Specification spec) throws SourceFileExceptionList, InterruptException;
097
098 /**
099 * Get required modules of given module. You can check the status to know if the loading was
100 * successful.
101 *
102 * @param process Working process.
103 * @param qedeq Module to check.
104 * @return Successful loading.
105 * @throws InterruptException User canceled request.
106 */
107 public boolean loadRequiredModules(InternalServiceJob process, KernelQedeqBo qedeq) throws InterruptException;
108
109 /**
110 * Check if all formulas of a QEDEQ module and its required modules are well formed.
111 *
112 * @param process Working process.
113 * @param qedeq Module to check.
114 * @return Was check successful?
115 * @throws InterruptException User canceled request.
116 */
117 public boolean checkWellFormedness(InternalServiceJob process, KernelQedeqBo qedeq) throws InterruptException;
118
119 /**
120 * Check if all propositions of this and all required modules have correct formal proofs.
121 *
122 * @param process Working process.
123 * @param qedeq Module to check.
124 * @return Was check successful?
125 * @throws InterruptException Process execution was canceled by user.
126 */
127 public boolean checkFormallyProved(InternalServiceJob process, KernelQedeqBo qedeq) throws InterruptException;
128
129 /**
130 * Execute plugin on given QEDEQ module.
131 *
132 * @param parent Parent service process. Must not be <code>null</code>
133 * @param id Plugin id.
134 * @param qedeq QEDEQ module.
135 * @param data Process data. Additional data beside module.
136 * @return Plugin specific resulting object. Might be <code>null</code>.
137 * @throws InterruptException Process execution was canceled by user.
138 * @throws NullPointerException <code>parent</code> was null.
139 */
140 public Object executePlugin(final InternalServiceJob parent, final String id, final KernelQedeqBo qedeq,
141 final Object data) throws InterruptException;
142
143 /**
144 * Get DAO for reading and writing QEDEQ modules from or to a file.
145 *
146 * @return DAO.
147 */
148 public QedeqFileDao getQedeqFileDao();
149
150 /**
151 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
152 * position.
153 *
154 * @param address This source had a problem.
155 * @param code Failure code.
156 * @param message Textual description of failure.
157 * @param e Wrapped exception.
158 * @return Created list.
159 */
160 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
161 String address, IOException e);
162
163 /**
164 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
165 * position.
166 *
167 * @param address This source had a problem.
168 * @param code Failure code.
169 * @param message Textual description of failure.
170 * @param e Wrapped exception.
171 * @return Created list.
172 */
173 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
174 String address, RuntimeException e);
175
176 /**
177 * Creates a list with a {@link org.qedeq.kernel.se.common.SourceFileException} with dummy
178 * position.
179 *
180 * @param address This source had a problem.
181 * @param code Failure code.
182 * @param message Textual description of failure.
183 * @param e Wrapped exception.
184 * @return Created list.
185 */
186 public SourceFileExceptionList createSourceFileExceptionList(int code, String message,
187 String address, Exception e);
188
189 /**
190 * Get context checker.
191 *
192 * @return Checker for testing if context is valid.
193 */
194 public ContextChecker getContextChecker();
195
196 }
|