COSMOS ${releaseVersion} resource-modeling Project
Internal API Specification

org.eclipse.cosmos.rm.repository.internal.operations
Class ExportOperation

java.lang.Object
  extended by org.eclipse.cosmos.rm.repository.internal.operations.ExportOperation

public class ExportOperation
extends java.lang.Object

Export a set of SML model documents to an SML-IF file


Constructor Summary
ExportOperation(org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository repository)
           
 
Method Summary
protected  void addFileToDefinitionsAndInstances(java.util.Map aliases, org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument document)
          Add indicated file to SML-IF document buffers, depending on type of file
protected  void addFileToSection(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument file, java.lang.StringBuffer sectionBuffer, java.util.Map aliases)
          Add the file to the indicated section of the document.
protected  void appendAliasToBuffer(java.lang.String alias, java.lang.StringBuffer buffer)
           
protected  void appendDefinitionsAndInstances()
          Copy definition and instance buffers to SML-IF buffer before writing file to system.
protected  void buildRuleBindings(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] modelUnits, RuleBinding[] ruleBindings)
           
protected  void createDirectoryStructureFor(java.io.File smlifFile)
           
 void exportFromFiles(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] modelUnits, java.util.Map aliases, RuleBinding[] ruleBindings, org.eclipse.cosmos.rm.repository.provisional.resource.ISMLIFIdentity identity)
          Build an SML-IF file from a collection of individual files representing definition and instance model units.
protected  boolean fileExistsAndIsReadable(java.io.File file)
          Answer whether a file exists and is readable
protected  java.lang.StringBuffer getFileAlias(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument file, java.util.Map aliases)
          Construct alias entity for the indicated file
protected  java.lang.StringBuffer getFileContent(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument modelUnitFile)
          Read definition or instance file and return contents as a string buffer
protected  boolean hasDefinitions()
           
protected  boolean hasInstances()
           
protected  boolean hasRuleBindings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExportOperation

public ExportOperation(org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository repository)
Method Detail

createDirectoryStructureFor

protected void createDirectoryStructureFor(java.io.File smlifFile)
                                    throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException

fileExistsAndIsReadable

protected boolean fileExistsAndIsReadable(java.io.File file)
                                   throws java.rmi.server.ExportException
Answer whether a file exists and is readable

Parameters:
file -
Returns:
whether the file exists and is readable
Throws:
java.rmi.server.ExportException

addFileToDefinitionsAndInstances

protected void addFileToDefinitionsAndInstances(java.util.Map aliases,
                                                org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument document)
Add indicated file to SML-IF document buffers, depending on type of file

Parameters:
aliases -
file -

addFileToSection

protected void addFileToSection(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument file,
                                java.lang.StringBuffer sectionBuffer,
                                java.util.Map aliases)
Add the file to the indicated section of the document. The document sections are maintained as StringBuffer instances.

Parameters:
file - the file being added to the SML-IF document
sectionBuffer - the string buffer for either the definitions or instances section
aliases -

getFileAlias

protected java.lang.StringBuffer getFileAlias(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument file,
                                              java.util.Map aliases)
Construct alias entity for the indicated file

Parameters:
file - file being added to SML-IF document
aliases -
Returns:
StringBuffer containing alias markup

appendAliasToBuffer

protected void appendAliasToBuffer(java.lang.String alias,
                                   java.lang.StringBuffer buffer)

getFileContent

protected java.lang.StringBuffer getFileContent(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument modelUnitFile)
Read definition or instance file and return contents as a string buffer

Parameters:
modelUnitFile -
Returns:

exportFromFiles

public void exportFromFiles(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] modelUnits,
                            java.util.Map aliases,
                            RuleBinding[] ruleBindings,
                            org.eclipse.cosmos.rm.repository.provisional.resource.ISMLIFIdentity identity)
                     throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
Build an SML-IF file from a collection of individual files representing definition and instance model units.

Parameters:
modelUnits - The model units representing the instances and definitions
aliases - The aliases of the documents
ruleBindings - The rule bindings
identity - The SML-IF identity
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException - In case of an unexpected error

buildRuleBindings

protected void buildRuleBindings(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] modelUnits,
                                 RuleBinding[] ruleBindings)

appendDefinitionsAndInstances

protected void appendDefinitionsAndInstances()
Copy definition and instance buffers to SML-IF buffer before writing file to system.


hasRuleBindings

protected boolean hasRuleBindings()

hasDefinitions

protected boolean hasDefinitions()

hasInstances

protected boolean hasInstances()

COSMOS ${releaseVersion} resource-modeling Project
Internal API Specification