You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Eknath Kadam <ek...@yahoo.com> on 2006/10/04 09:59:03 UTC

Using jackrabbit repository remotely

I dont what to do about this problem. When connected to a remote repository
using JNP, I see that a couple of repository admin functions are not available.

For example,
1. Registering cutom nodes.
  Workspace wsp = session.getWorkspace();
  NodeTypeManager ntMgr = wsp.getNodeTypeManager();
  NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
  ntReg.registerNodeType(nodeTypeDef);
Above code will throw ClassCastException when trying cast NodeTypeManager to
NodeTypeManagerImpl

2. Creating a new workspace remotely is also not supported
((org.apache.jackrabbit.core.WorkspaceImpl)workspace).createWorkspace(name);

3. or shutting down a repository.
((org.apache.jackrabbit.core.RepositoryImpl) session.getRepository()).shutdown();

I was informed by Jukka that JCR-RMI only supports the standard JCR interfaces,
so you can't cast the adapters to Jackrabbit-specific classes.

I understand this but is there any other way or workaround to perform these
functions? Our system would go live soon and before that I need to figure out
how I can do this remotely.

Thanks,
Eknath



Re: Using jackrabbit repository remotely

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

In the future, for other implementation specific extensions, we could maybe
use a wrapper mechanism like the one from JDBC 4.0, as described here:

http://java.sun.com/javase/6/docs/api/java/sql/Wrapper.html

This mechanism was invented for JDBC drivers, but it can be used for other
APIs as well (as far as I see). For Jackrabbit, probably we should remove
the 'generic' part of it.

Thomas


On 10/5/06, Tobias Bocanegra <to...@day.com> wrote:
>
> hi eknath,
> i create a jira issue for this:
> http://issues.apache.org/jira/browse/JCR-585
>
> regards, toby
>
> On 10/4/06, Eknath Kadam <ek...@yahoo.com> wrote:
> > > On 10/4/06, Thomas Mueller <thomas.tom.mueller <at> gmail.com> wrote:
> > > > - For those interfaces that need to be extended, create new
> interfaces as
> > > > part of Jackrabbit, and let them extend the JCR API. Then use those
> > > > interfaces instead of the JCR API for the RMI API and the log/trace
> wrapper.
> > > > The application then just casts to the new interfaces instead of the
> > > > implementation.
> >
> > Thanks Thomas for the idea.
> > I modified RemoteWorkspace.java ServerWorkspace.java and
> > ClientWorkspace.java and added new method
> > void createWorkspace(String name), rebuild the project and
> > used the new jar in project.
> > Now I use following code create new workspace remotely
> > ((ClientWorkspace)workspace).createWorkspace("newWorkspace");
> >
> > I am sure this approach would work for rest the issue also.
> > I would recommand if standard jackrabbit-rmi
> > also provides such functionality.
> >
> > Thanks,
> > Eknath
> >
> >
>
>
> --
> -----------------------------------------< tobias.bocanegra@day.com >---
> Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
> T +41 61 226 98 98, F +41 61 226 98 97
> -----------------------------------------------< http://www.day.com >---
>

Re: Using jackrabbit repository remotely

Posted by Tobias Bocanegra <to...@day.com>.
hi eknath,
i create a jira issue for this: http://issues.apache.org/jira/browse/JCR-585

regards, toby

On 10/4/06, Eknath Kadam <ek...@yahoo.com> wrote:
> > On 10/4/06, Thomas Mueller <thomas.tom.mueller <at> gmail.com> wrote:
> > > - For those interfaces that need to be extended, create new interfaces as
> > > part of Jackrabbit, and let them extend the JCR API. Then use those
> > > interfaces instead of the JCR API for the RMI API and the log/trace wrapper.
> > > The application then just casts to the new interfaces instead of the
> > > implementation.
>
> Thanks Thomas for the idea.
> I modified RemoteWorkspace.java ServerWorkspace.java and
> ClientWorkspace.java and added new method
> void createWorkspace(String name), rebuild the project and
> used the new jar in project.
> Now I use following code create new workspace remotely
> ((ClientWorkspace)workspace).createWorkspace("newWorkspace");
>
> I am sure this approach would work for rest the issue also.
> I would recommand if standard jackrabbit-rmi
> also provides such functionality.
>
> Thanks,
> Eknath
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Using jackrabbit repository remotely

Posted by Eknath Kadam <ek...@yahoo.com>.
> On 10/4/06, Thomas Mueller <thomas.tom.mueller <at> gmail.com> wrote:
> > - For those interfaces that need to be extended, create new interfaces as
> > part of Jackrabbit, and let them extend the JCR API. Then use those
> > interfaces instead of the JCR API for the RMI API and the log/trace wrapper.
> > The application then just casts to the new interfaces instead of the
> > implementation.

Thanks Thomas for the idea.
I modified RemoteWorkspace.java ServerWorkspace.java and 
ClientWorkspace.java and added new method 
void createWorkspace(String name), rebuild the project and
used the new jar in project. 
Now I use following code create new workspace remotely
((ClientWorkspace)workspace).createWorkspace("newWorkspace");

