use of org.jclouds.blobstore.BlobMap in project archaius by Netflix.
the class BlobStoreConfigurationSource method poll.
@Override
public PollResult poll(boolean initial, Object checkPoint) throws Exception {
String container = containerName.get();
BlobMap blobs = ctx.createBlobMap(container);
Map<String, Object> props = ImmutableMap.copyOf(filterValues(transformEntries(blobs, toStringOrNull), notNull()));
log.info("{}: {} properties in container {}", new Object[] { ctx.unwrap().getName(), props.size(), container });
return PollResult.createFull(props);
}
use of org.jclouds.blobstore.BlobMap in project qi4j-sdk by Qi4j.
the class JCloudsMapEntityStoreMixin method applyChanges.
@Override
public void applyChanges(MapChanges changes) throws IOException {
final BlobMap blobMap = storeContext.createBlobMap(container);
changes.visitMap(new MapChanger() {
@Override
public Writer newEntity(final EntityReference ref, EntityDescriptor entityDescriptor) throws IOException {
return new StringWriter() {
@Override
public void close() throws IOException {
super.close();
Blob blob = blobMap.blobBuilder().payload(toString()).build();
blobMap.put(ref.identity(), blob);
}
};
}
@Override
public Writer updateEntity(final EntityReference ref, EntityDescriptor entityDescriptor) throws IOException {
if (!blobMap.containsKey(ref.identity())) {
throw new EntityNotFoundException(ref);
}
return new StringWriter() {
@Override
public void close() throws IOException {
super.close();
Blob blob = blobMap.blobBuilder().payload(toString()).build();
blobMap.put(ref.identity(), blob);
}
};
}
@Override
public void removeEntity(EntityReference ref, EntityDescriptor entityDescriptor) throws EntityNotFoundException {
if (!blobMap.containsKey(ref.identity())) {
throw new EntityNotFoundException(ref);
}
blobMap.remove(ref.identity());
}
});
}
Aggregations