|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
InternalKernelServices | Line # 36 | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
No Tests | |||
1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
2 | * | |
3 | * Copyright 2000-2013, 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 | ||
21 | import org.qedeq.base.io.Parameters; | |
22 | import org.qedeq.kernel.bo.common.KernelProperties; | |
23 | import org.qedeq.kernel.se.base.module.Specification; | |
24 | import org.qedeq.kernel.se.common.ModuleAddress; | |
25 | import org.qedeq.kernel.se.common.Service; | |
26 | import org.qedeq.kernel.se.common.SourceFileExceptionList; | |
27 | import org.qedeq.kernel.se.config.QedeqConfig; | |
28 | import org.qedeq.kernel.se.visitor.ContextChecker; | |
29 | import org.qedeq.kernel.se.visitor.InterruptException; | |
30 | ||
31 | /** | |
32 | * The kernel internal service methods are assembled here. Needed by the kernel and its helpers. | |
33 | * | |
34 | * @author Michael Meyling | |
35 | */ | |
36 | public interface InternalKernelServices extends KernelProperties { | |
37 | ||
38 | /** | |
39 | * Get access to configuration parameters. | |
40 | * | |
41 | * @return Configuration access. | |
42 | */ | |
43 | public QedeqConfig getConfig(); | |
44 | ||
45 | /** | |
46 | * Get buffer directory for QEDEQ module files. | |
47 | * | |
48 | * @return buffer directory. | |
49 | */ | |
50 | public File getBufferDirectory(); | |
51 | ||
52 | /** | |
53 | * Get directory for generated files. | |
54 | * | |
55 | * @return Generation directory. | |
56 | */ | |
57 | public File getGenerationDirectory(); | |
58 | ||
59 | /** | |
60 | * Get {@link KernelQedeqBo} for an address. | |
61 | * | |
62 | * @param address Look for this address. | |
63 | * @return Existing or new {@link KernelQedeqBo}, if address is malformed | |
64 | * <code>null</code> is returned. | |
65 | */ | |
66 | public KernelQedeqBo getKernelQedeqBo(ModuleAddress address); | |
67 | ||
68 | /** | |
69 | * Transform an URL address into a local file path where the QEDEQ module is buffered. | |
70 | * If the QEDEQ module is a local file the path to that file is given. | |
71 | * | |
72 | * @param address Get local address for this QEDEQ module address. | |
73 | * @return Local file path for that <code>address</code>. | |
74 | */ | |
75 | public File getLocalFilePath(ModuleAddress address); | |
76 | ||
77 | /** | |
78 | * Load QEDEQ module. | |
79 | * | |
80 | * @param process Working process. | |
81 | * @param address Load module from this address. | |
82 | * @return BO for QEDEQ module. Loading still might have failed. Check status. | |
83 | * @throws InterruptException User canceled request. | |
84 | */ | |
85 | public KernelQedeqBo loadKernelModule(final InternalServiceProcess process, final ModuleAddress address) | |
86 | throws InterruptException; | |
87 | ||
88 | /** | |
89 | * Load specified QEDEQ module from QEDEQ parent module. | |
90 | * | |
91 | * @param process Working process. | |
92 | * @param parent Parent module address. | |
93 | * @param spec Specification for another QEDEQ module. | |
94 | * @return Loaded module. | |
95 | * @throws SourceFileExceptionList Loading failed. | |
96 | * @throws InterruptException User canceled request. | |
97 | */ | |
98 | public KernelQedeqBo loadModule(InternalServiceProcess process, ModuleAddress parent, | |
99 | Specification spec) throws SourceFileExceptionList, InterruptException; | |
100 | ||
101 | /** | |
102 | * Get required modules of given module. You can check the status to know if the loading was | |
103 | * successful. | |
104 | * | |
105 | * @param process Working process. | |
106 | * @param qedeq Module to check. | |
107 | * @return Successful loading. | |
108 | * @throws InterruptException User canceled request. | |
109 | */ | |
110 | public boolean loadRequiredModules(InternalServiceProcess process, KernelQedeqBo qedeq) throws InterruptException; | |
111 | ||
112 | /** | |
113 | * Check if all formulas of a QEDEQ module and its required modules are well formed. | |
114 | * | |
115 | * @param process Working process. | |
116 | * @param qedeq Module to check. | |
117 | * @return Was check successful? | |
118 | */ | |
119 | public boolean checkWellFormedness(InternalServiceProcess process, KernelQedeqBo qedeq); | |
120 | ||
121 | /** | |
122 | * Check if all propositions of this and all required modules have correct formal proofs. | |
123 | * | |
124 | * @param process Working process. | |
125 | * @param qedeq Module to check. | |
126 | * @return Was check successful? | |
127 | */ | |
128 | public boolean checkFormallyProved(InternalServiceProcess process, KernelQedeqBo qedeq); | |
129 | ||
130 | /** | |
131 | * Execute plugin on given QEDEQ module. | |
132 | * | |
133 | * @param parent Parent service process. Might be <code>null</code> | |
134 | * @param id Plugin id. | |
135 | * @param qedeq QEDEQ module. | |
136 | * @param data Process data. Additional data beside module. | |
137 | * @return Plugin specific resulting object. Might be <code>null</code>. | |
138 | * @throws InterruptException Process execution was canceled by user. | |
139 | */ | |
140 | public Object executePlugin(final InternalServiceProcess 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 | public InternalServiceProcess createServiceProcess(final String action); | |
197 | ||
198 | /** | |
199 | * Create service process for given module. Locks also module access. | |
200 | * | |
201 | * @param service The service that runs in current thread. | |
202 | * @param qedeq QEDEQ module for service. | |
203 | * @param configParameters Config parameters for the service. | |
204 | * @param parameters Parameter for this service call. | |
205 | * @param process We run in this process. | |
206 | * @param parent Parent process that creates a new one. | |
207 | * @return Created service call. | |
208 | * @throws InterruptException Locking of module was canceled by user. | |
209 | */ | |
210 | public InternalServiceCall createServiceCall(Service service, | |
211 | final KernelQedeqBo qedeq, final Parameters configParameters, final Parameters parameters, | |
212 | final InternalServiceProcess process, final InternalServiceCall parent) | |
213 | throws InterruptException; | |
214 | ||
215 | ||
216 | public boolean lockModule(InternalServiceProcess process, KernelQedeqBo qedeq, Service service) | |
217 | throws InterruptException; | |
218 | ||
219 | public boolean unlockModule(InternalServiceProcess process, KernelQedeqBo qedeq); | |
220 | ||
221 | } |
|