ucot.core
Class Core

java.lang.Object
  extended by ucot.ModuleProperties
      extended by ucot.core.Core
All Implemented Interfaces:
ControlInterface, ModulePropertyInterface

public class Core
extends ModuleProperties
implements ControlInterface

This is the implementation of core of the program, the controller of the program.

Author:
UCOT

Field Summary
private  AnalyzeModel analyzeModel
           
static java.lang.String CANNOT_ADD_SELECTED_USE_CASE_ERROR
           
static java.lang.String CANNOT_LOAD_FILES_ERROR
           
private  HeuristicInterface currentHeuristic
           
private  ParserInterface currentParser
           
static java.lang.String FILE_NOT_FOUND
           
static java.lang.String FILE_NOT_SAVED_ERROR
           
static java.lang.String FILE_NOT_WRITABLE_ERROR
           
static java.lang.String FILEFORMAT_NOT_SUPPORTED_ERROR
           
private  java.util.Vector<HeuristicInterface> heuristics
           
private  InputCollection inputs
           
private  java.util.logging.Logger logger
           
private  java.util.Vector<OutputInterface> outputs
           
private  java.util.Vector<ParserInterface> parsers
           
protected static java.util.Vector<java.lang.Runnable> parsingThreads
           
private  ProgressBarInterface progressBar
           
private  UseCaseCollection useCases
           
private  UIInterface userInterface
           
 
Fields inherited from class ucot.ModuleProperties
properties, propertiesURL
 
Constructor Summary
Core()
          Default constructor for UCOT core component.
 
Method Summary
 void addToAnalyzeModel(java.util.Vector<UseCase> useCases)
          Requests core to parse use case, perform heuristic on it and add it to given analyze model.
 void addToAnalyzeModel(java.util.Vector<UseCase> useCases, ParserInterface parser, HeuristicInterface heuristic)
          Requests core to parse use case, perform heuristic on it and add it to given analyze model.
 void applyProperties()
          Applies current properties for the module.
 void clearAnalyzeModel()
          Clears the whole current analyze model.
private  HeuristicInterface findHeuristic(java.lang.String name)
          Helper method for applyProperties to find heuristics by name.
private  ParserInterface findParser(java.lang.String name)
          Helper method for applyProperties to find parsers by name.
 AnalyzeModel getAnalyzeModel()
          Returns vector of all analyze models from core.
 HeuristicInterface getCurrentHeuristic()
          Returns the current heuristic.
 ParserInterface getCurrentParser()
          Returns the current default parser.
static java.lang.String getFileNotFoundMessage(java.net.URL file)
           
 java.util.Vector<HeuristicInterface> getHeuristics()
          Returns a list of heuristics that are available.
 InputCollection getInputs()
          Returns InputCollection of inputs.
 java.util.Vector<OutputInterface> getOutputs()
          Returns a list of output adapters available.
 java.util.Vector<ParserInterface> getParsers()
          Returns a vector of parsers that are available.
 UseCaseCollection getUseCaseCollection()
          Returns all loaded use cases.
 void loadAnalyzeModel(java.net.URL url)
          Loads analyze model from a file.
 java.util.Properties loadDefaultProperties()
          Method which returns the factory default properties for the module.
 void loadProperties()
          Loads settings from the current properties XML file.
 void loadUseCases(java.net.URL url)
          Loads use cases from file.
static void main(java.lang.String[] args)
          Main method that starts the UCOT core.
 void output(java.net.URL url, OutputInterface output, AnalyzeModel model)
          Exports given analyze model to given url using given output adapter.
 void reloadUseCases(java.net.URL url)
          Reloads use cases from file.
private  void runParserAndHeuristic(java.lang.Runnable runnable, java.util.Vector<UseCase> useCases, ParserInterface parser, HeuristicInterface heuristic)
          This method runs the parser and heuristic in a single thread.
 void saveAnalyzeModel(java.net.URL url)
          Saves analyze model to a file.
 void saveProperties()
          Saves current properties to the properties XML file.
 void setCurrentHeuristic(HeuristicInterface heuristic)
          Sets the default heuristic to use.
 void setCurrentParser(ParserInterface parser)
          Sets the default parser to use.
 void shutdown()
          Shuts down the program.
 
Methods inherited from class ucot.ModuleProperties
getProperties, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucot.ModulePropertyInterface
getProperties, setProperties
 

Field Detail

FILEFORMAT_NOT_SUPPORTED_ERROR

public static final java.lang.String FILEFORMAT_NOT_SUPPORTED_ERROR

CANNOT_LOAD_FILES_ERROR

public static final java.lang.String CANNOT_LOAD_FILES_ERROR

