Home Products Services Company Developer Connection
Applied Informatics

Developer Connection

Archive for April, 2009

POCO Platform 2009.1 Preview Part 2: Open Service Platform and Remoting

With the POCO C++ Libraries Release 1.3.4 finally out, it’s only a few more days until the release of the POCO Platform 2009.1 release. 2009.1 will include improvements to Remoting and the Open Service Platform. Especially the integration between Remoting and OSP has been greatly improved.

It is now possible to generate Remoting services that can be registered as OSP services. How is this done? The Remoting code generator has a new option for creating OSP-based services. When this option is enabled, the base class of the interface class is no longer Poco::RefCountedObject, but Poco::OSP::Service. This means that generated Proxy and RemoteObject classes can be registered as OSP services with the OSP ServiceRegistry.

To enable this option, the code generator can either be invoked with the –osp option, or an additional setting can be added to the code generator configuration file:

<osp>
 <enable>true<enable>
<osp>

The code generator can now also automatically generate the code for a BundleActivator, both for client and servers.

With this new feature, it is now possible to have location-transparent OSP services. On a server, simply deploy the server bundle. On a client, deploy the client bundle. Or deploy both the server and the client bundle to a single OSP application.

The Open Service Platform has another nice addition in 2009.1 — the OSP Shell. This is a new OSP service that implements command-line administration features for OSP. The service is accompanied by a small command line utility that reads commands from the user, sends them to the service, and displays the output from the command back to the user.

The OSP Shell basically has the same features as the existing Web-based Bundle Admin utility. It is possible to list the currently available bundles, control the lifecycle of bundles, install new bundles, etc. But probably the best features about the Shell service is that it is extensible. It is very easy to add custom commands to an application.

To add a custom command to the Shell, one only needs to create a subclass of Poco::OSP::Shell::Command, and register this new command using a special extension point.

For example, a simple Echo command implementation looks like this:

class EchoCommand: public Poco::OSP::Shell::Command
{
public:
    int execute(Poco::OSP::Shell::Session& session,
                const std::vector& args,
                std::ostream& ostr)
    {
        for (int i = 1; i < args.size(); ++i)
        {
            if (i > 1) ostr << ' ';
            ostr << args[i];
        }
        ostr << std::endl;

        return Command::STATUS_OK;
    }
};

POCO C++ Libraries 1.3.4 Released

Release 1.3.4 of the POCO C++ Libraries, the Open Source foundation of the POCO Platform, has been released today. Apart from the usual bugfixes, this release contains significant performance improvements as well as some nice new features, such as a writable XMLConfiguration, a refactored NetSSL_OpenSSL library, support for case-insensitive globs, a new Poco::Util::Timer class, new PriorityNotificationQueue and TimedNotificationQueue classes in Foundation, and much more. See the CHANGELOG for a complete list of changes.