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.common;
017
018 import java.io.File;
019 import java.io.IOException;
020 import java.net.URL;
021
022 import org.qedeq.kernel.se.common.ModuleAddress;
023 import org.qedeq.kernel.se.common.ModuleService;
024 import org.qedeq.kernel.se.visitor.InterruptException;
025
026 /**
027 * The main QEDEQ kernel methods are assembled here.
028 *
029 * @author Michael Meyling
030 */
031 public interface KernelServices {
032
033 /**
034 * Remove all modules from memory.
035 *
036 * @return Was removal successful?
037 */
038 public boolean removeAllModules();
039
040 /**
041 * Clear local buffer and all loaded QEDEQ modules.
042 *
043 * @return Was deletion successful?
044 */
045 public boolean clearLocalBuffer();
046
047 /**
048 * Get a certain module. You can check the status to know if the loading was successful.
049 *
050 * @param address Address of module.
051 * @return Wanted module.
052 */
053 public QedeqBo loadModule(ModuleAddress address);
054
055 /**
056 * Get required modules of given module. You can check the status to know if the loading was
057 * successful.
058 *
059 * @param address Address of module.
060 * @return Successful loading.
061 */
062 public boolean loadRequiredModules(ModuleAddress address);
063
064 /**
065 * Load all QEDEQ modules from project web directory for current kernel.
066 *
067 * @return Successful loading.
068 */
069 public boolean loadAllModulesFromQedeq();
070
071 /**
072 * Remove a QEDEQ module from memory.
073 *
074 * @param address Remove module identified by this address.
075 */
076 public void removeModule(ModuleAddress address);
077
078 /**
079 * Get list of all currently loaded QEDEQ modules.
080 *
081 * @return All currently loaded QEDEQ modules.
082 */
083 public ModuleAddress[] getAllLoadedModules();
084
085 /**
086 * Get {@link QedeqBo} for an address.
087 *
088 * @param address Look for this address.
089 * @return Existing or new {@link QedeqBo}.
090 */
091 public QedeqBo getQedeqBo(ModuleAddress address);
092
093 /**
094 * Get source of an QEDEQ module.
095 * If the module was not yet not buffered <code>null</code> is returned.
096 *
097 * @param address Address for QEDEQ module address.
098 * @return Contents of locally buffered QEDEQ module.
099 * @throws IOException Loading failed.
100 */
101 public String getSource(ModuleAddress address) throws IOException;
102
103 /**
104 * Get module address from URL.
105 *
106 * @param url URL for QEDEQ module.
107 * @return Module address.
108 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
109 */
110 public ModuleAddress getModuleAddress(URL url) throws IOException;
111
112 /**
113 * Get module address from URL.
114 *
115 * @param url URL for QEDEQ module.
116 * @return Module address.
117 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
118 */
119 public ModuleAddress getModuleAddress(String url) throws IOException;
120
121 /**
122 * Get module address from URL.
123 *
124 * @param file Local QEDEQ module.
125 * @return Module address.
126 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
127 */
128 public ModuleAddress getModuleAddress(File file) throws IOException;
129
130 /**
131 * Check if all formulas of a QEDEQ module and its required modules are well formed.
132 *
133 * @param address Module to check.
134 * @return Was check successful?
135 */
136 public boolean checkWellFormedness(ModuleAddress address);
137
138 /**
139 * Check if all propositions of this and all required modules have correct formal proofs.
140 *
141 * @param address Module to check.
142 * @return Was check successful?
143 */
144 public boolean checkFormallyProved(ModuleAddress address);
145
146 /**
147 * Get all installed plugins.
148 *
149 * @return Installed plugins.
150 */
151 public ModuleService[] getPlugins();
152
153 /**
154 * Execute plugin on given QEDEQ module.
155 *
156 * @param id Plugin id.
157 * @param address QEDEQ module address.
158 * @param data Process data. Additional data beside module.
159 * @throws InterruptException User canceled further processing.
160 * @return Plugin specific resulting object. Might be <code>null</code>.
161 */
162 public Object executePlugin(final String id, final ModuleAddress address, final Object data)
163 throws InterruptException;
164
165 /**
166 * Clear all plugin warnings and errors for given module.
167 *
168 * @param address QEDEQ module address.
169 */
170 public void clearAllPluginResults(final ModuleAddress address);
171
172 /**
173 * Get information about all service processes.
174 *
175 * @return Result.
176 */
177 public ServiceJob[] getServiceProcesses();
178
179 /**
180 * Get all running service processes. But remember a running process might currently
181 * be blocked.
182 *
183 * @return All service running processes.
184 */
185 public ServiceJob[] getRunningServiceProcesses();
186
187 /**
188 * Stop all currently running service executions.
189 */
190 public void terminateAllServiceProcesses();
191
192 }
|