de.cau.cs.kieler.kex.controller
Class ExampleManager

java.lang.Object
  extended by de.cau.cs.kieler.kex.controller.ExampleManager

public final class ExampleManager
extends Object

This class manages the import and export in kex. It represents the bridge from kex.ui to kex code.

Rating red

Method Summary
 void export(Map<ExampleElement,Object> properties)
          Exports a given example.
 void generateProject(IPath resourcePath)
          Checks if an project is accessible.
static ExampleManager get()
          Singleton call of ExampleManager.
 List<String> getCategories()
          Creates a resultlist with categories of collectors.
 Example getExample(SourceType type, String exampleTitle)
          searches the examplepool of a source for a special example.
 Map<String,Example> getExamples()
          Adds all examples of a the collectors to the result map.
 List<String> importExamples(IPath selectedResource, List<Example> selectedExamples, boolean checkDuplicate)
          This method calls an validate and uses the ExampleImport to import examples.
 void load(boolean forceLoad)
          Loads examples, if not loaded before.
 InputStream loadOverviewPic(Example example)
          Loads the preview picture.
 InputStream loadStandardPic()
          Loads the standard picture.
 List<String> quickStartImport(Example quickStarter)
          Imports a quickstart example.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static ExampleManager get()
Singleton call of ExampleManager.

Returns:
ExampleManager

load

public void load(boolean forceLoad)
          throws KielerException
Loads examples, if not loaded before.

Parameters:
forceLoad - , set this parameter to force loading of examples
Throws:
KielerException - , can be thrown by load() .

getExample

public Example getExample(SourceType type,
                          String exampleTitle)
                   throws KielerException
searches the examplepool of a source for a special example.

Parameters:
type - , SourceType
exampleTitle - , String
Returns:
Example
Throws:
KielerException - , can be thrown by PluginExampleCollector.getExample(...) and if the example found example is null.

getExamples

public Map<String,Example> getExamples()
Adds all examples of a the collectors to the result map.

Returns:
Map with String as key and Example as value.

getCategories

public List<String> getCategories()
Creates a resultlist with categories of collectors.

Returns:
List of String.

importExamples

public List<String> importExamples(IPath selectedResource,
                                   List<Example> selectedExamples,
                                   boolean checkDuplicate)
                            throws KielerException
This method calls an validate and uses the ExampleImport to import examples.

Parameters:
selectedResource - , IPath
selectedExamples - , List of Example
checkDuplicate - , boolean
Returns:
List of String
Throws:
KielerException - , if ExampleImport.validate(...) or ExampleImport.importExamples(...) throws it.

export

public void export(Map<ExampleElement,Object> properties)
            throws KielerException
Exports a given example. Created and deleted categories will managed, too.

Parameters:
properties - , Map with ExampleElement as key and Object as value.
Throws:
KielerException - , can be thrown at several places.

loadOverviewPic

public InputStream loadOverviewPic(Example example)
                            throws KielerException
Loads the preview picture.

Parameters:
example - , Example
Returns:
InputStream
Throws:
KielerException - , if ExampleImport.loadOverviewPic(...) throws it.

loadStandardPic

public InputStream loadStandardPic()
Loads the standard picture.

Returns:
InputStream

quickStartImport

public List<String> quickStartImport(Example quickStarter)
                              throws KielerException
Imports a quickstart example.

Parameters:
quickStarter - , Example
Returns:
files which can be open directly, List
Throws:
KielerException - , if anything goes wrong at ExampleImport.importExamples(...).

generateProject

public void generateProject(IPath resourcePath)
Checks if an project is accessible. If not, checks if exists, if not a new project with first segment of resourcePath becomes create. Then the project becomes open.

Parameters:
resourcePath - , IPath of import location.