xoops forums

redheadedrod

Home away from home
Posted on: 2014/5/21 20:05
redheadedrod
redheadedrod (Show more)
Home away from home
Posts: 1296
Since: 2008/2/26
#1

Xoops 2.6 Service Manager

Thought I would start a thread to discuss this news announcement:

https://xoops.org/modules/news/article.php?storyid=6631

For module programmers this is a great new feature.

For those that do not understand the importance of this feature this new Service Manager allows a module to provide a service that can be used anywhere in the system.

This feature makes the idea I have made known more than once about module Libraries pretty much a moot point.

As an example, XoopsPoll can be rewritten to serve a poll service that needs very little code to access. This then allows you to EASILY include poll's into a new forum, event module or anything you want to add it to. This also then allows one to easily upgrade the original poll module while leaving the service mostly untouched and be used by the secondary modules without having to update them. You could also then replace the xoopspoll module as long as the new module completes the original poll modules contract. It can include MORE items but it has to fulfill the original contract. If you have a new module that will perform all of the functions of the original and new ones then it makes sense to provide not only the original contract but a secondary one as well. Because a contract is an interface it is very easy to add.

In practical use we can use the example of how CBB adds polling support. Currently the code base duplicates large portions of xoops poll to allow the support but if the code in CBB doesn't match the code with Xoopspoll then CBB will be very buggy to provide the polls. If xoopspoll was a service provider then CBB can be rewritten to use this service and have no actual xoopspoll code within the module. This then makes it much easier to upgrade xoopspoll in the future or outright replace it with a similar module.

(Note, if I have time this summer I will try to move Xoopspoll to a service providing system but with other cool stuff I hope to get involved in I may not have the time.)

Attending College working towards Bachelors in Software Engineering and Network Security.

redheadedrod

Home away from home
Posted on: 2014/5/21 20:39
redheadedrod
redheadedrod (Show more)
Home away from home
Posts: 1296
Since: 2008/2/26
#2

Re: Xoops 2.6 Service Manager

Another great example of the power of this new system is a project I have been working on. I am finishing up another project that was started during the school year and then I will be getting back to this but I have been moving the phpmailer to a service manager module.

Once completed you will access the service manager to setup an email to send out. This new mailer module will support all conventional email components including attachments with very simple calls to the service manager.

The importance of this project will become obvious once I am complete with this mailer because I will be building a new service using Swift mailer to do the same thing. The idea here is that you can use whatever mailer you feel comfortable with and the settings will be done in the related provider module instead of the system preferences.

So if someone has a cloud based mailer or anything else it should be simple to make a provider that can just be plugged in and turned on. No additional work would need to be done in a module to use this or any other mail provider.

At the moment I am close to being able to provide the module for initial testing and when finished I will post instructions here how to try it out.

Note that Avatar and Gravatar are already setup to use this system.

Rodney
Attending College working towards Bachelors in Software Engineering and Network Security.

alain01

Quite a regular
Posted on: 2014/5/22 10:01
alain01
alain01 (Show more)
Quite a regular
Posts: 294
Since: 2003/6/20
#3

Re: Xoops 2.6 Service Manager

Quote:

redheadedrod wrote:
For those that do not understand the importance of this feature this new Service Manager allows a module to provide a service that can be used anywhere in the system.
...

As an example, XoopsPoll can be rewritten to serve a poll service that needs very little code to access. This then allows you to EASILY include poll's into a new forum, event module or anything you want to add it to.


Thanks, redheadedrod for this explanation.