Exemplo n.º 1
0
 /**
  * Copies files from specified container.
  *
  * @param sourceMachine source machine
  * @param sourcePath path to file or directory inside specified container
  * @param targetPath path to destination file or directory inside container
  * @param overwrite If "false" then it will be an error if unpacking the given content would cause
  *     an existing directory to be replaced with a non-directory and vice versa.
  * @throws MachineException if any error occurs when files are being copied
  */
 @Override
 public void copy(Instance sourceMachine, String sourcePath, String targetPath, boolean overwrite)
     throws MachineException {
   if (!(sourceMachine instanceof DockerInstance)) {
     throw new MachineException("Unsupported copying between not docker machines");
   }
   try {
     docker.putResource(
         container,
         targetPath,
         docker.getResource(((DockerInstance) sourceMachine).container, sourcePath),
         overwrite);
   } catch (IOException e) {
     throw new MachineException(e.getLocalizedMessage());
   }
 }