cancel
Showing results for 
Search instead for 
Did you mean: 

Using a custom JAR / properties file

Former Member
0 Kudos

All,

I have a need to use a *.properties file to be read at run time in the mapping. So, a Java class has been created that will have the methods to be called from the mapping program through UDF, read the PROPS file and get back with a response.

Is there a place on the server that I can keep this file and define that path in the Java class ? Typically what is the standard path that is used?

m

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Instead of answering your question....can i ask you/suggest you another method...

How about using the value mapping to achieve the same ?

Thanks.

Former Member
0 Kudos

Is it not faster with a local file than RFC connections, a table on R/3 etc? I am just trying to keep it simple.

Former Member
0 Kudos

This is not an RFC call ..This is a standard XI feature...you maintain these values in the Integration Directory..which can be accessed from inside mapping using standard function...

Further more, it eliminates the need for custom coding,....

Thanks.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks!!

Former Member
0 Kudos

standard way of reading a properties file wont work directly...as direct file io is not encouraged from within EJB runtime environment.wherever you are going to have a properties file bundled inside the jar read it as

Properties properties = new Properties();
InputStream inStream = this.getClass().getResourceAsStream("MY_PROP.properties");
	try
	{
	properties .load(inStream);
	}
	catch (Exception e)
	{
                 // Error handling code
	}

Former Member
0 Kudos

> standard way of reading a properties file wont work

> directly...as direct file io is not encouraged from

> within EJB runtime environment.wherever you are going

> to have a properties file bundled inside the jar read

> it as

>

> [code]Properties properties = new Properties();

> InputStream inStream =

> this.getClass().getResourceAsStream("MY_PROP.propertie

> s");

> try

> {

> properties .load(inStream);

> }

> catch (Exception e)

> {

> // Error handling code

So is there a central location on the file system where the properties files can be placed? For example in some lib folder?

The same question for custom jar files - is there a central location where we can put the jar file, instead of attaching a jar file to each namespace, which is messy and difficult to maintain.

Thanks.

Ron

Former Member
0 Kudos

>>The same question for custom jar files - is there a central location where we >>can put the jar file, instead of attaching a jar file to each namespace, which is >>messy and difficult to maintain.

hmm...a question raised so far many times and no satisfactory answer even as of now...at least I have not seen...only possible way being add your jar file to each and every namespace under imported archives

bhavesh_kantilal
Active Contributor
0 Kudos

There is no standard location.

Butr one option is to bundle the file with your Jar and use the getResource() to read the file as pointed by Amol.

To make sure that the jar is accessible in all SWCV's create a Generic SWCV and make sure that all other SWCV's have a usage dependency on the generic SWCV.

The best way though would be to use value Mapping maintained in the Integration Directory.

Regards

Bhavesh

Former Member
0 Kudos

All - I am using value mapping now. Thanks for your response !!

Also given points to all

Maddux