|Re: OCL in a pojo domain usage scenario [message #24340]
||Tue, 22 May 2007 18:42
Originally posted by: cdamus.ca.ibm.com|
I'm including the OCL newsgroup in my reply, as I think this subject may be
of interest to other OCL users. I'll let Ed answer the more general
question of how to adapt a POJO world into EMF.
As far as OCL is concerned, you could probably define an independent Ecore
model of your POJO classes and implement a custom Environment (subclassing
the org.eclipse.ocl.ecore.EcoreEnvironment) that understands the
relationship between your Java Classes and Ecore EClasses. A custom
EvaluationEnvironment (subclassing EcoreEvaluationEnvironment), then,
provides the necessary reflective access to operations and attributes of
your POJOs in terms of their Ecore correspondents.
The help documentation for OCL in the 1.1 M7 build should provide details of
how to create and use a custom OCL Environment.
I haven't tried this, myself, but I think it should work ... There is no
assumption in the OCL implementation that run-time instances of your
model's classifiers are EObjects; only that the model itself is EMF-based
(and, hence, that "classifiers" are some kind of EObject, whether an
EClassifier or a UML Classifier or something else).
Juan Bernabó wrote:
> I want to know if this is a a viable usage scenario for EMF and OCL, IŽm
> trying to figure out the viables strategies so help is wanted.
> I would like to have a pojo domain model and be able to query it using
> OCL, donŽt want to use code generation.
> To be able to do that, my current strategy is to build an ECore or UML
> model from the POJO classes, at runtime, and wrap each object into an
> EObject using an adaptor.
> Currently IŽm wrapping or adding some features to pojo models by using
> aspects with sucess, in that way IŽm reduzing the need for code generation
> and there is a very clear separation of concerns, and domain code remains
> pojos, which is a must for us.
> Is it possible to build Ecore or UML2 models from pojos? (maybe some
> annotations needed)
> Is it possible to wrap pojos into EObjects?
> Any comments are welcome.
> Thanks in advance,
Powered by FUDForum
. Page generated in 0.02692 seconds