On my way to my solution store just found this nice to use, old and easy feature.
Possibilities endless, usage typically very easy.

I used the following to generate XML from sqlplus:

 select dbms_xmlgen.getxml('select * from user') from dual; 


 < ROW >
  < TNAME >Employee< / TNAME >
 < / ROW >
< / ROWSET >

Doing the Locale – Danmark

The following illustrates how to get the Number format working with a danish locale.

  1. import java.text.NumberFormat;
  2. import java.util.Currency;
  3. import java.util.Locale;
  6. public class TestLocale {
  8.  public static void main(String args[]){
  9.  // Create a Locale for Danmark
  10.  Locale DANMARK = new Locale("da","DK");
  12.  // get the currency instance for this locale.
  13.  Currency krone = Currency.getInstance(DANMARK);
  15.  // Get a Number format for the locale.
  16.  NumberFormat krFormat = NumberFormat.getCurrencyInstance(DANMARK);
  17.  // A symbol for the currency
  18.  String symbol = krFormat.getCurrency().getSymbol();
  19.  // A double amount
  20.  double amount = 10000.25;
  21. // print it out after formatting.
  22.  System.out.println(krFormat.format(amount));
  23.  }
  24. }

How to read a file from the JAR?

Someone just asked me this question today. And I thought might as well put it down for info.

  1.  public TestReadFileFromJar() throws FileNotFoundException, IOException {
  2.         InputStream is = getClass().getResource("txtData/");
  3.         read(is);
  4. }

In the case above txtData is placed in the jar on the root. Remmember to add the path with the /

Crocus – CSV Reader

Easy to use ready to go CSV File Reading utility. Read One or Multiple files into a RecordManager, quick access to the file with segmentation into Fields and Records. Merge Multiple CSV files in one. Listener to CSV Files.

Download Here

A CSV file is broken up as follows
A CSVField has a group of characters
A CSVRecord has a group of CSVFields
A CSVFile has a group of record

How To Use:

Reading a Single CSVFile into a RecordManager

  1.  // Creating a single file interface
  2. CSVSingleFileInterface fileInterface = new CSVSingleFileInterface("/media/data/dev/workspace/crocus/testData/drupal-sample.csv",CSVConstants.COMMA);
  3. // Calling the read returns a CSVRecordManager i.e. in memory
  4. AbstractCSVRecordManager manager =;

Reading multiple files into one RecordManager

  1. // Specify a FileSet
  2. AbstractCSVFileSet fileSet = new CSVFileSet();
  4. // Add files to the set
  5. fileSet.addFile("testData/drupal-sample.csv");
  6. fileSet.addFile("testData/countries.csv");
  8. // Add the fileSet to a Reading Interface
  9. CSVFileSetInterface fileSetInterface = new CSVFileSetInterface(fileSet);
  11. //  Reading returns a manager same as in a Single file case.
  12. AbstractCSVRecordManager manager =;

This functionality is not complete but a peak is available.
You can now specify a Listener to Pre, Post and On Add of a record.

Setting up a Listener.

To add you listener simply implement the RecordListener class

  1. // Get a Record Manager
  2. AbstractCSVRecordManager manager = fileInterface.getRecordManager();
  4. // Add a listener to the Manager.
  5. manager.addRecordListener(this);
  1. // Implement an event listening method for listening to the RecordEvent.
  2. public void eventPerformed(RecordEvent recordEvent) {
  3. System.out.println(recordEvent.toString());
  5. }

for further information refer to the docs.

The Build System:

The build script supports the following targets

Build: init, clean, compile, jar, javadoc, tests

Including, Excluding files while creating compile, jar, tests

FILE DETAILS (Paths and description):



CROCUS_DEV = the main directory i.e. examples from here onwards this will be the variable used for describing details.

You will need to set CROCUS_DEV env variable inorder to run the build process

Also you would need to set ANT_HOME for usage of ant. I have used Ant 1.6.5 for builds.

$CROCUS_DEV/src Holds the source code i.e. java files

$CROCUS_DEV/build Carries all the build related files

$CROCUS_DEV/build/build.xml Main build script

$CROCUS_DEV/build/include.xml patterns for inclusion of java files at the time of compilation

$CROCUS_DEV/build/exclude.xml patterns for exclusion of java files at the time of compilation

$CROCUS_DEV/build/tests_include.xml patterns for inclusion of test java files at the time of compilation

$CROCUS_DEV/build/tests_exclude.xml patterns for exclusion of test java files at the time of compilation

$CROCUS_DEV/build/tools tools used during build.

$CROCUS_DEV/build/jar_buildfiles you can simply specify a txt file with some wild card matches and name it as yourjar.jar for the build system to recognize that “yourjar.jar” will be the name for this jar that should have the packages in it as specified in this txt(yourjar.jar)

$CROCUS_DEV/build/bin Holds the uniz script and the bat file for developers to run the build script more or less as:

Windows:> %CROCUS_DEV%/build all

Linux:> $CROCUS_DEV/ all

$CROCUS_DEV/build_results Holds all the results of the builds

$CROCUS_DEV/build_results/docs Created java docs

$CROCUS_DEV/build_results/classes Created classes

$CROCUS_DEV/build_results/tests Unit test results

$CROCUS_DEV/build_results/jars the jars created by the system

$CROCUS_DEV/jars/ Is the directory for jars related information

$CROCUS_DEV/jars/manifests Holds the manifests for the $CROCUS_DEV/build/jar_buildfiles.

Conventionally should use: Manifest.jarName

$CROCUS_DEV/jars/original3rdparty Holds any 3rd party vendor jars that might be used for putting in the classpath for the build system

$CROCUS_DEV/testData logically should hold all testData no matter how that might be. currently I have placed a few csv files (tabbed,comma,semicolon).