Tabnine Logo
DisabledConnectionCallback.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
ch.cyberduck.core.DisabledConnectionCallback
constructor

Best Java code snippets using ch.cyberduck.core.DisabledConnectionCallback.<init> (Showing top 18 results out of 315)

origin: iterate-ch/cyberduck

  public String read(final Path file) throws BackgroundException {
    final Read read = session._getFeature(Read.class);
    final InputStream in = read.read(file, new TransferStatus(), new DisabledConnectionCallback());
    try {
      return IOUtils.toString(in, "UTF-8");
    }
    catch(IOException e) {
      throw new DefaultIOExceptionMappingService().map(e);
    }
    finally {
      IOUtils.closeQuietly(in);
    }
  }
}
origin: iterate-ch/cyberduck

  /**
   * Rename existing file on server if there is a conflict.
   */
  @Override
  public void apply(final Path file, final Local local, final TransferStatus status,
           final ProgressListener listener) throws BackgroundException {
    // Rename existing file before putting new file in place
    if(status.isExists()) {
      Path rename;
      do {
        final String proposal = MessageFormat.format(PreferencesFactory.get().getProperty("queue.upload.file.rename.format"),
            FilenameUtils.getBaseName(file.getName()),
            UserDateFormatterFactory.get().getMediumFormat(System.currentTimeMillis(), false).replace(Path.DELIMITER, '-').replace(':', '-'),
            StringUtils.isNotBlank(file.getExtension()) ? String.format(".%s", file.getExtension()) : StringUtils.EMPTY);
        rename = new Path(file.getParent(), proposal, file.getType());
      }
      while(find.withCache(cache).find(rename));
      if(log.isInfoEnabled()) {
        log.info(String.format("Rename existing file %s to %s", file, rename));
      }
      move.move(file, rename, new TransferStatus().exists(false), new Delete.DisabledCallback(), new DisabledConnectionCallback());
      if(log.isDebugEnabled()) {
        log.debug(String.format("Clear exist flag for file %s", file));
      }
      status.setExists(false);
    }
    super.apply(file, local, status, listener);
  }
}
origin: iterate-ch/cyberduck

  public void write(final Path file, final byte[] content, final TransferStatus status) throws BackgroundException {
    final Write<?> write = session._getFeature(Write.class);
    status.setLength(content.length);
    status.setChecksum(write.checksum(file).compute(new ByteArrayInputStream(content), status));
    final StatusOutputStream<?> out = write.write(file, status, new DisabledConnectionCallback());
    try {
      IOUtils.write(content, out);
    }
    catch(IOException e) {
      throw new DefaultIOExceptionMappingService().map(e);
    }
    finally {
      new DefaultStreamCloser().close(out);
    }
  }
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus transferStatus) throws BackgroundException {
  final SpectraBulkService bulk = new SpectraBulkService(session);
  final TransferStatus status = new TransferStatus();
  bulk.pre(Transfer.Type.upload, Collections.singletonMap(new TransferItem(file), status.length(0L)), new DisabledConnectionCallback());
  final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  final S3Object metadata = (S3Object) out.getStatus();
  return new Path(file.getParent(), file.getName(), file.getType(),
    new S3AttributesFinderFeature(session).toAttributes(metadata));
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  final Local temp = TemporaryFileServiceFactory.get().create(file);
  LocalTouchFactory.get().touch(temp);
  try {
    final T reply = feature.upload(file, temp,
      new BandwidthThrottle(BandwidthThrottle.UNLIMITED),
      new DisabledStreamListener(), status, new DisabledConnectionCallback());
    if(log.isDebugEnabled()) {
      log.debug(String.format("Received reply %s for creating file %s", reply, file));
    }
    return new Path(file.getParent(), file.getName(), file.getType(), attributes.find(file));
  }
  finally {
    temp.delete();
  }
}
origin: iterate-ch/cyberduck

  log.info(String.format("Rename file %s to %s", file, status.getDisplayname().remote));
move.move(file, status.getDisplayname().remote, status, new Delete.DisabledCallback(), new DisabledConnectionCallback());
origin: iterate-ch/cyberduck

