Contribution as java class?

Is it possible do define contribution (to an extension point) as Java class? As i understand, XML contribution config is converted to an instance of java class with Xmap.

For example: when contributing to WebLayoutManager's “layouts” ext. point, xml config is Xmap-ed to an instance of the “LayoutDescriptor” class. Can I instantiate LayoutDescriptor object, configure it and deploy it to nuxeo?

I'd feel much more comfortable with java instead of xml (I am well aware of nuxeo studio, I still want my java editor).

Thanks.

0 votes

1 answers

1436 views

ANSWER



There is no problem to contribute with your java code. This exactly what does the Nuxeo Runtime at the server start and for the hot reload. When the Nuxeo Runtime detect the WebLayoutManager declaration, it instantiates this service and store it into a Map. When a contribution is detected, the Nuxeo Runtime get the service from the map and call the method registerContribution

To register your layout, it will be painful to create the contribution object. So I think the better way is to call the registerLayout method that get a LayoutDefinition as parameter.

But I'm not sure your code will be more readable with that.

After I don't know when and how activate this contribution.

I need to check my eclipse :)

0 votes