jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r158587 - incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
Date Tue, 22 Mar 2005 09:39:21 GMT
Author: tripod
Date: Tue Mar 22 01:39:21 2005
New Revision: 158587

URL: http://svn.apache.org/viewcvs?view=rev&rev=158587
Log:
- adapting first steps login

Modified:
    incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java

Modified: incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java?view=diff&r1=158586&r2=158587
==============================================================================
--- incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
(original)
+++ incubator/jackrabbit/trunk/contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
Tue Mar 22 01:39:21 2005
@@ -16,9 +16,7 @@
  */
 package org.apache.jackrabbit.examples;
 
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Hashtable;
+import org.apache.jackrabbit.core.jndi.RegistryHelper;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
@@ -27,12 +25,14 @@
 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;
 import javax.naming.InitialContext;
-
-import org.apache.jackrabbit.core.jndi.RegistryHelper;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Hashtable;
 
 /**
  * The First Steps example class.
@@ -47,7 +47,8 @@
     public static void main(String[] args) {
         try {
             Repository repository = getRepository();
-            Session session = repository.login();
+            SimpleCredentials creds = new SimpleCredentials("anonymous", "".toCharArray());
+            Session session = repository.login(creds);
             Node root = session.getRootNode();
 
             System.out.println(root.getPrimaryNodeType().getName());
@@ -62,7 +63,7 @@
             if (!root.hasNode("importxml")) {
                 System.out.println("importing xml");
                 Node node = root.addNode("importxml", "nt:unstructured");
-                InputStream xml =  new FileInputStream("repotest/test.xml");
+                InputStream xml = new FileInputStream("repotest/test.xml");
                 session.importXML("/importxml", xml);
                 session.save();
             }
@@ -89,8 +90,7 @@
         env.put(Context.PROVIDER_URL, "localhost");
         InitialContext ctx = new InitialContext(env);
 
-        RegistryHelper.registerRepository(
-                ctx, "repo", configFile, repHomeDir, true);
+        RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
         return (Repository) ctx.lookup("repo");
     }
 



Mime
View raw message