Hilbert II - Version 0.03.09

org.qedeq.kernel.bo.control
Class DefaultInternalKernelServices

java.lang.Object
  extended byorg.qedeq.kernel.bo.control.DefaultInternalKernelServices
All Implemented Interfaces:
InternalKernelServices, KernelServices

public class DefaultInternalKernelServices
extends Object
implements KernelServices, InternalKernelServices

This class provides access methods for loading QEDEQ modules.

Version:
$Revision: 1.1 $

Constructor Summary
DefaultInternalKernelServices(KernelProperties kernel, ModuleLoader loader)
          Constructor.
 
Method Summary
 void autoReloadLastSessionChecked()
          If configured load all QEDEQ modules that where successfully loaded the last time.
 boolean checkModule(ModuleAddress address)
          Checks if all formulas of a QEDEQ module and its required modules are well formed.
 void clearLocalBuffer()
          Clear local file buffer and all loaded QEDEQ modules.
 ModuleAddress[] getAllLoadedModules()
          Get list of all currently loaded QEDEQ modules.
 File getBufferDirectory()
          Get buffer directory for QEDEQ module files.
 File getGenerationDirectory()
          Get directory for generated files.
 KernelQedeqBo getKernelQedeqBo(ModuleAddress address)
          Get KernelQedeqBo for an address.
 File getLocalFilePath(ModuleAddress address)
          Transform an URL address into a relative local file path.
 ModuleAddress getModuleAddress(File file)
          Get module address from URL.
 ModuleAddress getModuleAddress(String url)
          Get module address from URL.
 ModuleAddress getModuleAddress(URL url)
          Get module address from URL.
 QedeqBo getQedeqBo(ModuleAddress address)
          Get QedeqBo for an address.
 String getSource(ModuleAddress address)
          Get source of an QEDEQ module.
 String[] getSourceFileExceptionList(ModuleAddress address)
          Get description of source file exception list.
 boolean loadAllModulesFromQedeq()
          Load all QEDEQ modules from project web directory for current kernel.
 QedeqBo loadModule(ModuleAddress address)
          Get a certain module.
 KernelQedeqBo loadModule(ModuleAddress parent, Specification spec)
          Load specified QEDEQ module from QEDEQ parent module.
 boolean loadPreviouslySuccessfullyLoadedModules()
          Load all previously checked QEDEQ modules.
 void loadRequiredModules(ModuleAddress address)
          Get a certain module.
 void removeAllModules()
          Remove all modules from memory.
 void removeModule(KernelQedeqBo prop)
          Remove a QEDEQ module from memory.
 void removeModule(ModuleAddress address)
          Remove a QEDEQ module from memory.
 void startup()
          Initialisation of services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInternalKernelServices

public DefaultInternalKernelServices(KernelProperties kernel,
                                     ModuleLoader loader)
Constructor.

Parameters:
kernel - For kernel access.
loader - For loading QEDEQ modules.
Method Detail

startup

public void startup()
Description copied from interface: InternalKernelServices
Initialisation of services. This method should be called from the kernel directly after switching into ready state. Calling this method in ready state is not supported. TODO mime 20070411: what about an appropriate closing method? TODO mime 20080213: should not be here! Implementation detail!

Specified by:
startup in interface InternalKernelServices

autoReloadLastSessionChecked

public void autoReloadLastSessionChecked()
If configured load all QEDEQ modules that where successfully loaded the last time.


removeAllModules

public void removeAllModules()
Description copied from interface: KernelServices
Remove all modules from memory.

Specified by:
removeAllModules in interface KernelServices

removeModule

public void removeModule(ModuleAddress address)
Remove a QEDEQ module from memory.

Specified by:
removeModule in interface KernelServices
Parameters:
address - Remove module identified by this address.

removeModule

public void removeModule(KernelQedeqBo prop)
Remove a QEDEQ module from memory. This method must block all other methods and if this method runs no other is allowed to run

Parameters:
prop - Remove module identified by this property.

clearLocalBuffer

public void clearLocalBuffer()
                      throws IOException
Clear local file buffer and all loaded QEDEQ modules.

Specified by:
clearLocalBuffer in interface KernelServices
Throws:
IOException - Deletion of all buffered file was not successful.

loadModule

public QedeqBo loadModule(ModuleAddress address)
                   throws SourceFileExceptionList
Get a certain module.

Specified by:
loadModule in interface KernelServices
Parameters:
address - Address of module.
Returns:
Wanted module.
Throws:
SourceFileExceptionList - Module could not be successfully loaded.

loadModule

public KernelQedeqBo loadModule(ModuleAddress parent,
                                Specification spec)
                         throws SourceFileExceptionList
Load specified QEDEQ module from QEDEQ parent module.

