Tabnine Logo
org.jets3t.service.model
Code IndexAdd Tabnine to your IDE (free)

How to use org.jets3t.service.model

Best Java code snippets using org.jets3t.service.model (Showing top 20 results out of 315)

origin: Alluxio/alluxio

@Override
protected boolean createEmptyObject(String key) {
 try {
  GSObject obj = new GSObject(key);
  obj.setDataInputStream(new ByteArrayInputStream(new byte[0]));
  obj.setContentLength(0);
  obj.setMd5Hash(DIR_HASH);
  obj.setContentType(Mimetypes.MIMETYPE_BINARY_OCTET_STREAM);
  mClient.putObject(mBucketName, obj);
  return true;
 } catch (ServiceException e) {
  LOG.error("Failed to create directory: {}", key, e);
  return false;
 }
}
origin: Alluxio/alluxio

@Override
public ObjectStatus[] getObjectStatuses() {
 StorageObject[] objects = mChunk.getObjects();
 ObjectStatus[] ret = new ObjectStatus[objects.length];
 for (int i = 0; i < ret.length; ++i) {
  ret[i] = new ObjectStatus(objects[i].getKey(), objects[i].getMd5HashAsBase64(),
    objects[i].getContentLength(), objects[i].getLastModifiedDate().getTime());
 }
 return ret;
}
origin: Alluxio/alluxio

@Override
protected ObjectStatus getObjectStatus(String key) {
 try {
  GSObject meta = mClient.getObjectDetails(mBucketName, key);
  if (meta == null) {
   return null;
  }
  return new ObjectStatus(key, meta.getMd5HashAsBase64(), meta.getContentLength(),
    meta.getLastModifiedDate().getTime());
 } catch (ServiceException e) {
  return null;
 }
}
origin: net.java.dev.jets3t/jets3t

protected StorageObject newObject() {
  if (isGoogleStorageMode) {
    return new GSObject();
  } else {
    return new S3Object();
  }
}
origin: Alluxio/alluxio

 @Override
 public void close() throws IOException {
  if (mClosed.getAndSet(true)) {
   return;
  }
  mLocalOutputStream.close();
  try {
   GSObject obj = new GSObject(mKey);
   obj.setBucketName(mBucketName);
   obj.setDataInputFile(mFile);
   obj.setContentLength(mFile.length());
   obj.setContentType(Mimetypes.MIMETYPE_BINARY_OCTET_STREAM);
   if (mHash != null) {
    obj.setMd5Hash(mHash.digest());
   } else {
    LOG.warn("MD5 was not computed for: {}", mKey);
   }
   mClient.putObject(mBucketName, obj);
   if (!mFile.delete()) {
    LOG.error("Failed to delete temporary file @ {}", mFile.getPath());
   }
  } catch (ServiceException e) {
   LOG.error("Failed to upload {}. Temporary file @ {}", mKey, mFile.getPath());
   throw new IOException(e);
  }
 }
}
origin: opentripplanner/OpenTripPlanner

S3Object object = s3Service.getObject(awsBucketName, key);
InputStream istream = object.getDataInputStream();
FileOutputStream ostream = new FileOutputStream(path);
origin: net.java.dev.jets3t/jets3t

protected StorageBucket newBucket() {
  if (isGoogleStorageMode) {
    return new GSBucket();
  } else {
    return new S3Bucket();
  }
}
origin: Alluxio/alluxio

