Skip to content

Commit bba52cc

Browse files
committed
Add documentation about container related build items
1 parent fc7d4cb commit bba52cc

File tree

4 files changed

+110
-5
lines changed

4 files changed

+110
-5
lines changed

core/deployment/src/main/java/io/quarkus/deployment/builditem/ContainerRuntimeStatusBuildItem.java

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,45 @@
33
import io.quarkus.builder.item.SimpleBuildItem;
44
import io.quarkus.deployment.IsContainerRuntimeWorking;
55

6+
/**
7+
* A build item that represents the status of a container runtime.
8+
* <p>
9+
* This abstract class provides a mechanism to check if a container runtime
10+
* is available and caches the result for subsequent calls.
11+
* </p>
12+
*/
613
public abstract class ContainerRuntimeStatusBuildItem extends SimpleBuildItem {
14+
15+
/**
16+
* A functional interface ({@link java.util.function.BooleanSupplier}) used to determine if the container runtime is
17+
* working.
18+
*/
719
private final IsContainerRuntimeWorking isContainerRuntimeWorking;
20+
21+
/**
22+
* A cached status indicating whether the container runtime is available.
23+
* This value is computed lazily and stored for future use.
24+
*/
825
private volatile Boolean cachedStatus;
926

27+
/**
28+
* Constructs a new {@link ContainerRuntimeStatusBuildItem}.
29+
*
30+
* @param isContainerRuntimeWorking a functional interface to check the container runtime status
31+
*/
1032
protected ContainerRuntimeStatusBuildItem(IsContainerRuntimeWorking isContainerRuntimeWorking) {
1133
this.isContainerRuntimeWorking = isContainerRuntimeWorking;
1234
}
1335

36+
/**
37+
* Checks if the container runtime is available.
38+
* <p>
39+
* This method uses the {@link IsContainerRuntimeWorking} interface to determine
40+
* the runtime status and caches the result for subsequent calls.
41+
* </p>
42+
*
43+
* @return {@code true} if the container runtime is available, {@code false} otherwise
44+
*/
1445
public boolean isContainerRuntimeAvailable() {
1546
if (cachedStatus == null) {
1647
synchronized (this) {
@@ -19,7 +50,6 @@ public boolean isContainerRuntimeAvailable() {
1950
}
2051
}
2152
}
22-
2353
return cachedStatus;
2454
}
25-
}
55+
}

core/deployment/src/main/java/io/quarkus/deployment/builditem/DockerStatusBuildItem.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,36 @@
22

33
import io.quarkus.deployment.IsDockerWorking;
44

5+
/**
6+
* A build item that represents the status of the Docker container runtime.
7+
* <p>
8+
* This class extends {@link ContainerRuntimeStatusBuildItem} and provides
9+
* a specific implementation for checking the availability of the Docker runtime.
10+
* </p>
11+
*/
512
public final class DockerStatusBuildItem extends ContainerRuntimeStatusBuildItem {
13+
14+
/**
15+
* Constructs a new {@link DockerStatusBuildItem}.
16+
*
17+
* @param isDockerWorking a functional interface to check if the Docker runtime is working
18+
*/
619
public DockerStatusBuildItem(IsDockerWorking isDockerWorking) {
720
super(isDockerWorking);
821
}
922

1023
/**
24+
* Checks if the Docker runtime is available.
25+
* <p>
26+
* This method is deprecated and will be removed in a future release.
27+
* Use {@link #isContainerRuntimeAvailable()} instead.
28+
* </p>
29+
*
30+
* @return {@code true} if the Docker runtime is available, {@code false} otherwise
1131
* @deprecated Use {@link #isContainerRuntimeAvailable()} instead
1232
*/
1333
@Deprecated(forRemoval = true)
1434
public boolean isDockerAvailable() {
1535
return isContainerRuntimeAvailable();
1636
}
17-
}
37+
}

core/deployment/src/main/java/io/quarkus/deployment/builditem/PodmanStatusBuildItem.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,21 @@
22

33
import io.quarkus.deployment.IsPodmanWorking;
44

5+
/**
6+
* A build item that represents the status of the Podman container runtime.
7+
* <p>
8+
* This class extends {@link ContainerRuntimeStatusBuildItem} and provides
9+
* a specific implementation for checking the availability of the Podman runtime.
10+
* </p>
11+
*/
512
public final class PodmanStatusBuildItem extends ContainerRuntimeStatusBuildItem {
13+
14+
/**
15+
* Constructs a new {@link PodmanStatusBuildItem}.
16+
*
17+
* @param isPodmanWorking a functional interface to check if the Podman runtime is working
18+
*/
619
public PodmanStatusBuildItem(IsPodmanWorking isPodmanWorking) {
720
super(isPodmanWorking);
821
}
9-
}
22+
}

core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/DeploymentResultBuildItem.java

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,64 @@
55

66
import io.quarkus.builder.item.SimpleBuildItem;
77

8+
/**
9+
* A build item representing the result of a Kubernetes or OpenShift deployment process.
10+
* <p>
11+
* This build item encapsulates the name and labels of the main resource created or updated
12+
* during deployment. It is typically produced by deployment steps and can be consumed by
13+
* other build steps that need information about the deployed resource.
14+
* </p>
15+
*
16+
* <p>
17+
* The {@code name} usually refers to the primary resource (such as a Deployment, StatefulSet,
18+
* or DeploymentConfig) that was applied to the cluster. The {@code labels} map contains
19+
* metadata labels associated with this resource, which can be used for identification,
20+
* filtering, or further processing.
21+
* </p>
22+
*/
823
public final class DeploymentResultBuildItem extends SimpleBuildItem {
924

25+
/**
26+
* The name of the main deployed resource (e.g., Deployment, StatefulSet, or DeploymentConfig).
27+
*/
1028
private final String name;
29+
30+
/**
31+
* The labels associated with the deployed resource.
32+
* <p>
33+
* These labels provide metadata that can be used for resource selection, grouping,
34+
* or integration with other tools and processes.
35+
* </p>
36+
*/
1137
private final Map<String, String> labels;
1238

39+
/**
40+
* Constructs a new {@link DeploymentResultBuildItem}.
41+
*
42+
* @param name the name of the main deployed resource
43+
* @param labels a map of labels associated with the deployed resource
44+
*/
1345
public DeploymentResultBuildItem(String name, Map<String, String> labels) {
1446
this.name = name;
1547
this.labels = labels;
1648
}
1749

50+
/**
51+
* Returns the name of the main deployed resource.
52+
*
53+
* @return the resource name
54+
*/
1855
public String getName() {
1956
return this.name;
2057
}
2158

59+
/**
60+
* Returns the labels associated with the deployed resource.
61+
*
62+
* @return a map of resource labels
63+
*/
2264
public Map<String, String> getLabels() {
2365
return this.labels;
2466
}
2567

26-
}
68+
}

0 commit comments

Comments
 (0)