Jump to content

Accessing Module properties in Java Global Instance in BW 6.4 or BWCE


Darshan Nachankar

Recommended Posts

Has anyone tried to pass the parameters to the java global instance(java method which is called by java global instance) through module properties in tibco bw 6.4 or tibco bwce In documentation it is mentioned that:

1) In the TIBCO BusinessWorks Container Edition module, specify a dependency on the package "com.tibco.bw.palette.shared.java" usingImport-Package.

Double-clickDependencieslocated underBusinessWorks Container Edition Module>Module Descriptors. This opensBW Manifest Editor.

In theImported Packagessection, click theAddtab to add the dependency on thecom.tibco.bw.palette.shared.javapackage.

2)Add the@ModulePropertiesannotation to the method that accepts only one parameter of typejava.lang.HashMap.

Through this HashMap you can access the name or value pair of BusinessWorks Container Edition module properties.

It doesnt seems to be clear from the documentation. Any help or sample code as an example provided will be appreciated. Thanks in advance

Link to comment
Share on other sites

  • 1 month later...

I had the same issue and this is what I used to get it working.

First I followed the steps fromt he documentation:

https://docs.tibco.com/pub/activematrix_businessworks/6.4.2/doc/html/GUI...

Specifically adding the package to the import.

Then I added the following method to my class.

 

@ModuleProperties

public void loadProperties(HashMap moduleProperties){

System.out.println("Started loading module properties.");

this.myClassProperty = moduleProperties.get("/path/to/bw6/CaseSensitive/moduleProperty");

System.out.println("Completed loading module properties.");

}

What it does is load the module properties into the class. I use them to transfer the module properties to class properties. This method is called by the BW engine when it instantiates the Global Instance (twice, it seems, for some reason. I added to System.out calls to see if the method gets called).

While this works as intended I do find it strange that TIBCO didn't provide the option to select module properties as the input for parameters in the Java Global Resource editor. Perhaps something to post on ideas...

Link to comment
Share on other sites

  • 2 weeks later...

If we set the myClassProperty to static in the below code snippet then it will be accessible across the instances,regardless how many objects are created.

 

@ModuleProperties public void loadProperties(HashMap moduleProperties){ System.out.println("Started loading module properties."); this.myClassProperty = moduleProperties.get("/path/to/bw6/CaseSensitive/moduleProperty"); System.out.println("Completed loading module properties."); }

Link to comment
Share on other sites

  • 1 year later...

Do you have an working example to the path to the module properties

 

(this.myClassProperty = moduleProperties.get("/path/to/bw6/CaseSensitive/moduleProperty");

 

below is my code that not working

 

argUserName = moduleProperties.get("/Ent-Integration/iSeriesConnectionFactory/userid");

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...