• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamically discovering and/or loading plugins at run time

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

is there an easy/documented way to dynamically discover and load Groovy/Grails plugins at application run time similar to OSGi?

I know about using and developing plugins during application development, but I would like to add ability to my application to dynamically load plugins while my application starts.
I do not really care about other OSGi like dynamic plugin loading/unloading of a plugin (bundle) during the lifetime of the application, discovery and loading at application start time
would be sufficient.

Thanks, Lubos Pochman
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is this [older] JPF (java plugin framework) project here http://jpf.sourceforge.net/

They define simple interfaces and sample implementations for loading plugins on startup.

Or, if you wanted to do a full custom thing, invent a convention like a plugins/ folder and any .jar file found in that folder is a plugin that is to be loaded on application startup.

You could use the MANIFEST.MF file inside the jar file, or invent your own descriptor, to contain the meta information, such as plugin name, description, version, depends on ohter plugins, so your boot strap method to discover plugins on application startup could use this to try to load them in an order that makes sense, if there are dependencies between plugins.

as far as finding the code from the pluginzs, its likely not to hard to use a URLClassLoader, that works to target classes contained inside the plugin jar files.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic