I placed the code in jira:
https://issues.apache.org/jira/browse/JCR-1100. I think there is a lot
of room to make this better. Here is an example test case I wrote with
our data:
JcrRepository repo = getRepository();
Feature feature = new FeatureImpl("test feature mixin");
feature = (Feature)repo.add(feature);
feature = (Feature)feature.addMixin(new EngineImpl());
Engine engine = (Engine)feature;
engine.setConfiguration(Engine.V_CONFIGURATION);
engine.setFuelType(Engine.UNLEADED_FUEL);
engine.setHorsePower(200);
engine.setHorsePowerRPM(10);
repo.save(feature);
Object obj = repo.forPath(feature.getPath());
assert obj instanceof Engine;
Note in this example there are four java files: Feature (interface),
FeatureImpl (class), Engine (interface), Engine (class)...
-paddy
Christophe Lombart wrote:
Hi Paddy,
It should be nice if you can donnate the code
Christophe
On 10/23/07, Padraic I. Hannon <[EMAIL PROTECTED]> wrote:
I think this would be a great idea, I implemented something similar for
OCM using cglib mixin proxies to provide mixin support at run time.
-paddy