org.eclipse.emf.exporter
Class ModelExporter

java.lang.Object
  extended by org.eclipse.emf.converter.ModelConverter
      extended by org.eclipse.emf.exporter.ModelExporter

public abstract class ModelExporter
extends ModelConverter

Since:
2.2.0

Nested Class Summary
static class ModelExporter.EPackageExportInfo
           
static class ModelExporter.ExportData
           
protected static class ModelExporter.GenPackagesTreeIterator
           
static class ModelExporter.ReferencedGenPackageExportInfo
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.converter.ModelConverter
ModelConverter.EPackageConvertInfo, ModelConverter.ReferencedEPackageFilter, ModelConverter.ReferencedGenPackageConvertInfo
 
Field Summary
protected  URI directoryURI
           
protected  java.util.Map<EPackage,GenPackage> ePackageToGenPackageMap
           
static java.lang.String GENANNOTATION_KEY_DIRECTORY_URI
           
static java.lang.String GENANNOTATION_SOURCE_PREFIX
           
static java.lang.String GENANNOTATION_SOURCE_SELECTED_EPACKAGES
           
static java.lang.String GENANNOTATION_SOURCE_SELECTED_REFERENCES
           
protected  java.util.Map<GenBase,EMap<java.lang.String,java.lang.String>> genBaseToDetailsMap
           
protected  boolean saveEPackageArtifactURI
           
protected  boolean saveExporter
           
 
Fields inherited from class org.eclipse.emf.converter.ModelConverter
ePackages, ePackageToInfoMap, externalGenModelList, externalGenModelResourceSet, genModel, referencedEPackageFilter, referencedEPackageFilterToConvert, referencedGenPackages, referencedGenPackageToInfoMap
 
Constructor Summary
ModelExporter()
           
 
Method Summary
protected  void adjustGenModel()
           
protected  boolean canConvert(EPackage ePackage)
          Returns true if the EPackage can be converted.
 Diagnostic checkEPackageArtifactLocation(java.lang.String location, java.lang.String packageName)
           
protected  URI computeArtifactURI(java.lang.String location)
          Returns the artifact URI for a given artifact location.
protected  URI createEncodedURI(java.lang.String location)
           
protected  ModelConverter.EPackageConvertInfo createEPackageInfo(EPackage ePackage)
           
protected  java.util.List<EPackage> createEPackagesList()
           
protected  ModelConverter.ReferencedGenPackageConvertInfo createGenPackageConvertInfo(GenPackage genPackage)
           
protected  ModelConverter.ReferencedEPackageFilter createReferencedEPackageFilterToConvert()
           
protected  java.util.List<GenPackage> createReferencedGenPackagesList()
           
 void dispose()
           
protected  java.lang.String doCheckEPackageArtifactLocation(java.lang.String location, java.lang.String packageName)
           
protected  Diagnostic doExport(Monitor monitor, ModelExporter.ExportData exportData)
          Subclasses should overwrite this method, adding the code that performs the actions required to export the model.
 Diagnostic export(Monitor monitor)
          Creates the ModelExporter.ExportData instance and delegates the export work to the doExport(Monitor, ModelExporter.ExportData) method.
 java.util.List<URI> getArtifactURIs(GenPackage genPackage)
           
protected  java.lang.String getConverterGenAnnotationSource()
           
protected  java.lang.String getDefaultArtifactFileName(EPackage ePackage)
           
protected  java.lang.String getDefaultArtifactLocation(EPackage ePackage)
           
 URI getDirectoryURI()
           
 ModelExporter.EPackageExportInfo getEPackageExportInfo(EPackage ePackage)
           
protected  java.util.Map<EPackage,GenPackage> getEPackageToGenPackageMap()
           
protected  EMap<java.lang.String,java.lang.String> getExporterGenAnnotationDetails(GenBase genBase)
          Returns the GenBase object's GenAnnotation Details map associated with this Model Exporter or ECollections.EMPTY_EMAP
protected  EMap<java.lang.String,java.lang.String> getExporterNestedGenAnnotationDetails(GenBase genBase, java.lang.String nestedGenAnnotationSource)
           
protected  java.util.List<GenAnnotation> getExporterNestedGenAnnotations(GenBase genBase)
           
protected  java.util.Map<GenBase,EMap<java.lang.String,java.lang.String>> getGenBaseToGenAnnotationDetailsMap()
           
 ModelExporter.ReferencedGenPackageExportInfo getReferencedGenPackageExportInfo(GenPackage genPackage)
           
 boolean isSaveEPackageArtifactURI()
           
 boolean isSaveExporter()
           
protected  boolean isValidEPackage(GenPackage genPackage)
          Returns whether the EPackage associated with the specified GenPackage should be added to the ePackage list.
protected  boolean isValidReferencedGenPackage(GenPackage genPackage)
          Returns whether the specified GenPackage should be added to the referenced GenPackage list.
 void loadGenModel(URI uri)
           
protected  void printExportData(ModelExporter.ExportData exportData)
           
 void save()
          Saves this exporters settings in the selected GenModel.
protected  boolean saveEPackageArtifactURI()
          Saves the exported artifact URI as annotations on the respective GenPackage.
protected  boolean saveExporter()
          Saves this exporter settings.
 void setDirectoryURI(java.lang.String location)
           
 void setDirectoryURI(URI directoryURI)
           
 void setGenModel(GenModel genModel)
           
 void setSaveEPackageArtifactURI(boolean saveEPackageArtifactURI)
           
 void setSaveExporter(boolean saveExporter)
           
 Diagnostic validateDirectoryURI(java.lang.String uri)
           
 
Methods inherited from class org.eclipse.emf.converter.ModelConverter
clearEPackageConvertInfoCache, clearEPackagesCollections, clearReferenceGenPackageConvertInfoCache, computeEPackagesToConvert, computeValidReferencedGenPackages, createExternalGenModelResourceSet, createReferencedEPackageFilter, createResourceSet, filterReferencedEPackages, filterReferencedEPackagesToConvert, getEPackageConvertInfo, getEPackages, getEPackageToInfoMap, getExternalGenModels, getGenModel, getGenmodelSaveOptions, getGenModelSaveOptions, getID, getReferencedGenPackages, getReferencedGenPackageToInfoMap, getReferenceGenPackageConvertInfo, getReferredEPackage, makeEPackageConvertDataUnique
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENANNOTATION_SOURCE_PREFIX

public static final java.lang.String GENANNOTATION_SOURCE_PREFIX
See Also:
Constant Field Values

GENANNOTATION_KEY_DIRECTORY_URI

public static final java.lang.String GENANNOTATION_KEY_DIRECTORY_URI
See Also:
Constant Field Values

GENANNOTATION_SOURCE_SELECTED_EPACKAGES

public static final java.lang.String GENANNOTATION_SOURCE_SELECTED_EPACKAGES
See Also:
Constant Field Values

GENANNOTATION_SOURCE_SELECTED_REFERENCES

public static final java.lang.String GENANNOTATION_SOURCE_SELECTED_REFERENCES
See Also:
Constant Field Values

ePackageToGenPackageMap

protected java.util.Map<EPackage,GenPackage> ePackageToGenPackageMap

directoryURI

protected URI directoryURI

genBaseToDetailsMap

protected java.util.Map<GenBase,EMap<java.lang.String,java.lang.String>> genBaseToDetailsMap

saveExporter

protected boolean saveExporter

saveEPackageArtifactURI

protected boolean saveEPackageArtifactURI
Constructor Detail

ModelExporter

public ModelExporter()
Method Detail

dispose

public void dispose()
Overrides:
dispose in class ModelConverter

getConverterGenAnnotationSource

protected java.lang.String getConverterGenAnnotationSource()
Overrides:
getConverterGenAnnotationSource in class ModelConverter

getEPackageToGenPackageMap

protected java.util.Map<EPackage,GenPackage> getEPackageToGenPackageMap()

getGenBaseToGenAnnotationDetailsMap

protected java.util.Map<GenBase,EMap<java.lang.String,java.lang.String>> getGenBaseToGenAnnotationDetailsMap()

getExporterGenAnnotationDetails

protected EMap<java.lang.String,java.lang.String> getExporterGenAnnotationDetails(GenBase genBase)
Returns the GenBase object's GenAnnotation Details map associated with this Model Exporter or ECollections.EMPTY_EMAP


getExporterNestedGenAnnotations

protected java.util.List<GenAnnotation> getExporterNestedGenAnnotations(GenBase genBase)

getExporterNestedGenAnnotationDetails

protected EMap<java.lang.String,java.lang.String> getExporterNestedGenAnnotationDetails(GenBase genBase,
                                                                                        java.lang.String nestedGenAnnotationSource)

getArtifactURIs

public java.util.List<URI> getArtifactURIs(GenPackage genPackage)

setGenModel

public void setGenModel(GenModel genModel)
                 throws DiagnosticException
Throws:
DiagnosticException

adjustGenModel

protected void adjustGenModel()

getDefaultArtifactLocation

protected java.lang.String getDefaultArtifactLocation(EPackage ePackage)

isValidEPackage

