uk.ac.ic.doc.automed.modelmanagement.modeldef
Class ModelDef

java.lang.Object
  extended by uk.ac.ic.doc.automed.modelmanagement.modeldef.ModelDef
Direct Known Subclasses:
ASGFileModelDef, BBKSQLModelDef, BibTeXModelDef, CSVModelDef, EERModelDef, ERModelDef, HDMModelDef, ICOWLDLModelDef, OWLDLModelDef, OWLLiteModelDef, P2PModelDef, QueryCacheModelDef, RDFSModelDef, RelModelDef, SMRModelDef, SQLModelDef, UMLModelDef, XMLDSSModelDef, XMLSchemaModelDef, YattaModelDef

public abstract class ModelDef
extends java.lang.Object

Author:
acs203 The base class for model definitions. This class contains methods to create the Constructs needed for each AutoMed Model as well as any special features that model may have.

Field Summary
protected  java.lang.String automedModelName
           
protected  java.lang.String baseName
           
protected  boolean distinctModels
           
protected static java.lang.String[] empty
           
(package private)  int featureSet
           
protected  boolean modelInUse
           
protected  java.lang.String modelName
           
static java.lang.String SOURCE_PREFIX
          String prefixed to AutoMed oriented Model names in order to obtain source oriented Model names.
 
Constructor Summary
ModelDef()
           
 
Method Summary
 void clearFeatures()
          Clear all the features for this factory.
abstract  void createAutoMedModel()
          Create the automed oriented Model used to represent the Schema of the datasource.
abstract  void createModel()
          Create the source oriented Model used to represent the Schema of the datasource.
 Model getAutoMedModel()
           
 java.lang.String getAutoMedModelName()
          Find the name of the Model that will be used to represent an AutoMed oriented view of the data source.
abstract  java.lang.String[] getFeatureNames()
          Return the list of feature names provided by the model definition.
 int getFeatures()
          Return the bitwise or of all the features in use for a wrapper.
 Model getModel()
           
 java.lang.String getModelBaseName()
          Return text used as basis for generating Model names
 java.lang.String getModelName()
          Find the name of the Model that will be used when a new wrapper is generated
 boolean isFeatureInUse(int features)
          Test if a certain group of features is being implemented in the representation of the datasource model in the AutoMed repository
 void setFeatures(int features)
          Allows certain features of the Model used for Schemas generated by this wrapper factory.
 void setFeatures(int[] features)
          Allows certain features of the Model used for Schemas generated by this model definition to be set.
 void setModelBaseName(java.lang.String baseName)
          Each implementing class gives a name for the Models that will be generated for Schemas.
private  void setModelNames()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_PREFIX

public static final java.lang.String SOURCE_PREFIX
String prefixed to AutoMed oriented Model names in order to obtain source oriented Model names. Note that some wrappers do not need the source/AutoMed oriented distinction, and therefore do not use this prefix.

See Also:
Constant Field Values

modelInUse

protected boolean modelInUse

featureSet

int featureSet

distinctModels

protected boolean distinctModels

baseName

protected java.lang.String baseName

modelName

protected java.lang.String modelName

automedModelName

protected java.lang.String automedModelName

empty

protected static final java.lang.String[] empty
Constructor Detail

ModelDef

public ModelDef()
Method Detail

setModelBaseName

public void setModelBaseName(java.lang.String baseName)
Each implementing class gives a name for the Models that will be generated for Schemas. This same will be suffixed by the value of getFeatures() (unless that is zero). Thus one may create different models with different features set, and they obtain distinct Model names. Also for source oriented Models that differ from AutoMed oriented Models, it will be prefixed by SOURCE_PREFIX.

Parameters:
baseName - text that appears in the Model name

getModelBaseName

public java.lang.String getModelBaseName()
Return text used as basis for generating Model names


isFeatureInUse

public final boolean isFeatureInUse(int features)
Test if a certain group of features is being implemented in the representation of the datasource model in the AutoMed repository

Parameters:
features - is the bitwise `or' of feature flags to be tested
Returns:
true if all those features are being ignored

getAutoMedModelName

public final java.lang.String getAutoMedModelName()
Find the name of the Model that will be used to represent an AutoMed oriented view of the data source.

Returns:
name of Model used for the Schema of new wrappers.

getModelName

public final java.lang.String getModelName()
Find the name of the Model that will be used when a new wrapper is generated

Returns:
name of Model used for the Schema of new wrappers.

getFeatures

public final int getFeatures()
Return the bitwise or of all the features in use for a wrapper. Note that features are only defined in the implementing wrapper factory.


clearFeatures

public final void clearFeatures()
Clear all the features for this factory.


setFeatures

public void setFeatures(int features)
                 throws IntegrityException
Allows certain features of the Model used for Schemas generated by this wrapper factory.

Parameters:
features - a bitwise `or' of the feature flags. By default no features are used.
Throws:
IntegrityException - if a Model with the given features already exists

getFeatureNames

public abstract java.lang.String[] getFeatureNames()
Return the list of feature names provided by the model definition. The order of feature names is the same as the bit position in the #setFeature methods. In particular you may use the list on javax.swing.JList#setListData()


setFeatures

public void setFeatures(int[] features)
                 throws IntegrityException
Allows certain features of the Model used for Schemas generated by this model definition to be set.

Parameters:
features - an array of integers containing the bit position of the feature to set. Note that is you create a JList from the featureNames of the factory, then you may called this method with the value of javax.swing.JList.getSelectedIndices()
Throws:
IntegrityException - if a Model with the given features already exists

setModelNames

private void setModelNames()

createModel

public abstract void createModel()
                          throws InconsistentException
Create the source oriented Model used to represent the Schema of the datasource.

Throws:
InconsistentException

createAutoMedModel

public abstract void createAutoMedModel()
                                 throws InconsistentException
Create the automed oriented Model used to represent the Schema of the datasource.

Throws:
InconsistentException

getModel

public Model getModel()
               throws AutoMedException
Throws:
AutoMedException

getAutoMedModel

public Model getAutoMedModel()
                      throws AutoMedException
Throws:
AutoMedException