You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Dan Tenenbaum <da...@dandante.com> on 2008/11/07 21:08:38 UTC

modifying a repository directly with jackrabbit; also, disabling RMI

I have a java program that opens a TransientRepository using
SLING_HOME/jackrabbit/repository.xml as the config file and
SLING_HOME/jackrabbit/repository as the repository directory.
This program doesn't use sling at all, just jackrabbit. It adds some nodes
to the repository, then exits. It throws no exceptions. However, when I
start the sling webapp (launchpad), I don't see those nodes.
Furthermore, my program runs whether the sling webapp is running or not.

So my questions are:
1) Where is the repository that my program is writing to? Or, if it is
writing to the same repository, why can't I see the nodes that were created.
Could it be using a different workspace? Is there a way to determine what
workspace you are in (and what user you are logged in as) from a sling
script?
2) Can a java program directly modify the repository that launchpad uses,
while the launchpad app is running? We have a need to use the jackrabbit API
directly to modify our repository, but if we have to take down the webapp
every time we do this, that's not an option we can use. Is there another
type of repository that can handle this type of concurrency?

Next question:
I have an RMI application that has nothing to do with Sling or Jackrabbit.
When I try and start this app, it fails if launchpad is running, telling me
the RMI port is in use.
If I stop the launchpad app, then my RMI app can start, and then I can start
launchpad and it works fine.
This suggests that sling is starting up RMI but not using it. Can I disable
that?

Thanks
Dan

Re: modifying a repository directly with jackrabbit; also, disabling RMI

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Fri, Nov 7, 2008 at 9:08 PM, Dan Tenenbaum <da...@dandante.com> wrote:
> I have a java program that opens a TransientRepository using
> SLING_HOME/jackrabbit/repository.xml as the config file and
> SLING_HOME/jackrabbit/repository as the repository directory...

Using the TransientRepository(String config, String home) constructor I assume.

> So my questions are:
> 1) Where is the repository that my program is writing to? ...

If config and home actually point to the repository that Sling uses,
that should be the same one. The best way to find out is to check the
file timestamps after making changes with one app or the other.

> ...Or, if it is
> writing to the same repository, why can't I see the nodes that were created.
> Could it be using a different workspace? Is there a way to determine what
> workspace you are in (and what user you are logged in as) from a sling
> script?...

By default, Sling uses the repository's default workspace.

The JCR Session object can tell you what this is, so
currentNode.getSession().getWorkspace().getName() should do.

> ...2) Can a java program directly modify the repository that launchpad uses,
> while the launchpad app is running?...

Not directly, but your program could connect to the same repository via RMI.

But can't you do those modifications using the Sling API? We aim to
provide full access to the repository via the HTTP/JSON interface of
the default Sling servlets, and if there's something missing we might
want to add it.

> Next question:
> ...This suggests that sling is starting up RMI but not using it. Can I disable
> that?...

Yes, use the Sling console
(http://localhost:8888/system/console/configMgr), select the
org.apache.sling.jcr.jackrabbit.server.RmiRegistrationSupport config
and change the port number. I don't think there's a simple way to
completely disable that ATM.

-Bertrand