You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by hwellmann <ha...@multi-m.de> on 2010/10/18 11:40:19 UTC
Jackrabbit on App Server with JCA
There is little documentation on how to use Jackrabbit in a Java EE web app
using the JCA resource adapter, so I'm currently experimenting by trial and
error to get things working.
My setup:
- Glassfish 3.0.1
- jackrabbit-jca-2.1.1.rar
First of all, I'm not sure which properties to set on the resource adapter.
There are
RepositoryURI
HomeDir
ConfigFile
I found examples using a URI "jcr-jackrabbit://jackrabbit", but I have no
clue what that is supposed to mean - a protocol "jcr-jackrabbit" talking to
a host called "jackrabbit"?
I'm currently using RepositoryURI=file:/path/to/my/repository, HomeDir and
ConfigFile are unset, and this seems to work well with the default
auto-created repository.
Next question: What is the best practice for using a repository from a
stateless session bean? This is what I'm currently doing:
@Stateless
public class SimpleJcrService {
@Resource(name = "jcr/MyRepo")
private Repository repository;
public void businessMethod() {
SimpleCredentials credentials = new SimpleCredentials("user",
"passwd".toCharArray());
session = repository.login(credentials);
// do some work
session.save();
session.logout();
}
That's four lines of boilerplate code per method, which I'd like to avoid.
Is there a way of directly injecting a Session instead of a Repository
(similar to @PersistenceContext vs. @PersistenceUnit in JPA)?
Best regards,
Harald
--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-on-App-Server-with-JCA-tp2999907p2999907.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.