Parameters:
parent - Parent module address.
spec - Specification for another QEDEQ module.
Returns:
Loaded module.
Throws:
SourceFileExceptionList - Loading failed.

getAllLoadedModules

public ModuleAddress[] getAllLoadedModules()
Description copied from interface: KernelServices
Get list of all currently loaded QEDEQ modules.

Specified by:
getAllLoadedModules in interface KernelServices
Returns:
All currently loaded QEDEQ modules.

loadRequiredModules

public void loadRequiredModules(ModuleAddress address)
                         throws SourceFileExceptionList
Description copied from interface: KernelServices
Get a certain module.

Specified by:
loadRequiredModules in interface KernelServices
Parameters:
address - Address of module.
Throws:
SourceFileExceptionList - Required modules could not be successfully loaded. This can also happen if the required modules references form a circle.

loadPreviouslySuccessfullyLoadedModules

public boolean loadPreviouslySuccessfullyLoadedModules()
Load all previously checked QEDEQ modules.

Returns:
Successfully reloaded all modules.

loadAllModulesFromQedeq

public boolean loadAllModulesFromQedeq()
Description copied from interface: KernelServices
Load all QEDEQ modules from project web directory for current kernel.

Specified by:
loadAllModulesFromQedeq in interface KernelServices
Returns:
Successful loading.

getLocalFilePath

public final File getLocalFilePath(ModuleAddress address)
Transform an URL address into a relative local file path. This can also be another file name.

Specified by:
getLocalFilePath in interface InternalKernelServices
Parameters:
address - Transform this URL.
Returns:
Result of transformation.

getBufferDirectory

public File getBufferDirectory()
Description copied from interface: InternalKernelServices
Get buffer directory for QEDEQ module files.

Specified by:
getBufferDirectory in interface InternalKernelServices
Returns:
buffer directory.

getGenerationDirectory

public File getGenerationDirectory()
Description copied from interface: InternalKernelServices
Get directory for generated files.

Specified by:
getGenerationDirectory in interface InternalKernelServices
Returns:
Generation directory.

getKernelQedeqBo

public KernelQedeqBo getKernelQedeqBo(ModuleAddress address)
Description copied from interface: InternalKernelServices
Get KernelQedeqBo for an address.

Specified by:
getKernelQedeqBo in interface InternalKernelServices
Parameters:
address - Look for this address.
Returns:
Existing or new KernelQedeqBo, if address is malformed null is returned.

getQedeqBo

public QedeqBo getQedeqBo(ModuleAddress address)
Description copied from interface: KernelServices
Get QedeqBo for an address.

Specified by:
getQedeqBo in interface KernelServices
Parameters:
address - Look for this address.
Returns:
Existing or new QedeqBo, if address is maleformed null is returned.

getModuleAddress

public ModuleAddress getModuleAddress(URL url)
                               throws IOException
Description copied from interface: KernelServices
Get module address from URL.

Specified by:
getModuleAddress in interface KernelServices
Parameters:
url - URL for QEDEQ module.
Returns:
Module address.
Throws:
IOException - URL has not the correct format for referencing a QEDEQ module.

getModuleAddress

public ModuleAddress getModuleAddress(String url)
                               throws IOException
Description copied from interface: KernelServices
Get module address from URL.

Specified by:
getModuleAddress in interface KernelServices
Parameters:
url - URL for QEDEQ module.
Returns:
Module address.
Throws:
IOException - URL has not the correct format for referencing a QEDEQ module.

getModuleAddress

public ModuleAddress getModuleAddress(File file)
                               throws IOException
Description copied from interface: KernelServices
Get module address from URL.

Specified by:
getModuleAddress in interface KernelServices
Parameters:
file - Local QEDEQ module.
Returns:
Module address.
Throws:
IOException - URL has not the correct format for referencing a QEDEQ module.

getSource

public String getSource(ModuleAddress address)
                 throws IOException
Description copied from interface: KernelServices
Get source of an QEDEQ module. If the module was not yet not buffered null is returned.

Specified by:
getSource in interface KernelServices
Parameters:
address - Address for QEDEQ module address.
Returns:
Contents of locally buffered QEDEQ module.
Throws:
IOException - Loading failed.

checkModule

public boolean checkModule(ModuleAddress address)
Description copied from interface: KernelServices
Checks if all formulas of a QEDEQ module and its required modules are well formed.

Specified by:
checkModule in interface KernelServices
Parameters:
address - Module to check.
Returns:
Was check successful?

getSourceFileExceptionList

public String[] getSourceFileExceptionList(ModuleAddress address)
Description copied from interface: KernelServices
Get description of source file exception list.

Specified by:
getSourceFileExceptionList in interface KernelServices
Parameters:
address - Get description for this module exceptions.
Returns:
Error description and location.

Hilbert II - Version 0.03.09

©left GNU General Public Licence
All Rights Reserved.