jade.core
Class ServiceManagerImpl

java.lang.Object
  extended by jade.core.ServiceManagerImpl
All Implemented Interfaces:
ServiceFinder, ServiceManager

public class ServiceManagerImpl
extends java.lang.Object
implements ServiceManager, ServiceFinder

The ServiceManagerImpl class is the actual implementation of JADE platform Service Manager and Service Finder components. It holds a set of services and manages them.

Author:
Giovanni Rimassa - FRAMeTech s.r.l., Giovanni Caire - TILAB

Field Summary
 
Fields inherited from interface jade.core.ServiceFinder
MAIN_SLICE, THIS_SLICE
 
Method Summary
 void activateService(ServiceDescriptor desc)
          Activates a new service on the local agent container.
 void addAddress(java.lang.String addr)
          Adds an address to the address list of this Service Manager.
 void addNode(NodeDescriptor desc, ServiceDescriptor[] services)
          Adds a new node to the distributed platform.
 void deactivateService(java.lang.String name)
          Deactivates a service on the local container.
 Service.Slice[] findAllSlices(java.lang.String serviceKey)
          Retrieves all the slices of a service currently active on this platform.
 Service findService(java.lang.String key)
          Looks up a platform service by name.
 Service.Slice findSlice(java.lang.String serviceKey, java.lang.String sliceKey)
          Looks up a specific service slice by name.
 java.lang.String getLocalAddress()
          Access the address exported by this copy of the Service Manager.
 java.util.Vector getLocalServices()
          Retrieve the list of locally installed services as a Vector of ServiceDescriptor objects
 java.lang.String getPlatformName()
          Retrieves the platform name from the platform Service Manager.
 void removeAddress(java.lang.String addr)
          Removes an address to the address list of this Service Manager.
 void removeNode(NodeDescriptor desc)
          Removes a node from the distributed platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPlatformName

public java.lang.String getPlatformName()
                                 throws IMTPException
Description copied from interface: ServiceManager
Retrieves the platform name from the platform Service Manager.

Specified by:
getPlatformName in interface ServiceManager
Returns:
The name of the platform, that can be used to compose the GUID of the resident agents.
Throws:
IMTPException - If an underlying network error forbids to fetch the name from the remote end.

addAddress

public void addAddress(java.lang.String addr)
                throws IMTPException
Description copied from interface: ServiceManager
Adds an address to the address list of this Service Manager.

Specified by:
addAddress in interface ServiceManager
Parameters:
addr - The address to add, as a stringified URL.
Throws:
IMTPException - If an underlying network error occurs.

removeAddress

public void removeAddress(java.lang.String addr)
                   throws IMTPException
Description copied from interface: ServiceManager
Removes an address to the address list of this Service Manager.

Specified by:
removeAddress in interface ServiceManager
Parameters:
addr - The address to remove, as a stringified URL.
Throws:
IMTPException - If an underlying network error occurs.

getLocalAddress

public java.lang.String getLocalAddress()
                                 throws IMTPException
Description copied from interface: ServiceManager
Access the address exported by this copy of the Service Manager.

Specified by:
getLocalAddress in interface ServiceManager
Returns:
The locally exported address.
Throws:
IMTPException - If an underlying network error occurs.

addNode

public void addNode(NodeDescriptor desc,
                    ServiceDescriptor[] services)
             throws IMTPException,
                    ServiceException,
                    jade.security.JADESecurityException
Description copied from interface: ServiceManager
Adds a new node to the distributed platform. The node abstraction can correspond to an agent container, but also to a different kind of networked component (command proxy server, persistent repository, etc.) of the JADE platform.

Specified by:
addNode in interface ServiceManager
Parameters:
desc - The description of the new node to add, containing the node identifier and other node properties.
services - An array of ServiceDescriptor objects, describing the various kernel-level services that are to be activated on the newly created node.
Throws:
IMTPException - If an underlying network error forbids to tell whether the requested operation was possible. In that case, the operation is not executed.
ServiceException - If the requested operation couldn't be executed (or an execution attempt failed) due to some condition on the remote end.
jade.security.JADESecurityException

removeNode

public void removeNode(NodeDescriptor desc)
                throws IMTPException,
                       ServiceException
Description copied from interface: ServiceManager
Removes a node from the distributed platform. The node abstraction can correspond to an agent container, but also to a different kind of networked component (command proxy server, persistent repository, etc.) of the JADE platform.

Specified by:
removeNode in interface ServiceManager
Parameters:
desc - The description of the node to remove. At the very least, the description must contain a node identifier used as a key in node findng operations.
Throws:
IMTPException - If an underlying network error forbids to tell whether the requested operation was possible. In that case, the operation is not executed.
ServiceException - If the requested operation couldn't be executed (or an execution attempt failed) due to some condition on the remote end.

activateService

public void activateService(ServiceDescriptor desc)
                     throws IMTPException,
                            ServiceException
Description copied from interface: ServiceManager
Activates a new service on the local agent container. Depending on whether the service is already active on other containers, the result can be the actual federation of this container and other containers service slices.

Specified by:
activateService in interface ServiceManager
Parameters:
desc - The ServiceDescriptor object specifying the Service object implementing the service, along with the name and properties of the service.
Throws:
IMTPException - If an underlying network error forbids to tell whether the requested operation was possible. In that case, the operation is not executed.
ServiceException - If the requested operation couldn't be executed (or an execution attempt failed) due to some condition on the remote end.
See Also:
ServiceFinder

deactivateService

public void deactivateService(java.lang.String name)
                       throws IMTPException,
                              ServiceException
Description copied from interface: ServiceManager
Deactivates a service on the local container. Depending on whether the service is enabled also on other containers, this method can cause the complete service deactivation on the platform or just the detchmnent of the service slice corresponding to this container.

Specified by:
deactivateService in interface ServiceManager
Parameters:
name - The name of the service to be deactivated.
Throws:
IMTPException - If an underlying network error forbids to tell whether the requested operation was possible. In that case, the operation is not executed.
ServiceException - If the requested operation couldn't be executed (or an execution attempt failed) due to some condition on the remote end.
See Also:
ServiceFinder

findService

public Service findService(java.lang.String key)
                    throws IMTPException,
                           ServiceException
Description copied from interface: ServiceFinder
Looks up a platform service by name.

Specified by:
findService in interface ServiceFinder
Parameters:
key - The name of the service. Concrete syntax for service names is left up to concrete services.
Throws:
IMTPException
ServiceException

findSlice

public Service.Slice findSlice(java.lang.String serviceKey,
                               java.lang.String sliceKey)
                        throws IMTPException,
                               ServiceException
Description copied from interface: ServiceFinder
Looks up a specific service slice by name.

Specified by:
findSlice in interface ServiceFinder
Throws:
IMTPException
ServiceException

findAllSlices

public Service.Slice[] findAllSlices(java.lang.String serviceKey)
                              throws IMTPException,
                                     ServiceException
Description copied from interface: ServiceFinder
Retrieves all the slices of a service currently active on this platform.

Specified by:
findAllSlices in interface ServiceFinder
Parameters:
serviceKey - The name of the service. Concrete syntax for service names is left up to concrete services.
Returns:
An array of Service.Slice objects, containing all the slices of the requested service.
Throws:
IMTPException
ServiceException

getLocalServices

public java.util.Vector getLocalServices()
Description copied from interface: ServiceManager
Retrieve the list of locally installed services as a Vector of ServiceDescriptor objects

Specified by:
getLocalServices in interface ServiceManager
Returns:
the list of locally installed services as a Vector of ServiceDescriptor objects