design patterns - How to make a Java project 'extendable' by developers? -


i'm working on server engine, , not sure in form distribute it. quite modular , uses interfaces/abstract classes.

should be:

  • a library (no entry-point, write own main() , call new server().setsomehandler(myhandler).run())

  • a binary (executable entrypoint config file can inject jar handlers)

  • something else?

basically, developer should able extend or change way server works. don't idea of making library because should platform itself, whole server system.

providing programmatic way more versatile executable. , both ways aren't mutually exclusive. after all, if developer provides handler, internally still need call setter in example use handler. exposing api shouldn't difficult. still provide small launcher application loads config file , wraps in api calls, if needed.

the more important question be, there predefined extension points developers can plug in own implementations or modular , exchangeable?

for simple way provide implementations of predefined interfaces, can use serviceloader/spi mechanism. can built basic plug-in system it.

if want create platform, osgi seems more appropriate. here define apis/spis fine grained components/services. developers provide own modules extend server or replace default modules.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -