Romain Manni-Bucau created TOMEE-420:
----------------------------------------

             Summary: install a ClassLoaderEnricher
                 Key: TOMEE-420
                 URL: https://issues.apache.org/jira/browse/TOMEE-420
             Project: TomEE
          Issue Type: New Feature
            Reporter: Romain Manni-Bucau
             Fix For: 1.1.0


ClassLoaderEnricher component (manage a list of url to add to app classloaders)

Common usage: 
SystemInstance.get().getComponent(ClassLoaderEnricher.class).addUrl(url);

Designed to be used with Services:

public void initEnricher(@Observes final ObserverAdded event) {
        File dir = new File(path);
        if (dir.exists()) {
            final File[] libs = dir.listFiles();
            if (libs != null) {
                final ClassLoaderEnricher enricher = 
SystemInstance.get().getComponent(ClassLoaderEnricher.class);
                for (File lib : libs) {
                    try {
                        enricher.addUrl(lib.toURI().toURL());
                    } catch (MalformedURLException e) {
                        throw new OpenEJBRuntimeException(e);
                    }
                }
            }
        }
    }

This one is provided by default for instance:

enricher = 
new://Service?class-name=org.apache.openejb.assembler.classic.AdditionalLibClassLoaderEnricherObserver
enricher.path = /my/additional-lib/

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to