com.sodius.mdw.core.model
Interface Metamodel

All Superinterfaces:
Comparable<Object>
All Known Subinterfaces:
EMFMetamodel

public interface Metamodel
extends Comparable<Object>

Defines a metamodel ("UML 2.1" for example), from which you can manage models.

This interface is not intended to be implemented by clients.

See Also:
Model.getMetamodel(), MDWObject.eMetamodel(), MetamodelManager.getMetamodel(String)

Method Summary
 int compareTo(Object o)
          Compare the metamodels based on their presentation name.
 Model createModel()
          Creates an empty model based on this metamodel.
 MetamodelConfiguration getConfiguration()
          Returns the configuration from which this metamodel originates.
 EClassifier getEClassifier(String name)
          Returns the EClassifier of specified name defined in this metamodel.
  getEClassifiers()
          Returns the list of EClassifiers defined in this metamodel.
 EPackage getEPackage()
          Returns the EPackage declaring this metamodel.
 MetamodelManager getManager()
          Returns the manager to which the metamodel is registered.
 ConnectorDescriptor getModelReaderDescriptor(String name)
          Returns the connector, used to read a model, that matches the specified name.
 List<ConnectorDescriptor> getModelReaderDescriptors()
          Returns the registered connectors that can be used to read a model.
 ConnectorDescriptor getModelWriterDescriptor(String name)
          Returns the connector, used to write a model, that matches the specified name.
 List<ConnectorDescriptor> getModelWriterDescriptors()
          Returns the registered connectors that can be used to write a model.
 String getName()
          Returns the name of this metamodel ("UML" for example).
 String getPresentationName()
          Returns the display name of this metamodel, which may include a name and a metamodel version ("UML 2.1" for example).
 String getUniqueID()
          Returns the ID which uniquely identifies this metamodel.
 String getVersion()
          Returns the version of this metamodel ("2.1" for example), if any.
 boolean isAssignableFrom(Metamodel metamodel)
          Determines if the metamodel represented by this Metamodel object is the same as the specified Metamodel parameter, and if the applied metamodel extensions are the same or a subset of the ones applied on the Metamodel parameter.
 Model readModel(String readerName, String uri)
          Creates and populates a model using the specified connector information.
 

Method Detail

getManager

MetamodelManager getManager()
Returns the manager to which the metamodel is registered.

Returns:
the metamodel manager.

getConfiguration

MetamodelConfiguration getConfiguration()
Returns the configuration from which this metamodel originates. The configuration can be used to retrieve metamodel related resources.

Returns:
the metamodel configuration.

getName

String getName()
Returns the name of this metamodel ("UML" for example).

Returns:
the name of the metamodel

getVersion

String getVersion()
Returns the version of this metamodel ("2.1" for example), if any. This version is for example used during XMI serialization.

Returns:
the version of the metamodel, an empty String if no version is specified.

getPresentationName

String getPresentationName()
Returns the display name of this metamodel, which may include a name and a metamodel version ("UML 2.1" for example).

Returns:
the display name of the metamodel

getUniqueID

String getUniqueID()
Returns the ID which uniquely identifies this metamodel. This ID will be used in templates to refer to the metamodel.

Returns:
the unique ID of the metamodel.

createModel

Model createModel()
Creates an empty model based on this metamodel.

Returns:
an empty model.

readModel

Model readModel(String readerName,
                String uri)
                throws CoreException
Creates and populates a model using the specified connector information.

The reader name must match a connector registered on this metamodel. The uri is used to locate a resource from where the connector should read information. If the connector expects a file, the uri must be a valid file path. Otherwise, it can be any connector specific resource locator, including null when the connector does not expect any uri.

This method is a facility and acts as a strict equivalent of calling createModel() and then Model.read(String, String).

Parameters:
readerName - the connector name to be used.
uri - an additional resource locator used by the connector to read the model (can be null)
Throws:
CoreException - if the model could not be loaded. Reasons include:
  • The reader name does not match any registered connector.
  • The uri is not valid.
  • The connector failed to read the resource located by the uri.
See Also:
Model.read(String, String), getModelReaderDescriptors(), ConnectorDescriptor.getKind()

getModelReaderDescriptors

List<ConnectorDescriptor> getModelReaderDescriptors()
Returns the registered connectors that can be used to read a model.

The connectors are returned in the order they are declared in the metamodels.xml file of this metamodel. Additional connectors (declared outside of the metamodel descriptor) are appended in an unpredictable order.

Returns:
an unmodifiable list of registered connectors that can be used to read a model.

getModelReaderDescriptor

ConnectorDescriptor getModelReaderDescriptor(String name)
                                             throws CoreException
Returns the connector, used to read a model, that matches the specified name.

Parameters:
name - the name of the connector to retrieve.
Returns:
the reader connector that matches the specified name
Throws:
CoreException - if no reader connector matches this name
See Also:
ConnectorDescriptor.getName()

getModelWriterDescriptors

List<ConnectorDescriptor> getModelWriterDescriptors()
Returns the registered connectors that can be used to write a model.

The connectors are returned in the order they are declared in the metamodels.xml file of this metamodel. Additional connectors (declared outside of the metamodel descriptor) are appended in an unpredictable order.

Returns:
an unmodifiable list of registered connectors that can be used to write a model.

getModelWriterDescriptor

ConnectorDescriptor getModelWriterDescriptor(String name)
                                             throws CoreException
Returns the connector, used to write a model, that matches the specified name.

Parameters:
name - the name of the connector to retrieve.
Returns:
the writer connector that matches the specified name
Throws:
CoreException - if no writer connector matches this name
See Also:
ConnectorDescriptor.getName()

compareTo

int compareTo(Object o)
Compare the metamodels based on their presentation name.

Specified by:
compareTo in interface Comparable<Object>
See Also:
getPresentationName()

getEClassifiers

 getEClassifiers()
Returns the list of EClassifiers defined in this metamodel.

Returns:
the list of EClassifiers defined in this metamodel.
Since:
MDWorkbench 3.0.0

getEClassifier

EClassifier getEClassifier(String name)
Returns the EClassifier of specified name defined in this metamodel.

Parameters:
name - the name of the classifier to look for
Returns:
the EClassifier of specified name defined in this metamodel, null if none.
Since:
MDWorkbench 3.0.0

getEPackage

EPackage getEPackage()
Returns the EPackage declaring this metamodel.

Returns:
the EPackage declaring this metamodel.
Since:
MDWorkbench 3.0.0

isAssignableFrom

boolean isAssignableFrom(Metamodel metamodel)
Determines if the metamodel represented by this Metamodel object is the same as the specified Metamodel parameter, and if the applied metamodel extensions are the same or a subset of the ones applied on the Metamodel parameter.

Parameters:
metamodel - the metamodel to be checked
Returns:
true if the specified metamodel is the same as the receiver and if the applied metamodel extensions are compatible.
Since:
MDWorkbench 3.0.0