IBM Rational Software Modeler
Release 6.0

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


public interface IRASAssetReader

This is used to read in an asset in a storage format independent way. Any file read-access to the asset should be done throught this class. This interface is not intended to be implemented by clients.


Method Summary
 void close()
          Closes any resources used by the reader.
 String getAssetPath()
          Get the asset's path.
 IRASAssetReader getAssetReader(String theReference)
          Gets a reference that is specified in the asset as an asset reader.
 Document getManifest()
          Get the asset's manifest in the latest supported format.
 String getManifestReference()
          Get the asset's manifest reference.
 InputStream getResourceStream(String theReference)
          Gets a reference that is specified in the asset as a stream.
 Object loadAsset()
          Load the asset as an emf model.
 void open(String theAssetPath, String theManifestReference)
          Set the asset's path.
 boolean performExportIfRelatedAssets()
          Indicates if it should recursively export this asset or treat it as already packaged.
 

Method Detail

getAssetPath

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

Returns:
the asset's path

open

public void open(String theAssetPath,
                 String theManifestReference)
Set the asset's path. The format is reader specific, for instance a file path for file based assets. This is intended to only be used by the factory creating the reader.

Parameters:
theAssetPath - the new asset path
theManifestReference - optional; the manifest to use in the asset. This may be null in which case the reader should use the default manifest.

getManifest

public Document getManifest()
                     throws IOException,
                            NullPointerException
Get the asset's manifest in the latest supported format. This method will take care of updating the profile to the latest version supported.

Returns:
the manifest
Throws:
IOException - if an error occured retrieving the manifest
NullPointerException - if an error occured retrieving the manifest because an argument was null

loadAsset

public Object loadAsset()
                 throws IOException,
                        NullPointerException
Load the asset as an emf model.

Returns:
the asset, or null if it can't be found
Throws:
NullPointerException - if the manifest is null or it couldn't be initialized
IOException - if an error occured retrieving the manifest

getResourceStream

public InputStream getResourceStream(String theReference)
                              throws IOException
Gets a reference that is specified in the asset as a stream. This allows the client to get referenced artifacts without having to know how the asset is packaged. The implementation should always first try to get it in its implementation specific way. If that fails to find the reference then it should try to get the reference as an abolute file path.

Parameters:
theReference - the reference as specified in the asset
Returns:
a stream to the resource being referenced or null if the resource doesn't exist.
Throws:
IOException - if an error occured retrieving the reference or if it didn't exist

close

public void close()
Closes any resources used by the reader. Note that the readers should be able to re-open the resources if another request is made on the reader.


getAssetReader

public IRASAssetReader getAssetReader(String theReference)
Gets a reference that is specified in the asset as an asset reader. This is used mainly for readering the related assets.

Parameters:
theReference - the reference as specified in the asset
Returns:
the reference's asset reader or null if the reference doesn't point to a valid asset/manifest.

performExportIfRelatedAssets

public boolean performExportIfRelatedAssets()
Indicates if it should recursively export this asset or treat it as already packaged. If true then it will perform an export on this asset and include the manifest and all its references. If false then it will simply include the manifest as is.

Returns:
true if the assets should be processed

getManifestReference

public String getManifestReference()
Get the asset's manifest reference. The format is reader specific and can be null. For instance for a bundled asset this can point to the specific manifest to use.

Returns:
the asset's manifest reference

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

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