Hi Alex.
Yes I know that you were serious. Your question was very relevant. I really have need of the definition of types. For now I just use the nt:unstructured. But from now I have a need of user defined types which then will be managed by filtering and transforming to other structures. Exactly for the filtering needs I should now the type primary type of the nodes. Then these nodes will be transformed to visual component in the Flex based interface. For that I need of object persistence also, but I have not implemented yet, because of asynchronous nature of the Sling CRUD. Actualy I managed to implement the unregistering of the types in runtime by using NodeTypeManager.unregisterNodeType(String). So the newly created runtime NodeTypes cannot be updated. I just unregister them and import back again. Everything is putted in SlingPostOperation with the operation property ":operation=define". The biggest problem that took me the most time was the build configuration. It turns out that the interface NodeTypeManager is included from the couple maven artifacts. The apache-incubator-2.0.2 includes the package javax.jcr.nodetype and the native javax.jcr version 2.0 also includes the same package. In the NodeTypeManager Interface provided by apache-incubator-2.0.2 does not have unregisterNodeType method so the my solution that I found is to put the dependency definition of:
<dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
            <version>2.0</version>
</dependency>
in the start of the <dependancies /> definitions node in the pom. Thus the build becomes successful, because the generated class path first includes the JAR file from this artifact.

Thank you for everything guys.
Dimitar

On 10/11/2012 05:21 PM, Alexander Klimetschek wrote:
On 11.10.2012, at 12:23, Dimitar Dimitrov <[email protected]> wrote:

Alex you are amazingly insightful:). The NodeType definition in runtime
was the easy part. :) As Felix recommends
NodeTypeLoader.registerNodeType() did this perfectly. I just put it in
new SlingPostOperation based bundle.
Alex it seems that you have a lot of experience with this issue, so
please could you give me some helpful tips for changing the NodeType
definition on a fly :)
No, I was serious about this. Autogenerating node types from some kind of UI 
definition is not a good idea. Just try to start with nt:unstructured and go 
from there, with JCR there is no need for schemas (= node types). 
Autogenerating implies that it will change and changing schemas is difficult 
with any database solution.

Cheers,
Alex

Reply via email to