jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wechner <michael.wech...@wyona.com>
Subject small changes of the FirstSteps example
Date Tue, 08 Mar 2005 09:08:55 GMT
I think it would make to add the repHomeDir and the XML file as command 
line parameters.
(Please see below)

WDYT?

Michi

FirstSteps.java
Index: 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java
===================================================================
--- 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java    
(revision 156512)
+++ 
contrib/examples/src/java/org/apache/jackrabbit/examples/FirstSteps.java    
(working copy)
@@ -46,7 +46,7 @@
      */
     public static void main(String[] args) {
         try {
-            Repository repository = getRepository();
+            Repository repository = getRepository(args[0]);
             Session session = repository.login();
             Node root = session.getRootNode();

@@ -62,7 +62,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(args[1]);
                 session.importXML("/importxml", xml);
                 session.save();
             }
@@ -79,9 +79,8 @@
      * @return repository instance
      * @throws Exception on errors
      */
-    private static Repository getRepository() throws Exception {
-        String configFile = "repotest/repository.xml";
-        String repHomeDir = "repotest";
+    private static Repository getRepository(String repHomeDir) throws 
Exception {
+        String configFile = repHomeDir + java.io.File.separator + 
"repository.xml";

         Hashtable env = new Hashtable();
         env.put(Context.INITIAL_CONTEXT_FACTORY,

-- 
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