Class DockerContainer
- java.lang.Object
-
- io.patriot_framework.network_simulator.docker.container.DockerContainer
-
- All Implemented Interfaces:
Container
public class DockerContainer extends Object implements Container
Instance of DockerContainer representing informations which are required for work with container. Class is providing basic work with container. This type of work is later executed in DockerManager.
-
-
Constructor Summary
Constructors Constructor Description DockerContainer(String id)
ConstructorDockerContainer(String name, String id)
Instantiates a new Docker container.DockerContainer(String name, String id, DockerManager dockerManager)
Instantiates a new Docker container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
connectToNetwork(List<Network> networks)
Method provides connecting container to networks.void
destroyContainer()
Method provides soft delete of container (stop + delete).boolean
exists()
Method returns if is container alive.String
getGatewayNetworkIp()
Method gathers ip of container's gateway.Integer
getGatewayNetworkMask()
Method gathers CIDR mask of container's gateway.String
getId()
Gets id.String
getIpAddress(Network network)
Gets ip address.Manager
getManager()
Gets manager.String
getName()
Gets name.void
setId(String id)
Sets id.void
setManager(Manager manager)
Sets manager.void
setName(String name)
Sets name.
-
-
-
Constructor Detail
-
DockerContainer
public DockerContainer(String id)
Constructor- Parameters:
id
- id of created container
-
DockerContainer
public DockerContainer(String name, String id, DockerManager dockerManager)
Instantiates a new Docker container.- Parameters:
name
- the nameid
- the iddockerManager
- the docker manager
-
-
Method Detail
-
setName
public void setName(String name)
Sets name.- Parameters:
name
- the name
-
getIpAddress
public String getIpAddress(Network network)
Description copied from interface:Container
Gets ip address.- Specified by:
getIpAddress
in interfaceContainer
- Parameters:
network
- the network- Returns:
- the ip address
-
setId
public void setId(String id)
Sets id.- Parameters:
id
- the id
-
getManager
public Manager getManager()
Gets manager.- Returns:
- the manager
-
setManager
public void setManager(Manager manager)
Sets manager.- Parameters:
manager
- the manager
-
exists
public boolean exists()
Method returns if is container alive.
-
connectToNetwork
public void connectToNetwork(List<Network> networks)
Method provides connecting container to networks.- Specified by:
connectToNetwork
in interfaceContainer
- Parameters:
networks
- networks to which will be container connected
-
destroyContainer
public void destroyContainer()
Method provides soft delete of container (stop + delete).- Specified by:
destroyContainer
in interfaceContainer
-
getGatewayNetworkIp
public String getGatewayNetworkIp()
Method gathers ip of container's gateway.- Returns:
- String Ip address of container gateway
-
getGatewayNetworkMask
public Integer getGatewayNetworkMask()
Method gathers CIDR mask of container's gateway.- Returns:
- Integer CIDR mask of container gateway.
-
-