jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@adobe.com>
Subject Re: I set a TransientRepository, I get a RepositoryImpl ?
Date Mon, 06 Jun 2011 08:54:49 GMT
On 05.06.11 21:19, "Hervé Agnoux" <herve.agnoux@diaam-informatique.com>
>    TransientRepository trans = new TransientRepository(
>     new File("/some/sort/of/path"));
>    Session session = trans.login();
>    TransientRepository transgetted =
>     (TransientRepository) session.getRepository();
>I get :
>Exception in thread "main" java.lang.ClassCastException:
>org.apache.jackrabbit.core.RepositoryImpl cannot be cast to
>	at com.hum.Repo.main(Repo.java:20)
>Is it a bug or a feature ??

session.getRepository() returns a Repository interface. You cannot make
any assumption about its implementation. In Jackrabbit's
TransientRepository case, it's actually a different object than the
TransientRepository you start at the beginning, because of some good
reason. Since creating/starting the repository (in this case calling
Jackrabbit's "new TransientRepository") is not defined by the JCR
spec/API, this is ok.

Might even be to avoid that other (unprivileged) sessions can actually
cast back to the TransientRepository to get "control" over the repository,
but I don't know for sure.


Alexander Klimetschek
Developer // Adobe (Day) // Berlin - Basel

View raw message