I need to refactor an existing jar to work under weblogic 11c and 12c. The code requires full details of the java role to LDAP group mapping, as found in an ears META-INF/weblogic-application.xm. I seek a good mechanism to retrieve this information.
Some specifics:
- The jar is not an EJB jar, and as the interface can't change, and I have no control over how it will be used in applications (it is a adrop-in replacement for an other library).
- This means I can't inject the EJB context.
- This also means I have no connection to the JMX mbean tree available (which would need configuration info)
- I want something that works for multiple applications, all deployed as ears.
- I want something that survives fastswap and exploded directory layout
- I want something as future proof as possible
- It needs to work both when called from WAR files as from EJB jar files
- It needs to run under WebLogic 11c,12c, and be as future proof as reasonably possible
For now, i use this strategy:
- Use getClass().getResource(myself) to retrieve an URL to my code
- Drop the jar: prefix and associated ! markers
- Scan upwards trough the directory tree, until we find a folder containing META-INF/weblogic-application.xml
- If found -> read and parse./ Otherwise -> complain and crash
This seems to work, but I hope to discover a less hackish approach, either by accessing the xml file, or by querying the managed server which executes the jar (but without means to configure connection parameters)