Class LocalFederationManagement
java.lang.Object
org.eclipse.mosaic.rti.federation.LocalFederationManagement
- All Implemented Interfaces:
FederationManagement
- Direct Known Subclasses:
DistributedFederationManagement
This implementation of
FederationManagement
allows local
administration only.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String,
FederateAmbassador> Mapping between federation id and federation ambassador instances.protected final Map<String,
FederateDescriptor> Mapping between federation id and federation descriptors.protected final ComponentProvider
The simulation components of this federation.protected static final String
Constant representing the local host address.protected final org.slf4j.Logger
protected final com.google.common.collect.Multimap<String,
ProcessLoggingThread> protected WatchDog
-
Constructor Summary
ConstructorsConstructorDescriptionLocalFederationManagement
(ComponentProvider federation) Constructor with string identifying a federation as parameter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFederate
(FederateDescriptor descriptor) Adds a federate to the federation.void
Creates an empty federation.protected void
deployFederate
(FederateDescriptor descriptor) Deploys a federate represented by its descriptor on the local machine.getAmbassador
(String federateId) Returns a reference to the ambassador associated with the given federate id.Returns a collection of all ambassadors associated with joined federates.Returns the id of the simulated federation.boolean
isFederateJoined
(String federateId) Checks whether a federate is joined or not.void
setWatchdog
(WatchDog watchdog) Sets theWatchDog
which detects broken federates.protected void
startFederate
(FederateDescriptor handle) Starts a federate represented by its handle on the local machine.protected void
stopFederate
(FederateDescriptor handle, boolean forceStop) Stops a federate represented by its handle on the local machine.void
Stops the federation.protected void
undeployFederate
(FederateDescriptor handle) Undeploys a federate represented by its handle on the local machine.
-
Field Details
-
LOCALHOST
Constant representing the local host address.- See Also:
-
log
protected final org.slf4j.Logger log -
federation
The simulation components of this federation. -
federateDescriptors
Mapping between federation id and federation descriptors. -
federateAmbassadors
Mapping between federation id and federation ambassador instances. -
loggingThreads
-
watchDog
-
-
Constructor Details
-
LocalFederationManagement
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 interfaceFederationManagement
-
addFederate
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 interfaceFederationManagement
- Parameters:
descriptor
- object containing all data that are necessary to manage the lifecycle of a federate- Throws:
Exception
-
isFederateJoined
Description copied from interface:FederationManagement
Checks whether a federate is joined or not.- Specified by:
isFederateJoined
in interfaceFederationManagement
- Parameters:
federateId
- unique string identifying the federate- Returns:
- a boolean, whether a federate is joined or not
-
getAmbassador
Description copied from interface:FederationManagement
Returns a reference to the ambassador associated with the given federate id.- Specified by:
getAmbassador
in interfaceFederationManagement
- Parameters:
federateId
- unique string identifying the federate- Returns:
- ambassador associated with the given federate id
-
getAmbassadors
Description copied from interface:FederationManagement
Returns a collection of all ambassadors associated with joined federates.- Specified by:
getAmbassadors
in interfaceFederationManagement
- Returns:
- collection of all ambassadors
-
stopFederation
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 interfaceFederationManagement
- Throws:
Exception
-
deployFederate
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
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
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
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
Description copied from interface:FederationManagement
Returns the id of the simulated federation.- Specified by:
getFederationId
in interfaceFederationManagement
- Returns:
- the id of the simulated federation.
-
setWatchdog
Description copied from interface:FederationManagement
Sets theWatchDog
which detects broken federates.- Specified by:
setWatchdog
in interfaceFederationManagement
-