-
-
Notifications
You must be signed in to change notification settings - Fork 53
What It Is
Mihai edited this page Apr 19, 2020
·
5 revisions
It is a Java library for the Docker Engine API. It is the equivalent of the docker
command-line client, for Java applications.
Unlike other docker clients for Java, this one aims to be as lightweight as possible, with as few transitive dependencies as possible and it should cause absolutely no runtime conflicts with other frameworks or platforms like Java EE.
One other target is that this library should be a true API, not an SDK. Read this blog post for more details.
-
encapsulation (everything is hidden behind interfaces)
-
no getters/setters
-
immutability
-
fluency
-
no null references
-
fail-fast:
- If it receives any HTTP response that does not have the expected status code, it throws UnexpectedResponseException (runtime exception)
- Other exceptional case represents
IOException
and this should indicate that there is a real networking problem, not a business problem with the API
-
polymorphism:
- All the API resources (
Container
,Image
etc) represent their entities' operations (as seen bellow) and are also implementingJsonObject
. They hold the Json representation returned by the API at the moment of the object's creation (see examples and comments bellow).
- All the API resources (
-
JDK Integration
- Wherever possible, the APIs are integrated with the JDK. For instance
Containers
,Images
etc are allIterable
of their respective entities. This means, for example, you can iterate over all the running Containers in Docker as simply as:
for(final Container ctn : containers) { //running containers }
- Wherever possible, the APIs are integrated with the JDK. For instance