public void run() { try { AtmosObject object = future.get(); checkNotNull(object.getSystemMetadata(), object + " has no content metadata"); if (object.getSystemMetadata().getContentMD5() != null) { if (Arrays.equals(toSearch, object.getSystemMetadata().getContentMD5())) { queue.put(true); } } else { logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID()); } } catch (InterruptedException e) { Throwables.propagate(e); } catch (ExecutionException e) { Throwables.propagate(e); } } }, userExecutor);
public void run() { try { AtmosObject object = future.get(); checkNotNull(object.getSystemMetadata(), object + " has no content metadata"); if (object.getSystemMetadata().getContentMD5() != null) { if (Arrays.equals(toSearch, object.getSystemMetadata().getContentMD5())) { queue.put(true); } } else { logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID()); } } catch (InterruptedException e) { Throwables.propagate(e); } catch (ExecutionException e) { Throwables.propagate(e); } } }, userExecutor);
public void run() { try { AtmosObject object = future.get(); checkNotNull(object.getSystemMetadata(), object + " has no content metadata"); if (object.getSystemMetadata().getContentMD5() != null) { if (Arrays.equals(toSearch, object.getSystemMetadata().getContentMD5())) { queue.put(true); } } else { logger.debug("object %s has no content md5", object.getSystemMetadata().getObjectID()); } } catch (InterruptedException e) { Throwables.propagate(e); } catch (ExecutionException e) { Throwables.propagate(e); } } }, userExecutor);
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
@Override public String apply(Object input) { checkArgument(checkNotNull(input, "input") instanceof AtmosObject, "this function is only valid for AtmosObjects!"); AtmosObject object = AtmosObject.class.cast(input); return checkNotNull(object.getContentMetadata().getName() != null ? object.getContentMetadata().getName() : object.getSystemMetadata().getObjectName(), "objectName"); }
public MutableBlobMetadata apply(AtmosObject from) { if (from == null) return null; MutableBlobMetadata to = new MutableBlobMetadataImpl(); to.setId(from.getSystemMetadata().getObjectID()); to.setLastModified(from.getSystemMetadata().getLastUserDataModification()); HttpUtils.copy(from.getContentMetadata(), to.getContentMetadata()); to.setName(objectName.apply(from)); to.setUri(from.getContentMetadata().getUri()); to.setContainer(Iterables.get(Splitter.on('/').split(from.getContentMetadata().getPath()), 0)); if (from.getAllHeaders().containsEntry("x-emc-groupacl", "other=READ")) to.setPublicUri(shareUrl.apply(from.getContentMetadata().getPath())); if (from.getSystemMetadata().getType() == FileType.DIRECTORY) { to.setType(StorageType.FOLDER); } else { to.setType(StorageType.BLOB); } Map<String, String> lowerKeyMetadata = Maps.newHashMap(); for (Entry<String, String> entry : from.getUserMetadata().getMetadata().entrySet()) { String key = entry.getKey().toLowerCase(); if (!systemMetadata.contains(key)) lowerKeyMetadata.put(key, entry.getValue()); } to.setUserMetadata(lowerKeyMetadata); to.setSize(from.getContentMetadata().getContentLength()); return to; } }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); object.getContentMetadata().setContentMD5(object.getSystemMetadata().getContentMD5()); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); object.getContentMetadata().setContentMD5(object.getSystemMetadata().getContentMD5()); return object; }
private static void verifyMetadata(String metadataValue, AtmosObject getBlob) { assertEquals(getBlob.getContentMetadata().getContentLength(), Long.valueOf(16)); assert getBlob.getContentMetadata().getContentType().startsWith("text/plain"); assertEquals(getBlob.getUserMetadata().getMetadata().get("Metadata"), metadataValue); SystemMetadata md = getBlob.getSystemMetadata(); assertEquals(md.getSize(), 16); assert md.getGroupID() != null; assertEquals(md.getHardLinkCount(), 1); assert md.getInceptionTime() != null; assert md.getLastAccessTime() != null; assert md.getLastMetadataModification() != null; assert md.getLastUserDataModification() != null; assert md.getObjectID() != null; assertEquals(md.getObjectName(), "object"); assert md.getPolicyName() != null; assertEquals(md.getType(), FileType.REGULAR); assert md.getUserID() != null; try { Strings2.toStringAndClose(URI.create( "http://accesspoint.emccis.com/rest/objects/" + getBlob.getSystemMetadata().getObjectID()).toURL() .openStream()); fail("shouldn't have worked, since it is private"); } catch (IOException e) { } }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
private static void verifyMetadata(String metadataValue, AtmosObject getBlob) { assertEquals(getBlob.getContentMetadata().getContentLength(), Long.valueOf(16)); assert getBlob.getContentMetadata().getContentType().startsWith("text/plain"); assertEquals(getBlob.getUserMetadata().getMetadata().get("Metadata"), metadataValue); SystemMetadata md = getBlob.getSystemMetadata(); assertEquals(md.getSize(), 16); assert md.getGroupID() != null; assertEquals(md.getHardLinkCount(), 1); assert md.getInceptionTime() != null; assert md.getLastAccessTime() != null; assert md.getLastMetadataModification() != null; assert md.getLastUserDataModification() != null; assert md.getObjectID() != null; assertEquals(md.getObjectName(), "object"); assert md.getPolicyName() != null; assertEquals(md.getType(), FileType.REGULAR); assert md.getUserID() != null; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }
/** * First, calls {@link ParseSystemAndUserMetadataFromHeaders}. * * Then, sets the object size based on the Content-Length header and adds the content to the * {@link AtmosObject} result. * * @throws org.jclouds.http.HttpException */ public AtmosObject apply(HttpResponse from) { checkNotNull(from, "http response"); AtmosObject object = objectProvider.create(systemMetadataParser.apply(from), userMetadataParser.apply(from)); object.getContentMetadata().setName(object.getSystemMetadata().getObjectName()); object.getContentMetadata().setPath(path); object.getContentMetadata().setUri(uri); object.getAllHeaders().putAll(from.getHeaders()); object.setPayload(from.getPayload()); object.getContentMetadata().setContentLength(attemptToParseSizeAndRangeFromHeaders(from)); return object; }