I am sure this approach would work for rest the issue also.
I would recommand if standard jackrabbit-rmi 
also provides such functionality.

Thanks,
Eknath


Re: Using jackrabbit repository remotely

Posted by Tobias Bocanegra <to...@day.com>.
we once started the jackrabbit-api...maybe it's time to expose those
methods via RMI aswell....creating a specific jackrabbit-rmi.

On 10/4/06, Thomas Mueller <th...@gmail.com> wrote:
> Hi,
>
> I am currently writing a Trace/Log wrapper for the JCR API, and I ran into
> the same problem. I think this functionality should be included in the next
> JCR API (as part of JSR 283). But I don't know how long this will take?
> Short / medium term, I think there are other solutions / workarounds:
>
> - For those interfaces that need to be extended, create new interfaces as
> part of Jackrabbit, and let them extend the JCR API. Then use those
> interfaces instead of the JCR API for the RMI API and the log/trace wrapper.
> The application then just casts to the new interfaces instead of the
> implementation.
>
> - Alternative solution: Create a public utility class with some public
> static methods. Example: JcrUtils.registerNodeType(NodeTypeManager,
> InputStream nodeTypeDef). This utility class calls the relevant method(s)
> via reflection. For the log/trace wrapper this should be quite easy to
> implement, it is probably a little harder for RMI API.
>
> Thomas
>
>
> On 10/4/06, Eknath Kadam <ek...@yahoo.com> wrote:
> >
> > I dont what to do about this problem. When connected to a remote
> > repository
> > using JNP, I see that a couple of repository admin functions are not
> > available.
> >
> > For example,
> > 1. Registering cutom nodes.
> >   Workspace wsp = session.getWorkspace();
> >   NodeTypeManager ntMgr = wsp.getNodeTypeManager();
> >   NodeTypeRegistry ntReg = ((NodeTypeManagerImpl)
> > ntMgr).getNodeTypeRegistry();
> >   ntReg.registerNodeType(nodeTypeDef);
> > Above code will throw ClassCastException when trying cast NodeTypeManager
> > to
> > NodeTypeManagerImpl
> >
> > 2. Creating a new workspace remotely is also not supported
> > ((org.apache.jackrabbit.core.WorkspaceImpl
> > )workspace).createWorkspace(name);
> >
> > 3. or shutting down a repository.
> > ((org.apache.jackrabbit.core.RepositoryImpl) session.getRepository
> > ()).shutdown();
> >
> > I was informed by Jukka that JCR-RMI only supports the standard JCR
> > interfaces,
> > so you can't cast the adapters to Jackrabbit-specific classes.
> >
> > I understand this but is there any other way or workaround to perform
> > these
> > functions? Our system would go live soon and before that I need to figure
> > out
> > how I can do this remotely.
> >
> > Thanks,
> > Eknath
> >
> >
> >
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Using jackrabbit repository remotely

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

I am currently writing a Trace/Log wrapper for the JCR API, and I ran into
the same problem. I think this functionality should be included in the next
JCR API (as part of JSR 283). But I don't know how long this will take?
Short / medium term, I think there are other solutions / workarounds:

- For those interfaces that need to be extended, create new interfaces as
part of Jackrabbit, and let them extend the JCR API. Then use those
interfaces instead of the JCR API for the RMI API and the log/trace wrapper.
The application then just casts to the new interfaces instead of the
implementation.

- Alternative solution: Create a public utility class with some public
static methods. Example: JcrUtils.registerNodeType(NodeTypeManager,
InputStream nodeTypeDef). This utility class calls the relevant method(s)
via reflection. For the log/trace wrapper this should be quite easy to
implement, it is probably a little harder for RMI API.

Thomas


On 10/4/06, Eknath Kadam <ek...@yahoo.com> wrote:
>
> I dont what to do about this problem. When connected to a remote
> repository
> using JNP, I see that a couple of repository admin functions are not
> available.
>
> For example,
> 1. Registering cutom nodes.
>   Workspace wsp = session.getWorkspace();
>   NodeTypeManager ntMgr = wsp.getNodeTypeManager();
>   NodeTypeRegistry ntReg = ((NodeTypeManagerImpl)
> ntMgr).getNodeTypeRegistry();
>   ntReg.registerNodeType(nodeTypeDef);
> Above code will throw ClassCastException when trying cast NodeTypeManager
> to
> NodeTypeManagerImpl
>
> 2. Creating a new workspace remotely is also not supported
> ((org.apache.jackrabbit.core.WorkspaceImpl
> )workspace).createWorkspace(name);
>
> 3. or shutting down a repository.
> ((org.apache.jackrabbit.core.RepositoryImpl) session.getRepository
> ()).shutdown();
>
> I was informed by Jukka that JCR-RMI only supports the standard JCR
> interfaces,
> so you can't cast the adapters to Jackrabbit-specific classes.
>
> I understand this but is there any other way or workaround to perform
> these
> functions? Our system would go live soon and before that I need to figure
> out
> how I can do this remotely.
>
> Thanks,
> Eknath
>
>
>