jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject Re: FirstSteps example and permissions
Date Tue, 22 Mar 2005 09:24:00 GMT
Hi Tobias

Thanks very much for the pointer. I have fixed the FirstSteps example as 
follows:


Index: 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
===================================================================
--- 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java    
(revision 158578)
+++ 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java    
(working copy)
@@ -27,6 +27,7 @@
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
 import javax.jcr.StringValue;
 import javax.jcr.Value;
 import javax.naming.Context;
@@ -47,7 +48,9 @@
     public static void main(String[] args) {
         try {
             Repository repository = getRepository();
-            Session session = repository.login();
+            String userId = "anonymous";
+            char[] password = "".toCharArray();
+            Session session = repository.login(new 
SimpleCredentials(userId, password));
             Node root = session.getRootNode();

             System.out.println(root.getPrimaryNodeType().getName());


Also you might want to add a "test.xml" to src/conf, e.g.

<?xml version="1.0"?>

<hello>
world
</hello>


Thanks

Michi


Tobias Strasser wrote:

>build/classes:lib/jcr-0.16.2.jar:lib/jackrabbit-0.16.2-dev-LCR158328.jar:lib/runtime/jdom-1.0.jar:lib/runtime/log4j-1.2.8.jar:lib/runtime/commons-collections-2.1.1.jar:lib/runtime/cqfs-3.5.6.jar:lib/runtime/cqfs-jackrabbit-3.5.6.jar:lib/runtime/commons-logging-1.0.4.jar:lib/runtime/xercesImpl-2.6.2.jar:lib/runtime/concurrent-1.3.4.jar:lib/runtime/lucene-1.4.1.jar:lib:/home/michi/.maven/repository/xml-apis/jars/xmlParserAPIs-2.0.2.jar
>  
>
>>-Djava.security.auth.login.config==jaas.config
>>org.apache.jackrabbit.examples.FirstSteps
>>    
>>
>
>one '=' is enough :-)
>
>further, anonymous login (eg. Repository.login()) returns a session
>with readonly access. use some fake user (eg:
>Repository.login("anonymous"));
>
>see also: http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/853
>
>cheers, tobi
>  
>


-- 
Michael Wechner
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://www.wyona.com                      http://lenya.apache.org
michael.wechner@wyona.com                        michi@apache.org


Mime
View raw message