public Credentials get() throws BackgroundException {
  final Host address = new HostParser(factory).get(url);
  final Path access = new Path(PathNormalizer.normalize(address.getDefaultPath()), EnumSet.of(Path.Type.file));
  address.setDefaultPath(String.valueOf(Path.DELIMITER));
  final DAVSession connection = new DAVSession(address, trust, key);
  connection.withListener(transcript).open(ProxyFactory.get().find(address), new DisabledHostKeyCallback(), new DisabledLoginCallback());
  final InputStream in = new DAVReadFeature(connection).read(access, new TransferStatus(), new DisabledConnectionCallback());
  try {
    final Credentials credentials = this.parse(in);
    connection.close();
    return credentials;
  }
  finally {
    connection.removeListener(transcript);
  }
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  if(Checksum.NONE == status.getChecksum()) {
    status.setChecksum(writer.checksum(file).compute(new NullInputStream(0L), status));
  }
  status.setTimestamp(System.currentTimeMillis());
  final StatusOutputStream<BaseB2Response> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  return new Path(file.getParent(), file.getName(), file.getType(),
    new B2AttributesFinderFeature(session, fileid).toAttributes((B2FileResponse) out.getStatus()));
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  status.setLength(0L);
  final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  final StorageObject metadata = out.getStatus();
  return new Path(file.getParent(), file.getName(), file.getType(),
    new SwiftAttributesFinderFeature(session, regionService).toAttributes(metadata));
}
origin: iterate-ch/cyberduck

  @Override
  public void setClass(final Path file, final String redundancy) throws BackgroundException {
    if(containerService.isContainer(file)) {
      final String key = String.format("s3.storageclass.%s", containerService.getContainer(file).getName());
      preferences.setProperty(key, redundancy);
    }
    if(file.isFile() || file.isPlaceholder()) {
      try {
        final S3ThresholdCopyFeature copy = new S3ThresholdCopyFeature(session);
        final TransferStatus status = new TransferStatus();
        status.setLength(file.attributes().getSize());
        status.setStorageClass(redundancy);
        copy.copy(file, file, status, new DisabledConnectionCallback());
      }
      catch(NotfoundException e) {
        if(file.isPlaceholder()) {
          // No placeholder file may exist but we just have a common prefix
          return;
        }
        throw e;
      }
    }
  }
}
origin: iterate-ch/cyberduck

/**
 * @param file    File to copy with new setting or bucket to change default preference
 * @param setting A supported algorithm for server side encryption
 */
@Override
public void setEncryption(final Path file, final Algorithm setting) throws BackgroundException {
  if(containerService.isContainer(file)) {
    final String key = String.format("s3.encryption.key.%s", containerService.getContainer(file).getName());
    preferences.setProperty(key, setting.toString());
  }
  if(file.isFile() || file.isPlaceholder()) {
    try {
      final S3ThresholdCopyFeature copy = new S3ThresholdCopyFeature(session);
      // Copy item in place to write new attributes
      final TransferStatus status = new TransferStatus();
      status.setEncryption(setting);
      status.setLength(file.attributes().getSize());
      copy.copy(file, file, status, new DisabledConnectionCallback());
    }
    catch(NotfoundException e) {
      if(file.isPlaceholder()) {
        // No placeholder file may exist but we just have a common prefix
        return;
      }
      throw e;
    }
  }
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  if(Checksum.NONE == status.getChecksum()) {
    status.setChecksum(writer.checksum(file).compute(new NullInputStream(0L), status));
  }
  new DefaultStreamCloser().close(writer.write(file, status, new DisabledConnectionCallback()));
  return new Path(file.getParent(), file.getName(), file.getType(), new AzureAttributesFinderFeature(session, context).find(file));
}
origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  if(containerService.isContainer(folder)) {
    final S3BucketCreateService service = new S3BucketCreateService(session);
    service.create(folder, StringUtils.isBlank(region) ? PreferencesFactory.get().getProperty("s3.location") : region);
    return folder;
  }
  else {
    if(Checksum.NONE == status.getChecksum()) {
      status.setChecksum(writer.checksum(folder).compute(new NullInputStream(0L), status));
    }
    // Add placeholder object
    status.setMime(MIMETYPE);
    final EnumSet<AbstractPath.Type> type = EnumSet.copyOf(folder.getType());
    type.add(Path.Type.placeholder);
    final StatusOutputStream<StorageObject> out = writer.write(new Path(folder.getParent(), folder.getName(), type,
      new PathAttributes(folder.attributes())), status, new DisabledConnectionCallback());
    new DefaultStreamCloser().close(out);
    final StorageObject metadata = out.getStatus();
    return new Path(folder.getParent(), folder.getName(), type,
      new S3AttributesFinderFeature(session).toAttributes(metadata));
  }
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  if(Checksum.NONE == status.getChecksum()) {
    status.setChecksum(writer.checksum(file).compute(new NullInputStream(0L), status));
  }
  status.setLength(0L);
  final StatusOutputStream<StorageObject> out = writer.write(file, status, new DisabledConnectionCallback());
  new DefaultStreamCloser().close(out);
  final S3Object metadata = (S3Object) out.getStatus();
  return new Path(file.getParent(), file.getName(), file.getType(),
    new S3AttributesFinderFeature(session).toAttributes(metadata));
}
origin: iterate-ch/cyberduck