protected boolean isValidEPackage(GenPackage genPackage)
Returns whether the EPackage associated with the specified GenPackage should be added to the ePackage list.


isValidReferencedGenPackage

protected boolean isValidReferencedGenPackage(GenPackage genPackage)
Returns whether the specified GenPackage should be added to the referenced GenPackage list.


createEPackagesList

protected java.util.List<EPackage> createEPackagesList()
Overrides:
createEPackagesList in class ModelConverter

createReferencedGenPackagesList

protected java.util.List<GenPackage> createReferencedGenPackagesList()
Overrides:
createReferencedGenPackagesList in class ModelConverter

loadGenModel

public void loadGenModel(URI uri)
                  throws DiagnosticException
Throws:
DiagnosticException

getEPackageExportInfo

public ModelExporter.EPackageExportInfo getEPackageExportInfo(EPackage ePackage)

createEPackageInfo

protected ModelConverter.EPackageConvertInfo createEPackageInfo(EPackage ePackage)
Overrides:
createEPackageInfo in class ModelConverter

getReferencedGenPackageExportInfo

public ModelExporter.ReferencedGenPackageExportInfo getReferencedGenPackageExportInfo(GenPackage genPackage)

createGenPackageConvertInfo

protected ModelConverter.ReferencedGenPackageConvertInfo createGenPackageConvertInfo(GenPackage genPackage)
Overrides:
createGenPackageConvertInfo in class ModelConverter

createReferencedEPackageFilterToConvert

protected ModelConverter.ReferencedEPackageFilter createReferencedEPackageFilterToConvert()
Overrides:
createReferencedEPackageFilterToConvert in class ModelConverter

canConvert

protected boolean canConvert(EPackage ePackage)
Description copied from class: ModelConverter
Returns true if the EPackage can be converted. This method doesn't check for dependencies or anything, being focused in testing whether all the required information to generate an EPackage was gathered.

Overrides:
canConvert in class ModelConverter

export

public Diagnostic export(Monitor monitor)
                  throws java.lang.Exception

Creates the ModelExporter.ExportData instance and delegates the export work to the doExport(Monitor, ModelExporter.ExportData) method.

The Diagnostic returned by this method should be used to provide the user some information regarding a successful export. If the export fails, an exception should be thrown.

Parameters:
monitor -
Returns:
Diagnostic
Throws:
java.lang.Exception

doExport

protected Diagnostic doExport(Monitor monitor,
                              ModelExporter.ExportData exportData)
                       throws java.lang.Exception

Subclasses should overwrite this method, adding the code that performs the actions required to export the model.

The Diagnostic returned by this method should be used to provide the user some information regarding a successfull export. If the export fails, an exception should be thrown.

Parameters:
monitor -
Returns:
Diagnostic
Throws:
java.lang.Exception

checkEPackageArtifactLocation

public Diagnostic checkEPackageArtifactLocation(java.lang.String location,
                                                java.lang.String packageName)

doCheckEPackageArtifactLocation

protected java.lang.String doCheckEPackageArtifactLocation(java.lang.String location,
                                                           java.lang.String packageName)

getDirectoryURI

public URI getDirectoryURI()

setDirectoryURI

public void setDirectoryURI(URI directoryURI)

setDirectoryURI

public void setDirectoryURI(java.lang.String location)

computeArtifactURI

protected URI computeArtifactURI(java.lang.String location)
Returns the artifact URI for a given artifact location. The URI is resolved against the directory URI.


createEncodedURI

protected URI createEncodedURI(java.lang.String location)

validateDirectoryURI

public Diagnostic validateDirectoryURI(java.lang.String uri)

isSaveEPackageArtifactURI

public boolean isSaveEPackageArtifactURI()

setSaveEPackageArtifactURI

public void setSaveEPackageArtifactURI(boolean saveEPackageArtifactURI)

isSaveExporter

public boolean isSaveExporter()

setSaveExporter

public void setSaveExporter(boolean saveExporter)

save

public void save()
          throws java.lang.Exception
Saves this exporters settings in the selected GenModel.

Throws:
java.lang.Exception

saveExporter

protected boolean saveExporter()
Saves this exporter settings.

Returns:
Whether this method has changed the GenModel instance

saveEPackageArtifactURI

protected boolean saveEPackageArtifactURI()
Saves the exported artifact URI as annotations on the respective GenPackage.

Returns:
Whether this method has changed the GenModel instance

getDefaultArtifactFileName

protected java.lang.String getDefaultArtifactFileName(EPackage ePackage)

printExportData

protected void printExportData(ModelExporter.ExportData exportData)

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.