You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Tim O'Brien <to...@discursive.com> on 2006/04/12 16:55:04 UTC

Loading a Node Type using the RMI client

I'm trying to load a node type using a Repository created with the
clientFactory.  I tried this:

<code>
ClientRepositoryFactory clientFactory = new ClientRepositoryFactory();
Repository repository = clientFactory.getRepository(rmiLocation);

Session session = repository.login();
Workspace ws = session.getWorkspace();

NodeTypeManagerImpl ntmgr = (NodeTypeManageImpl) ws.getNodeTypeManager();
</code>

But, it threw a ClassCastException when I tried to cast to the node type
manager implementation.   I'm assuming that the NodeTypeManagerImpl isn't
available when you access a repository over RMI.  Correct assumption?  If
so, is there any way to do this over RMI?

Tim O'Brien
tobrien@discursive.com

Re: Loading a Node Type using the RMI client

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On 4/12/06, Tim O'Brien <to...@discursive.com> wrote:
> NodeTypeManagerImpl ntmgr = (NodeTypeManageImpl) ws.getNodeTypeManager();
> [...]
> But, it threw a ClassCastException when I tried to cast to the node type
> manager implementation.   I'm assuming that the NodeTypeManagerImpl isn't
> available when you access a repository over RMI.  Correct assumption?  If
> so, is there any way to do this over RMI?

Yes, you are right. JCR-RMI provides the client with adapter instances
that implement the standard JCR interfaces but does not expose more
features of the underlying server classes.

It would be possible possible to extend the JCR-RMI interfaces to
extend the public Jackrabbit extension interfaces in
org.apache.jackrabbit.api, but that would bring in a dependency to
Jackrabbit. A better option would perhaps be to make a jackrabbit-rmi
extension to JCR-RMI that would use the custom extensions. The
AdapterFactory approach in JCR-RMI should even make this relatively
painless. You may want to file a feature request about this in Jira.

The short term workaround is to do all nodetype management using a
local repository instance.

BR,

Jukka Zitting

--
Yukatan - http://yukatan.fi/ - info@yukatan.fi
Software craftsmanship, JCR consulting, and Java development