|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| KernelServices | Line # 32 | 0 | 0 | - |
-1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* This file is part of the project "Hilbert II" - http://www.qedeq.org | |
| 2 | * | |
| 3 | * Copyright 2000-2010, 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.context; | |
| 17 | ||
| 18 | import java.io.File; | |
| 19 | import java.io.IOException; | |
| 20 | import java.net.URL; | |
| 21 | import java.util.Map; | |
| 22 | ||
| 23 | import org.qedeq.kernel.bo.QedeqBo; | |
| 24 | import org.qedeq.kernel.common.ModuleAddress; | |
| 25 | import org.qedeq.kernel.common.SourceFileExceptionList; | |
| 26 | ||
| 27 | /** | |
| 28 | * The main QEDEQ kernel methods are assembled here. | |
| 29 | * | |
| 30 | * @author Michael Meyling | |
| 31 | */ | |
| 32 | public interface KernelServices { | |
| 33 | ||
| 34 | /** | |
| 35 | * Initialization of services. This method should be called from the kernel | |
| 36 | * directly after switching into ready state. Calling this method in ready state is not | |
| 37 | * supported. | |
| 38 | * | |
| 39 | * TODO m31 20070411: what about an appropriate closing method? | |
| 40 | * TODO m31 20080213: should not be here! Implementation detail! | |
| 41 | */ | |
| 42 | public void startupServices(); | |
| 43 | ||
| 44 | /** | |
| 45 | * Remove all modules from memory. | |
| 46 | */ | |
| 47 | public void removeAllModules(); | |
| 48 | ||
| 49 | /** | |
| 50 | * Clear local buffer and all loaded QEDEQ modules. | |
| 51 | * | |
| 52 | * @throws IOException Deletion of all buffered file was not successful. | |
| 53 | */ | |
| 54 | public void clearLocalBuffer() throws IOException; | |
| 55 | ||
| 56 | /** | |
| 57 | * Get a certain module. You can check the status to know if the loading was successful. | |
| 58 | * | |
| 59 | * @param address Address of module. | |
| 60 | * @return Wanted module. | |
| 61 | * @throws SourceFileExceptionList Loading or QEDEQ module failed. | |
| 62 | */ | |
| 63 | public QedeqBo loadModule(ModuleAddress address) throws SourceFileExceptionList; | |
| 64 | ||
| 65 | /** | |
| 66 | * Get a certain module. | |
| 67 | * | |
| 68 | * @param address Address of module. | |
| 69 | * @throws SourceFileExceptionList Required modules could not be successfully loaded. | |
| 70 | * This can also happen if the required modules references | |
| 71 | * form a circle. | |
| 72 | */ | |
| 73 | public void loadRequiredModules(ModuleAddress address) throws SourceFileExceptionList; | |
| 74 | ||
| 75 | /** | |
| 76 | * Load all QEDEQ modules from project web directory for current kernel. | |
| 77 | * | |
| 78 | * @return Successful loading. | |
| 79 | */ | |
| 80 | public boolean loadAllModulesFromQedeq(); | |
| 81 | ||
| 82 | /** | |
| 83 | * Remove a certain module. | |
| 84 | * | |
| 85 | * @param address Address of module. | |
| 86 | */ | |
| 87 | public void removeModule(ModuleAddress address); | |
| 88 | ||
| 89 | /** | |
| 90 | * Get list of all currently loaded QEDEQ modules. | |
| 91 | * | |
| 92 | * @return All currently loaded QEDEQ modules. | |
| 93 | */ | |
| 94 | public ModuleAddress[] getAllLoadedModules(); | |
| 95 | ||
| 96 | /** | |
| 97 | * Get {@link QedeqBo} for an address. | |
| 98 | * | |
| 99 | * @param address Look for this address. | |
| 100 | * @return Existing or new {@link QedeqBo}. | |
| 101 | */ | |
| 102 | public QedeqBo getQedeqBo(ModuleAddress address); | |
| 103 | ||
| 104 | /** | |
| 105 | * Get source of an QEDEQ module. | |
| 106 | * If the module was not yet not buffered <code>null</code> is returned. | |
| 107 | * | |
| 108 | * @param address Address for QEDEQ module address. | |
| 109 | * @return Contents of locally buffered QEDEQ module. | |
| 110 | * @throws IOException Loading failed. | |
| 111 | */ | |
| 112 | public String getSource(ModuleAddress address) throws IOException; | |
| 113 | ||
| 114 | /** | |
| 115 | * Get module address from URL. | |
| 116 | * | |
| 117 | * @param url URL for QEDEQ module. | |
| 118 | * @return Module address. | |
| 119 | * @throws IOException URL has not the correct format for referencing a QEDEQ module. | |
| 120 | */ | |
| 121 | public ModuleAddress getModuleAddress(URL url) throws IOException; | |
| 122 | ||
| 123 | /** | |
| 124 | * Get module address from URL. | |
| 125 | * | |
| 126 | * @param url URL for QEDEQ module. | |
| 127 | * @return Module address. | |
| 128 | * @throws IOException URL has not the correct format for referencing a QEDEQ module. | |
| 129 | */ | |
| 130 | public ModuleAddress getModuleAddress(String url) throws IOException; | |
| 131 | ||
| 132 | /** | |
| 133 | * Get module address from URL. | |
| 134 | * | |
| 135 | * @param file Local QEDEQ module. | |
| 136 | * @return Module address. | |
| 137 | * @throws IOException URL has not the correct format for referencing a QEDEQ module. | |
| 138 | */ | |
| 139 | public ModuleAddress getModuleAddress(File file) throws IOException; | |
| 140 | ||
| 141 | /** | |
| 142 | * Checks if all formulas of a QEDEQ module and its required modules are well formed. | |
| 143 | * | |
| 144 | * @param address Module to check. | |
| 145 | * @return Was check successful? | |
| 146 | */ | |
| 147 | public boolean checkModule(ModuleAddress address); | |
| 148 | ||
| 149 | /** | |
| 150 | * Execute plugin on given QEDEQ module. | |
| 151 | * | |
| 152 | * @param name Plugin name | |
| 153 | * @param address QEDEQ module address. | |
| 154 | * @param parameters Plugin specific parameters. Might be <code>null</code>. | |
| 155 | * @return Plugin specific resulting object. Might be <code>null</code>. | |
| 156 | */ | |
| 157 | public Object executePlugin(final String name, final ModuleAddress address, final Map parameters); | |
| 158 | ||
| 159 | } | |
|
||||||||||