java.lang.CircularityError IClientSelector [message #568027] |
Mon, 20 February 2006 21:10 |
Selcuk Aya Messages: 13 Registered: July 2009 |
Junior Member |
|
|
Hi,
As validation framework nicely supports OCL, following the tutorial for
validation framework in emf, I tried to implement a simple constraint with
my two plugins GeneratedOETests and helloworld. helloworld contributes the
context, binding and constrain in its plugin.xml:
<extension
point="org.eclipse.emf.validation.constraintBindings">
<clientContext
default="false"
id="com.acme.orderentry.constraintsContext">
<selector
class="helloworld.actions.ValidationDelegateClientSelector"/ >
</clientContext>
<binding
context="com.acme.orderentry.constraintsContext"
category="com.acme.orderentry.constraints"/>
</extension>
<extension
point="org.eclipse.emf.validation.constraintProviders">
<category
name="OrderEntry Constraints"
id="com.acme.orderentry.constraints"/>
<constraintProvider cache="true">
<package namespaceUri="http:///orderentry.ecore"/>
<constraints categories="com.acme.orderentry.constraints">
<constraint
lang="Java"
class="helloworld.actions.NonEmptyNamesConstraint"
severity="ERROR"
mode="Batch"
name="Non-Empty Names"
id="com.acme.orderentry.constraints.NameNotEmpty"
statusCode="1">
<description>
All customers should have some unique identifier or name.
</description>
<message>
A {0} has been found to have no unique identifier (name
or title).
</message>
<target class="Customer"/>
</constraint>
</constraints>
</constraintProvider>
</extension>
In GeneratedOETests which depend on helloworld, the plugin-test
BatchValidator does the following:
Customer customer=OrderEntryFactory.eINSTANCE.createCustomer();
ValidationDelegateClientSelector.running = true;
IBatchValidator validator =
(IBatchValidator)ModelValidationService.getInstance()
.newValidator(EvaluationMode.BATCH);
validator.setIncludeLiveConstraints(true);
IStatus status=validator.validate(customer,null);
ValidationDelegateClientSelector.running = false;
Collection descs=ConstraintRegistry.getInstance().getAllDescriptors();
logger.debug("desc size:"+descs.size());
Collection
contexts=ClientContextManager.getInstance().getClientContext s();
logger.debug("contexts size:"+contexts.size());
In validator.validate(customer,null), when the class loader tries to load
ValidationDelegateClientSelector, it gives java.lang.CircularityError
error. Before trying to load the ValidationDelegateClientSelector, the
class loader actually looks at whether it has been alrady loaded and it
fails to find the class altough we already used it before calling the
validator.validate(customer,null) method.
I am using eclipse 3.2.0
I had spent quite some time on this. I would appreciate any directions or
suggestions for workarounds.
Thanks,
Selcuk
|
|
|
Powered by
FUDForum. Page generated in 0.02622 seconds