Class DelegatingDockerClient

java.lang.Object
io.jenkins.dockerjavaapi.client.DelegatingDockerClient
All Implemented Interfaces:
com.github.dockerjava.api.DockerClient, Closeable, AutoCloseable

public class DelegatingDockerClient extends Object implements com.github.dockerjava.api.DockerClient
Simple delegate class for the DockerClient interface.

This makes it easy for other classes to override specific methods without having to implement all of them. Every method here:

If you are writing a Jenkins plugin that needs a class to implement/wrap DockerClient, you'd be best advised to extend this one, otherwise your code could fail whenever the version of this plugin changes and the DockerClient gains additional methods.

  • Constructor Details

    • DelegatingDockerClient

      public DelegatingDockerClient(@NonNull com.github.dockerjava.api.DockerClient delegate)
      Constructs a new instance that delegates all API calls to the specified DockerClient.
      Parameters:
      delegate - The DockerClient to delegate to.
  • Method Details

    • getDelegate

      @NonNull protected com.github.dockerjava.api.DockerClient getDelegate()
      Obtains the underlying DockerClient interface. Subclasses can override this if they need to hook into every call before anything else happens.
      Returns:
      the DockerClient to be delegated to.
    • interceptAnswer

      protected <T> T interceptAnswer(T originalAnswer)
      Called just before the result is returned. Subclasses can override this if they need to hook into every call just before the method returns and/or to alter the result.

      Note: If a subclass only wishes to act upon certain specific DockerClient calls then it may be clearer to override those specific methods instead. This hook is intended for use by subclasses that need to act upon "all methods" or need to act on methods that were not part of the DockerClient API at the time they were implemented.

      Type Parameters:
      T - The type of the originalAnswer.
      Parameters:
      originalAnswer - The result from the delegate.
      Returns:
      The result to be returned instead.
    • interceptVoid

      protected void interceptVoid()
      Called just before the method returns void. Allows a subclass to act just before the method returns.

      Note: If a subclass only wishes to act upon certain specific DockerClient calls then it may be clearer to override those specific methods instead. This hook is intended for use by subclasses that need to act upon "all methods" or need to act on methods that were not part of the DockerClient API at the time they were implemented.

    • attachContainerCmd

      public com.github.dockerjava.api.command.AttachContainerCmd attachContainerCmd(String arg0)
      Specified by:
      attachContainerCmd in interface com.github.dockerjava.api.DockerClient
    • authCmd

      public com.github.dockerjava.api.command.AuthCmd authCmd()
      Specified by:
      authCmd in interface com.github.dockerjava.api.DockerClient
    • authConfig

      public com.github.dockerjava.api.model.AuthConfig authConfig() throws com.github.dockerjava.api.exception.DockerException
      Specified by:
      authConfig in interface com.github.dockerjava.api.DockerClient
      Throws:
      com.github.dockerjava.api.exception.DockerException
    • buildImageCmd

      public com.github.dockerjava.api.command.BuildImageCmd buildImageCmd()
      Specified by:
      buildImageCmd in interface com.github.dockerjava.api.DockerClient
    • buildImageCmd

      public com.github.dockerjava.api.command.BuildImageCmd buildImageCmd(File arg0)
      Specified by:
      buildImageCmd in interface com.github.dockerjava.api.DockerClient
    • buildImageCmd

      public com.github.dockerjava.api.command.BuildImageCmd buildImageCmd(InputStream arg0)
      Specified by:
      buildImageCmd in interface com.github.dockerjava.api.DockerClient
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface com.github.dockerjava.api.DockerClient
      Throws:
      IOException
    • commitCmd

      public com.github.dockerjava.api.command.CommitCmd commitCmd(String arg0)
      Specified by:
      commitCmd in interface com.github.dockerjava.api.DockerClient
    • connectToNetworkCmd

      public com.github.dockerjava.api.command.ConnectToNetworkCmd connectToNetworkCmd()
      Specified by:
      connectToNetworkCmd in interface com.github.dockerjava.api.DockerClient
    • containerDiffCmd

      public com.github.dockerjava.api.command.ContainerDiffCmd containerDiffCmd(String arg0)
      Specified by:
      containerDiffCmd in interface com.github.dockerjava.api.DockerClient
    • copyArchiveFromContainerCmd

      public com.github.dockerjava.api.command.CopyArchiveFromContainerCmd copyArchiveFromContainerCmd(String arg0, String arg1)
      Specified by:
      copyArchiveFromContainerCmd in interface com.github.dockerjava.api.DockerClient
    • copyArchiveToContainerCmd

      public com.github.dockerjava.api.command.CopyArchiveToContainerCmd copyArchiveToContainerCmd(String arg0)
      Specified by:
      copyArchiveToContainerCmd in interface com.github.dockerjava.api.DockerClient
    • copyFileFromContainerCmd

      public com.github.dockerjava.api.command.CopyFileFromContainerCmd copyFileFromContainerCmd(String arg0, String arg1)
      Specified by:
      copyFileFromContainerCmd in interface com.github.dockerjava.api.DockerClient
    • createContainerCmd

      public com.github.dockerjava.api.command.CreateContainerCmd createContainerCmd(String arg0)
      Specified by:
      createContainerCmd in interface com.github.dockerjava.api.DockerClient
    • createImageCmd

      public com.github.dockerjava.api.command.CreateImageCmd createImageCmd(String arg0, InputStream arg1)
      Specified by:
      createImageCmd in interface com.github.dockerjava.api.DockerClient
    • createNetworkCmd

      public com.github.dockerjava.api.command.CreateNetworkCmd createNetworkCmd()
      Specified by:
      createNetworkCmd in interface com.github.dockerjava.api.DockerClient
    • createVolumeCmd

      public com.github.dockerjava.api.command.CreateVolumeCmd createVolumeCmd()
      Specified by:
      createVolumeCmd in interface com.github.dockerjava.api.DockerClient
    • disconnectFromNetworkCmd

      public com.github.dockerjava.api.command.DisconnectFromNetworkCmd disconnectFromNetworkCmd()
      Specified by:
      disconnectFromNetworkCmd in interface com.github.dockerjava.api.DockerClient
    • eventsCmd

      public com.github.dockerjava.api.command.EventsCmd eventsCmd()
      Specified by:
      eventsCmd in interface com.github.dockerjava.api.DockerClient
    • execCreateCmd

      public com.github.dockerjava.api.command.ExecCreateCmd execCreateCmd(String arg0)
      Specified by:
      execCreateCmd in interface com.github.dockerjava.api.DockerClient
    • execStartCmd

      public com.github.dockerjava.api.command.ExecStartCmd execStartCmd(String arg0)
      Specified by:
      execStartCmd in interface com.github.dockerjava.api.DockerClient
    • infoCmd

      public com.github.dockerjava.api.command.InfoCmd infoCmd()
      Specified by:
      infoCmd in interface com.github.dockerjava.api.DockerClient
    • inspectContainerCmd

      public com.github.dockerjava.api.command.InspectContainerCmd inspectContainerCmd(String arg0)
      Specified by:
      inspectContainerCmd in interface com.github.dockerjava.api.DockerClient
    • inspectExecCmd

      public com.github.dockerjava.api.command.InspectExecCmd inspectExecCmd(String arg0)
      Specified by:
      inspectExecCmd in interface com.github.dockerjava.api.DockerClient
    • inspectImageCmd

      public com.github.dockerjava.api.command.InspectImageCmd inspectImageCmd(String arg0)
      Specified by:
      inspectImageCmd in interface com.github.dockerjava.api.DockerClient
    • inspectNetworkCmd

      public com.github.dockerjava.api.command.InspectNetworkCmd inspectNetworkCmd()
      Specified by:
      inspectNetworkCmd in interface com.github.dockerjava.api.DockerClient
    • inspectVolumeCmd

      public com.github.dockerjava.api.command.InspectVolumeCmd inspectVolumeCmd(String arg0)
      Specified by:
      inspectVolumeCmd in interface com.github.dockerjava.api.DockerClient
    • killContainerCmd

      public com.github.dockerjava.api.command.KillContainerCmd killContainerCmd(String arg0)
      Specified by:
      killContainerCmd in interface com.github.dockerjava.api.DockerClient
    • listContainersCmd

      public com.github.dockerjava.api.command.ListContainersCmd listContainersCmd()
      Specified by:
      listContainersCmd in interface com.github.dockerjava.api.DockerClient
    • listImagesCmd

      public com.github.dockerjava.api.command.ListImagesCmd listImagesCmd()
      Specified by:
      listImagesCmd in interface com.github.dockerjava.api.DockerClient
    • listNetworksCmd

      public com.github.dockerjava.api.command.ListNetworksCmd listNetworksCmd()
      Specified by:
      listNetworksCmd in interface com.github.dockerjava.api.DockerClient
    • listVolumesCmd

      public com.github.dockerjava.api.command.ListVolumesCmd listVolumesCmd()
      Specified by:
      listVolumesCmd in interface com.github.dockerjava.api.DockerClient
    • loadImageCmd

      public com.github.dockerjava.api.command.LoadImageCmd loadImageCmd(InputStream arg0)
      Specified by:
      loadImageCmd in interface com.github.dockerjava.api.DockerClient
    • loadImageAsyncCmd

      public com.github.dockerjava.api.command.LoadImageAsyncCmd loadImageAsyncCmd(@NonNull InputStream inputStream)
      Specified by:
      loadImageAsyncCmd in interface com.github.dockerjava.api.DockerClient
    • logContainerCmd

      public com.github.dockerjava.api.command.LogContainerCmd logContainerCmd(String arg0)
      Specified by:
      logContainerCmd in interface com.github.dockerjava.api.DockerClient
    • pauseContainerCmd

      public com.github.dockerjava.api.command.PauseContainerCmd pauseContainerCmd(String arg0)
      Specified by:
      pauseContainerCmd in interface com.github.dockerjava.api.DockerClient
    • pingCmd

      public com.github.dockerjava.api.command.PingCmd pingCmd()
      Specified by:
      pingCmd in interface com.github.dockerjava.api.DockerClient
    • pullImageCmd

      public com.github.dockerjava.api.command.PullImageCmd pullImageCmd(String arg0)
      Specified by:
      pullImageCmd in interface com.github.dockerjava.api.DockerClient
    • pushImageCmd

      public com.github.dockerjava.api.command.PushImageCmd pushImageCmd(String arg0)
      Specified by:
      pushImageCmd in interface com.github.dockerjava.api.DockerClient
    • pushImageCmd

      public com.github.dockerjava.api.command.PushImageCmd pushImageCmd(com.github.dockerjava.api.model.Identifier arg0)
      Specified by:
      pushImageCmd in interface com.github.dockerjava.api.DockerClient
    • removeContainerCmd

      public com.github.dockerjava.api.command.RemoveContainerCmd removeContainerCmd(String arg0)
      Specified by:
      removeContainerCmd in interface com.github.dockerjava.api.DockerClient
    • removeImageCmd

      public com.github.dockerjava.api.command.RemoveImageCmd removeImageCmd(String arg0)
      Specified by:
      removeImageCmd in interface com.github.dockerjava.api.DockerClient
    • removeNetworkCmd

      public com.github.dockerjava.api.command.RemoveNetworkCmd removeNetworkCmd(String arg0)
      Specified by:
      removeNetworkCmd in interface com.github.dockerjava.api.DockerClient
    • removeVolumeCmd

      public com.github.dockerjava.api.command.RemoveVolumeCmd removeVolumeCmd(String arg0)
      Specified by:
      removeVolumeCmd in interface com.github.dockerjava.api.DockerClient
    • renameContainerCmd

      public com.github.dockerjava.api.command.RenameContainerCmd renameContainerCmd(String arg0)
      Specified by:
      renameContainerCmd in interface com.github.dockerjava.api.DockerClient
    • restartContainerCmd

      public com.github.dockerjava.api.command.RestartContainerCmd restartContainerCmd(String arg0)
      Specified by:
      restartContainerCmd in interface com.github.dockerjava.api.DockerClient
    • saveImageCmd

      public com.github.dockerjava.api.command.SaveImageCmd saveImageCmd(String arg0)
      Specified by:
      saveImageCmd in interface com.github.dockerjava.api.DockerClient
    • searchImagesCmd

      public com.github.dockerjava.api.command.SearchImagesCmd searchImagesCmd(String arg0)
      Specified by:
      searchImagesCmd in interface com.github.dockerjava.api.DockerClient
    • startContainerCmd

      public com.github.dockerjava.api.command.StartContainerCmd startContainerCmd(String arg0)
      Specified by:
      startContainerCmd in interface com.github.dockerjava.api.DockerClient
    • statsCmd

      public com.github.dockerjava.api.command.StatsCmd statsCmd(String arg0)
      Specified by:
      statsCmd in interface com.github.dockerjava.api.DockerClient
    • stopContainerCmd

      public com.github.dockerjava.api.command.StopContainerCmd stopContainerCmd(String arg0)
      Specified by:
      stopContainerCmd in interface com.github.dockerjava.api.DockerClient
    • tagImageCmd

      public com.github.dockerjava.api.command.TagImageCmd tagImageCmd(String arg0, String arg1, String arg2)
      Specified by:
      tagImageCmd in interface com.github.dockerjava.api.DockerClient
    • topContainerCmd

      public com.github.dockerjava.api.command.TopContainerCmd topContainerCmd(String arg0)
      Specified by:
      topContainerCmd in interface com.github.dockerjava.api.DockerClient
    • unpauseContainerCmd

      public com.github.dockerjava.api.command.UnpauseContainerCmd unpauseContainerCmd(String arg0)
      Specified by:
      unpauseContainerCmd in interface com.github.dockerjava.api.DockerClient
    • updateContainerCmd

      public com.github.dockerjava.api.command.UpdateContainerCmd updateContainerCmd(String arg0)
      Specified by:
      updateContainerCmd in interface com.github.dockerjava.api.DockerClient
    • versionCmd

      public com.github.dockerjava.api.command.VersionCmd versionCmd()
      Specified by:
      versionCmd in interface com.github.dockerjava.api.DockerClient
    • waitContainerCmd

      public com.github.dockerjava.api.command.WaitContainerCmd waitContainerCmd(String arg0)
      Specified by:
      waitContainerCmd in interface com.github.dockerjava.api.DockerClient
    • initializeSwarmCmd

      public com.github.dockerjava.api.command.InitializeSwarmCmd initializeSwarmCmd(com.github.dockerjava.api.model.SwarmSpec swarmSpec)
      Specified by:
      initializeSwarmCmd in interface com.github.dockerjava.api.DockerClient
    • inspectSwarmCmd

      public com.github.dockerjava.api.command.InspectSwarmCmd inspectSwarmCmd()
      Specified by:
      inspectSwarmCmd in interface com.github.dockerjava.api.DockerClient
    • joinSwarmCmd

      public com.github.dockerjava.api.command.JoinSwarmCmd joinSwarmCmd()
      Specified by:
      joinSwarmCmd in interface com.github.dockerjava.api.DockerClient
    • leaveSwarmCmd

      public com.github.dockerjava.api.command.LeaveSwarmCmd leaveSwarmCmd()
      Specified by:
      leaveSwarmCmd in interface com.github.dockerjava.api.DockerClient
    • updateSwarmCmd

      public com.github.dockerjava.api.command.UpdateSwarmCmd updateSwarmCmd(com.github.dockerjava.api.model.SwarmSpec swarmSpec)
      Specified by:
      updateSwarmCmd in interface com.github.dockerjava.api.DockerClient
    • updateSwarmNodeCmd

      public com.github.dockerjava.api.command.UpdateSwarmNodeCmd updateSwarmNodeCmd()
      Specified by:
      updateSwarmNodeCmd in interface com.github.dockerjava.api.DockerClient
    • listSwarmNodesCmd

      public com.github.dockerjava.api.command.ListSwarmNodesCmd listSwarmNodesCmd()
      Specified by:
      listSwarmNodesCmd in interface com.github.dockerjava.api.DockerClient
    • listServicesCmd

      public com.github.dockerjava.api.command.ListServicesCmd listServicesCmd()
      Specified by:
      listServicesCmd in interface com.github.dockerjava.api.DockerClient
    • createServiceCmd

      public com.github.dockerjava.api.command.CreateServiceCmd createServiceCmd(com.github.dockerjava.api.model.ServiceSpec serviceSpec)
      Specified by:
      createServiceCmd in interface com.github.dockerjava.api.DockerClient
    • inspectServiceCmd

      public com.github.dockerjava.api.command.InspectServiceCmd inspectServiceCmd(String serviceId)
      Specified by:
      inspectServiceCmd in interface com.github.dockerjava.api.DockerClient
    • updateServiceCmd

      public com.github.dockerjava.api.command.UpdateServiceCmd updateServiceCmd(String serviceId, com.github.dockerjava.api.model.ServiceSpec serviceSpec)
      Specified by:
      updateServiceCmd in interface com.github.dockerjava.api.DockerClient
    • removeServiceCmd

      public com.github.dockerjava.api.command.RemoveServiceCmd removeServiceCmd(String serviceId)
      Specified by:
      removeServiceCmd in interface com.github.dockerjava.api.DockerClient
    • listTasksCmd

      public com.github.dockerjava.api.command.ListTasksCmd listTasksCmd()
      Specified by:
      listTasksCmd in interface com.github.dockerjava.api.DockerClient
    • logServiceCmd

      public com.github.dockerjava.api.command.LogSwarmObjectCmd logServiceCmd(String serviceId)
      Specified by:
      logServiceCmd in interface com.github.dockerjava.api.DockerClient
    • logTaskCmd

      public com.github.dockerjava.api.command.LogSwarmObjectCmd logTaskCmd(String taskId)
      Specified by:
      logTaskCmd in interface com.github.dockerjava.api.DockerClient
    • pruneCmd

      public com.github.dockerjava.api.command.PruneCmd pruneCmd(com.github.dockerjava.api.model.PruneType pruneType)
      Specified by:
      pruneCmd in interface com.github.dockerjava.api.DockerClient
    • removeConfigCmd

      public com.github.dockerjava.api.command.RemoveConfigCmd removeConfigCmd(String configId)
      Specified by:
      removeConfigCmd in interface com.github.dockerjava.api.DockerClient
    • inspectConfigCmd

      public com.github.dockerjava.api.command.InspectConfigCmd inspectConfigCmd(String configId)
      Specified by:
      inspectConfigCmd in interface com.github.dockerjava.api.DockerClient
    • createConfigCmd

      public com.github.dockerjava.api.command.CreateConfigCmd createConfigCmd()
      Specified by:
      createConfigCmd in interface com.github.dockerjava.api.DockerClient
    • listConfigsCmd

      public com.github.dockerjava.api.command.ListConfigsCmd listConfigsCmd()
      Specified by:
      listConfigsCmd in interface com.github.dockerjava.api.DockerClient
    • removeSecretCmd

      public com.github.dockerjava.api.command.RemoveSecretCmd removeSecretCmd(String secretId)
      Specified by:
      removeSecretCmd in interface com.github.dockerjava.api.DockerClient
    • createSecretCmd

      public com.github.dockerjava.api.command.CreateSecretCmd createSecretCmd(com.github.dockerjava.api.model.SecretSpec secretSpec)
      Specified by:
      createSecretCmd in interface com.github.dockerjava.api.DockerClient
    • listSecretsCmd

      public com.github.dockerjava.api.command.ListSecretsCmd listSecretsCmd()
      Specified by:
      listSecretsCmd in interface com.github.dockerjava.api.DockerClient
    • removeSwarmNodeCmd

      public com.github.dockerjava.api.command.RemoveSwarmNodeCmd removeSwarmNodeCmd(String swarmNodeId)
      Specified by:
      removeSwarmNodeCmd in interface com.github.dockerjava.api.DockerClient
    • resizeContainerCmd

      public com.github.dockerjava.api.command.ResizeContainerCmd resizeContainerCmd(String containerId)
      Specified by:
      resizeContainerCmd in interface com.github.dockerjava.api.DockerClient
    • saveImagesCmd

      public com.github.dockerjava.api.command.SaveImagesCmd saveImagesCmd()
      Specified by:
      saveImagesCmd in interface com.github.dockerjava.api.DockerClient
    • resizeExecCmd

      public com.github.dockerjava.api.command.ResizeExecCmd resizeExecCmd(String execId)
      Specified by:
      resizeExecCmd in interface com.github.dockerjava.api.DockerClient