Java Code Examples for com.spotify.docker.client.messages.ProgressMessage#status()

The following examples show how to use com.spotify.docker.client.messages.ProgressMessage#status() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnsiProgressHandler.java    From docker-client with Apache License 2.0 6 votes vote down vote up
@Override
public void progress(ProgressMessage message) throws DockerException {
  if (message.error() != null) {
    throw new DockerException(message.error());
  }

  if (message.progressDetail() != null) {
    printProgress(message);
    return;
  }

  String value = message.stream();
  if (value != null) {
    // trim trailing new lines which are present in streams
    value = value.replaceFirst("\n$", "");
  } else {
    value = message.status();
  }
  // if value is null it's an unknown message type so just print the whole thing out
  if (value == null) {
    value = message.toString();
  }

  out.println(value);
}
 
Example 2
Source File: LoggingProgressHandler.java    From dockerfile-maven with Apache License 2.0 5 votes vote down vote up
@Override
public void progress(ProgressMessage message) throws DockerException {
  if (message.error() != null) {
    handleError(message.error());
  } else if (message.progressDetail() != null) {
    handleProgress(message.id(), message.status(), message.progress());
  } else if ((message.status() != null) || (message.stream() != null)) {
    handleGeneric(message.stream(), message.status());
  }

  String imageId = message.buildImageId();
  if (imageId != null) {
    builtImageId = imageId;
  }
}
 
Example 3
Source File: DefaultDockerClient.java    From docker-client with Apache License 2.0 5 votes vote down vote up
@Override
public void progress(ProgressMessage message) throws DockerException {
  delegate.progress(message);
  final String status = message.status();
  if (status != null && (status.length() == EXPECTED_CHARACTER_NUM1
                         || status.length() == EXPECTED_CHARACTER_NUM2)) {
    imageId = message.status();
  }
}