@Override
public Path touch(final Path file, final TransferStatus status) throws BackgroundException {
  try {
    if(nodeid.isEncrypted(file)) {
      nodeid.setFileKey(status);
    }
    final StatusOutputStream<VersionId> out = writer.write(file, status, new DisabledConnectionCallback());
    out.close();
    return new Path(file.getParent(), file.getName(), file.getType(),
      new PathAttributes(file.attributes()).withVersionId(out.getStatus().id));
  }
  catch(IOException e) {
    throw new DefaultIOExceptionMappingService().map("Cannot create file {0}", e, file);
  }
}
origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    final BlobRequestOptions options = new BlobRequestOptions();
    if(containerService.isContainer(folder)) {
      // Container name must be lower case.
      final CloudBlobContainer container = session.getClient().getContainerReference(containerService.getContainer(folder).getName());
      container.create(options, context);
      return new Path(folder.getParent(), folder.getName(), folder.getType(), new AzureAttributesFinderFeature(session, context).find(folder));
    }
    else {
      if(Checksum.NONE == status.getChecksum()) {
        status.setChecksum(writer.checksum(folder).compute(new NullInputStream(0L), status));
      }
      final EnumSet<AbstractPath.Type> type = EnumSet.copyOf(folder.getType());
      type.add(Path.Type.placeholder);
      final Path placeholder = new Path(folder.getParent(), folder.getName(), type,
        new PathAttributes(folder.attributes()));
      new DefaultStreamCloser().close(writer.write(placeholder, status, new DisabledConnectionCallback()));
      return new Path(placeholder.getParent(), placeholder.getName(), placeholder.getType(), new AzureAttributesFinderFeature(session, context).find(placeholder));
    }
  }
  catch(URISyntaxException e) {
    throw new NotfoundException(e.getMessage(), e);
  }
  catch(StorageException e) {
    throw new AzureExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
}
origin: iterate-ch/cyberduck

final StatusOutputStream<BaseB2Response> out = writer.write(folder, status, new DisabledConnectionCallback());
new DefaultStreamCloser().close(out);
final EnumSet<AbstractPath.Type> type = EnumSet.copyOf(folder.getType());
origin: iterate-ch/cyberduck

@Override
public Path mkdir(final Path folder, final String region, final TransferStatus status) throws BackgroundException {
  try {
    if(containerService.isContainer(folder)) {
      // Create container at top level
      session.getClient().createContainer(regionService.lookup(
        new SwiftLocationFeature.SwiftRegion(region)), folder.getName());
      return new Path(folder.getParent(), folder.getName(), folder.getType(),
        new SwiftAttributesFinderFeature(session, regionService).find(folder));
    }
    else {
      status.setMime("application/directory");
      status.setLength(0L);
      final StatusOutputStream<StorageObject> out = writer.write(folder, status, new DisabledConnectionCallback());
      new DefaultStreamCloser().close(out);
      final StorageObject metadata = out.getStatus();
      return new Path(folder.getParent(), folder.getName(), folder.getType(),
        new SwiftAttributesFinderFeature(session, regionService).toAttributes(metadata));
    }
  }
  catch(GenericException e) {
    throw new SwiftExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
  catch(IOException e) {
    throw new DefaultIOExceptionMappingService().map("Cannot create folder {0}", e, folder);
  }
}
ch.cyberduck.coreDisabledConnectionCallback<init>

Popular methods of DisabledConnectionCallback

    Popular in Java

    • Parsing JSON documents to java classes using gson
    • onCreateOptionsMenu (Activity)
    • compareTo (BigDecimal)
    • getOriginalFilename (MultipartFile)
      Return the original filename in the client's filesystem.This may contain path information depending
    • Component (java.awt)
      A component is an object having a graphical representation that can be displayed on the screen and t
    • Socket (java.net)
      Provides a client-side TCP socket.
    • SocketTimeoutException (java.net)
      This exception is thrown when a timeout expired on a socket read or accept operation.
    • Date (java.util)
      A specific moment in time, with millisecond precision. Values typically come from System#currentTime
    • HashSet (java.util)
      HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
    • BoxLayout (javax.swing)
    • Best plugins for Eclipse
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now