org.eclipse.stp.core.introspection
Interface IComponentTypeIntrospector

All Known Implementing Classes:
AbstractComponentTypeIntrospector

public interface IComponentTypeIntrospector

Clients should provide an implementation which updates the individual features on a ComponentType when introspect(int, List) is called.

Implementations are encouraged to only reflect the specific field requested, and delay the introspection of the entire type, if possible.

The init(Implementation) method will be called before the introspector is used and after the introspector has been added to the ComponentType. Implementations are required to save the implementation supplied when the init(Implementation) method is called.

Implementations may subclass AbstractComponentTypeIntrospector for convenience.

Clients may implement this interface.

Since:
1.0
See Also:
AbstractComponentTypeIntrospector

Field Summary
static java.lang.String ADAPTER_TYPE
          The ADAPTER_TYPE is used for searching for IComponentTypeIntrospectors attached to the eAdapter() list of an EObject.
 
Method Summary
 IStatus dispose()
          Release any resources that were required to introspect the implementation model.
 IStatus hasValidComponentType()
          This method will only be called after init() and after the introspector has been added to the ComponentType as an adapter, so clients will also have access to a the ComponentType model object via AbstractComponentTypeIntrospector.getComponentType() if clients choose to subclass that the AbstractComponentTypeIntrospector type.
 void init(Implementation theImplementation)
          init() will be called exactly once with the implementation model from a Component.
 IStatus introspect(int theFieldType, java.util.List theCurrentValues)
          The introspector should add or remove values as necessary to synchronize the current list available on the ComponentType with the underlying implementation model.
 IStatus onModelChange(int theFieldType, int theChangeType, java.lang.Object theChangedObject)
          Respond to a change in the list of values for a given field type.
 java.lang.Object resolveImplementation()
           
 IStatus save()
          Persist the changes made to the underlying model through this adaptation.
 

Field Detail

ADAPTER_TYPE

static final java.lang.String ADAPTER_TYPE
The ADAPTER_TYPE is used for searching for IComponentTypeIntrospectors attached to the eAdapter() list of an EObject. Clients are not expected to need this access this adapter directly.

Method Detail

init

void init(Implementation theImplementation)
init() will be called exactly once with the implementation model from a Component. If no component context is present, then an UnknownImplementation will be passed with its URI intialized to that of the IFile that triggered it. This method is required to handle two cases. The first case is when theImplementation is loaded through a resource directly, and there is no Component present. In this case, the type of theImplementation will be an UnknownImplementation with a String based path to the file being loaded. In the second case, a substitution group specific to the introspector (like "implementation.java") will be passed in. Then the introspector can use the attributes and elements of the implementation element to determine how the ComponentType should be resolved. The ComponentTypeIntrospector should save the Implementation for later invocations on introspectXXX() methods.

Parameters:
theImplementation - An implementation URI that uses a scheme or extension which this IComponentTypeIntrospector is interested in.

hasValidComponentType

IStatus hasValidComponentType()
This method will only be called after init() and after the introspector has been added to the ComponentType as an adapter, so clients will also have access to a the ComponentType model object via AbstractComponentTypeIntrospector.getComponentType() if clients choose to subclass that the AbstractComponentTypeIntrospector type.

Returns:
An OK Status if the component type is valid, or an error status otherwise. The status will automatically be added to the model object if it is !isOK()

introspect

IStatus introspect(int theFieldType,
                   java.util.List theCurrentValues)
The introspector should add or remove values as necessary to synchronize the current list available on the ComponentType with the underlying implementation model.

The integer value will indicate which field requires introspection. The values are available as:

The current state of the list will be passed by reference. Clients may add and remove to this list and return it (without need for creating a new list). Clients should use the value of the theFieldType parameter to determine what type of values exist in the list. The possible types are described below.

Parameters:
theCurrentValues - The current List of values known in the canonical model. The list will be empty the first time this method is called.
theFieldType - The field that should be introspected. The types of fields are available as SCAPackage.SERVICE, SCAPackage.COMPONENT_TYPE__REFERENCES, or SCAPackage.COMPONENT_TYPE__PROPERTIES.
Returns:
A status to indicate whether the introspection was successful.
See Also:
Service, Reference, Property

onModelChange

IStatus onModelChange(int theFieldType,
                      int theChangeType,
                      java.lang.Object theChangedObject)
Respond to a change in the list of values for a given field type. The types of fields are available as SCAPackage.SERVICE, SCAPackage.COMPONENT_TYPE__REFERENCES, or SCAPackage.COMPONENT_TYPE__PROPERTIES.

Parameters:
theFieldType - One of SCAPackage.SERVICE, SCAPackage.COMPONENT_TYPE__REFERENCES, or SCAPackage.COMPONENT_TYPE__PROPERTIES. Indicates the type of changed object (SCAPackage.SERVICE for Service, SCAPackage.COMPONENT_TYPE__REFERENCES for Reference, and SCAPackage.COMPONENT_TYPE__PROPERTIES for Property).
theChangeType - One of org.eclipse.emf.common.notify.Notification#ADD or org.eclipse.emf.common.notify.Notification#REMOVE.
theChangedObject - The object that was added or removed. Check the value of theFieldType to determine the type.
Returns:
A status to indicate whether the update to the implementation model succeeded.

save

IStatus save()
Persist the changes made to the underlying model through this adaptation.

Returns:
A status to indicate whether the save succeeded or failed.

dispose

IStatus dispose()
Release any resources that were required to introspect the implementation model.

Returns:
A status to indicate whether the save succeeded or failed.

resolveImplementation

java.lang.Object resolveImplementation()
Returns:
The Implementation for the underlying ComponentType.