Topic
  • 1 reply
  • Latest Post - ‏2013-06-11T19:09:02Z by AlexFleischer
MiguelFranco
MiguelFranco
1 Post

Pinned topic How to use a configuration file in ODM

‏2013-06-11T15:28:35Z |

I need to use a configuration file to setup a database access from within a XOM Java class for my ODM RuleApp.

So I created a config file (that I called "myRuleApp.config")  and I am reading it from my Java class using the Java Properties class.

How do I deploy this config file into the Rule Execution Server? Should it go along inside the XOM Resource Zip file (where my Java class is)? Should it go along with the RuleApp jar file? Do I have to save this file manually to a specific directory on the server?

Is there any better way to have a configuration for this purpose?

When I test my RuleApp Ruleset on Eclipse on my machine, I am able to read the config file, but when I deploy the RuleApp and XOM into the Rule Execution Server and try to call the rule as a webservice I get an exception get an exception saying the system cannot find the file specified.

Thanks in advance!

 

A snippet from my source code:

import java.io.*;

Properties config = new Properties();

config.load(new FileInputStream("myRuleApp.config"));

String dbServer = config.getProperty("DBServer");
String dbInstance = config.getProperty("DBInstance");
String dbName = config.getProperty("DBName");
String dbUser = config.getProperty("DBUser");
String dbPassword = config.getProperty("DBPassword");