Skip to Main Content U.S. Department of Energy
 

MIF Samples

This page lists all the sample code distributed with the MeDICi Integration Framework (MIF). You will find the sample code in MIF_HOME/sources/mif-samples. Before starting to program against the MIF API, we recommend that you start with the Hello World sample.

Prerequisites

Before you start working through these samples:

Sample Code

  • Hello World - Sample which accepts a string from the console, appends 2 additional strings, and returns the new string to the console
  • Hello Component - Hello World using a MIF Component and JMS endpoints
  • Aggregator - Demonstrate a simple aggregator which combines 2 strings
  • Splitter - Demonstrates a simple splitter which breaks apart a string into multiple smaller strings.
  • Specialized Modules - These are modules which have a special purpose and are used often. So, they have been made available in the MIF API.

Running the samples

Command line

If it is not specified by a particular sample, you can run all the samples on the command line by opening a terminal and changing to the MIF_HOME directory. Then use the launcher script (bin/mif.sh on UNIX and mif.bat on windows) and specify the sample class with the -c option, e.g.: bin/mif_script -c <class-name>. This command not only works for the samples, it will launch any MIF pipeline if the specified class has a main method that configures and starts the piepline.

So, to run a sample class called com.example.Sample1 from UNIX, you would enter the command:

bin/mif.sh -c com.example.Sample1

To run Sample1 from Windows, enter the command:

bin\mif.bat -c com.example.Sample1

Cross-platform Note

Some sample documentation may reference the UNIX launcher script (bin/mif.sh) only. However, all samples and pipelines will also work with the Windows launcher (bin\mif.bat).

IDE

To run the sample code in your favorite IDE, import them into a new project and put the jar MIF_HOME/mif-vers-all.jar on your classpath, as described in the installation instructions. To run the samples from Eclipse, please follow the detailed instructions specific to eclipse development.

 
mif_samples.txt · Last modified: 2010/06/01 11:28 by adamw