Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure custom node definitions in Apache Jackrabbit?

Is there a way that I can configure custom node types for Apache Jackrabbit to be registered when a new repository is instantiated?

I am automating my build using Apache Maven and have some unit tests to run with JUnit and integration tests to run with Jetty and want to be able to easily set-up and tear-down a test repository.

like image 976
Brian Matthews Avatar asked Dec 14 '22 04:12

Brian Matthews


2 Answers

If you are able to upgrade to the newly-released Jackrabbit 2.0.0, you can programmatically create and register nodetypes. The main hook is the JSR-283 NodeTypeManager which doubles as a factory for new NodeTypes, and a place for them to be registered. Just register them in the setup method of your JUnit tests, and you should be good to go.

like image 69
acfoltzer Avatar answered May 10 '23 12:05

acfoltzer


I suggest that you define your nodetypes using a CND file and configure your JUnit test cases to register them for you, as in this example. I would say the most appropriate way to do so is to define an abstract test case which performs this configuration.

Also notice that the node types are associated to a workspace, and not to the whole repository.

like image 26
Douglas Avatar answered May 10 '23 11:05

Douglas