CANNOT_ADD_SELECTED_USE_CASE_ERROR

public static final java.lang.String CANNOT_ADD_SELECTED_USE_CASE_ERROR

FILE_NOT_SAVED_ERROR

public static final java.lang.String FILE_NOT_SAVED_ERROR

FILE_NOT_WRITABLE_ERROR

public static final java.lang.String FILE_NOT_WRITABLE_ERROR

FILE_NOT_FOUND

public static final java.lang.String FILE_NOT_FOUND

inputs

private InputCollection inputs

useCases

private UseCaseCollection useCases

analyzeModel

private AnalyzeModel analyzeModel

heuristics

private java.util.Vector<HeuristicInterface> heuristics

parsers

private java.util.Vector<ParserInterface> parsers

outputs

private java.util.Vector<OutputInterface> outputs

userInterface

private UIInterface userInterface

currentParser

private ParserInterface currentParser

currentHeuristic

private HeuristicInterface currentHeuristic

progressBar

private ProgressBarInterface progressBar

logger

private java.util.logging.Logger logger

parsingThreads

protected static java.util.Vector<java.lang.Runnable> parsingThreads
Constructor Detail

Core

public Core()
Default constructor for UCOT core component. This initializes the core component by loading all available modules.

Method Detail

getFileNotFoundMessage

public static java.lang.String getFileNotFoundMessage(java.net.URL file)

main

public static void main(java.lang.String[] args)
Main method that starts the UCOT core.

Parameters:
args - Command line arguments.

shutdown

public void shutdown()
Description copied from interface: ControlInterface
Shuts down the program. The shutdown routine triggers all possible autosave actions and after that the core gets rid of all its modules.

Specified by:
shutdown in interface ControlInterface

loadUseCases

public void loadUseCases(java.net.URL url)
Description copied from interface: ControlInterface
Loads use cases from file.

Specified by:
loadUseCases in interface ControlInterface
Parameters:
url - URL of the file.

loadAnalyzeModel

public void loadAnalyzeModel(java.net.URL url)
                      throws java.io.IOException
Description copied from interface: ControlInterface
Loads analyze model from a file.

Specified by:
loadAnalyzeModel in interface ControlInterface
Parameters:
url - URL of the file containing analyze model.
Throws:
java.io.IOException - If something goes wrong with loading use the analyze model from given URL.

getUseCaseCollection

public UseCaseCollection getUseCaseCollection()
Description copied from interface: ControlInterface
Returns all loaded use cases.

Specified by:
getUseCaseCollection in interface ControlInterface
Returns:
Use case colletion.

clearAnalyzeModel

public void clearAnalyzeModel()
Description copied from interface: ControlInterface
Clears the whole current analyze model. Basically this is similiar to creating a whole new empty analyze model.

Specified by:
clearAnalyzeModel in interface ControlInterface

runParserAndHeuristic

private void runParserAndHeuristic(java.lang.Runnable runnable,
                                   java.util.Vector<UseCase> useCases,
                                   ParserInterface parser,
                                   HeuristicInterface heuristic)
This method runs the parser and heuristic in a single thread.

Parameters:
runnable - Runnable where this thread is running.
useCases - Use cases to be parsed.
parser - Parser to use.
heuristic - Heuristic to use.

addToAnalyzeModel

public void addToAnalyzeModel(java.util.Vector<UseCase> useCases,
                              ParserInterface parser,
                              HeuristicInterface heuristic)
Description copied from interface: ControlInterface
Requests core to parse use case, perform heuristic on it and add it to given analyze model.

Specified by:
addToAnalyzeModel in interface ControlInterface
Parameters:
useCases - Use case to work magic on.
parser - Parser to use.
heuristic - Heuristic to use.

addToAnalyzeModel

public void addToAnalyzeModel(java.util.Vector<UseCase> useCases)
Description copied from interface: ControlInterface
Requests core to parse use case, perform heuristic on it and add it to given analyze model.

Specified by:
addToAnalyzeModel in interface ControlInterface
Parameters:
useCases - Use cases to work magic on.

getAnalyzeModel

public AnalyzeModel getAnalyzeModel()
Description copied from interface: ControlInterface
Returns vector of all analyze models from core.

Specified by:
getAnalyzeModel in interface ControlInterface
Returns:
Specified analyze model.

getParsers

public java.util.Vector<ParserInterface> getParsers()
Description copied from interface: ControlInterface
Returns a vector of parsers that are available.

Specified by:
getParsers in interface ControlInterface
Returns:
Vector containing parser adapters.

getHeuristics

public java.util.Vector<HeuristicInterface> getHeuristics()
Description copied from interface: ControlInterface
Returns a list of heuristics that are available.

