QedeqBo.java
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 org.qedeq.kernel.se.base.module.Qedeq;
019 import org.qedeq.kernel.se.common.DependencyState;
020 import org.qedeq.kernel.se.common.LoadingState;
021 import org.qedeq.kernel.se.common.LogicalModuleState;
022 import org.qedeq.kernel.se.common.ModuleAddress;
023 import org.qedeq.kernel.se.common.SourceFileExceptionList;
024 
025 
026 /**
027  * Represents a module and its states.
028  *
029  @author  Michael Meyling
030  */
031 public interface QedeqBo {
032 
033     /**
034      * Has the module any basic failures? This includes errors during loading the module, during load
035      * of imported modules and logical checking. This includes no plugin errors.
036      *
037      @return  wWre there any basic errors?
038      */
039     public boolean hasBasicFailures();
040 
041     /**
042      * Is this a error state the module is in?
043      *
044      @return  Were there any errors?
045      */
046     public boolean hasErrors();
047 
048     /**
049      * Is this a warning state the module is in?
050      *
051      @return  Were there any warnings?
052      */
053     public boolean hasWarnings();
054 
055     /**
056      * Get {@link ModuleAddress} of module.
057      *
058      @return  Address of module.
059      */
060     public ModuleAddress getModuleAddress();
061 
062     /**
063      * Get module loading state.
064      *
065      @return  Module state.
066      */
067     public LoadingState getLoadingState();
068 
069     /**
070      * Set completeness percentage.
071      *
072      @return  completeness    Completeness of loading into memory in percent.
073      */
074     public int getLoadingCompleteness();
075 
076    /**
077     * Get module dependency state.
078     *
079     @return  module state.
080     */
081    public DependencyState getDependencyState();
082 
083     /**
084      * Get module logical state.
085      *
086      @return  module state.
087      */
088     public LogicalModuleState getLogicalState();
089 
090     /**
091      * Get error list.
092      *
093      @return  Error list.
094      */
095     public SourceFileExceptionList getErrors();
096 
097     /**
098      * Get warning list.
099      *
100      @return  Warning list.
101      */
102     public SourceFileExceptionList getWarnings();
103 
104     /**
105      * Get module state description.
106      *
107      @return  module state description.
108      */
109     public String getStateDescription();
110 
111     /**
112      * Get name of module.
113      *
114      @return  module name.
115      */
116     public String getName();
117 
118     /**
119      * Get rule version information.
120      *
121      @return  rule version.
122      */
123     public String getRuleVersion();
124 
125     /**
126      * Get original URL of module.
127      *
128      @return  URL of module.
129      */
130     public String getUrl();
131 
132     /**
133      * Is this module already loaded?
134      *
135      @return  Is this module already loaded?
136      */
137     public boolean isLoaded();
138 
139     /**
140      * Get module. Works only if module is already completely loaded.
141      *
142      @return  QEDEQ module if it is already loaded.
143      */
144     public Qedeq getQedeq();
145 
146     /**
147      * Are all required modules loaded?
148      *
149      @return  Are all required modules loaded?
150      */
151     public boolean hasLoadedRequiredModules();
152 
153     /**
154      * Get labels and URLs of all referenced modules. Only available if module has loaded
155      * all required modules. Otherwise a runtime exception is thrown.
156      *
157      @return  URLs of all referenced modules.
158      @throws  IllegalStateException   Module not yet loaded.
159      */
160     public ModuleReferenceList getRequiredModules();
161 
162     /**
163      * Was the module checked?
164      *
165      * TODO 20110329 m31: this is currently only a check for "are all formulas well formed and dependencies ok"
166      *
167      @return  Module is checked?
168      */
169     public boolean isChecked();
170 
171     /**
172      * Get all supported languages for this QEDEQ module.
173      *
174      @return  Array of supported languages.
175      */
176     public String[] getSupportedLanguages();
177 
178     /**
179      * Is the given language supported.
180      *
181      @param   language    Language.
182      @return  Is this language supported?
183      */
184     public boolean isSupportedLanguage(String language);
185 
186     /**
187      * Get default language for this QEDEQ module. This should be the original language
188      * of the module before it was translated. This value should be also within
189      {@link #getSupportedLanguages()}.
190      *
191      @return  Original language.
192      */
193     public String getOriginalLanguage();
194 
195 }