Package io.fabric8.maven.docker.service
Class ContainerTracker
- java.lang.Object
-
- io.fabric8.maven.docker.service.ContainerTracker
-
public class ContainerTracker extends Object
Tracker class for tracking started containers so that they can be shut down at the end whendocker:startanddocker:stopare used in the same run
-
-
Constructor Summary
Constructors Constructor Description ContainerTracker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor>getShutdownDescriptors(GavLabel gavLabel)Get all shutdown descriptors for a given pom label.StringlookupContainer(String lookup)Lookup a container by name or alias from the tracked containersvoidregisterContainer(String containerId, ImageConfiguration imageConfig, GavLabel gavLabel)Register a started container to this trackerio.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptorremoveContainer(String containerId)Remove a container from this container (if stored) and return its descriptorCollection<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor>removeShutdownDescriptors(GavLabel gavLabel)Get all shutdown descriptors for a given pom label and remove it from the tracker.
-
-
-
Method Detail
-
registerContainer
public void registerContainer(String containerId, ImageConfiguration imageConfig, GavLabel gavLabel)
Register a started container to this tracker- Parameters:
containerId- container id to registerimageConfig- configuration of associated imagegavLabel- pom label to identifying the reactor project where the container was created
-
removeContainer
public io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor removeContainer(String containerId)
Remove a container from this container (if stored) and return its descriptor- Parameters:
containerId- id to remove- Returns:
- descriptor of the container removed or
null
-
lookupContainer
public String lookupContainer(String lookup)
Lookup a container by name or alias from the tracked containers- Parameters:
lookup- name or alias of the container to lookup- Returns:
- container id found or
null
-
removeShutdownDescriptors
public Collection<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor> removeShutdownDescriptors(GavLabel gavLabel)
Get all shutdown descriptors for a given pom label and remove it from the tracker. The descriptors are returned in reverse order of their registration. If no pom label is given, then all descriptors are returned.- Parameters:
gavLabel- the label for which to get the descriptors ornullfor all descriptors- Returns:
- the descriptors for the given label or an empty collection
-
getShutdownDescriptors
public List<io.fabric8.maven.docker.service.ContainerTracker.ContainerShutdownDescriptor> getShutdownDescriptors(GavLabel gavLabel)
Get all shutdown descriptors for a given pom label. The descriptors are returned in order of their registration. If no pom label is given, then all descriptors are returned.- Parameters:
gavLabel- the label for which to get the descriptors ornullfor all descriptors- Returns:
- the descriptors for the given label or an empty collection
-
-