System.out.println("StorageClass: " + blob.getStorageClass()); System.out.println("TimeCreated: " + new Date(blob.getCreateTime())); System.out.println("Last Metadata Update: " + new Date(blob.getUpdateTime())); Boolean temporaryHoldIsEnabled = (blob.getTemporaryHold() != null && blob.getTemporaryHold()); System.out.println("temporaryHold: " + (temporaryHoldIsEnabled ? "enabled" : "disabled"));
do { for (Blob blob : blobPages.getValues()) { long lastModified = blob.getUpdateTime(); if (lastModified < currentTimestamp || lastModified == currentTimestamp && currentKeys.contains(blob.getName())) { if (blob.getUpdateTime() != null) { attributes.put(UPDATE_TIME_ATTR, String.valueOf(blob.getUpdateTime()));
if (blob.getUpdateTime() != null) { attributes.put(UPDATE_TIME_ATTR, String.valueOf(blob.getUpdateTime()));
if (blob.getUpdateTime() != null) { attributes.put(UPDATE_TIME_ATTR, String.valueOf(blob.getUpdateTime()));
assertEquals(SELF_LINK, blob.getSelfLink()); assertEquals(SIZE, blob.getSize()); assertEquals(UPDATE_TIME, blob.getUpdateTime()); assertEquals(storage.getOptions(), blob.getStorage().getOptions()); assertFalse(blob.isDirectory()); assertNull(blob.getSelfLink()); assertEquals(0L, (long) blob.getSize()); assertNull(blob.getUpdateTime()); assertTrue(blob.isDirectory());
private static String getLastModifiedTimestamp(Blob blob) { if (blob.isDirectory()) { return "-"; } SimpleDateFormat dateFormat = new SimpleDateFormat("M/d/yy h:mm a"); return dateFormat.format(new Date(blob.getUpdateTime())); }
@Override public long lastModified() throws IOException { return throwExceptionForNullBlob(getBlob()).getUpdateTime(); }
@Override public long lastModified() throws IOException { return throwExceptionForNullBlob(getBlob()).getUpdateTime(); }
/** * Lists Blobs prefixed with `path`. * Prefix `path` is removed from the name of returned entries. * e.g. * If `path` equals gs://bucket/infix and 2 Blobs exist: "gs://bucket/infix/blob1, gs://bucket/infix/blob2, * the returned array contains of Persist Entries with names set to blob1 and blob2, respectively. */ @Override public PersistEntry[] list(String path) { final String bk[] = split(path); int substrLen = bk.length == 2 ? bk[1].length() : 0; List<PersistEntry> results = new ArrayList<>(); try { for (Blob b : storageProvider.getStorage().list(bk[0]).iterateAll()) { if (bk.length == 1 || (bk.length == 2 && b.getName().startsWith(bk[1]))) { String relativeName = b.getName().substring(substrLen); if (relativeName.startsWith("/")) { relativeName = relativeName.substring(1); } results.add(new PersistEntry(relativeName, b.getSize(), b.getUpdateTime())); } } } catch (StorageException e) { Log.err(e); } return results.toArray(new PersistEntry[results.size()]); }
@Before public void setUp() { GcsTestUtils.setupVirtualFileWithBucketMocks(bucketVirtualFile); when(loginService.isLoggedIn()).thenReturn(true); when(directoryBlob.isDirectory()).thenReturn(true); when(directoryBlob.getName()).thenReturn(DIR_NAME); when(binaryBlob.isDirectory()).thenReturn(false); when(binaryBlob.getName()).thenReturn(BLOB_NAME); when(binaryBlob.getSize()).thenReturn(1024L); when(binaryBlob.getContentType()).thenReturn(BLOB_CONTENT_TYPE); when(binaryBlob.getUpdateTime()).thenReturn(0L); when(binaryBlobInDirectory.getName()).thenReturn(NESTED_BLOB_FULL_NAME); // TODO: consider shutting down timer instead when clear what is creating the timer. ThreadTracker.longRunningThreadCreated(ApplicationManager.getApplication(), "Timer-0"); }