org.eclipse.emf.validation.service
Class AbstractConstraintProvider

java.lang.Object
  extended byorg.eclipse.emf.validation.service.AbstractConstraintProvider
All Implemented Interfaces:
org.eclipse.core.runtime.IExecutableExtension, IModelConstraintProvider
Direct Known Subclasses:
XmlConstraintProvider

public abstract class AbstractConstraintProvider
extends java.lang.Object
implements IModelConstraintProvider, org.eclipse.core.runtime.IExecutableExtension

For situations in which the XmlConstraintProvider class does not suffice (i.e., where a plug-in provides constraints dynamically, rather than statically registered in XML), this is a useful class to extend as it provides a partial implementation of the IModelConstraintProvider interface. In particular, it extracts the URI namespace prefix information from the extension point XML and provides no-op implementations of the provider methods (redefine only those which need an implementation).

This class may be subclassed by clients of the validation framework.

See Also:
XmlConstraintProvider

Constructor Summary
protected AbstractConstraintProvider()
          Initializes me.
 
Method Summary
 java.util.Collection getBatchConstraints(org.eclipse.emf.ecore.EObject eObject, java.util.Collection constraints)
          This is a no-op implementation.
 java.util.Collection getLiveConstraints(org.eclipse.emf.common.notify.Notification notification, java.util.Collection constraints)
          This is a no-op implementation.
 java.lang.String[] getNamespaceUris()
          Obtains the namespace URIs of the EMF packages that I provide constraints for.
 void setInitializationData(org.eclipse.core.runtime.IConfigurationElement config, java.lang.String propertyName, java.lang.Object data)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractConstraintProvider

protected AbstractConstraintProvider()
Initializes me.

Method Detail

getNamespaceUris

public final java.lang.String[] getNamespaceUris()
Obtains the namespace URIs of the EMF packages that I provide constraints for.

Returns:
my packages' namespace URIs

setInitializationData

public void setInitializationData(org.eclipse.core.runtime.IConfigurationElement config,
                                  java.lang.String propertyName,
                                  java.lang.Object data)
                           throws org.eclipse.core.runtime.CoreException

Specified by:
setInitializationData in interface org.eclipse.core.runtime.IExecutableExtension
Throws:
org.eclipse.core.runtime.CoreException - if the subclass implementation of this method throws on an error in accessing the config or for any other reason (see the subclass documentation)

getBatchConstraints

public java.util.Collection getBatchConstraints(org.eclipse.emf.ecore.EObject eObject,
                                                java.util.Collection constraints)
This is a no-op implementation. Subclasses that need to implement it should redefine this method. There is no need to call super.

Specified by:
getBatchConstraints in interface IModelConstraintProvider
Parameters:
eObject - the EObject for which constraints are to be obtained that can be applied to it
constraints - a collector parameter to which I will add any constraints that I provide. If this argument is null, then I create and return a new collection
Returns:
the collection which was passed in by the constraints parameter (with additions), or a new collection if constraints == null

getLiveConstraints

public java.util.Collection getLiveConstraints(org.eclipse.emf.common.notify.Notification notification,
                                               java.util.Collection constraints)
This is a no-op implementation. Subclasses that need to implement it should redefine this method. There is no need to call super.

Specified by:
getLiveConstraints in interface IModelConstraintProvider
Parameters:
notification - the EMF notification that is to be validated. Encapsulates the object and the particular change
constraints - a collector parameter to which I will add any constraints that I provide. If this argument is null, then I create and return a new collection
Returns:
the collection which was passed in by the constraints parameter (with additions), or a new collection if constraints == null

Copyright 2002, 2006 IBM Corporation and others.
All Rights Reserved.