jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: RMI NodeType export
Date Fri, 17 Apr 2009 12:17:13 GMT
On Fri, Apr 17, 2009 at 1:58 PM, Kooper <sergeysachkov@list.ru> wrote:
> Does anyone know how I can export Node types via RMI?
> I am able to export them through local repository:
> FileWriter writer = new FileWriter(destFile);
>                NamespaceRegistry namespaceReg =
> jcrSession.getWorkspace().getNamespaceRegistry();
>                NodeTypeManagerImpl ntm = (NodeTypeManagerImpl)
> jcrSession.getWorkspace().getNodeTypeManager();
>                NodeTypeRegistry ntr = ntm.getNodeTypeRegistry();
>                Set custom = new HashSet();
>                Name[] names = ntr.getRegisteredNodeTypes();
>                for (int i=0; i<names.length; i++) {
>                    if (!ntr.isBuiltIn(names[i])) {
>                        custom.add(ntr.getNodeTypeDef(names[i]));
>                    }
>                }
>                SessionNamespaceResolver sessionNamespaceResolver = new
> SessionNamespaceResolver(jcrSession);
>                NodeTypeDef[] defs = (NodeTypeDef[]) custom.toArray(new
> NodeTypeDef[custom.size()]);
>                CompactNodeTypeDefWriter.write(Arrays.asList(defs),
> sessionNamespaceResolver, new
> DefaultNamePathResolver(sessionNamespaceResolver), writer);
>
> but cannot find any example via RMI. Are there any posobility to do export
> via RMI?

No, because NodeTypeManagerImpl and CompactNodeTypeDefWriter are
actually jackrabbit internal classes and thus aren't part of the JCR
rmi interface.

You might have succcess by copying the CompactNodeTypeDefWriter code
and let it work solely with the jcr NodeType interface. You get all
nodetypes from the NodeTypeManager.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message