jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Jackrabbit Wiki] Update of "ExamplesPage" by HendyIrawan
Date Fri, 08 Apr 2011 15:53:20 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jackrabbit Wiki" for change notification.

The "ExamplesPage" page has been changed by HendyIrawan.
The comment on this change is: Using JCR Commons CndImporter sample code.
http://wiki.apache.org/jackrabbit/ExamplesPage?action=diff&rev1=39&rev2=40

--------------------------------------------------

  }}}
  == Register a Node Type [CND] ==
  Register one or more node types using CND.  CND is described in http://jackrabbit.apache.org/node-type-notation.html.
+ 
+ Using JCR Commons CndImporter :
+ 
+ {{{
+ public static void RegisterCustomNodeTypes(Session session, String cndFileName)
+     throws Exception {
+     // Register the custom node types defined in the CND file, using JCR Commons CndImporter
+ 	NodeType[] nodeTypes = CndImporter.registerNodeTypes(new FileReader(cndFileName), session);
+ 	for (NodeType nt : nodeTypes) {
+ 		System.out.println("Registered: " + nt.getName());
+ 	}
+     
+     // You can also use JCR NodeTypeManager from the Workspace.
+ 	NodeTypeManager manager = session.getWorkspace().getNodeTypeManager();
+ 	// ... use manager here ...
+ }
+ }}}
+ 
+ Using deprecated JackrabbitNodeTypeManager API:
  
  {{{
      public void createCustomNodeTypes(Session session)

Mime
View raw message