0
votes

We are trying to get All the properties inside the Worklight server using Java code running on the server.

Worklight Version 6.2.0.1

Based on the following URL:

https://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSZH4A_6.2.0/com.ibm.worklight.apiref.doc/html/refjava-worklight-server/html/com/worklight/server/bundle/api/WorklightConfiguration.html

I'm trying to use getAllProperties() API. However, I'm not getting it inside the code:

I imported java.util.Properties;

try{
     Properties p = new Properties();
     p.getAllProperties(); // This doesn't exist
     .
     .
}

enter image description here

Am I doing it wrong or missing something.? How can I read all the properties inside Worklight based on IBM URL mentioned above?

1
What you do mean "inside Worklight"? Which properties are you looking for? - Idan Adar
I meant the Worklight Application runtime which has worklight.properties and I'm looking for "ssl.keystore.path" and "ssl.keystore.password". I can access them from WebSphere > Application > WebSphere enterprise applications > myApp_runtime > Environment entries for web modules. But I need to get their values from Java. Based on the URL, it looks I can use getAllProperties (Definition : public java.util.Properties getAllProperties()Get all Worklight properties including system properties and Worklight configuration) - Sami
the link you provide talk about the WorklightConfiguration class. So you have a method getAllProperties on a WorklightConfiguration object. In your description you try to use it on a Properties object - vincent

1 Answers

2
votes

If I got your problem correctly, the class WorklightConfiguration provides a method called getAllProperties() wich returns an instance of Properties. You haven't provided any code in your question, but a this code example might help you (disclaimer: I have never used Worklight before, so this might need some adjustments, but you'll get the idea):

WorklightConfiguration config = WorklightConfiguration.getInstance ();
Properties properties = config.getAllProperties ();

for (String propertyName: properties.propertyNames ()) {
    String property = properties.getProperty (propertyName);
    // rest of implementation...
}