wyona / yanel

http://www.yanel.org
Apache License 2.0
10 stars 5 forks source link

Resource.getProperties() #3

Open baszero opened 13 years ago

baszero commented 13 years ago

Hi, is there a possibility to retrieve all config parameters of a certain resource?

e.g. resource.getProperties() ?

If not, I'll send a pull request.

baszero commented 13 years ago

Currently I'm doing it this way, but I think this should be provided via a method of the Resource class:

MyResource resource = (MyResource)Yanel.getInstance().getResourceManager().getResource(getEnvironment(), getRealm(), "...a resource path...");
Node node = resource.getConfiguration().getNode();
Document nodedoc = MyXMLHelper.convertNode(node); // any method that converts the node into a document
NodeList nodelist = nodedoc.getElementsByTagNameNS("http://www.wyona.org/yanel/rti/1.0", "property");
for (int index = 0; index < nodelist.getLength(); index++) {
    String name = ((Element)nodelist.item(index)).getAttribute("name");
    String value = ((Element)nodelist.item(index)).getAttribute("value");
    // do something
}