Class LocalFederationManagement

java.lang.Object
org.eclipse.mosaic.rti.federation.LocalFederationManagement
All Implemented Interfaces:
FederationManagement
Direct Known Subclasses:
DistributedFederationManagement

public class LocalFederationManagement extends Object implements FederationManagement
This implementation of FederationManagement allows local administration only.
See Also:
  • Field Details

    • LOCALHOST

      protected static final String LOCALHOST
      Constant representing the local host address.
      See Also:
    • log

      protected final org.slf4j.Logger log
    • federation

      protected final ComponentProvider federation
      The simulation components of this federation.
    • federateDescriptors

      protected final Map<String,FederateDescriptor> federateDescriptors
      Mapping between federation id and federation descriptors.
    • federateAmbassadors

      protected final Map<String,FederateAmbassador> federateAmbassadors
      Mapping between federation id and federation ambassador instances.
    • loggingThreads

      protected final com.google.common.collect.Multimap<String,ProcessLoggingThread> loggingThreads
    • watchDog

      protected WatchDog watchDog
  • Constructor Details

    • LocalFederationManagement

      public LocalFederationManagement(ComponentProvider federation)
      Constructor with string identifying a federation as parameter.
      Parameters:
      federation - federation
  • Method Details

    • createFederation

      public void createFederation()
      Description copied from interface: FederationManagement
      Creates an empty federation. After calling this method it is possible for federates to join the federation.
      Specified by:
      createFederation in interface FederationManagement
    • addFederate

      public void addFederate(FederateDescriptor descriptor) throws Exception
      Description copied from interface: FederationManagement
      Adds a federate to the federation. This method can be called either before or during runtime of the simulation of the federation.
      Specified by:
      addFederate in interface FederationManagement
      Parameters:
      descriptor - object containing all data that are necessary to manage the lifecycle of a federate
      Throws:
      Exception
    • isFederateJoined

      public boolean isFederateJoined(String federateId)
      Description copied from interface: FederationManagement
      Checks whether a federate is joined or not.
      Specified by:
      isFederateJoined in interface FederationManagement
      Parameters:
      federateId - unique string identifying the federate
      Returns:
      a boolean, whether a federate is joined or not
    • getAmbassador

      public FederateAmbassador getAmbassador(String federateId)
      Description copied from interface: FederationManagement
      Returns a reference to the ambassador associated with the given federate id.
      Specified by:
      getAmbassador in interface FederationManagement
      Parameters:
      federateId - unique string identifying the federate
      Returns:
      ambassador associated with the given federate id
    • getAmbassadors

      public Collection<FederateAmbassador> getAmbassadors()
      Description copied from interface: FederationManagement
      Returns a collection of all ambassadors associated with joined federates.
      Specified by:
      getAmbassadors in interface FederationManagement
      Returns:
      collection of all ambassadors
    • stopFederation

      public void stopFederation() throws Exception
      Description copied from interface: FederationManagement
      Stops the federation. All resources of federates are freed. Afterwards, no new federates are allowed to join.
      Specified by:
      stopFederation in interface FederationManagement
      Throws:
      Exception
    • deployFederate

      protected void deployFederate(FederateDescriptor descriptor) throws Exception
      Deploys a federate represented by its descriptor on the local machine.
      Parameters:
      descriptor - federate descriptor consisting all necessary data to deploy a federate
      Throws:
      Exception - if the federate could not be deployed
    • startFederate

      protected void startFederate(FederateDescriptor handle) throws Exception
      Starts a federate represented by its handle on the local machine.
      Parameters:
      handle - federate handle consisting all necessary data to start a federate
      Throws:
      Exception - if the federate could not be started
    • stopFederate

      protected void stopFederate(FederateDescriptor handle, boolean forceStop) throws Exception
      Stops a federate represented by its handle on the local machine.
      Parameters:
      handle - federate handle consisting all necessary data to stop a federate
      Throws:
      Exception - if the federate could not be stopped
    • undeployFederate

      protected void undeployFederate(FederateDescriptor handle) throws Exception
      Undeploys a federate represented by its handle on the local machine.
      Parameters:
      handle - federate handle consisting all necessary data to undeploy a federate
      Throws:
      Exception - if the federate could not be undeployed
    • getFederationId

      public String getFederationId()
      Description copied from interface: FederationManagement
      Returns the id of the simulated federation.
      Specified by:
      getFederationId in interface FederationManagement
      Returns:
      the id of the simulated federation.
    • setWatchdog

      public void setWatchdog(WatchDog watchdog)
      Description copied from interface: FederationManagement
      Sets the WatchDog which detects broken federates.
      Specified by:
      setWatchdog in interface FederationManagement