org.openlca.dataconversion
Class Converter

java.lang.Object
  extended by org.openlca.dataconversion.Converter

public class Converter
extends java.lang.Object

Converter implementation.

Version:
1.0
Author:
Michael Srocka, GreenDeltaTC, for the openLCA project (www.openlca.org)

Method Summary
 ConversionData convert(LCADocument document, DataFormat targetFormat, java.io.File targetDir)
          Converts a single LCA document into a given target directory.
 java.util.List<ConversionData> convert(java.util.List<LCADocument> documents, DataFormat targetFormat, java.io.File targetDir)
          Converts a list of LCA documents into a given target directory.
 java.util.List<FlowProperty> getFlowProperties()
          Returns ELCD flow properties, used to assign to units for data conversion into the ELCD format.
static Converter getInstance()
          Returns the singleton instance of the converter.
 LCADocument getLCADocument(java.io.File sourceFile)
          Returns the LCA document for a given file or throws a ConverterException.
 java.util.List<LCADocument> getLCADocuments(java.io.File sourceDir)
          Returns LCADocuments from a given directory.
static LCADocumentOutputter getOutputter()
          Returns a static singleton instance.
static org.jdom.input.SAXBuilder getSAXBuilder()
          Returns a static singleton instance.
static LCADocumentTransformer getTransformer()
          Returns a static singleton instance.
 java.util.List<UnitFlowPropertyAssignment> getUnitflowPropAssignments()
           
 java.util.List<java.lang.String> getUnits(java.util.List<LCADocument> documents)
          Returns the units of a list of LCA documents.
 void setUnitflowPropAssignments(java.util.List<UnitFlowPropertyAssignment> unitflowPropAssignments)
          Sets the unit flow property assignments used in the conversion to ELCD.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Converter getInstance()
                             throws ConverterException
Returns the singleton instance of the converter.

Returns:
possible object is Converter.
Throws:
ConverterException

getSAXBuilder

public static org.jdom.input.SAXBuilder getSAXBuilder()
Returns a static singleton instance.

Returns:
possible object is SAXBuilder.

getOutputter

public static LCADocumentOutputter getOutputter()
Returns a static singleton instance.

Returns:
possible object is LCADocumentOutputter.

getTransformer

public static LCADocumentTransformer getTransformer()
Returns a static singleton instance.

Returns:
possible object is LCADocumentTransformer.

convert

public ConversionData convert(LCADocument document,
                              DataFormat targetFormat,
                              java.io.File targetDir)
                       throws ConverterException
Converts a single LCA document into a given target directory.

Parameters:
document - Allowed object is LCADocumentBuilder.
targetFormat - Allowed object is DataFormat.
targetDir - Allowed object is File as directory.
Throws:
ConverterException

convert

public java.util.List<ConversionData> convert(java.util.List<LCADocument> documents,
                                              DataFormat targetFormat,
                                              java.io.File targetDir)
                                       throws ConverterException
Converts a list of LCA documents into a given target directory. Calls n times convert(LCADocument, DataFormat, File).

Parameters:
documents - Allowed is a list of LCADocument.
targetFormat - Allowed object is DataFormat.
targetDir - Allowed object is File as directory.
Returns:
Returns a list of ConversionData.
Throws:
ConverterException

getFlowProperties

public java.util.List<FlowProperty> getFlowProperties()
                                               throws ConverterException
Returns ELCD flow properties, used to assign to units for data conversion into the ELCD format.

Returns:
A list of FlowProperty.
Throws:
ConverterException

getLCADocument

public LCADocument getLCADocument(java.io.File sourceFile)
                           throws ConverterException
Returns the LCA document for a given file or throws a ConverterException.

Parameters:
sourceFile - Allowed object is File.
Returns:
Possible object is LCADocument.
Throws:
ConverterException

getLCADocuments

public java.util.List<LCADocument> getLCADocuments(java.io.File sourceDir)
                                            throws ConverterException
Returns LCADocuments from a given directory.

Parameters:
sourceDir - allowed Object is File.
Returns:
possible list objects are LCADocument.
Throws:
ConverterException

getUnitflowPropAssignments

public java.util.List<UnitFlowPropertyAssignment> getUnitflowPropAssignments()
Returns:
List of UnitFlowPropertyAssignment.

getUnits

public java.util.List<java.lang.String> getUnits(java.util.List<LCADocument> documents)
Returns the units of a list of LCA documents.

Parameters:
documents - List of LCADocument allowed.
Returns:
List of units.

setUnitflowPropAssignments

public void setUnitflowPropAssignments(java.util.List<UnitFlowPropertyAssignment> unitflowPropAssignments)
Sets the unit flow property assignments used in the conversion to ELCD. See createElcdFlowDatasets(Document, File, ConversionData).

Parameters:
unitflowPropAssignments - Allowed is a list of UnitFlowPropertyAssignment.