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

org.eclipse.cosmos.rm.repository.internal.core
Class FileSystemSMLRepository

java.lang.Object
  extended by org.eclipse.cosmos.rm.repository.internal.operations.AbstractListenerManager
      extended by org.eclipse.cosmos.rm.repository.internal.core.FileSystemSMLRepository
All Implemented Interfaces:
java.io.Serializable, org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository

public class FileSystemSMLRepository
extends AbstractListenerManager
implements org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository, java.io.Serializable

A file system implementation of an SML repository. The repository works from a root context folder that is provided as a connection attribute when connecting to this repository.

See Also:
Serialized Form

Field Summary
static java.lang.String ATTRIBUTE_CONFIGURATION_PROPERTY
          The attribute name of the configuration property file
 
Constructor Summary
FileSystemSMLRepository()
           
 
Method Summary
 void addDocument(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata, java.io.InputStream input)
          The id of the meta-data is used as the file path.
 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
 org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] fetchDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata)
          Returns the set of documents that match the meta-data that is passed in.
 org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] getActiveDocuments()
          Returns the set of active documents of this repository
 MetadataProcessor getMetadataProcessor()
           
 org.eclipse.cosmos.rm.repository.provisional.operations.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(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata)
          Remove the SML document with the meta-data that is passed in.
 org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] retrieveRootDocuments()
          Retrieves the SML documents representing the root context of a model.
 void setActiveDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.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
 
Methods inherited from class org.eclipse.cosmos.rm.repository.internal.operations.AbstractListenerManager
addProgressListener, getProgressListeners, removeProgressListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_CONFIGURATION_PROPERTY

public static final java.lang.String ATTRIBUTE_CONFIGURATION_PROPERTY
The attribute name of the configuration property file

See Also:
Constant Field Values
Constructor Detail

FileSystemSMLRepository

public FileSystemSMLRepository()
Method Detail

connect

public void connect(java.util.Map attributes)
             throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryConnectionException
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
A connection will first need to be established before a repository can be used

Specified by:
connect in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
attributes - The attributes required as part of the connection. This is specific to an implementation.
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryConnectionException - If a connection cannot be established
See Also:
ISMLRepository.connect(java.util.Map)

addDocument

public void addDocument(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata,
                        java.io.InputStream input)
                 throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
The id of the meta-data is used as the file path. The id is expected to be specified relative to the root context directory. If the id ends with a '/', then the document is stored in the folder structure passed in. If however the id does not end with '/', then the last segment is used as the filename. If no id is specified, then an arbitrary name is used and the document is stored at the root context directory.

Specified by:
addDocument in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException - If the operation fails
See Also:
ISMLRepository.addDocument(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata, java.io.InputStream)

disconnect

public void disconnect()
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Disconnects this repository

Specified by:
disconnect in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
See Also:
ISMLRepository.disconnect()

fetchDocuments

public org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] fetchDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata)
                                                                                    throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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

Specified by:
fetchDocuments in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
metadata - The meta-data used to perform the query
Returns:
The set of stored documents that match the meta-data passed in
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException - If the operation fails
See Also:
ISMLRepository.fetchDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata)

getActiveDocuments

public org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] getActiveDocuments()
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns the set of active documents of this repository

Specified by:
getActiveDocuments in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns:
The set of active documents or an empty list if no such list exists.
See Also:
ISMLRepository.getActiveDocuments()

setActiveDocuments

public void setActiveDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] documents)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Sets the set of active documents of this repository

Specified by:
setActiveDocuments in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
documents - The active documents of this repository
See Also:
org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository#setActiveDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata[])

getOperation

public org.eclipse.cosmos.rm.repository.provisional.operations.ISMLOperation getOperation(java.lang.String id)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns the operation matching the operation id passed in.

Specified by:
getOperation in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
id - The operation id
Returns:
The supported operation or null if no such operation is supported
See Also:
ISMLRepository.getOperation(java.lang.String)

getSupportedOperations

public java.lang.String[] getSupportedOperations()
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns the ID of the supported operations of this repository.

Specified by:
getSupportedOperations in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns:
The supported operations of this repository
See Also:
ISMLRepository.getSupportedOperations()

isConnection

public boolean isConnection()
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns a boolean indicating the connection status of the repository.

Specified by:
isConnection in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns:
true if a connection has been established; false otherwise
See Also:
ISMLRepository.isConnection()

removeDocuments

public void removeDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata metadata)
                     throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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.

Specified by:
removeDocuments in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
metadata - The meta-data matching the stored documents that will be removed
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException - If the operation fails
See Also:
ISMLRepository.removeDocuments(org.eclipse.cosmos.rm.repository.provisional.resource.ISMLMetadata)

retrieveRootDocuments

public org.eclipse.cosmos.rm.repository.provisional.resource.ISMLDocument[] retrieveRootDocuments()
                                                                                           throws org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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.

Specified by:
retrieveRootDocuments in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Returns:
The documents representing the root context of a model or an empty list/null if no such thing exists
Throws:
org.eclipse.cosmos.rm.repository.provisional.exception.RepositoryOperationException - If the operation fails
See Also:
ISMLRepository.retrieveRootDocuments()

getMetadataProcessor

public MetadataProcessor getMetadataProcessor()
Returns:
the metadataProcessor

getProperty

public java.lang.Object getProperty(java.lang.String name,
                                    java.lang.Object defaultValue)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Retrieve the property of type Object with the name passed in. The default value is returned if no such property is found

Specified by:
getProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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
See Also:
ISMLRepository.getProperty(java.lang.String, java.lang.Object)

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Retrieve the property of type String with the name passed in. The default value is returned if no such property is found

Specified by:
getProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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
See Also:
ISMLRepository.getProperty(java.lang.String, java.lang.String)

getProperty

public boolean getProperty(java.lang.String name,
                           boolean defaultValue)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Retrieve the property of type boolean with the name passed in. The default value is returned if no such property is found

Specified by:
getProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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
See Also:
ISMLRepository.getProperty(java.lang.String, boolean)

getProperty

public int getProperty(java.lang.String name,
                       int defaultValue)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Retrieve the property of type int with the name passed in. The default value is returned if no such property is found

Specified by:
getProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
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
See Also:
ISMLRepository.getProperty(java.lang.String, int)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Sets the property of type Object with the name and value passed in

Specified by:
setProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
name - The name of the property
value - The value of the property
See Also:
ISMLRepository.setProperty(java.lang.String, java.lang.Object)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Sets the property of type String with the name and value passed in

Specified by:
setProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
name - The name of the property
value - The value of the property
See Also:
ISMLRepository.setProperty(java.lang.String, java.lang.String)

setProperty

public void setProperty(java.lang.String name,
                        boolean value)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Sets the property of type boolean with the name and value passed in

Specified by:
setProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
name - The name of the property
value - The value of the property
See Also:
ISMLRepository.setProperty(java.lang.String, boolean)

setProperty

public void setProperty(java.lang.String name,
                        int value)
Description copied from interface: org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Sets the property of type int with the name and value passed in

Specified by:
setProperty in interface org.eclipse.cosmos.rm.repository.provisional.core.ISMLRepository
Parameters:
name - The name of the property
value - The value of the property
See Also:
ISMLRepository.setProperty(java.lang.String, int)

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