String accountOwner = "unknown";
if (storageOwner != null) {
 accountOwnerId = storageOwner.getId();
  owner = storageOwner.getDisplayName();
origin: net.java.dev.jets3t/jets3t

protected StorageOwner newOwner() {
  if (isGoogleStorageMode) {
    return new GSOwner();
  } else {
    return new S3Owner();
  }
}
origin: Alluxio/alluxio

@Override
protected boolean copyObject(String src, String dst) {
 LOG.debug("Copying {} to {}", src, dst);
 GSObject obj = new GSObject(dst);
 // Retry copy for a few times, in case some Jets3t or GCS internal errors happened during copy.
 int retries = 3;
 for (int i = 0; i < retries; i++) {
  try {
   mClient.copyObject(mBucketName, src, mBucketName, obj, false);
   return true;
  } catch (ServiceException e) {
   LOG.error("Failed to copy file {} to {}", src, dst, e);
   if (i != retries - 1) {
    LOG.error("Retrying copying file {} to {}", src, dst);
   }
  }
 }
 LOG.error("Failed to copy file {} to {}, after {} retries", src, dst, retries);
 return false;
}
origin: Alluxio/alluxio

/**
 * Creates a new instance of {@link GCSInputStream}, at a specific position.
 *
 * @param bucketName the name of the bucket
 * @param key the key of the file
 * @param client the client for GCS
 * @param pos the position to start
 * @throws ServiceException if a service exception occurs
 */
GCSInputStream(String bucketName, String key, GoogleStorageService client, long pos)
  throws ServiceException {
 mBucketName = bucketName;
 mKey = key;
 mClient = client;
 mPos = pos;
 // For an empty file setting start pos = 0 will throw a ServiceException
 if (mPos > 0) {
  mObject = mClient.getObject(mBucketName, mKey, null, null, null, null, mPos, null);
 } else {
  mObject = mClient.getObject(mBucketName, mKey);
 }
 mInputStream = new BufferedInputStream(mObject.getDataInputStream());
}
origin: net.java.dev.jets3t/jets3t

  @Override
  public int hashCode() {
    int result = transition != null ? transition.hashCode() : 0;
    result = 31 * result + (expiration != null ? expiration.hashCode() : 0);
    return result;
  }
}
origin: net.java.dev.jets3t/jets3t

public void startExpiration() {
  latestTimeEvent = config.new Expiration();
  latestRule.setExpiration(((Expiration)latestTimeEvent));
}
origin: net.java.dev.jets3t/jets3t

public void startTransition() {
  latestTimeEvent = config.new Transition();
  latestRule.setTransition(((Transition)latestTimeEvent));
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

protected StorageObject newObject() {
  if (isGoogleStorageMode) {
    return new GSObject();
  } else {
    return new S3Object();
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

protected StorageBucket newBucket() {
  if (isGoogleStorageMode) {
    return new GSBucket();
  } else {
    return new S3Bucket();
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

protected StorageOwner newOwner() {
  if (isGoogleStorageMode) {
    return new GSOwner();
  } else {
    return new S3Owner();
  }
}
origin: Alluxio/alluxio

 /**
  * This method leverages the ability to open a stream from GCS from a given offset. When the
  * underlying stream has fewer bytes buffered than the skip request, the stream is closed, and
  * a new stream is opened starting at the requested offset.
  *
  * @param n number of bytes to skip
  * @return the number of bytes skipped
  */
 @Override
 public long skip(long n) throws IOException {
  if (mInputStream.available() >= n) {
   return mInputStream.skip(n);
  }
  // The number of bytes to skip is possibly large, open a new stream from GCS.
  mInputStream.close();
  mPos += n;
  try {
   mObject = mClient.getObject(mBucketName, mKey, null /* ignore ModifiedSince */,
     null /* ignore UnmodifiedSince */, null /* ignore MatchTags */,
     null /* ignore NoneMatchTags */, mPos /* byteRangeStart */,
     null /* ignore byteRangeEnd */);
   mInputStream = new BufferedInputStream(mObject.getDataInputStream());
  } catch (ServiceException e) {
   throw new IOException(e);
  }
  return n;
 }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

  @Override
  public int hashCode() {
    int result = transition != null ? transition.hashCode() : 0;
    result = 31 * result + (expiration != null ? expiration.hashCode() : 0);
    return result;
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jets3t

public void startExpiration() {
  latestTimeEvent = config.new Expiration();
  latestRule.setExpiration(((Expiration)latestTimeEvent));
}
org.jets3t.service.model

Most used classes

  • S3Object
    An S3 object.
  • S3Bucket
    Represents an S3 bucket.
  • StorageObject
    A generic storage object.
  • GSObject
    A Google Storage object.
  • S3Owner
    Represents an S3 owner object with a canonical ID and, optionally, a display name.
  • WebsiteConfig,
  • BaseVersionOrDeleteMarker,
  • GSBucketLoggingStatus,
  • GSWebsiteConfig,
  • LifecycleConfig$Expiration,
  • LifecycleConfig$Rule,
  • LifecycleConfig$Transition,
  • LifecycleConfig,
  • MultipartCompleted,
  • MultipartPart$PartNumberComparator,
  • MultipartPart,
  • MultipartUpload,
  • MultipleDeleteResult$ErrorResult,
  • MultipleDeleteResult
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