Package jade.core

Class FEService

  • Direct Known Subclasses:
    TopicManagementFEService

    public abstract class FEService
    extends Object
    JADE kernel services providing a service-helper and wishing this helper to be available in the split execution mode too, need to provide a FEService class. When starting a split container the services option works exactly as when starting a normal container, but the indicated classes must be concrete implementations of the FEService abstract class.
    It should be noticed that a Front-End service is only intended to provide access to the service helper and not to actually implement full service functionality
    Author:
    Giovanni Caire - Telecom Italia
    • Constructor Detail

      • FEService

        public FEService()
    • Method Detail

      • getName

        public abstract String getName()
        Subclasses must implement this method to return the name of this service. Such name must be specified by an agent in the getHelper() method when retrieving the helper for this service.
        Returns:
        The name of this service
      • getBEServiceClassName

        public String getBEServiceClassName()
        In many cases for the Front-End service to work properly it is necessary that the real service (or possibly a modified version of it) is active in the Back-End. In such cases subclasses may redefine this method to return the fully qualified name of the class implementing the back-end side counterpart of this service.
        Returns:
        The fully qualified name of the class implementing the back-end side counterpart of this service
      • getHelper

        public abstract ServiceHelper getHelper​(Agent a)
        Subclasses must implement this method to return the helper for accessing this service.
        Parameters:
        a - The agent which the helper is requested for.
        Returns:
        The ServiceHelper to be used by the agent.
      • invoke

        protected Object invoke​(String actor,
                                String methodName,
                                Object[] methodParams)
                         throws NotFoundException,
                                ServiceException,
                                IMTPException
        Subclasses can use this method to forward a front-end side invocation of a service helper method to the back-end. Said A the agent invoking the method, the effect is that the same method will be invoked, with the passed parameters, on the service helper object associated to the agent image representing A in the back-end. In case the back-end side service helper method requires parameters different than those passed in the methodParams argument, a suitable "BackEnd Codec" class must be provided to perform the necessary conversions. Such class must implement the BECodec interface and must be called "BECodec"
        Parameters:
        actor - The name of the agent invoking the service helper method
        methodName - The name of the invoked method
        methodParams - The parameters to be passed to the back-end
        Returns:
        The result of the back-end side service helper method invocation possibly encoded by the BackEnd Codec (if any)
        Throws:
        NotFoundException - If the invoking agent is not found in the back-end
        ServiceException - If an error occurs at the service level
        IMTPException - If a communication error occurs