IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.patterns.framework.uml2.persistence
Class PatternDefinitionStore

java.lang.Object
  extended bycom.ibm.xtools.patterns.framework.AbstractPatternStore.Definition
      extended bycom.ibm.xtools.patterns.framework.uml2.persistence.PatternDefinitionStore

public class PatternDefinitionStore
extends AbstractPatternStore.Definition

This is the UML2 pattern definition store which is the default persistent store for pattern definitions in the framework. The pattern definition store is compatible and is used in conjunction with the UML2 pattern instance store also found in this package. A concrete factory is also supplied in this package in order to keep the family of concrete products (the pattern definition store and the pattern instance store) instantiated together when the concrete pattern store factory is selected by the client (or by default) via an abstract configuration. The purpose of the pattern definition store is to persist and reconstitute pattern definitions from UML2 models. Some operations offered by the pattern instance store require an instance of a pattern definition store in order to run. For the UML2 persistent store implementation, the pattern definition is mapped to a UML2 templateable element. This UML2 templateable element contains a UML2 template signature that in turn owns zero to many UML2 template parameters. The pattern instance store is responsible for the eventual template binding dependency between the bound template and the template signature of the defining template.


Constructor Summary
protected PatternDefinitionStore()
          Instantiation only from subclasses and this package's classes.
 
Method Summary
 boolean containsDefinition(AbstractPatternDefinition definition, Object containerObject)
          Determines if a definition already exists within the container object scope.
 Object createDefinition(AbstractPatternDefinition definition, Object containerObject)
          Creates a new pattern definition within the persistent pattern store.
static org.eclipse.emf.ecore.EAnnotation createEAnnotation(org.eclipse.emf.ecore.EModelElement container, String source)
          Creates an annotation.
 Object ensureDefinition(AbstractPatternDefinition definition, Object containerObject)
          Ensure a pattern definition already exists in the pattern store for the given pattern definition using the container object as the scope.
 Object getDefinition(AbstractPatternDefinition definition, Object containerObject)
          Retrieve a pattern definition representation in the persistent store given the pattern definition and container object.
 IPatternIdentity getDefinitionIdentity(Object representation)
          Get the definition identity associated with the instance representation object being passed in.
static IPatternIdentity getTemplateIdentity(org.eclipse.uml2.TemplateableElement template)
          Retrieves the pattern identity from the tagged template.
 Object getValidContainer(Object containerHint)
          Get a valid container for an pattern instance to live given the input target object.
static String putDetail(org.eclipse.emf.ecore.EAnnotation annotation, String key, String value)
          Adds or sets a detail entry given a key/value pair.
 void removeDefinition(AbstractPatternDefinition definition, Object containerObject)
          Remove a pattern definition in the persistent pattern store with the given definition using the container object as the scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternDefinitionStore

protected PatternDefinitionStore()
Instantiation only from subclasses and this package's classes.

Method Detail

getTemplateIdentity

public static IPatternIdentity getTemplateIdentity(org.eclipse.uml2.TemplateableElement template)
Retrieves the pattern identity from the tagged template.

Parameters:
template - the template tagged with the pattern identity
Returns:
the pattern identity decoded from the template

containsDefinition

public boolean containsDefinition(AbstractPatternDefinition definition,
                                  Object containerObject)
Description copied from class: AbstractPatternStore.Definition
Determines if a definition already exists within the container object scope.

Specified by:
containsDefinition in class AbstractPatternStore.Definition
Parameters:
definition - the pattern definition of interest
containerObject - the container object to use as the scope
Returns:
indicates existence with true

createDefinition

public Object createDefinition(AbstractPatternDefinition definition,
                               Object containerObject)
Description copied from class: AbstractPatternStore.Definition
Creates a new pattern definition within the persistent pattern store.

Specified by:
createDefinition in class AbstractPatternStore.Definition
Parameters:
definition - the pattern definition of interest
containerObject - the container object to use as the scope
Returns:
the newly created pattern definition representation in the store; the object returned is only used in subsequent calls to the pattern store which require a reference to the definition's corresponding persistent object

ensureDefinition

public Object ensureDefinition(AbstractPatternDefinition definition,
                               Object containerObject)
Description copied from class: AbstractPatternStore.Definition
Ensure a pattern definition already exists in the pattern store for the given pattern definition using the container object as the scope.

Specified by:
ensureDefinition in class AbstractPatternStore.Definition
Parameters:
definition - the pattern definition of interest
containerObject - the container object to use as the scope
Returns:
the pattern definition representation in the pattern store

getDefinition

public Object getDefinition(AbstractPatternDefinition definition,
                            Object containerObject)
Description copied from class: AbstractPatternStore.Definition
Retrieve a pattern definition representation in the persistent store given the pattern definition and container object.

Specified by:
getDefinition in class AbstractPatternStore.Definition
Parameters:
definition - the pattern definition of interest
containerObject - the container object to use as the scope
Returns:
the pattern definition representation in the persistent store

getDefinitionIdentity

public IPatternIdentity getDefinitionIdentity(Object representation)
Description copied from class: AbstractPatternStore.Definition
Get the definition identity associated with the instance representation object being passed in.

Specified by:
getDefinitionIdentity in class AbstractPatternStore.Definition
Parameters:
representation - the definition representation to retrieve the pattern identity from
Returns:
the pattern identity associated with the definition representation passed in

getValidContainer

public Object getValidContainer(Object containerHint)
Description copied from class: AbstractPatternStore.Definition
Get a valid container for an pattern instance to live given the input target object. The target object passed-in may or may not already be a valid container, given the specified target object though this method must either return the target object back or find another valid container that is related to the target object is some way. This method is on the definition store and not the instance store because it is typically used before an instance actually exists and makes more sense to be called upon the definition.

Specified by:
getValidContainer in class AbstractPatternStore.Definition
Parameters:
containerHint - the container candidate or container hint
Returns:
the valid container is returned; something valid has to return

removeDefinition

public void removeDefinition(AbstractPatternDefinition definition,
                             Object containerObject)
Description copied from class: AbstractPatternStore.Definition
Remove a pattern definition in the persistent pattern store with the given definition using the container object as the scope.

Specified by:
removeDefinition in class AbstractPatternStore.Definition
Parameters:
definition - the pattern definition of interest
containerObject - the container object to use as the scope

createEAnnotation

public static org.eclipse.emf.ecore.EAnnotation createEAnnotation(org.eclipse.emf.ecore.EModelElement container,
                                                                  String source)
Creates an annotation.

Parameters:
container - The annotation container.
source - The annotation source.
Returns:
The new annotation.

putDetail

public static String putDetail(org.eclipse.emf.ecore.EAnnotation annotation,
                               String key,
                               String value)
Adds or sets a detail entry given a key/value pair. It returns the previous value if any.

Parameters:
annotation - The annotation.
key - The key.
value - The value.
Returns:
The previous value.

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

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