Specified by:
getHeuristics in interface ControlInterface
Returns:
Vector containing heuristic adapter.

getOutputs

public java.util.Vector<OutputInterface> getOutputs()
Description copied from interface: ControlInterface
Returns a list of output adapters available.

Specified by:
getOutputs in interface ControlInterface
Returns:
Vector containing output adapter names.

getInputs

public InputCollection getInputs()
Description copied from interface: ControlInterface
Returns InputCollection of inputs.

Specified by:
getInputs in interface ControlInterface
Returns:
InputCollection.

setCurrentParser

public void setCurrentParser(ParserInterface parser)
Description copied from interface: ControlInterface
Sets the default parser to use.

Specified by:
setCurrentParser in interface ControlInterface
Parameters:
parser - Parser to be used by default.

setCurrentHeuristic

public void setCurrentHeuristic(HeuristicInterface heuristic)
Description copied from interface: ControlInterface
Sets the default heuristic to use.

Specified by:
setCurrentHeuristic in interface ControlInterface
Parameters:
heuristic - Default heuristic to be used.

getCurrentParser

public ParserInterface getCurrentParser()
Description copied from interface: ControlInterface
Returns the current default parser.

Specified by:
getCurrentParser in interface ControlInterface
Returns:
Default parser.

getCurrentHeuristic

public HeuristicInterface getCurrentHeuristic()
Description copied from interface: ControlInterface
Returns the current heuristic.

Specified by:
getCurrentHeuristic in interface ControlInterface
Returns:
Current heuristic.

output

public void output(java.net.URL url,
                   OutputInterface output,
                   AnalyzeModel model)
            throws java.lang.Exception
Description copied from interface: ControlInterface
Exports given analyze model to given url using given output adapter.

Specified by:
output in interface ControlInterface
Parameters:
url - Destination URL.
output - Output adapter to use.
model - Analyze model to export.
Throws:
java.lang.Exception - If something goes wrong with the output, then an exception is thrown.

saveAnalyzeModel

public void saveAnalyzeModel(java.net.URL url)
Description copied from interface: ControlInterface
Saves analyze model to a file.

Specified by:
saveAnalyzeModel in interface ControlInterface
Parameters:
url - Target file.

reloadUseCases

public void reloadUseCases(java.net.URL url)
Description copied from interface: ControlInterface
Reloads use cases from file. First core should remove all use cases that are loaded from given url. Then it should read use cases from the file.

Specified by:
reloadUseCases in interface ControlInterface
Parameters:
url - URL of the file to reload.

applyProperties

public void applyProperties()
                     throws BadPropertyValueException
Description copied from interface: ModulePropertyInterface
Applies current properties for the module.

Specified by:
applyProperties in interface ModulePropertyInterface
Overrides:
applyProperties in class ModuleProperties
Throws:
BadPropertyValueException - In this case exception is thrown only if either the given parser or heuristic does not exist.
See Also:
ModulePropertyInterface.applyProperties()

findParser

private ParserInterface findParser(java.lang.String name)
Helper method for applyProperties to find parsers by name.

Parameters:
name - Parser to search.
Returns:
Found parser or null if no parser with given name existed.

findHeuristic

private HeuristicInterface findHeuristic(java.lang.String name)
Helper method for applyProperties to find heuristics by name.

Parameters:
name - Heuristic to search.
Returns:
Found heuristic or null if no heuristic with given name existed.

loadDefaultProperties

public java.util.Properties loadDefaultProperties()
Description copied from interface: ModulePropertyInterface
Method which returns the factory default properties for the module.

Specified by:
loadDefaultProperties in interface ModulePropertyInterface
Overrides:
loadDefaultProperties in class ModuleProperties
Returns:
Default properties.
See Also:
ModulePropertyInterface.loadDefaultProperties()

saveProperties

public void saveProperties()
                    throws java.io.IOException
Description copied from interface: ModulePropertyInterface
Saves current properties to the properties XML file.

Specified by:
saveProperties in interface ModulePropertyInterface
Overrides:
saveProperties in class ModuleProperties
Throws:
java.io.IOException - Exception is thrown if something went wrong.
See Also:
ModulePropertyInterface.saveProperties()

loadProperties

public void loadProperties()
                    throws java.io.IOException
Description copied from interface: ModulePropertyInterface
Loads settings from the current properties XML file.

Specified by:
loadProperties in interface ModulePropertyInterface
Overrides:
loadProperties in class ModuleProperties
Throws:
java.io.IOException - Exception is thrown if something went wrong.
See Also:
ModulePropertyInterface.loadProperties()