Package jade.core
Class ServiceManagerImpl
- java.lang.Object
-
- jade.core.ServiceManagerImpl
-
- All Implemented Interfaces:
ServiceFinder,ServiceManager
public class ServiceManagerImpl extends Object implements ServiceManager, ServiceFinder
TheServiceManagerImplclass 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateService(ServiceDescriptor desc)Activates a new service on the local agent container.voidaddAddress(String addr)Adds an address to the address list of this Service Manager.voidaddNode(NodeDescriptor desc, ServiceDescriptor[] services)Adds a new node to the distributed platform.voiddeactivateService(String name)Deactivates a service on the local container.Service.Slice[]findAllSlices(String serviceKey)Retrieves all the slices of a service currently active on this platform.ServicefindService(String key)Looks up a platform service by name.Service.SlicefindSlice(String serviceKey, String sliceKey)Looks up a specific service slice by name.StringgetLocalAddress()Access the address exported by this copy of the Service Manager.VectorgetLocalServices()Retrieve the list of locally installed services as a Vector of ServiceDescriptor objectsStringgetPlatformName()Retrieves the platform name from the platform Service Manager.voidremoveAddress(String addr)Removes an address to the address list of this Service Manager.voidremoveNode(NodeDescriptor desc)Removes a node from the distributed platform.
-
-
-
Method Detail
-
getPlatformName
public String getPlatformName() throws IMTPException
Description copied from interface:ServiceManagerRetrieves the platform name from the platform Service Manager.- Specified by:
getPlatformNamein interfaceServiceManager- 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(String addr) throws IMTPException
Description copied from interface:ServiceManagerAdds an address to the address list of this Service Manager.- Specified by:
addAddressin interfaceServiceManager- Parameters:
addr- The address to add, as a stringified URL.- Throws:
IMTPException- If an underlying network error occurs.
-
removeAddress
public void removeAddress(String addr) throws IMTPException
Description copied from interface:ServiceManagerRemoves an address to the address list of this Service Manager.- Specified by:
removeAddressin interfaceServiceManager- Parameters:
addr- The address to remove, as a stringified URL.- Throws:
IMTPException- If an underlying network error occurs.
-
getLocalAddress
public String getLocalAddress() throws IMTPException
Description copied from interface:ServiceManagerAccess the address exported by this copy of the Service Manager.- Specified by:
getLocalAddressin interfaceServiceManager- Returns:
- The locally exported address.
- Throws:
IMTPException- If an underlying network error occurs.
-
addNode
public void addNode(NodeDescriptor desc, ServiceDescriptor[] services) throws IMTPException, ServiceException, JADESecurityException
Description copied from interface:ServiceManagerAdds 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:
addNodein interfaceServiceManager- Parameters:
desc- The description of the new node to add, containing the node identifier and other node properties.services- An array ofServiceDescriptorobjects, 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.JADESecurityException
-
removeNode
public void removeNode(NodeDescriptor desc) throws IMTPException, ServiceException
Description copied from interface:ServiceManagerRemoves 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:
removeNodein interfaceServiceManager- 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:ServiceManagerActivates 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:
activateServicein interfaceServiceManager- Parameters:
desc- TheServiceDescriptorobject specifying theServiceobject 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(String name) throws IMTPException, ServiceException
Description copied from interface:ServiceManagerDeactivates 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:
deactivateServicein interfaceServiceManager- 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(String key) throws IMTPException, ServiceException
Description copied from interface:ServiceFinderLooks up a platform service by name.- Specified by:
findServicein interfaceServiceFinder- Parameters:
key- The name of the service. Concrete syntax for service names is left up to concrete services.- Throws:
IMTPExceptionServiceException
-
findSlice
public Service.Slice findSlice(String serviceKey, String sliceKey) throws IMTPException, ServiceException
Description copied from interface:ServiceFinderLooks up a specific service slice by name.- Specified by:
findSlicein interfaceServiceFinder- Throws:
IMTPExceptionServiceException
-
findAllSlices
public Service.Slice[] findAllSlices(String serviceKey) throws IMTPException, ServiceException
Description copied from interface:ServiceFinderRetrieves all the slices of a service currently active on this platform.- Specified by:
findAllSlicesin interfaceServiceFinder- Parameters:
serviceKey- The name of the service. Concrete syntax for service names is left up to concrete services.- Returns:
- An array of
Service.Sliceobjects, containing all the slices of the requested service. - Throws:
IMTPExceptionServiceException
-
getLocalServices
public Vector getLocalServices()
Description copied from interface:ServiceManagerRetrieve the list of locally installed services as a Vector of ServiceDescriptor objects- Specified by:
getLocalServicesin interfaceServiceManager- Returns:
- the list of locally installed services as a Vector of ServiceDescriptor objects
-
-