-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add plugin architecture #561
Comments
It wil be great if plugins can be included by direct github url, for example: plugins = [ https://github.com/caiiiycuk/xitrum-memcached ] Or if we need concrete version: plugins = [ https://github.com/caiiiycuk/xitrum-memcached#v1.0 ] |
Recently i wanted to write plugins for database and for dependency injection. Both plugins need to inject something in Action object. I understand that for implementing this plugins in nice way, xitrum should provide some api to listen/control life cycle of Action. For example DI plugin (based on google guice): Client code: class MyAction extends Action {
@Inject
private var connection: Connection;
@Inject
private var resource: Resource;
...
} Plugin implementation: ...
def decorateAction(action: Action): Action = {
injector.inject(action)
action
}
...
|
I think it's better to let SBT manage the plugins. You can tell SBT to load a project from GitHub:
So now we have some hook points in our plan: Action:
Server:
If you have ideas about more hook points, please share. |
About config: I think conceptually, config files in the config directory (xitrum.conf, for example) should only expose things that should be tuned manually when deploying to an environment (production server, for example). In this direction, I think:
|
What plugins to create: For now, we plan to move these from Xitrum core to outside plugins (please comment if I miss something):
|
BTW, In PlayFramework, we can use plugin(module) like this. In plugins.sbt
In build.sbt
In application code
|
Also needed plugins that controls session. For example session store in memcached, database, etc. |
+1, we use AngularJS. So, jquery is redundant for us. |
The purpose is to be able to move Swagger etc. out of Xitrum core, to xitrum-swagger plugin etc. This way we can develop/upgrade plugins independently from Xitrum core.
We need to design an entry point to let plugins initialize themselves during Xitrum startup. We may require that a plugin provides an empty constructor. During startup, Xitrum will create an instance of the specified plugin class.
Plugins are included via build.sbt and their classes are specified in config/xitrum.conf file like this:
We need to design when to load plugins, so that plugin creators know when their plugins will be loaded, so that they can design their plugins properly.
The text was updated successfully, but these errors were encountered: