pl.edu.agh.cast.importer.base.util
Class ImporterUtil

java.lang.Object
  extended by pl.edu.agh.cast.importer.base.util.ImporterUtil

public class ImporterUtil
extends Object

Utility methods for the import process.

Author:
AGH CAST Team

Constructor Summary
ImporterUtil()
          The default constructor.
ImporterUtil(IImporterPluginRegistryProvider provider)
          Constructor which allows to set custom IImporterPluginRegistryProvider instance.
 
Method Summary
 org.eclipse.core.runtime.IConfigurationElement[] getConversionRuleConfigurations()
          Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.conversionrule extension point.
 String getConversionRuleDescription(String conversionRuleId)
          Delegated method.
 List<ConversionRuleInfo> getConversionRuleInfos()
          Delegated method.
 IConversionRule getConversionRuleInstance(String conversionRuleId)
          Delegated method.
 String getConverterDescription(String converterId)
          Delegated method.
 List<ImportConverterInfo> getConverterInfos()
          Delegated method.
 IImportConverter getConverterInstance(String converterId)
          Delegated method.
 org.eclipse.core.runtime.IConfigurationElement[] getConvertersConfigurations()
          Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.converter extension point.
 org.eclipse.core.runtime.IConfigurationElement[] getDataTypeConfigurations()
          Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.datatype extension point.
 List<DataTypeInfo> getDataTypeInfos()
          Deletaget method.
 Charset getFileCharset(String path, IImportTokenizer tokenizer)
          Detects the file encoding for file with the specified path using the specified tokenizer.
 Charset getFileCharset(String path, String tokenizerId)
          Detects the file encoding for file with the specified path using the tokenizer with specified id.
 Map<String,String> getSupportedFileExtensions()
          Delegated method.
 String getTokenizerDescription(String tokenizerId)
          Delegated method.
 List<TokenizerInfo> getTokenizerInfos()
          Delegated method.
 IImportTokenizer getTokenizerInstance(String tokenizerId)
          Delegated method.
 org.eclipse.core.runtime.IConfigurationElement[] getTokenizersConfigurations()
          Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.tokenizer extension point.
 List<RawTabularData> tokenizeData(String path, IImportTokenizer tokenizer, long rowsLimit, org.eclipse.core.runtime.IProgressMonitor monitor)
          Tokenizes the specified number of rows from given file using the specified tokenizer and its options.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImporterUtil

public ImporterUtil()
The default constructor. Creates a new instance of DefaultImporterPluginRegistryProvider.


ImporterUtil

public ImporterUtil(IImporterPluginRegistryProvider provider)
Constructor which allows to set custom IImporterPluginRegistryProvider instance. If null is passed, the DefaultImporterPluginRegistryProvider is used. This constructor should be used in tests.

Parameters:
provider - custom provider instance
Method Detail

getTokenizersConfigurations

public org.eclipse.core.runtime.IConfigurationElement[] getTokenizersConfigurations()
Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.tokenizer extension point.

Returns:
array of tokenizer configurations

getConvertersConfigurations

public org.eclipse.core.runtime.IConfigurationElement[] getConvertersConfigurations()
Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.converter extension point.

Returns:
array of converter configurations

getConversionRuleConfigurations

public org.eclipse.core.runtime.IConfigurationElement[] getConversionRuleConfigurations()
Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.conversionrule extension point.

Returns:
array of conversion rule configurations

getDataTypeConfigurations

public org.eclipse.core.runtime.IConfigurationElement[] getDataTypeConfigurations()
Returns configuration elements of extensions for pl.edu.agh.cast.importer.base.datatype extension point.

Returns:
array of data type configurations

tokenizeData

public List<RawTabularData> tokenizeData(String path,
                                         IImportTokenizer tokenizer,
                                         long rowsLimit,
                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                  throws IOException
Tokenizes the specified number of rows from given file using the specified tokenizer and its options.

Parameters:
path - the path to the file containing the data
tokenizer - the tokenizer extension (defined in the plugin.xml file)
rowsLimit - the number of rows to be tokenized (put Long.MAX_VALUE to import all the data)
monitor - the progress monitor for the tokenization operation
Returns:
imported rows in the form of list of raw tabular data
Throws:
IOException
org.eclipse.core.runtime.CoreException

getFileCharset

public Charset getFileCharset(String path,
                              String tokenizerId)
                       throws IOException,
                              org.eclipse.core.runtime.CoreException
Detects the file encoding for file with the specified path using the tokenizer with specified id.

Parameters:
path - the path to the file containing the data
tokenizerId - the identifier of the tokenizer extension (defined in the plugin.xml file)
Returns:
detected encoding in the form of charset
Throws:
IOException
org.eclipse.core.runtime.CoreException

getFileCharset

public Charset getFileCharset(String path,
                              IImportTokenizer tokenizer)
                       throws IOException
Detects the file encoding for file with the specified path using the specified tokenizer.

Parameters:
path - the path to the file containing the data
tokenizer - the tokenizer extension (defined in the plugin.xml file)
Returns:
detected encoding in the form of charset
Throws:
IOException
org.eclipse.core.runtime.CoreException

getTokenizerInstance

public IImportTokenizer getTokenizerInstance(String tokenizerId)
                                      throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getTokenizerInstance(java.lang.String)

getConverterInstance

public IImportConverter getConverterInstance(String converterId)
                                      throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getConverterInstance(java.lang.String)

getConversionRuleInstance

public IConversionRule getConversionRuleInstance(String conversionRuleId)
                                          throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
#getConversionRuleInstance(java.lang.String)

getTokenizerDescription

public String getTokenizerDescription(String tokenizerId)
                               throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getTokenizerDescription(java.lang.String)

getSupportedFileExtensions

public Map<String,String> getSupportedFileExtensions()
                                              throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
getSupportedFileExtensions()

getConverterDescription

public String getConverterDescription(String converterId)
                               throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getConverterDescription(java.lang.String)

getConversionRuleDescription

public String getConversionRuleDescription(String conversionRuleId)
                                    throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
#getConversionRuleDescription(java.lang.String)

getTokenizerInfos

public List<TokenizerInfo> getTokenizerInfos()
                                      throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getTokenizerInfos()

getConversionRuleInfos

public List<ConversionRuleInfo> getConversionRuleInfos()
                                                throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getConversionRuleInfos()

getConverterInfos

public List<ImportConverterInfo> getConverterInfos()
                                            throws org.eclipse.core.runtime.CoreException
Delegated method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getConverterInfos()

getDataTypeInfos

public List<DataTypeInfo> getDataTypeInfos()
                                    throws org.eclipse.core.runtime.CoreException
Deletaget method.

Throws:
org.eclipse.core.runtime.CoreException
See Also:
IImporterPluginRegistryProvider.getDataTypeInfos()


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.