Comments (4)
And Vincent's proposed solution:
I created a class named ClassPathManagerUtils (attached file) in the same
package as ClassPathManager (to access its classWorld variable, which has
default scope).
Not directly related, but somewhat useful... I created a custom ClassLoader
(PluginAwareClassLoader, attached file) that asks all the plugin ClassLoaders
for a class/resource instead of throwing a ClassNotFoundException right away. I
came up with this solution when faced with the following problem :
http://blogs.sun.com/adventures/entry/desrializing_objects_custom_class_loaders
Here is a code excerpt of my plugin initialization :
{{{
private static void initPluginManager() {
if (pm == null) {
pm = PluginManagerFactory.createPluginManager();
File pluginsDir = getPluginsDir();
File[] pluginDirs = pluginsDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY);
for (File pluginDir : pluginDirs) {
// Plugin root dir jars
Collection<File> pluginJarFiles = FileUtils.listFiles(pluginDir, new String[] { "jar" },
false);
// Accept only one root dir jar
File pluginJarFile = pluginJarFiles.isEmpty() ? null : pluginJarFiles.iterator().next();
if (pluginJarFile != null) {
URI pluginJarFileURI = pluginJarFile.toURI();
pm.addPluginsFrom(pluginJarFileURI);
File pluginLibDir = new File(pluginDir, "lib");
if (pluginLibDir.exists() && pluginLibDir.isDirectory()) {
PluginManagerImpl pmImpl = (PluginManagerImpl) pm;
<File> pluginDependencies = FileUtils.listFiles(pluginLibDir, new String[] { "jar" }, false);
ClassPathManagerUtils.addJarDependencies(pmImpl.getClassPathManager(), pluginJarFile, pluginDependencies);
}
}
}
}
}
}}}
Original comment by r.biedert
on 13 Sep 2010 at 8:36
from jspf.
Ralf,
Can you please publish proposed class (ClassPathManagerUtils)?
Original comment by [email protected]
on 22 Sep 2010 at 8:54
from jspf.
Attached files. Give me some time to re-consider this report, it is related to
Issue #19.
Original comment by r.biedert
on 23 Sep 2010 at 8:59
Attachments:
from jspf.
Hopefully fixed (please get 0.9.1a from the downloads and test!). Also see
http://code.google.com/p/jspf/wiki/FAQ -> Multiplugins.
Original comment by r.biedert
on 23 Sep 2010 at 3:42
- Changed state: Fixed
from jspf.
Related Issues (20)
- Maven repository is not available HOT 8
- @PluginImplementation seems not to work on inner classes HOT 1
- JSPF should allow to inject wrappers HOT 2
- When adding plugins with classpath://* not the complete classpath is being considered. HOT 1
- JSPF should be able to load nested plugins (archives, ...) HOT 1
- ANT task to include source files for GWT HOT 1
- Is there a way JSPF can be used for GWT based projects ? HOT 1
- JSPF should inspect classpath hierarchy more intensively ...
- return Collection of added plugins from PluginManager.addPluginsFrom (instead of void) HOT 1
- Project name clash (jSPF project already exists since 2006) HOT 2
- @PluginImplementation seems not to work on inner classes on Android HOT 3
- Pseudorandom noclassdeffounderror
- CoolPluginImpl.sayHello() NullPointerException in Android project
- Upload jspf to Maven Central
- Maven support
- java.lang.VerifyError: Cannot inherit from final class
- addPluginsFrom functionality
- Git repository wrong? HOT 1
- No class def found error when load multi-depended-plugins in JARs
- Not possible to load plugin remotely through a proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jspf.