Package cmion.level2

Class RemoteCompetency

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    RemoteTCPCompetency

    public abstract class RemoteCompetency
    extends Competency
    an abstract class describing a competency, whose main execution is performed remotely, in a different executable (possibly on a different machine) and that we communicate with over the network. This should not be subclassed directly by a competency implementation, but by another abstract class that adds the details of a certain network communication technology (e.g. TCP).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected RemoteCompetency​(IArchitecture architecture)
      call this constructor from subclasses
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean competencyCode​(java.util.HashMap<java.lang.String,​java.lang.String> parameters)
      the code that is executed when the competency is started
      protected abstract void processMessage​(java.lang.String message)
      this method will be called whenever a message is received from the remote competency, if the message gives an indication about failure or success of the remote competency than returnSuccess or returnFailure should be called at the end of this method
      protected void returnFailure()
      this should be called from the processMessage function whenever the competency has returned unsuccessfully
      protected void returnSuccess()
      this should be called from the processMessage function whenever the competency has returned successfully
      protected abstract void sendMessage​(java.lang.String message)
      this method should not be implemented by a competency but by a direct subclass e.g.
      protected abstract void startExecution​(java.util.HashMap<java.lang.String,​java.lang.String> parameters)
      this method will be called when execution of the competency is invoked, in here a command should be sent over the socket, starting the competency remotely
      • Methods inherited from class ion.Meta.Element

        destroy, getEventFilters, getEventHandlers, getRequestFilters, getRequestHandlers, getSimulation, getUID, schedule, wasDestroyed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RemoteCompetency

        protected RemoteCompetency​(IArchitecture architecture)
        call this constructor from subclasses
    • Method Detail

      • competencyCode

        protected final boolean competencyCode​(java.util.HashMap<java.lang.String,​java.lang.String> parameters)
        the code that is executed when the competency is started
        Specified by:
        competencyCode in class Competency
        Parameters:
        parameters - a map including running parameters and their values
        Returns:
        the return value of this method should indicate, whether the competency execution was a success (true) or failure (false)
      • startExecution

        protected abstract void startExecution​(java.util.HashMap<java.lang.String,​java.lang.String> parameters)
        this method will be called when execution of the competency is invoked, in here a command should be sent over the socket, starting the competency remotely
      • processMessage

        protected abstract void processMessage​(java.lang.String message)
        this method will be called whenever a message is received from the remote competency, if the message gives an indication about failure or success of the remote competency than returnSuccess or returnFailure should be called at the end of this method
      • sendMessage

        protected abstract void sendMessage​(java.lang.String message)
        this method should not be implemented by a competency but by a direct subclass e.g. Remote TCPClient competency
      • returnSuccess

        protected final void returnSuccess()
        this should be called from the processMessage function whenever the competency has returned successfully
      • returnFailure

        protected final void returnFailure()
        this should be called from the processMessage function whenever the competency has returned unsuccessfully