本文整理汇总了Java中org.jclouds.blobstore.BlobStore.removeBlob方法的典型用法代码示例。如果您正苦于以下问题:Java BlobStore.removeBlob方法的具体用法?Java BlobStore.removeBlob怎么用?Java BlobStore.removeBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jclouds.blobstore.BlobStore
的用法示例。
在下文中一共展示了BlobStore.removeBlob方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unregisterAddress
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private void unregisterAddress(String cluster, InetSocketAddress address) {
try (BlobStoreContext ctx = createContext()) {
BlobStore store = ctx.getBlobStore();
String file = cluster + '/' + AddressUtils.toFileName(address);
try {
if (store.blobExists(container, file)) {
store.removeBlob(container, file);
if (log.isInfoEnabled()) {
log.info("Unregistered address from the cloud store [container={}, file={}]", container, file);
}
}
} catch (ResourceNotFoundException | HttpResponseException e) {
if (log.isWarnEnabled()) {
log.warn("Failed to unregister the seed node address from the cloud store "
+ "[container={}, file={}, cause={}]", container, file, e.toString());
}
}
}
}
示例2: moveFile
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
/**
* Move a file from one AWS S3 folder to another.
*
* @param blobStore the blob store
* @param sourceKey the file source location
* @param destinationFolder the destination folder
* @return the destination key of the moved file
* @throws KeyNotFoundException if a key is not found
*/
@GuardedBy("ThreadLocal blobStore")
private String moveFile(final BlobStore blobStore, final String sourceKey,
final String destinationFolder) throws KeyNotFoundException {
final Blob blob = blobStore.getBlob(config.getS3().getBucket(), sourceKey);
if (blob != null) {
final String destinationKey = destinationFolder + "/"
+ sourceKey.substring(sourceKey.lastIndexOf('/') + 1);
blob.getMetadata().setName(destinationKey);
blobStore.putBlob(config.getS3().getBucket(), blob);
blobStore.removeBlob(config.getS3().getBucket(), sourceKey);
return destinationKey;
} else {
throw new KeyNotFoundException(sourceKey, config.getS3().getBucket(), "Error while moving file.");
}
}
示例3: handleAbortMultipartUpload
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private static void handleAbortMultipartUpload(HttpServletResponse response,
BlobStore blobStore, String containerName, String blobName,
String uploadId) throws IOException, S3Exception {
if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType(
blobStore))) {
if (!blobStore.blobExists(containerName, uploadId)) {
throw new S3Exception(S3ErrorCode.NO_SUCH_UPLOAD);
}
blobStore.removeBlob(containerName, uploadId);
}
// TODO: how to reconstruct original mpu?
MultipartUpload mpu = MultipartUpload.create(containerName,
blobName, uploadId, createFakeBlobMetadata(blobStore),
new PutOptions());
blobStore.abortMultipartUpload(mpu);
response.sendError(HttpServletResponse.SC_NO_CONTENT);
}
示例4: delete
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean delete(String id, String root, String filePath) {
ContainerAndName can = getContainerAndName(id, root, filePath);
BlobStore store = getBlobStore();
if (!store.blobExists(can.container, can.name)) {
return false;
} else {
store.removeBlob(can.container, can.name);
deleteContainerIfEmpty(can.container);
return true;
}
}
示例5: removeBlob
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
/**
* Remove a specific blob from a {@link BlobStore}
*/
public static void removeBlob(BlobStore blobStore, String container, String blobName) throws IOException {
if (!Strings.isNullOrEmpty(blobName)) {
blobStore.removeBlob(container, blobName);
}
}
示例6: deleteObject
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
@DELETE
public Response deleteObject(@NotNull @PathParam("account") String account,
@NotNull @PathParam("container") String container,
@NotNull @Encoded @PathParam("object") String objectName,
@QueryParam("multipart-manifest") String multipartManifest,
@HeaderParam("X-Auth-Token") String authToken) throws IOException {
if (objectName.length() > InfoResource.CONFIG.swift.max_object_name_length) {
return badRequest();
}
BlobStore store = getBlobStore(authToken).get(container, objectName);
if ("delete".equals(multipartManifest)) {
Blob blob;
try {
blob = store.getBlob(container, objectName);
} catch (ContainerNotFoundException cnfe) {
blob = null;
}
if (blob == null) {
return Response.status(Response.Status.OK)
.entity("{\"Number Not Found\": 1" +
", \"Response Status\": \"404 Not Found\"" +
// TODO: JSON encode container and objectName
", \"Errors\": [[\"/" + container + "/" + objectName + "\", \"Not found\"]]" +
", \"Number Deleted\": 0" +
", \"Response Body\": \"\"}")
.build();
}
if (!blob.getMetadata().getUserMetadata().containsKey(STATIC_OBJECT_MANIFEST)) {
return Response.status(Response.Status.OK)
.entity("{\"Number Not Found\": 0" +
", \"Response Status\": \"400 Bad Request\"" +
// TODO: JSON encode container and objectName
", \"Errors\": [[\"/" + container + "/" + objectName + "\", \"Not an SLO manifest\"]]" +
", \"Number Deleted\": 0" +
", \"Response Body\": \"\"}")
.build();
}
ManifestEntry[] entries = readSLOManifest(blob.getPayload().openStream());
Arrays.stream(entries).parallel().forEach(e -> store.removeBlob(e.container, e.object));
store.removeBlob(container, objectName);
return Response.status(Response.Status.OK)
.entity("{\"Number Not Found\": 0" +
", \"Response Status\": \"200 OK\"" +
", \"Errors\": [[]]" +
", \"Number Deleted\": " + entries.length +
", \"Response Body\": \"\"}")
.build();
}
if (!store.containerExists(container)) {
return Response.status(Response.Status.NOT_FOUND).build();
}
BlobMetadata meta = store.blobMetadata(container, objectName);
if (meta == null) {
return Response.status(Response.Status.NOT_FOUND).build();
}
store.removeBlob(container, objectName);
return Response.noContent()
.type(meta.getContentMetadata().getContentType())
.build();
}
示例7: handleBlobRemove
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
private static void handleBlobRemove(HttpServletResponse response,
BlobStore blobStore, String containerName,
String blobName) throws IOException, S3Exception {
blobStore.removeBlob(containerName, blobName);
response.sendError(HttpServletResponse.SC_NO_CONTENT);
}
示例8: removeBlob
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
@Override
public void removeBlob(String s, String s1) {
for (BlobStore blobStore : getCheckedStores()) {
blobStore.removeBlob(s, s1);
}
}
示例9: moveBlob
import org.jclouds.blobstore.BlobStore; //导入方法依赖的package包/类
static void moveBlob(BlobStore from, BlobStore to,
String containerNameFrom, String containerNameTo, String blobName)
throws IOException {
copyBlob(from, to, containerNameFrom, containerNameTo, blobName);
from.removeBlob(containerNameFrom, blobName);
}