IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.ras.core.data
Interface IDataModel

All Known Subinterfaces:
IDefaultComponentExportDataModel, IDefaultExportDataModel, IDefaultWebserviceExportDataModel, IImportDataModel

public interface IDataModel

Allows working with properties and registering listeners when the properties change.

The IDataModel interface is not intended to be implemented by clients.


Field Summary
static Object NULL
          The property that represents a null value.
 
Method Summary
 void addDataModelListener(IDataModelListener theListener)
          Adds the model listener that is notified when the model changes.
 boolean containsProperty(String theName)
          Checks if the model contains a property with the specified name.
 Object getProperty(String theName)
          Retrieves the property with the specified name.
 Boolean getPropertyAsBoolean(String theName)
          Retrieves the property with the specified name as a Boolean.
 Integer getPropertyAsInteger(String theName)
          Retrieves a property with the specified name as an Integer.
 String getPropertyAsString(String theName)
          Retrieves the property with the specified name as a String.
 void registerValidator(String theName, IPropertyValidator dataModelValidator)
          Indicate to the data model that the custom validator specified should be used for validating the property.
 void removeDataModelListener(IDataModelListener theListener)
          Removes a model listener.
 void removeProperty(String theName)
          Removes the property with the specified name and its corresponding value from this list of properties.
 void setProperty(String theName, boolean theValue)
          Sets the property with the specified name to the specified boolean value.
 void setProperty(String theName, int theValue)
          Sets a property with the specified name to the specified int value.
 void setProperty(String theName, Object theValue)
          Set a property with the specified name to the specified value.
 void unregisterValidator(String theName)
          Remove the registered validator if one exists for the property with the specified name from the data model.
 IStatus validateAll(IProgressMonitor progressMonitor)
          Validates the properties of the data model to determine if it is in an acceptable state.
 IStatus validateProperty(String theName, IProgressMonitor progressMonitor)
          Validate the property to determine if the property with the specified name is in an acceptable state.
 

Field Detail

NULL

public static final Object NULL
The property that represents a null value.

Method Detail

addDataModelListener

public void addDataModelListener(IDataModelListener theListener)
                          throws IllegalArgumentException
Adds the model listener that is notified when the model changes.

The method does not add the listener if the listener is already registered.

Parameters:
theListener - The listener to register.
Throws:
IllegalArgumentException - Thrown if theListener is null.

removeDataModelListener

public void removeDataModelListener(IDataModelListener theListener)
                             throws IllegalArgumentException
Removes a model listener.

The method cannot remove the listener, if the listener was not registered. Use the addDataModelListener method to register a new model listener.

Parameters:
theListener - The listener to remove.
Throws:
IllegalArgumentException - Thrown if theListener is null.

containsProperty

public boolean containsProperty(String theName)
                         throws IllegalArgumentException
Checks if the model contains a property with the specified name.

Parameters:
theName - The name of the property contained in the model.
Returns:
Returns a value of true, if the model contains a property with the specified name; otherwise, it returns a value of false.
Throws:
IllegalArgumentException - Thrown if theName is not a valid argument to the method.

getProperty

public Object getProperty(String theName)
                   throws IllegalArgumentException
Retrieves the property with the specified name.

Parameters:
theName - The name of the property to retrieve from the model.
Returns:
Returns the value for the specified property or null if the model does not contain the property.
Throws:
IllegalArgumentException - Thrown if theName is not a valid argument to the method.

getPropertyAsString

public String getPropertyAsString(String theName)
                           throws IllegalArgumentException
Retrieves the property with the specified name as a String.

Parameters:
theName - The name of the property to retrieve from the model.
Returns:
Returns the value for the specified property or null if the model does not contain the property.
Throws:
IllegalArgumentException - Thrown if theName is not a valid argument to the method.

getPropertyAsBoolean

public Boolean getPropertyAsBoolean(String theName)
                             throws IllegalArgumentException
Retrieves the property with the specified name as a Boolean.

The Boolean that is returned has a value of true if the string argument is not null and is equal to the string "true".

Example: Boolean.valueOf("True") returns true.
Example: Boolean.valueOf("yes") returns false.

Parameters:
theName - The name of the property to retrieve from the model.
Returns:
Returns the value for the specified property as a Boolean or null if the model does not contain the property.
Throws:
IllegalArgumentException - Thrown if theName is null.

getPropertyAsInteger

public Integer getPropertyAsInteger(String theName)
                             throws IllegalArgumentException
Retrieves a property with the specified name as an Integer.

The value is interpreted as representing a signed decimal integer as if the argument was given to the java.lang.Boolean#parseInt(java.lang.String) method. The result is an Integer object that represents the integer value specified by the value.

This method returns an Integer object equal to the value of:
new Integer(Integer.parseInt(s))

Parameters:
theName - The name of the parameter to retrieve from the model.
Returns:
Returns the value for the specified property as an Integer or null if the model does not contain the property.
Throws:
IllegalArgumentException - Thrown when theName is null.

setProperty

public void setProperty(String theName,
                        boolean theValue)
                 throws IllegalArgumentException
Sets the property with the specified name to the specified boolean value.

Parameters:
theName - The name for the property.
theValue - The boolean value for the property.
Throws:
IllegalArgumentException - Thrown when theName or theValue is null.

setProperty

public void setProperty(String theName,
                        int theValue)
                 throws IllegalArgumentException
Sets a property with the specified name to the specified int value.

Parameters:
theName - The name for the property.
theValue - The int value for the property.
Throws:
IllegalArgumentException - Thrown if theName or theValue is null.

setProperty

public void setProperty(String theName,
                        Object theValue)
                 throws IllegalArgumentException
Set a property with the specified name to the specified value.

Parameters:
theName - The name for the property.
theValue - The value for the property.
Throws:
IllegalArgumentException - Thrown if theName or theValue is null.

removeProperty

public void removeProperty(String theName)
                    throws IllegalArgumentException
Removes the property with the specified name and its corresponding value from this list of properties.

Parameters:
theName - The name of the property to remove.
Throws:
IllegalArgumentException - Thrown if theName is null.

registerValidator

public void registerValidator(String theName,
                              IPropertyValidator dataModelValidator)
                       throws IllegalArgumentException
Indicate to the data model that the custom validator specified should be used for validating the property.

Parameters:
theName - the name of the property to validate.
dataModelValidator - the custom validator that should be used for validating the property.
Throws:
IllegalArgumentException - if propertyName or dataModelValidator is not a valid argument to the method.

unregisterValidator

public void unregisterValidator(String theName)
                         throws IllegalArgumentException
Remove the registered validator if one exists for the property with the specified name from the data model.

Parameters:
theName - the name of the property whose registered validator is to be removed.
Throws:
IllegalArgumentException - if propertyName or dataModelValidator is not a valid argument to the method.

validateProperty

public IStatus validateProperty(String theName,
                                IProgressMonitor progressMonitor)
                         throws IllegalArgumentException
Validate the property to determine if the property with the specified name is in an acceptable state.

Parameters:
theName - the name of the property to validate
progressMonitor - to monitor progress of the validate operation. This can be null if necessary
Returns:
IStatus the status object that holds the status code and any messages
Throws:
IllegalArgumentException - if theName is not a valid argument to the method.

validateAll

public IStatus validateAll(IProgressMonitor progressMonitor)
Validates the properties of the data model to determine if it is in an acceptable state.

Parameters:
progressMonitor - to monitor progress of validate data model operation. This can be null if necessary.
Returns:
IStatus that holds the status code and status messages if any

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.