Hi,
before I get into some conceptual thoughs, I think the main question
regarding shutdown() is:
Do people need to be able to call shutdown() remotely?
I consider the interface "Repository" as part of the JCR client API.
The actually started JCR-server is IMHO a different entity, which is
currently somewhat represented by TransientRepository - but it has the
problem of implementing the Repository interface as well, which makes
things very confusing.
== Server
Things get clearer when we look at a remoting situation: here someone
starts the Jackrabbit/JCR server on one server. I will call this the
"server" entity for now, which is not standardized or even mentioned
in the JSR specs (1.0 and 2.0). This is the entity which is started
and stopped (shutdown) and probably managed in other ways as well. I
don't know if this should be standardized, but it would look good if
the code in the end (even if it is Jackrabbit-specific) would look
like this:
RepositoryServer server = new RepositoryServer("jndi://localhost/
jackrabbit"); // register on JNDI
RepositoryServer server = new RepositoryServer("http://localhost:1234
"); // start webdav server on port 1234
...
server.shutdown();
The shutdown method would be completely natural here. And note that
the RepositoryServer is only needed for server-startup code; the
embedded variant can be handled simpler (see below).
== Client
Then we have on a different machine a JCR client that connects to this
server. Here we have the normal JCR API, which always implements the
*client-side view* on a repository - a good example is "Workspace",
which is session-bound and does not represent the persisted Workspace
entity on the server, but rather what that specific client "sees".
Therefor we should not mix the interface "Repository" with the server.
A better naming in this regard would probably be
"RepositoryConnection", but as this is part of the standard we can't
change it anyway ;-)
Now to the solutions: I personally like the RepositoryFactory (or
ClientRepositoryFactory) proposal: it is a generic way to get client-
Repository instances. In the case of an embedded Repositories the
server entity gets completely hidden by the respective implementation
of the RepositoryFactory for the embedded case.
To allow shutdown(), I think it would be better to put this method
into the factory than in some client interface:
RepositoryFactory.shutdownEmbedded(Repository repo)
In all other cases, in which we start a server (eg. RMI), we can
easily shut it down on the server side (eg.
RepositoryServer.shutdown()); on the client side it depends on my
original question: if we want a remote shutdown, we need some general
interface like JackrabbitManagedRepository for the client. Otherwise
we can remove that interface completely.
Alex
PS: createWorkspace, node type registration etc. are on a different
layer than start/shutdown, so they should be part of the Workspace or
Session interface (including authorization) - which is already the case.
--
Alexander Klimetschek
[EMAIL PROTECTED]
>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<