Hi. I implement a plugin for language analysis. It uses an Apache UIMA annotation framework, and for reasons I have not yet figured out why, that framework loads some .jar files dynamically. That is, the plugin packages a set of .PEAR files (think of them as ZIP), each file for a specific language, and at runtime (once) the relevant file gets expanded and the framework loads (via UIMAClassLoader
) the set of .jars that are in the package.
No matter what permissions I set in my plugin-security.policy
, they are not applied to the dynamically loaded jars. I've debug-traced a test and I see that ESPolicy
(I run w/ 5.5.1, but also tested on 5.6.4) contains this code:
// check for an additional plugin permission: plugin policy is
// only consulted for its codesources.
Policy plugin = plugins.get(location.getFile());
if (plugin != null && plugin.implies(domain, permission)) {
return true;
}
I believe that's the core issue I'm getting. ESPolicy
applies the permissions I set in my plugin-security.policy
file to my plugin's files (those in .zip?) and its dependencies. However, since those language-dynamic .jar files do not exist on the classpath at all (as far as ES concerns, UIMAClassLoader
knows where to look for them), the permissions are not applied to them.
I am not sure what should I do next? I've tried expanding one of the .PEAR files directly under src/main/resources
, but still, since my pom.xml
does not reference them, they are not considered plugin files.
I also thought about registering my own SecurityManager
, wrapping ES's (I know it's not a good idea!), but the test fails w/ failing to create a security manager, even though I put permission java.lang.RuntimePermission "createSecurityManager";
in my plugin security file.
Has anyone created a plugin like that, which loads .jar files dynamically? Is it supported by Elasticsearch at all?