Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Update 2:

After meditating some more, I see you just need to conditionally include a JSP into another JSP. This is not "pluggable UI components" or anything like that, it's just conditional inclusion. There are no frameworks for that since it's just about 4-6 lines of code. It seems like you think it's more complex than it actually is.

I think this will do:

  • have a property in a file (or in DB) which tells which plugin should be used
  • assign a value of this property to a variable, say String plugin = ...
  • pass it to your JSP: request.setAttribute("plugin", plugin); or something similar
  • use it like <jsp:include page="${plugin}" flush="true" />

Could be wrong in syntax, but the point should be clear. Hope it helps.

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Update 2:

After meditating some more, I see you just need to conditionally include a JSP into another JSP. This is not "pluggable UI components" or anything like that, it's just conditional inclusion. There are no frameworks for that since it's just about 4-6 lines of code. It seems like you think it's more complex than it actually is.

I think this will do:

  • have a property in a file (or in DB) which tells which plugin should be used
  • assign a value of this property to a variable, say String plugin = ...
  • pass it to your JSP: request.setAttribute("plugin", plugin); or something similar
  • use it like <jsp:include page="${plugin}" flush="true" />

Could be wrong in syntax, but the point should be clear. Hope it helps.

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Update 2:

After meditating some more, I see you just need to conditionally include a JSP into another JSP. This is not "pluggable UI components" or anything like that, it's just conditional inclusion. There are no frameworks for that since it's just about 4-6 lines of code. It seems like you think it's more complex than it actually is.

I think this will do:

  • have a property in a file (or in DB) which tells which plugin should be used
  • assign a value of this property to a variable, say String plugin = ...
  • pass it to your JSP: request.setAttribute("plugin", plugin); or something similar
  • use it like <jsp:include page="${plugin}" flush="true" />

Could be wrong in syntax, but the point should be clear. Hope it helps.

Bounty Awarded with 100 reputation awarded by CommunityBot
added 756 characters in body
Source Link
scriptin
  • 4.4k
  • 23
  • 32

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Update 2:

After meditating some more, I see you just need to conditionally include a JSP into another JSP. This is not "pluggable UI components" or anything like that, it's just conditional inclusion. There are no frameworks for that since it's just about 4-6 lines of code. It seems like you think it's more complex than it actually is.

I think this will do:

  • have a property in a file (or in DB) which tells which plugin should be used
  • assign a value of this property to a variable, say String plugin = ...
  • pass it to your JSP: request.setAttribute("plugin", plugin); or something similar
  • use it like <jsp:include page="${plugin}" flush="true" />

Could be wrong in syntax, but the point should be clear. Hope it helps.

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Update 2:

After meditating some more, I see you just need to conditionally include a JSP into another JSP. This is not "pluggable UI components" or anything like that, it's just conditional inclusion. There are no frameworks for that since it's just about 4-6 lines of code. It seems like you think it's more complex than it actually is.

I think this will do:

  • have a property in a file (or in DB) which tells which plugin should be used
  • assign a value of this property to a variable, say String plugin = ...
  • pass it to your JSP: request.setAttribute("plugin", plugin); or something similar
  • use it like <jsp:include page="${plugin}" flush="true" />

Could be wrong in syntax, but the point should be clear. Hope it helps.

added 354 characters in body
Source Link
scriptin
  • 4.4k
  • 23
  • 32

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:

if my above observation is correct

It depends. You may as well include everything in distribution and only configure each installation to use what it needs. Possible reasons for going with plugins are:

  1. You charge your plugins separately and don't want to give away features for free
  2. Your plugins are "heavy" in some way, e.g. there are lots of them or they have a significant size.

If those reasons do not apply to your case, you may think of a simpler solution.


how to have above kind of plugin structure with Java/Java EE?

If you're OK with rolling your own simplest solution, here is the general scheme:

  1. In app's configuration (which can be *.properties file or a record in DB, whichever works better for your users, because they should be able to change it), add a property which contains a path to plugins directory
  2. Define and expose plugin API - a set of interfaces which a plugin must implement to allow application to invoke this plugin
  3. Write custom ClassLoader which uses the property from #1 and maybe checks if each plugin properly implements your API
  4. Load your plugins' classes and resources using this class loader
  5. Invoke plugins' functions via interfaces of plugin API or, if plugin consists of resources only, include those as needed

are there any frameworks in Java that supports above kind of thing?

Yes. Googling for "java plugin framework" reveals some.


Other questions on the topic:


Update:

To load JSP files (or any files), use classloader as described above: see getResource and getResourceAsStream methods.

Source Link
scriptin
  • 4.4k
  • 23
  • 32
Loading