IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.patterns.framework
Class AbstractPatternLibrary

java.lang.Object
  extended bycom.ibm.xtools.common.core.service.AbstractProvider
      extended bycom.ibm.xtools.patterns.core.AbstractPatternInstanceProvider
          extended bycom.ibm.xtools.patterns.framework.AbstractPatternLibrary
All Implemented Interfaces:
IProvider

public abstract class AbstractPatternLibrary
extends AbstractPatternInstanceProvider
implements IProvider

This class is the abstract base class to all pattern libraries defined by the framework. This class implements the pattern provider and pattern instance provider interfaces defined by the patterns core plug-in. It provides an implementation for the provides method that demultiplexes the provides call into the more type-specific overloaded provides method. To override the default provides implementation for any operation, simply override one of the type-specific provides methods. The general provides method has been made final as a reminder to make changes in the type-specific overloaded provides methods only. The hot-spot method that must be overridden is the get available pattern definitions method; the return results from this method define what patterns are available for use during this library's run-time existence. The create framework configuration method is a hot-spot method that can be optionally overridden. This is a factory method that returns the configuration that should be in use for this particular library. There are less frequently overridden hot-spot methods that can be optionally overridden. These methods include the provides methods strongly-typed to a particular operation.

See Also:
getAvailablePatternDefinitions(), createFrameworkConfiguration()

Constructor Summary
protected AbstractPatternLibrary(org.eclipse.core.runtime.Plugin associatedPlugin)
          Constructs an abstract pattern library given the specified associated plug-in.
protected AbstractPatternLibrary(org.eclipse.core.runtime.Plugin associatedPlugin, String uniqueIdentifier, String versionIdentifier)
          Constructs an abstract pattern library given the specified associated plugin, unique identifier and version identifier.
 
Method Summary
 void accept(Visitor visitor)
          Enable visitation of this entity.
 void addProviderChangeListener(IProviderChangeListener listener)
          Adds the specified listener to the list of provider change listeners for this provider.
 AbstractPatternInstance createContainedPatternInstance(IPatternDescriptor pattern, Object container, PatternInstanceOption[] options, AbstractPatternResult results, org.eclipse.core.runtime.MultiStatus status)
          Creates an instance of the pattern represented by the given pattern descriptor using the given object as the container for the instance.
protected  AbstractConfiguration createFrameworkConfiguration()
          This factory method is defaulted to create or return the default framework configuration instance.
 AbstractPatternInstance createPatternInstance(IPatternDescriptor pattern, IParameterDescriptor parameter, Object targetObject, PatternInstanceOption[] options, AbstractPatternResult results, org.eclipse.core.runtime.MultiStatus status)
          Creates an instance of the pattern represented by the given pattern descriptor using the given object as an argument for the given parameter of the instance.
 AbstractPatternInstance createPatternInstance(IPatternDescriptor pattern, Object targetObject, PatternInstanceOption[] options, AbstractPatternResult results, org.eclipse.core.runtime.MultiStatus status)
          Creates an instance of the pattern represented by the given pattern descriptor using the given object as the bound element for the instance.
 URL findImage(String imagePathIdentifier)
          Find an URL pointing to an image for the given image path identifier.
 AbstractPatternInstance getAppliedPatternInstance(IPatternApplication pattern, org.eclipse.emf.ecore.EObject applicationObject, org.eclipse.core.runtime.MultiStatus status)
          Returns the instance of an application of the given pattern to the given object.
 IPatternApplication[] getAppliedPatterns(org.eclipse.emf.ecore.EObject context, org.eclipse.core.runtime.MultiStatus status)
          Returns a collection of pattern application objects for all known instances of patterns applied to the given object.
protected abstract  AbstractPatternDefinition[] getAvailablePatternDefinitions()
          Get all the available pattern definitions in this library.
 boolean isPatternDefinitionAvailable(String identifier)
          Determines if a pattern definition is available given the unique identifier specified.
 boolean provides(IOperation operation)
          Indicates whether this pattern library provides the given operation as defined by the pattern service.
 void removeProviderChangeListener(IProviderChangeListener listener)
          Removes the specified listener from the list of provider change listeners for this provider.
 
Methods inherited from class com.ibm.xtools.common.core.service.AbstractProvider
fireProviderChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPatternLibrary

protected AbstractPatternLibrary(org.eclipse.core.runtime.Plugin associatedPlugin)
Constructs an abstract pattern library given the specified associated plug-in. The unique identifier and version identifier of the library is derived from the associated plug-in's unique identifier and version identifier.

Parameters:
associatedPlugin - the associated plug-in for this pattern library

AbstractPatternLibrary

protected AbstractPatternLibrary(org.eclipse.core.runtime.Plugin associatedPlugin,
                                 String uniqueIdentifier,
                                 String versionIdentifier)
Constructs an abstract pattern library given the specified associated plugin, unique identifier and version identifier. The unique identifier and version identifier need not be the same as the associated plug-in.

Parameters:
associatedPlugin - the associated plug-in for this pattern library
uniqueIdentifier - the unique identifier for this pattern library
versionIdentifier - the version identifier for this pattern library
Method Detail

accept

public void accept(Visitor visitor)
Enable visitation of this entity.


createContainedPatternInstance

public AbstractPatternInstance createContainedPatternInstance(IPatternDescriptor pattern,
                                                              Object container,
                                                              PatternInstanceOption[] options,
                                                              AbstractPatternResult results,
                                                              org.eclipse.core.runtime.MultiStatus status)
Description copied from class: AbstractPatternInstanceProvider
Creates an instance of the pattern represented by the given pattern descriptor using the given object as the container for the instance.

Specified by:
createContainedPatternInstance in class AbstractPatternInstanceProvider
Parameters:
pattern - The pattern to be instantiated.
container - The container of the pattern instance.
options - The options to use when creating the instance.
results - The results of the operation.
status - The status produced by the operation.
Returns:
Returns the created pattern instance.

createFrameworkConfiguration

protected AbstractConfiguration createFrameworkConfiguration()
This factory method is defaulted to create or return the default framework configuration instance. Override this method in subclasses to create a different concrete framework configuration for this library to use.

Returns:
returns the concrete framework configuration to use for this library

createPatternInstance

public AbstractPatternInstance createPatternInstance(IPatternDescriptor pattern,
                                                     IParameterDescriptor parameter,
                                                     Object targetObject,
                                                     PatternInstanceOption[] options,
                                                     AbstractPatternResult results,
                                                     org.eclipse.core.runtime.MultiStatus status)
Description copied from class: AbstractPatternInstanceProvider
Creates an instance of the pattern represented by the given pattern descriptor using the given object as an argument for the given parameter of the instance.

Specified by:
createPatternInstance in class AbstractPatternInstanceProvider
Parameters:
pattern - The pattern to be instantiated.
targetObject - The candidate object the argument.
parameter - The parameter of the pattern for which the object will be an argument.
options - The options to use when creating the instance.
results - The results of the operation.
status - The status produced by the operation.
Returns:
Returns the created pattern instance.

createPatternInstance

public AbstractPatternInstance createPatternInstance(IPatternDescriptor pattern,
                                                     Object targetObject,
                                                     PatternInstanceOption[] options,
                                                     AbstractPatternResult results,
                                                     org.eclipse.core.runtime.MultiStatus status)
Description copied from class: AbstractPatternInstanceProvider
Creates an instance of the pattern represented by the given pattern descriptor using the given object as the bound element for the instance.

Specified by:
createPatternInstance in class AbstractPatternInstanceProvider
Parameters:
pattern - The pattern to be instantiated.
targetObject - The candidate object for the bound element of the instance.
options - The options to use when creating the instance.
results - The results of the operation.
status - The status produced by the operation.
Returns:
Returns the created pattern instance.

findImage

public final URL findImage(String imagePathIdentifier)
Find an URL pointing to an image for the given image path identifier. The image path identifier is a relative path identifier and the following could be a valid path: "images/StrategyPattern2.gif -- the $nl$/icons/" will be prepended as the result of the contained methods being executed

Parameters:
imagePathIdentifier - the relative image path identifier
Returns:
the URL pointing to the image within the icon directory

getAppliedPatternInstance

public AbstractPatternInstance getAppliedPatternInstance(IPatternApplication pattern,
                                                         org.eclipse.emf.ecore.EObject applicationObject,
                                                         org.eclipse.core.runtime.MultiStatus status)
Description copied from class: AbstractPatternInstanceProvider
Returns the instance of an application of the given pattern to the given object.

Specified by:
getAppliedPatternInstance in class AbstractPatternInstanceProvider
Parameters:
pattern - The pattern definition which was instantiated.
applicationObject - The ecore object to which the pattern was applied.
status - The status produced by the operation.
Returns:
Returns the applied pattern instance.

getAppliedPatterns

public final IPatternApplication[] getAppliedPatterns(org.eclipse.emf.ecore.EObject context,
                                                      org.eclipse.core.runtime.MultiStatus status)
Description copied from class: AbstractPatternInstanceProvider
Returns a collection of pattern application objects for all known instances of patterns applied to the given object.

The instance information must be stored with the object in a way that makes it accessible to the pattern service, so the object must be an EObject.

Specified by:
getAppliedPatterns in class AbstractPatternInstanceProvider
Parameters:
context - The ecore object to which the patterns have been applied.
status - The status produced by the operation.
Returns:
Returns the applications for the pattern.

getAvailablePatternDefinitions

protected abstract AbstractPatternDefinition[] getAvailablePatternDefinitions()
Get all the available pattern definitions in this library.

Returns:
an array of all the available abstract pattern definitions stored by this library; available just means that they have been returned by this method, it is possible to have patterns in the same package that are not returned by this call--in this case they are deemed not available

isPatternDefinitionAvailable

public final boolean isPatternDefinitionAvailable(String identifier)
Determines if a pattern definition is available given the unique identifier specified.

Parameters:
identifier - the unique identifier of the pattern definition of interest
Returns:
true if the pattern definition is available and therefore returned as such via the get available pattern definitions method in this library

provides

public boolean provides(IOperation operation)
Indicates whether this pattern library provides the given operation as defined by the pattern service.

Specified by:
provides in interface IProvider
Parameters:
operation - the operation checked to see if provided
Returns:
true if this pattern library supports the operation

addProviderChangeListener

public void addProviderChangeListener(IProviderChangeListener listener)
Description copied from interface: IProvider
Adds the specified listener to the list of provider change listeners for this provider.

Specified by:
addProviderChangeListener in interface IProvider
Overrides:
addProviderChangeListener in class AbstractProvider
Parameters:
listener - The listener to be added.
See Also:
IProvider.addProviderChangeListener(IProviderChangeListener)

removeProviderChangeListener

public void removeProviderChangeListener(IProviderChangeListener listener)
Description copied from interface: IProvider
Removes the specified listener from the list of provider change listeners for this provider.

Specified by:
removeProviderChangeListener in interface IProvider
Overrides:
removeProviderChangeListener in class AbstractProvider
Parameters:
listener - The listener to be removed.
See Also:
IProvider.removeProviderChangeListener(IProviderChangeListener)

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

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