osl.service.Service and Service
Invocation: There are two big changes for foundry services.
The first is that osl.service.Service is now an abstract
class rather than an interface. This had to be done so that we could
support the second change, which is an alteration of how services are
invoked. The service invocation interface has been changed so that it
is easier for services to offer a variety of different functions. In
the old version, there was only the serviceInvoke method with
the prototype:
public Object serviceInokve(Object arg) throws ServiceException
While this works fine for simple services, anything which takes more
than a single argument is kind of a pain to handle. The programmer is
also forced to demultiplex arguments in cases where a service may
export several different functions. The new service invocation
interface is very similar to the new version of actor extensions
described above. The new prototype in Service is:
public Object serviceInvoke(String method, Object[] args) throws ServiceException
where method names a method to invoke in the service, and
args is an array of arguments to pass to the method. As with
actor extensions, service implementations must "register" their
service methods in order to export their behavior. Registration is
done by calling Service.serviceRegisterMethod. For example,
the YP service registers two methods as follows:
serviceRegisterMethod("ypLookupRemoteManager");
serviceRegisterMethod("ypMapActorToManager");
The user-accessible version of invokeService now has a
structure similar to extension. The canonical prototype is:
Object invokeService(ServiceName, Method, [ Arg1, ..., ArgN])
throws ServiceNotFoundException, ServiceException
where N goes as high as twenty. The method
Service.serviceInvoke is hardcoded to use the reflection
packages to automatically look up and invoke the appropriate
registered method in the service. Any result is returned back to the
caller as usual, with ServiceException wrapping any errors.
See osl.exmaples.remoteping.PingBoot for an example of the
new syntax in action. Unfortunately, service invocations may be
called from several areas within the foundry, so this change had to be
propagated to ActorManager, ActorImpl and
Actor. In short, some of your stuff may brake now (needless
to say, you'll definitely have to rewrite any services you may have
implemented).