org.eclipse.stp.core.introspection
Class AbstractComponentTypeIntrospector

java.lang.Object
  extended by org.eclipse.stp.core.introspection.AbstractComponentTypeIntrospector
All Implemented Interfaces:
IComponentTypeIntrospector

public abstract class AbstractComponentTypeIntrospector
extends java.lang.Object
implements IComponentTypeIntrospector

This class provides a default implementation of IComponentTypeIntrospector.

A template pattern is used for the the init(Implementation) (doInit()) and notifyChanged(Notification) (doNotifyChanged(Notification)) methods.

Clients may extend this class.


Field Summary
 
Fields inherited from interface org.eclipse.stp.core.introspection.IComponentTypeIntrospector
ADAPTER_TYPE
 
Constructor Summary
AbstractComponentTypeIntrospector()
          Default constructor.
 
Method Summary
 ComponentType getComponentType()
          The componentType that this adapter is attached to is stored through a call to setTarget() when the adapter is added.
 Implementation getImplementation()
          An implementation will not be returned if the init(Implementation) was supplied an UnknownImplementation.
 URI getImplementationURI()
          The implementation URI identifies where the real model is stored.
 Notifier getTarget()
          Return the current target.
 void init(Implementation theImplementation)
          The init method is called before any introspectXXX() methods are called.
 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.
 boolean isAdapterForType(java.lang.Object type)
          Not to be called by clients
 void notifyChanged(Notification notification)
          Notified when fields change on the ComponentType.
 void setTarget(Notifier newTarget)
          Called when this adapter is added to a list of adapters.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.stp.core.introspection.IComponentTypeIntrospector
dispose, hasValidComponentType, onModelChange, resolveImplementation, save
 

Constructor Detail

AbstractComponentTypeIntrospector

public AbstractComponentTypeIntrospector()
Default constructor.

Method Detail

init

public final void init(Implementation theImplementation)
The init method is called before any introspectXXX() methods are called.

Specified by:
init in interface IComponentTypeIntrospector
Parameters:
theImplementation - Either the URI the URI of the implementation (getImplementationURI()) or the actual Implementation model for this Introspector (getImplementation()) will be available after this method complete (but not both).

notifyChanged

public final void notifyChanged(Notification notification)
Notified when fields change on the ComponentType.


introspect

public final IStatus introspect(int theFieldType,
                                java.util.List theCurrentValues)
Description copied from interface: IComponentTypeIntrospector
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.

Specified by:
introspect in interface IComponentTypeIntrospector
Parameters:
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.
theCurrentValues - The current List of values known in the canonical model. The list will be empty the first time this method is called.
Returns:
A status to indicate whether the introspection was successful.
See Also:
Service, Reference, Property

getTarget

public final Notifier getTarget()
Return the current target. Clients may also call getComponentType() directly.

Returns:
The componentType saved from setTarget().

getComponentType

public final ComponentType getComponentType()
The componentType that this adapter is attached to is stored through a call to setTarget() when the adapter is added.

Returns:
The componentType saved from setTarget().

getImplementationURI

public final URI getImplementationURI()
The implementation URI identifies where the real model is stored. The implementation URI is determined by the implementation of IShareableComponentTypeFactory defined by the Introspector extension, if any.

Returns:
The implementation URI for the bound ComponentType.

getImplementation

public final Implementation getImplementation()
An implementation will not be returned if the init(Implementation) was supplied an UnknownImplementation. The UnknownImplementation will automatically be processed and the URI will be available from getImplementationURI().

Returns:
The custom implementation supplied in init(Implementation)

setTarget

public final void setTarget(Notifier newTarget)
Called when this adapter is added to a list of adapters. This adapter may only be attached to a ComponentType. Attempts to attach it to any other model object will result in failure.


isAdapterForType

public final boolean isAdapterForType(java.lang.Object type)
Not to be called by clients