You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Michael Wechner <mi...@wyona.com> on 2005/03/08 10:08:55 UTC
small changes of the FirstSteps example
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