How to Use the Obix Framework

1) Create the sample.config file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration SYSTEM "http://obix-framework.sourceforge.net/docs/obix-configuration.dtd">
<configuration>
  <entry entryKey="message">
    <value>Hello World!</value>
  </entry>
</configuration>

2) Create the ObixSample.java file:

import static java.lang.System.out;

import org.obix.configuration.Configuration;
import org.obix.configuration.ConfigurationAdapter;
import org.obix.configuration.ConfigurationAdapterFactory;

public final class ObixSample {

  public static void main(final String[] args) {
    final ConfigurationAdapterFactory factory = ConfigurationAdapterFactory.newAdapterFactory();

    final Configuration config = Configuration.getConfiguration();

    final ConfigurationAdapter adapter = factory.create(null);

    adapter.adaptConfiguration(config, "sample.config");

    out.println(config.getStringValue("message"));
  }

}

3) Compile the ObixSample.java file.

4) Launch the ObixSample class.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s