extending-cloudsim-express-platform.md
April 4, 2023 ยท View on GitHub
layout: page title: "Extending CloudSim express platform" permalink: /examples/extending-cloudsim-express-platform
Extending CloudSim express platform
The CloudSim Express is a modularized platform, as described in its architecture (refer to the README.md).
In this example, we extend its simulation manager to print a message once the simulation is completed.
Implementing custom simulation manager
- Create a simple Maven project.
- Go to a new folder.
- Execute
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-simple -DarchetypeVersion=1.4- Pre-requisite: Maven
- Enter followings when prompted.
- groupId =
org.cloudbus.cloudsim.express.examples - artifactId =
custom-simulation-manager - version =
1.0-SNAPSHOT - package =
org.cloudbus.cloudsim.express.examples - Press Enter to confirm.
- groupId =
- Configure dependencies.
- Go to the
custom-reusable-componentproject folder. - Open
pom.xml - Within the
<dependencies>tag, copy the following to declare CloudSim Express as a dependency- Pre-requisite: You must build
cloudsim-expressproject at least once. - Copy and paste the following.
<dependency> <artifactId>cloudsim-express-core</artifactId> <groupId>org.cloudbus.cloudsim.cloudsim-express</groupId> <version>0.1-SNAPSHOT</version> </dependency>
- Pre-requisite: You must build
- Create the custom simulation manager class in the
/src/main/java/org/cloudbus/cloudsim/express/examples/folder by creating a new fileCustomSimulationManager.java.- Delete the generated
App.javafile.
- Delete the generated
- Implement the logic accordingly.
- The sample code is available in the resources project.
- Build the project by executing
mvn clean installfrom the project root directory (i.e., where thepom.xmlfile resides).
- Go to the
Deploying the custom simulation manager
- Copy the custom-simualtion-manager jar file from
<custom-simulation-manager>/target/custom-simulation-manager-1.0-SNAPSHOT.jar, tocloudsim-express-tool-location/extensions. - Switch the simulation manager to the custom one. Open
configs.propertiesfile, and change the corresponding value. From:
module.simulation.manager=org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager
To:
module.simulation.manager=org.cloudbus.cloudsim.express.examples.CustomSimulationManager
- Executes the simulation via
sh ./cloudsim-express.sh - Check the CloudSim Express logs and observe the printed message by the custom simulation manager.
... [main] INFO org.cloudbus.cloudsim.express.manager.impl.CloudSimSimulationManager - CloudSim Simulation is completed Simulation Management is Completed! ...
Materials
The related materials are included in the resources folder.