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