com.sodius.mdw.core.model.io
Interface ConnectorDescriptor

All Superinterfaces:
PropertySet

public interface ConnectorDescriptor
extends PropertySet

Describes the properties of a model connector.

This interface is not intended to be implemented by clients.

See Also:
Model.read(String, String), Model.write(String, String)

Field Summary
static String PROPERTY_DIAGRAM_PROVIDER
          String property that can be used to support diagrams in doc templates.
static String PROPERTY_SINGLE_THREAD
          Boolean property that can be used to tell MDWorkbench the underlying connector does not support multi-threaded environments.
 
Method Summary
 String getClassName()
          Returns the implementation class name, subclass of ModelReader or ModelWriter, which is used to do the job of reading/writing the model.
 MetamodelConfiguration getConfiguration()
          Returns the configuration from which this connector originates.
 FileExtensionDescriptor getDefaultFileExtension()
          Returns the default file extension this connector expects to deal with.
 List<FileExtensionDescriptor> getFileExtensions()
          Returns the registered file extension descriptors.
 ConnectorKind getKind()
          Returns the connector kind, which describes the type of uri (resource locator) this connector expects.
 Metamodel getMetamodel()
          Returns the metamodel to which this connector is registered.
 String getName()
          Returns the connector name.
 Object getProperty(String name)
          Returns the value mapped to the specified property name.
 Set<String> getPropertyNames()
          Returns the property names registered to this connector.
 boolean isReader()
          Determines wheter this connector is meant to read models.
 boolean isWriter()
          Determines wheter this connector is meant to write models.
 void setProperty(String name, Object value)
          Associates the specified value with the specified property name.
 
Methods inherited from interface com.sodius.mdw.core.util.PropertySet
getProperty, getProperty, getProperty, getProperty, setProperty, setProperty, setProperty, setProperty
 

Field Detail

PROPERTY_SINGLE_THREAD

static final String PROPERTY_SINGLE_THREAD
Boolean property that can be used to tell MDWorkbench the underlying connector does not support multi-threaded environments. In MDWorkbench UI, this means the model should be loaded in the UI event dispatch thread. Default value is false.

See Also:
Constant Field Values

PROPERTY_DIAGRAM_PROVIDER

static final String PROPERTY_DIAGRAM_PROVIDER
String property that can be used to support diagrams in doc templates. This optional property must define the qualified name of a subclass of DiagramProvider.

Since:
2.1.0
See Also:
DiagramProvider, Constant Field Values
Method Detail

getMetamodel

Metamodel getMetamodel()
Returns the metamodel to which this connector is registered. The connector is available for any model based on this metamodel.

Returns:
the connector metamodel.

getConfiguration

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

This configuration may differ from the metamodel's one if the connector is declared externally. If connector related resources are required, always use this configuration rather than the metamodel's one, as you don't necessary have the knowledge of how this connector is declared.

Returns:
the connector configuration.

getName

String getName()
Returns the connector name. The connector is referenced by its name when reading and writing models.

This name is expected to be unique for a particular metamodel.

Returns:
the connector name.
See Also:
Model.read(String, String), Model.write(String, String)

getClassName

String getClassName()
Returns the implementation class name, subclass of ModelReader or ModelWriter, which is used to do the job of reading/writing the model.

Note : this is an advanced facility that is not needed in regular cases You should not have to consider this property in typical uses, since the model framework will instantiate and configure by itself the implementation class as requested.

Returns:
the connector implementation class name.

getKind

ConnectorKind getKind()
Returns the connector kind, which describes the type of uri (resource locator) this connector expects.

Returns:
the connector kind.

isReader

boolean isReader()
Determines wheter this connector is meant to read models. If this is a reader, then its implementation class name must be a subclass of ModelReader. A connector descriptor is either a reader or a writer, but not both.

Returns:
true if this connector descriptor is a model reader, false otherwise.

isWriter

boolean isWriter()
Determines wheter this connector is meant to write models. If this is a writer, then its implementation class name must be a subclass of ModelWriter. A connector descriptor is either a reader or a writer, but not both.

Returns:
true if this connector descriptor is a model writer, false otherwise.

getFileExtensions

List<FileExtensionDescriptor> getFileExtensions()
Returns the registered file extension descriptors. These are the file extensions the underlying connector is able to deal with.

Typical use of these extensions is to provide a comprehensive file selection dialog box to the end-user. The file uri passed to the underlying connector is not guaranteed to have one of these extensions.

If the connector does not deal with files, the returned list is likely to be empty but this is not required. Always check the getKind() to determine the type of uri this connector expects.

Returns:
an unmodifiable list of registered FileExtensionDescriptor, an empty list if no extensions is registered.
See Also:
FileExtensionDescriptor

getDefaultFileExtension

FileExtensionDescriptor getDefaultFileExtension()
Returns the default file extension this connector expects to deal with.

Typical use is to select this extension as the default one in a file selection dialog box.

Returns:
the default file extension descriptor, null if not specified.

getPropertyNames

Set<String> getPropertyNames()
Returns the property names registered to this connector.

These properties may comes from the connector descriptor declaration file. They also can be set dynamically using setProperty(String, Object). As the underlying ModelReader or ModelWriter has access to this descriptor, this can be a facility to pass extra parameters to configure the reader/writer.

Specified by:
getPropertyNames in interface PropertySet
Returns:
an unmodifiable collection of registered property names.

getProperty

Object getProperty(String name)
Returns the value mapped to the specified property name. Returns null if the property is not defined or if it maps to null.

Specified by:
getProperty in interface PropertySet
Parameters:
name - the property name
Returns:
the property value

setProperty

void setProperty(String name,
                 Object value)
Associates the specified value with the specified property name.

Specified by:
setProperty in interface PropertySet
Parameters:
name - the property name.
value - the property value (can be null)