Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


org.eclipse.emf.validation.service
Class ModelValidationService

java.lang.Object
  extended by 
org.eclipse.emf.validation.service.ModelValidationService

public class ModelValidationService
extends Object

The Model Validation Service makes constraints and validators available to the client application. An application obtains validators from the service and requests validation whenever it is appropriate, according to the application's mapping of the EvaluationMode triggers.

The ModelValidationService delegates the retrieval of constraints to any number of IModelConstraintProvider implementations registered by other plug-ins via the org.eclipse.emf.validation.constraintProvider extension point.

The validation service uses the meta-data associated with registered providers to determine which ones can provide constraints for a specific EMF object according to the meta-model URI namespace and the evaluation context. This allows the service to delay instantiating providers (and, hence, loading plug-ins) until it is absolutely necessary to do so.

See Also:
newValidator(EvaluationMode), IValidator, IModelConstraint

Method Summary
 void addValidationListener ( IValidationListener listener)
          Adds a new listener to receive validation events.
 void broadcastValidationEvent ( ValidationEvent event)
          Broadcasts the specified event to all listeners.
 void configureListeners ( IConfigurationElement[] elements)
          Deprecated. 1.2 This method is no longer implemented.
 void configureProviders ( IConfigurationElement[] elements)
          Deprecated. 1.2 This method is no longer implemented.
static  EClass findClass ( String namespaceUri, String className)
          Finds the EClass having the specified name within the namespace indicated by the URI.
static  ModelValidationService getInstance ()
          Obtains the instance of this class.
 void loadXmlConstraintDeclarations ()
           Loads all available XML-declared constraint descriptors.
<T,V extends IValidator<T>>
V
newValidator ( EvaluationMode<T> mode)
           Creates a new validator object that the client can use to validate EMF objects, notifications, or features, according to the value of the specified evaluation mode.
 void removeValidationListener ( IValidationListener listener)
          Removes a listener from the service.
 void replaceInCache ( IModelConstraint oldConstraint, IModelConstraint newConstraint)
          Replaces a constraint in the cache with an alternative implementation.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static 
ModelValidationService getInstance()
Obtains the instance of this class.

Returns:
the Singleton instance

newValidator

public <T,V extends 
IValidator<T>> V newValidator(
EvaluationMode<T> mode)

Creates a new validator object that the client can use to validate EMF objects, notifications, or features, according to the value of the specified evaluation mode.

The resulting validator may be retained as long as it is needed, and reused any number of times. Each validator has its own separate state.

Type Parameters:
T - the kind of validator to return
Parameters:
mode - the evaluation mode for which to create a new validator. Must not be null or EvaluationMode.NULL
Returns:
a new validator
Throws:
IllegalArgumentException - if the mode is not a valid evaluation mode

addValidationListener

public void addValidationListener(
IValidationListener listener)
Adds a new listener to receive validation events. This method has no effect if the listener is already registered.

Parameters:
listener - a new validation listener

removeValidationListener

public void removeValidationListener(
IValidationListener listener)
Removes a listener from the service. This method has no effect if the listener is not currently registered.

Parameters:
listener - a validation listener

broadcastValidationEvent

public void broadcastValidationEvent(
ValidationEvent event)
Broadcasts the specified event to all listeners. This method is used internally by validators to send notifications when they perform validation, but may also be used by clients to simulate validation occurrences.

Parameters:
event - a validation event to broadcast

configureListeners



@Deprecated
public void configureListeners(
IConfigurationElement[] elements)
Deprecated. 1.2 This method is no longer implemented.

Configures my listeners from the Eclipse configuration elements representing implementations of my extension point.

NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!

Parameters:
elements -

configureProviders



@Deprecated
public void configureProviders(
IConfigurationElement[] elements)
Deprecated. 1.2 This method is no longer implemented.

Configures my providers from the Eclipse configuration elements representing implementations of my extension point.

NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!

Parameters:
elements -

replaceInCache

public void replaceInCache(
IModelConstraint oldConstraint,
                           
IModelConstraint newConstraint)
Replaces a constraint in the cache with an alternative implementation. This must only be invoked by constraint providers, and then only when the provider can ensure that the new constraint implementation's semantics are compatible with the old.

Parameters:
oldConstraint - the constraint to be replaced in the cache
newConstraint - the new constraint to replace it

loadXmlConstraintDeclarations

public void loadXmlConstraintDeclarations()

Loads all available XML-declared constraint descriptors. This is not a very heavy-weight operation, as it does not require the loading of any plug-ins or even the instantantiation of any constraints. It only loads the constraint descriptors that are statically declared in XML.

Subsequent invocations of this method have no effect.

NOTE that this method should only be called by the EMF Model Validation Plug-in, not by any client code!


findClass

public static 
EClass findClass(
String namespaceUri,
                               
String className)
Finds the EClass having the specified name within the namespace indicated by the URI. The class name may optionally be fully qualified (prefixed by its full package name) to support constraint providers that need to disambiguate like-named classes in different EPackages.

Parameters:
namespaceUri - the provider-specified namespace URI of the EPackage
className - the class name. May be a simple name within the package namespace indicated by namespaceUri or a fully-qualified class name
Returns:
the corresponding EMF class object, or null if it could not be found

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire