License     Codehaus     OpenEJB     OpenJMS     OpenORB     Tyrex     
 

Main
  Home
  About
  Features
  Download
  Dependencies
  JavaDoc
  Maven 2 support
  Maven 2 archetypes
  DTD & Schemas
  Recent HTML changes
  News Archive
  RSS news feed

Development/Support
  Mailing Lists
  SVN/JIRA
  Contributing
  Support
  Prof. services

Related projects
  Spring ORM support
  Spring XML factories
  WS frameworks

XML
  Using XML
  XML Mapping
  Configuration
  Properties
  XML parsers
  XML FAQ
  XML HOW-TOs
  Tips & Tricks
  Custom Handlers
  Best practice

XML Code Generator
  Introduction
  Properties
  Custom bindings
  Ant task
  Maven 2 plugin
  Command line
  Schema Support
  Example

JDO
  Introduction
  First steps
  Using JDO
  JDO Config
  Types
  JDO Mapping
  JDO FAQ
  JDO Examples
  JDO HOW-TOs
  Tips & Tricks
  Other Features
  JDO sample JAR

Tools
  Schema generator

Advanced JDO
  Caching
  OQL
  Trans. & Locks
  Design
  KeyGen
  Long Trans.
  Nested Attrs.
  Pooling Examples
  LOBs
  Best practice

DDL Generator
  Using DDL Generator
  Properties
  Ant task
  Type Mapping

More
  Presentations
  The Examples
  3rd Party Tools
  JDO Tests
  XML Tests
  Configuration
 
 

About
  License
  Contributors
  Marketplace
  Status, Todo
  Changelog
  Library
  Contact
  Project Name

  



Running The Examples


Running The Examples
Castor JDO
Castor DSML
External Examples
    ebXMLsoft


Running The Examples

In order to run the examples located in src/examples, there are a number of steps that must first take place. These steps are outlined below:

  1. Download the Castor source via either FTP or SVN. If the source has been downloaded via FTP, it must be decompressed. This is dependent on whether a gzipped tarball has been downloaded or a zip file has been downloaded.

    Steps for a gzipped tarball:

    tar zxvf castor-0.9.3.9-src.tgz
    or
    gunzip < castor-0.9.3.9-src.tgz | tar xvf -

    Steps for a zip file:

    unzip castor-0.9.3.9-src.zip
    or
    jar xvf castor-0.9.3.9-src.zip
    or
    Get a copy of PowerArchiver

  2. If you're using Unix/Linux, the shell scripts must be made executable and the line endings must be changed. Use the following directions:

    1. Make the shell scripts executable:

      chmod +x *.sh

    2. Change the line endings on the shell scripts:

      for i in *.sh; do dos2unix $i $i; done

  3. If it is not set yet, please set the JAVA_HOME environment variable.
  4. Edit src/examples/jdo/database.xml for the database being used. (There are examples for all supported databases in src/tests/jdo.)
  5. Build the examples like so:

    build.[sh|bat] examples

    This will not only build the examples, but will also build the Castor classes.
  6. Add the appropriate classes for the database driver to the CLASSPATH.
  7. Run the examples using the directions in the next section.

The script files example.sh and example.bat can be used to run the provided examples. The first argument is the example package name. For example, to build and run the JDO example:

  build.sh examples
  example.sh jdo

Castor JDO

The JDO sample will test persistence between a set of Java classes (Product, ProductGroup, ProductDetail) and a known SQL schema. You can use the create.sql file to generate the database schema for the purpose of this test.

The mapping between the Java objects and SQL schema is described in the file mapping.xml. The JDBC connection to use is described in the file database.xml. The provided file uses PostgreSQL as the database server and JDBC driver. You can modify this file for your database server and use any JDBC 1.0 or 2.0 driver.

The database information and mapping are automatically read from the JDO example directory. There is no need to provide any parameters on the command line.

The performance test uses the ODMG engine as well as direct JDBC access. You must provide the JDBC URI and class name to use for this test on the command line.

Usage:

  example.sh jdo
        

Castor DSML

Do not run this sample against a production LDAP server unless you are sure it will not affect the information in your directory!

The DSML sample will attempt to import the supplied directory information from the test.xml file using the import policy described in the import.xml. file. It will then run a search against the LDAP server using the search criteria in the search.xml file and dump it to the console.

You must modify search.xml, import.xml and test.xml and adapt them to your LDAP directory structure. The default files assumes the root directory dc=intalio,dc=com and includes some sample LDAP entries.

Usage:

  test.sh dsml [jndi|mozilla] <host> <root-dn> <root-pwd>

  jndi|mozilla  Selects whether to use the JNDI or Mozilla Directory
            SDK implementations
  host          The LDAP host name (port number is optional)
  rood-dn       The root DN used for authenticating when importing
  root-pwd      The root password used for authenticating when importing

For example:

  example.sh dsml mozilla ldap.intalio.com dc=intalio,dc=com secret
      

External Examples

This section provides a place to link external examples of using Castor. If you have an example that you feel would be useful, please send us the URL. Also notify us if any links are broken.

ebXMLsoft

Goran Zugic and Duka Krunic of ebXMLsoft Inc. have some samples using Castor XML and Castor JDO. The examples use Castor 0.9.2 and offer good insight in using XML and JDO together.

http://www.ebxmlsoft.com/pilots/samples.html

 
   
  
   
 


Copyright © 1999-2005 ExoLab Group, Intalio Inc., and Contributors. All rights reserved.
 
Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners.