You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by co...@apache.org on 2008/09/24 13:50:00 UTC
[CONF] Apache Jackrabbit: Node Types (comment added)
Node Types (JCR) commented on by Sébastien Launay
http://cwiki.apache.org/confluence/display/JCR/Node+Types?focusedCommentId=98003#comment-98003
Comment
---------------------------------------------------------------------
I think the following snippet is simplier and less implementation dependent than the one in the example:
{code}
import java.io.FileInputStream;
import java.io.InputStream;
import javax.jcr.Workspace;
import org.apache.jackrabbit.api.JackrabbitNodeTypeManager;
public class CustomNodeTypeExample {
public static void registerCustomNodeTypes(Workspace ws, String cndFileName) throws Exception {
JackrabbitNodeTypeManager ntManager = (JackrabbitNodeTypeManager) ws.getNodeTypeManager();
InputStream is = null;
try
{
// Open the CND file
is = new FileInputStream(cndFileName);
// Register the custom node types
ntManager.registerNodeTypes(is, JackrabbitNodeTypeManager.TEXT_X_JCR_CND);
}
finally
{
if (is != null)
{
is.close();
}
}
}
}
{code}
---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence
Unsubscribe or edit your notifications preferences
http://cwiki.apache.org/confluence/users/viewnotifications.action
If you think it was sent incorrectly contact one of the administrators
http://cwiki.apache.org/confluence/administrators.action
If you want more information on Confluence, or have a bug to report see
http://www.atlassian.com/software/confluence