jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Jackrabbit: Node Types (comment added)
Date Wed, 24 Sep 2008 11:50:00 GMT
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



Mime
View raw message