001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2011, 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 import java.util.Map;
022
023 import org.qedeq.kernel.se.common.ModuleAddress;
024 import org.qedeq.kernel.se.common.Plugin;
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 public void removeAllModules();
037
038 /**
039 * Clear local buffer and all loaded QEDEQ modules.
040 *
041 * @throws IOException Deletion of all buffered file was not successful.
042 */
043 public void clearLocalBuffer() throws IOException;
044
045 /**
046 * Get a certain module. You can check the status to know if the loading was successful.
047 *
048 * @param address Address of module.
049 * @return Wanted module.
050 */
051 public QedeqBo loadModule(ModuleAddress address);
052
053 /**
054 * Get required modules of given module. You can check the status to know if the loading was
055 * successful.
056 *
057 * @param address Address of module.
058 * @return Successful loading.
059 */
060 public boolean loadRequiredModules(ModuleAddress address);
061
062 /**
063 * Load all QEDEQ modules from project web directory for current kernel.
064 *
065 * @return Successful loading.
066 */
067 public boolean loadAllModulesFromQedeq();
068
069 /**
070 * Remove a certain module.
071 *
072 * @param address Address of module.
073 */
074 public void removeModule(ModuleAddress address);
075
076 /**
077 * Get list of all currently loaded QEDEQ modules.
078 *
079 * @return All currently loaded QEDEQ modules.
080 */
081 public ModuleAddress[] getAllLoadedModules();
082
083 /**
084 * Get {@link QedeqBo} for an address.
085 *
086 * @param address Look for this address.
087 * @return Existing or new {@link QedeqBo}.
088 */
089 public QedeqBo getQedeqBo(ModuleAddress address);
090
091 /**
092 * Get source of an QEDEQ module.
093 * If the module was not yet not buffered <code>null</code> is returned.
094 *
095 * @param address Address for QEDEQ module address.
096 * @return Contents of locally buffered QEDEQ module.
097 * @throws IOException Loading failed.
098 */
099 public String getSource(ModuleAddress address) throws IOException;
100
101 /**
102 * Get module address from URL.
103 *
104 * @param url URL for QEDEQ module.
105 * @return Module address.
106 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
107 */
108 public ModuleAddress getModuleAddress(URL url) throws IOException;
109
110 /**
111 * Get module address from URL.
112 *
113 * @param url URL for QEDEQ module.
114 * @return Module address.
115 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
116 */
117 public ModuleAddress getModuleAddress(String url) throws IOException;
118
119 /**
120 * Get module address from URL.
121 *
122 * @param file Local QEDEQ module.
123 * @return Module address.
124 * @throws IOException URL has not the correct format for referencing a QEDEQ module.
125 */
126 public ModuleAddress getModuleAddress(File file) throws IOException;
127
128 /**
129 * Checks if all formulas of a QEDEQ module and its required modules are well formed.
130 *
131 * @param address Module to check.
132 * @return Was check successful?
133 */
134 public boolean checkModule(ModuleAddress address);
135
136 /**
137 * Get all installed plugins.
138 *
139 * @return Installed plugins.
140 */
141 public Plugin[] getPlugins();
142
143 /**
144 * Execute plugin on given QEDEQ module.
145 *
146 * @param id Plugin id.
147 * @param address QEDEQ module address.
148 * @param parameters Plugin specific parameters. Might be <code>null</code>.
149 * @return Plugin specific resulting object. Might be <code>null</code>.
150 */
151 public Object executePlugin(final String id, final ModuleAddress address, final Map parameters);
152
153 /**
154 * Clear all plugin warnings and errors for given module.
155 *
156 * @param address QEDEQ module address.
157 */
158 public void clearAllPluginResults(final ModuleAddress address);
159
160 /**
161 * Get information about all service processes.
162 *
163 * @return Result.
164 */
165 public ServiceProcess[] getServiceProcesses();
166
167 }
|