本文整理了Java中org.jclouds.blobstore.BlobStore.putBlob()
方法的一些代码示例,展示了BlobStore.putBlob()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlobStore.putBlob()
方法的具体详情如下:
包路径:org.jclouds.blobstore.BlobStore
类名称:BlobStore
方法名:putBlob
[英]Adds a Blob representing the data at location container/blob.metadata.name
[中]在位置container/Blob处添加表示数据的Blob。元数据。名称
代码示例来源:origin: apache/usergrid
BlobBuilder blobBuilder = blobStore.blobBuilder( filename )
.payload( ephemeral )
.contentMD5(Files.hash( ephemeral, Hashing.md5() ))
.contentType("application/json");
final String uploadedFile = blobStore.putBlob(
bucketName, blob, PutOptions.Builder.multipart() );
代码示例来源:origin: com.googlecode.the-fascinator.plugins/plugin-storage-blobstore
private void writePayloadMetadata(Map<String, String> userMetadata) throws StorageException {
Properties metadata = new Properties();
for (String key : userMetadata.keySet()) {
metadata.setProperty(key, userMetadata.get(key));
}
BlobStore blobStore = BlobStoreClient.getClient();
ByteArrayOutputStream output = new ByteArrayOutputStream();
try {
metadata.store(output, null);
} catch (IOException e) {
throw new StorageException("Failed to write payload metadata", e);
}
InputStream input = new ByteArrayInputStream(output.toByteArray());
Blob metadataBlob = blobStore.blobBuilder(blob.getMetadata().getName() + METADATA_SUFFIX).build();
metadataBlob.setPayload(input);
blobStore.putBlob(BlobStoreClient.getContainerName(), metadataBlob);
}
代码示例来源:origin: apache/usergrid
BlobBuilder blobBuilder = blobStore.blobBuilder( filename )
.payload( uploadFile )
.contentMD5(Files.hash( uploadFile, Hashing.md5()))
.contentType( "application/json" );
final String uploadedFile = blobStore.putBlob( bucketName, blob, PutOptions.Builder.multipart() );
代码示例来源:origin: rackerlabs/blueflood
public void publish(String remoteName, byte[] payload) throws IOException {
Timer.Context ctx = uploadTimer.time();
try {
Blob blob = blobStore.blobBuilder(remoteName).payload(payload)
.contentType("application/json")
.contentEncoding(remoteName.endsWith(".gz") ? "gzip" : "identity")
.calculateMD5().build();
String containerName = CONTAINER_DATE_FORMAT.format(new Date());
if (!lastContainerCreated.matches(containerName)) {
createContainer();
}
blobStore.putBlob(containerName, blob);
} finally {
ctx.stop();
}
}
}
代码示例来源:origin: gaul/s3proxy
ByteSource payload = ByteSource.empty();
BlobBuilder.PayloadBlobBuilder builder = blobStore
.blobBuilder(blobName)
.payload(payload);
addContentMetdataFromHttpRequest(builder, request);
builder.contentLength(payload.size());
blobStore.putBlob(containerName, builder.name(mpu.id()).build(),
options);
代码示例来源:origin: gaul/s3proxy
.blobBuilder(blobName)
.payload(is)
.contentLength(contentLength);
eTag = blobStore.putBlob(containerName, builder.build(),
options);
代码示例来源:origin: gaul/s3proxy
.blobBuilder(blobName)
.payload(payload);
if (contentType != null) {
builder.contentType(contentType);
blobStore.putBlob(containerName, blob);
代码示例来源:origin: jclouds/legacy-jclouds
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: io.cloudsoft.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: org.apache.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.FOLDER)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: org.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.RELATIVE_PATH)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: Nextdoor/bender
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.FOLDER)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: com.amysta.jclouds/jclouds-blobstore
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.FOLDER)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: apache/jclouds
public void execute(String containerName, String directory) {
blobStore.putBlob(
containerName,
blobStore.blobBuilder(directory + directorySuffix).type(StorageType.FOLDER)
.payload(newByteArrayPayload(new byte[] {})).contentType("application/directory").build());
}
}
代码示例来源:origin: org.apache.whirr/whirr-core
@Override
public void save(Cluster cluster) throws IOException {
BlobStore store = context.getBlobStore();
Blob blob = store.blobBuilder(blobName).payload(serialize(cluster)).build();
store.putBlob(container, blob);
LOG.info("Saved cluster state to '{}' ", context.getSigner()
.signGetBlob(container, blobName).getEndpoint().toString());
}
代码示例来源:origin: apache/attic-whirr
@Override
public void save(Cluster cluster) throws IOException {
BlobStore store = context.getBlobStore();
Blob blob = store.blobBuilder(blobName).payload(serialize(cluster)).build();
store.putBlob(container, blob);
LOG.info("Saved cluster state to '{}' ", context.getSigner()
.signGetBlob(container, blobName).getEndpoint().toString());
}
代码示例来源:origin: org.apache.whirr/whirr-core
public synchronized void putIfAbsent(File file) throws FileNotFoundException {
allocateContainer();
BlobStore store = context.getBlobStore();
if (!store.blobExists(container, file.getName())) {
LOG.info("Uploading '{}' to '{}' blob cache.", file.getName(), container);
Blob blob = context.getBlobStore().blobBuilder(container)
.name(file.getName())
.payload(file)
.contentLength(file.length())
.build();
store.putBlob(container, blob, multipart());
}
}
代码示例来源:origin: apache/attic-whirr
public synchronized void putIfAbsent(File file) throws FileNotFoundException {
allocateContainer();
BlobStore store = context.getBlobStore();
if (!store.blobExists(container, file.getName())) {
LOG.info("Uploading '{}' to '{}' blob cache.", file.getName(), container);
Blob blob = context.getBlobStore().blobBuilder(container)
.name(file.getName())
.payload(file)
.contentLength(file.length())
.build();
store.putBlob(container, blob, multipart());
}
}
代码示例来源:origin: org.apache.camel/camel-jclouds
/**
* Writes {@link Payload} to the {@link BlobStore}.
*/
public static void writeBlob(BlobStore blobStore, String container, String blobName, Payload payload) {
if (blobName != null && payload != null) {
mkDirs(blobStore, container, blobName);
Blob blob = blobStore.blobBuilder(blobName).payload(payload).contentType(MediaType.APPLICATION_OCTET_STREAM).contentDisposition(blobName).build();
blobStore.putBlob(container, blob, multipart());
}
}
代码示例来源:origin: apache/jackrabbit-oak
/**
* Uploads the block to the cloud service.
*/
@Override
protected void storeBlock(byte[] digest, int level, byte[] data) throws IOException {
Preconditions.checkNotNull(context);
String id = StringUtils.convertBytesToHex(digest);
cache.put(id, data);
org.jclouds.blobstore.BlobStore blobStore = context.getBlobStore();
if (!blobStore.blobExists(cloudContainer, id)) {
Map<String, String> metadata = Maps.newHashMap();
metadata.put("level", String.valueOf(level));
Blob blob = blobStore.blobBuilder(id)
.payload(data)
.userMetadata(metadata)
.build();
String etag = blobStore.putBlob(cloudContainer, blob, multipart());
LOG.debug("Blob " + id + " created with cloud tag : " + etag);
} else {
LOG.debug("Blob " + id + " already exists");
}
}
内容来源于网络,如有侵权,请联系作者删除!