IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.ras.profile.core
Interface IRASAssetWriter


public interface IRASAssetWriter

This is used to write/save an asset in a storage format independent way. Any persisting of the asset should be done throught this interface. This interface is not intended to be implemented by clients.


Field Summary
static String BUNDLED_WRITER_FORMAT
          Specifies that the asset should be in a bundled storage format.
static String PATH_SEPERATOR
          Specifies the path seperator.
 
Method Summary
 IAssetWriterStatus addFile(InputStream theInputStream, String theRelativePath, IProgressMonitor theProgressMonitor)
          Add a stream to the asset.
 IAssetWriterStatus addFile(String theSourceFilePath, String theRelativePath)
          Add a file to the asset.
 IAssetWriterStatus addFolder(String theRelativePath)
          Create a new folder in the asset.
 IStatus close()
          Closes the writer.
 String getAssetPath()
          Get the asset's path.
 IStatus open(String theAssetPath, boolean shouldOverwriteExisting)
          Opens the writer.
 void setManifest(EObject theManifest)
          Sets the primary manifest for the asset.
 boolean shouldOverwriteExisting()
          Indicates whether or not the writer should overwrite resouces that already exist in the target location.
 

Field Detail

PATH_SEPERATOR

public static final String PATH_SEPERATOR
Specifies the path seperator.

See Also:
Constant Field Values

BUNDLED_WRITER_FORMAT

public static final String BUNDLED_WRITER_FORMAT
Specifies that the asset should be in a bundled storage format. This means that the manifest and all it's artifacts will be zipped into a .ras file.

See Also:
Constant Field Values
Method Detail

getAssetPath

public String getAssetPath()
Get the asset's path. The format is writer specific, for instance a file path for file based assets.

Returns:
the target location file path

shouldOverwriteExisting

public boolean shouldOverwriteExisting()
Indicates whether or not the writer should overwrite resouces that already exist in the target location.

Returns:
true if the writer should overwrite existing resouces

setManifest

public void setManifest(EObject theManifest)
Sets the primary manifest for the asset. The parameter theManifest should be the EMF object that represents the manifest. The writer should serialize the object into a physical manifest and add it to the asset. Note: This should not occur until all resources have been added to the asset. If done prior there is the potential for the manifest to have invalid references. Only the asset writer can construct and return an accurate reference for insertion in the manifest.

Parameters:
theManifest - the EMF object representing the manifest
Throws:
IllegalArgumentException - if theManifest is null
See Also:
EObject

addFile

public IAssetWriterStatus addFile(InputStream theInputStream,
                                  String theRelativePath,
                                  IProgressMonitor theProgressMonitor)
Add a stream to the asset.

Parameters:
theInputStream - the stream that will be added
theRelativePath - the path relative to the root of the asset.
theProgressMonitor - optionally tracks progress of the file being added. This parameter can be null
Returns:
the status of the addition including the reference of the added stream.

addFile

public IAssetWriterStatus addFile(String theSourceFilePath,
                                  String theRelativePath)
Add a file to the asset.

Parameters:
theSourceFilePath - the path of the file that will be added
theRelativePath - the path of the file relative to the root of the asset.
Returns:
the status of the addition including the reference of the added file.

addFolder

public IAssetWriterStatus addFolder(String theRelativePath)
Create a new folder in the asset.

Parameters:
theRelativePath - the path of the folder relative to the root of the asset.
Returns:
the status of the addition including the reference of the added folder.

open

public IStatus open(String theAssetPath,
                    boolean shouldOverwriteExisting)
Opens the writer. This should be called to begin the writing of the asset.

Parameters:
theAssetPath - The format is writer specific, for instance a file path for file based assets.
shouldOverwriteExisting - indicates if existing resources should be overwritten
Returns:
the result of the open operation

close

public IStatus close()
Closes the writer. This should be called to finalize the writing of the asset.

Returns:
the result of the close operation

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.