KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > CliTest


1
2 // You can redistribute this software and/or modify it under the terms of
3
// the Ozone Library License version 1 published by ozone-db.org.
4
//
5
// The original code and portions created by SMB are
6
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
7
//
8
// $Id: CliTest.java,v 1.1 2003/11/22 19:29:51 per_nyfelt Exp $
9

10 import org.xmldb.api.DatabaseManager;
11 import org.xmldb.api.base.Collection;
12 import org.xmldb.api.base.Database;
13
14 /**
15  *
16  * @author <a HREF="http://www.smb-tec.com">SMB</a>
17  * @version $Revision: 1.1 $
18  */

19 public class CliTest {
20
21     /**
22      *
23      */

24     public static void main( String JavaDoc args[] ) throws Exception JavaDoc {
25
26         // load a database instance
27
Database xmlDB = (Database)
28                           Class.forName( "org.ozoneDB.xml.cli.DatabaseImpl" ).newInstance();
29
30         // url schema:
31
//
32
// xmldb:ozonexml:<database>?<rootcoll>
33
//
34
// <database> can either be a directory in the local filesystem or a remote
35
// ip address (host:port)
36
// <rootcoll> specifies the name of the root collection to load
37

38         // connect to the database and return the requested root collection
39
Collection rootCol = xmlDB.getCollection( "xmldb:ozonexml:/home/lars/xmltest?root" );
40         //Collection rootCol = xmlDB.getCollection( "xmldb:ozonexml://localhost:4445?root" );
41

42         // try to load the parent collection
43
Collection parentCol = rootCol.getParentCollection();
44         if (parentCol == null)
45             System.out.println( "This Collection doesn't have a parental Collection!" );
46
47         
48     }
49
50 }
51
Popular Tags