jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saminda Wijeratne <samin...@gmail.com>
Subject Creating user manager instance in order to create users
Date Sat, 24 Sep 2011 22:48:00 GMT
Hi,

I'm new to using JackRabbit repository. I couldn't find a similar question
on the archives. I just want to programatically create a user for JackRabbit
registry.

I was attempting to use the JackRabbit API.

        HashMap<String, String> map = new HashMap<String, String>();
        map.put("org.apache.jackrabbit.repository.uri", "
http://localhost:8080/rmi");
        Repository repository = new
RmiRepositoryFactory().getRepository(map);
        Credentials credentials=new SimpleCredentials("admin", new
String("admin").toCharArray());
        Session session = repository.login(credentials);


Tried to initialize the SimpleSecurityManager to get the UserManager object.

            SimpleSecurityManager simpleSecurityManager = new
SimpleSecurityManager();
            simpleSecurityManager.init(repository, session);

But calling init method throws the following,
javax.jcr.RepositoryException: RepositoryImpl expected
    at
org.apache.jackrabbit.core.security.simple.SimpleSecurityManager.init(SimpleSecurityManager.java:127)
    at FirstHop.main(FirstHop.java:38)

Looking at the impl of the init method showed that the repository parameter
expected in the init method looks for a specific implementation of
RepositoryImpl class. From where can this object be derived from the
existing repository object? Or is the way I'm doing this is all wrong?

Thanks in advance,
Saminda

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message