de.deepamehta.plugins.csv
Class CsvPlugin

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.osgi.PluginActivator
      extended by de.deepamehta.plugins.csv.CsvPlugin
All Implemented Interfaces:
PluginContext, org.osgi.framework.BundleActivator

public class CsvPlugin
extends PluginActivator


Field Summary
private  FilesService fileService
           
static String FOLDER
           
private  boolean isInitialized
           
private static Logger log
           
static char SEPARATOR
           
 
Fields inherited from class de.deepamehta.core.osgi.PluginActivator
bundle, dms
 
Constructor Summary
CsvPlugin()
           
 
Method Summary
private  void configureIfReady()
           
private  void createCsvDirectory()
           
private  Map<String,Map<String,Long>> getPossibleAggrChilds(String typeUri, List<String> childTypeUris)
          get all possible aggregation instances and hash them by typeUri and value
private  Map<String,Long> getTopicIdsByUri(String typeUri)
          get all existing instance topics and hash them by URI
private  Map<String,Long> getTopicIdsByValue(String childTypeUri)
          get all existing instance topics and hash them by value
 ImportStatus importCsv(String typeUri, long fileId, ClientState cookie)
           
 void init()
          Initialize.
private  List<String[]> readCsvFile(long fileId)
          read and validate CSV file
 void serviceArrived(PluginService service)
           
 void serviceGone(PluginService service)
           
 
Methods inherited from class de.deepamehta.core.osgi.PluginActivator
getBundleContext, postInstall, publishDirectory, setCoreService, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private static Logger log

FOLDER

public static final String FOLDER
See Also:
Constant Field Values

SEPARATOR

public static final char SEPARATOR
See Also:
Constant Field Values

isInitialized

private boolean isInitialized

fileService

private FilesService fileService
Constructor Detail

CsvPlugin

public CsvPlugin()
Method Detail

importCsv

public ImportStatus importCsv(String typeUri,
                              long fileId,
                              @HeaderParam(value="Cookie")
                              ClientState cookie)

getPossibleAggrChilds

private Map<String,Map<String,Long>> getPossibleAggrChilds(String typeUri,
                                                           List<String> childTypeUris)
get all possible aggregation instances and hash them by typeUri and value

Parameters:
typeUri -
childTypeUris -
Returns:

getTopicIdsByValue

private Map<String,Long> getTopicIdsByValue(String childTypeUri)
get all existing instance topics and hash them by value

Parameters:
childTypeUri -
Returns:
instance topics hashed by value

getTopicIdsByUri

private Map<String,Long> getTopicIdsByUri(String typeUri)
get all existing instance topics and hash them by URI

Parameters:
typeUri -
Returns:
instance topics hashed by URI

readCsvFile

private List<String[]> readCsvFile(long fileId)
                            throws IOException
read and validate CSV file

Parameters:
fileId -
Returns:
parsed CSV rows with trimmed column array
Throws:
FileNotFoundException
IOException

init

public void init()
Initialize.

Specified by:
init in interface PluginContext
Overrides:
init in class PluginActivator

serviceArrived

public void serviceArrived(PluginService service)
Specified by:
serviceArrived in interface PluginContext
Overrides:
serviceArrived in class PluginActivator

serviceGone

public void serviceGone(PluginService service)
Specified by:
serviceGone in interface PluginContext
Overrides:
serviceGone in class PluginActivator

configureIfReady

private void configureIfReady()

createCsvDirectory

private void createCsvDirectory()


Copyright © 2014. All Rights Reserved.