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

org.eclipse.cosmos.rm.repository.provisional.core
Interface ISMLRepository


public interface ISMLRepository

Represents a repository that can be used to connect to and fetch stored documents from. This interface provides an abstraction from the type of repository used and the query method used to retrieve stored documents.


Method Summary
 void addDocument(ISMLMetadata metadata, java.io.InputStream input)
          Add a document to this repository.
 void connect(java.util.Map attributes)
          A connection will first need to be established before a repository can be used
 void disconnect()
          Disconnects this repository
 ISMLDocument[] fetchDocuments(ISMLMetadata metadata)
          Returns the set of documents that match the meta-data that is passed in.
 ISMLDocument[] getActiveDocuments()
          Returns the set of active documents of this repository
 ISMLOperation getOperation(java.lang.String id)
          Returns the operation matching the operation id passed in.
 boolean getProperty(java.lang.String name, boolean defaultValue)
          Retrieve the property of type boolean with the name passed in.
 int getProperty(java.lang.String name, int defaultValue)
          Retrieve the property of type int with the name passed in.
 java.lang.Object getProperty(java.lang.String name, java.lang.Object defaultValue)
          Retrieve the property of type Object with the name passed in.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Retrieve the property of type String with the name passed in.
 java.lang.String[] getSupportedOperations()
          Returns the ID of the supported operations of this repository.
 boolean isConnection()
          Returns a boolean indicating the connection status of the repository.
 void removeDocuments(ISMLMetadata metadata)
          Remove the SML document with the meta-data that is passed in.
 ISMLDocument[] retrieveRootDocuments()
          Retrieves the SML documents representing the root context of a model.
 void setActiveDocuments(ISMLDocument[] documents)
          Sets the set of active documents of this repository
 void setProperty(java.lang.String name, boolean value)
          Sets the property of type boolean with the name and value passed in
 void setProperty(java.lang.String name, int value)
          Sets the property of type int with the name and value passed in
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets the property of type Object with the name and value passed in
 void setProperty(java.lang.String name, java.lang.String value)
          Sets the property of type String with the name and value passed in
 

Method Detail

connect

void connect(java.util.Map attributes)
             throws RepositoryConnectionException
A connection will first need to be established before a repository can be used

Parameters:
attributes - The attributes required as part of the connection. This is specific to an implementation.
Throws:
RepositoryConnectionException - If a connection cannot be established

isConnection

boolean isConnection()
Returns a boolean indicating the connection status of the repository.

Returns:
true if a connection has been established; false otherwise

getProperty

java.lang.Object getProperty(java.lang.String name,
                             java.lang.Object defaultValue)
Retrieve the property of type Object with the name passed in. The default value is returned if no such property is found

Parameters:
name - The name of the property
defaultValue - The default value
Returns:
The property with the name passed in or defaultValue if no such property is found

setProperty

void setProperty(java.lang.String name,
                 java.lang.Object value)
Sets the property of type Object with the name and value passed in

Parameters:
name - The name of the property
value - The value of the property

getProperty

java.lang.String getProperty(java.lang.String name,
                             java.lang.String defaultValue)
Retrieve the property of type String with the name passed in. The default value is returned if no such property is found

Parameters:
name - The name of the property
defaultValue - The default value
Returns:
The property with the name passed in or defaultValue if no such property is found

setProperty

void setProperty(java.lang.String name,
                 java.lang.String value)
Sets the property of type String with the name and value passed in

Parameters:
name - The name of the property
value - The value of the property

getProperty

boolean getProperty(java.lang.String name,
                    boolean defaultValue)
Retrieve the property of type boolean with the name passed in. The default value is returned if no such property is found

Parameters:
name - The name of the property
defaultValue - The default value
Returns:
The property with the name passed in or defaultValue if no such property is found

setProperty

void setProperty(java.lang.String name,
                 boolean value)
Sets the property of type boolean with the name and value passed in

Parameters:
name - The name of the property
value - The value of the property

getProperty

int getProperty(java.lang.String name,
                int defaultValue)
Retrieve the property of type int with the name passed in. The default value is returned if no such property is found

Parameters:
name - The name of the property
defaultValue - The default value
Returns:
The property with the name passed in or defaultValue if no such property is found

setProperty

void setProperty(java.lang.String name,
                 int value)
Sets the property of type int with the name and value passed in

Parameters:
name - The name of the property
value - The value of the property

retrieveRootDocuments

ISMLDocument[] retrieveRootDocuments()
                                     throws RepositoryOperationException
Retrieves the SML documents representing the root context of a model. This depends on the underlying model that a repository stores. If there is no such notion of a root context in an underlying model, then an empty list or null is expected to be returned.

Returns:
The documents representing the root context of a model or an empty list/null if no such thing exists
Throws:
RepositoryOperationException - If the operation fails

addDocument

void addDocument(ISMLMetadata metadata,
                 java.io.InputStream input)
                 throws RepositoryOperationException
Add a document to this repository. The data of the SML document is read from the input stream and its meta-data (if one exists) is read from the metadata argument.

Parameters:
metadata - The meta-data of the document. The only relevant fields that should be read from the meta-data is the id, alias(es), and bound rule(s). Other fields can potentially be used by implementers.
input - The input stream that contains the document
Throws:
RepositoryOperationException - If the operation fails

removeDocuments

void removeDocuments(ISMLMetadata metadata)
                     throws RepositoryOperationException
Remove the SML document with the meta-data that is passed in. The documents removed is the returned set of fetchDocuments(metadata). This operation has no effect if no stored document matches the meta-data passed in.

Parameters:
metadata - The meta-data matching the stored documents that will be removed
Throws:
RepositoryOperationException - If the operation fails

getSupportedOperations

java.lang.String[] getSupportedOperations()
Returns the ID of the supported operations of this repository.

Returns:
The supported operations of this repository

getOperation

ISMLOperation getOperation(java.lang.String id)
Returns the operation matching the operation id passed in.

Parameters:
id - The operation id
Returns:
The supported operation or null if no such operation is supported

fetchDocuments

ISMLDocument[] fetchDocuments(ISMLMetadata metadata)
                              throws RepositoryOperationException
Returns the set of documents that match the meta-data that is passed in. An empty list is returned if the meta-data does not match any stored documents

Parameters:
metadata - The meta-data used to perform the query
Returns:
The set of stored documents that match the meta-data passed in
Throws:
RepositoryOperationException - If the operation fails

getActiveDocuments

ISMLDocument[] getActiveDocuments()
Returns the set of active documents of this repository

Returns:
The set of active documents or an empty list if no such list exists.

setActiveDocuments

void setActiveDocuments(ISMLDocument[] documents)
Sets the set of active documents of this repository

Parameters:
documents - The active documents of this repository

disconnect

void disconnect()
Disconnects this repository


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