@Override public LocalFileItem getFileItem(File file) { FileDesc fileDesc = getCoreCollection().getFileDesc(file); if (fileDesc != null) { return (LocalFileItem) fileDesc.getClientProperty(FILE_ITEM_PROPERTY); } return null; }
private LocalFileItem getOrCreateLocalFileItem(FileDesc fileDesc) { LocalFileItem item; Object object = fileDesc.getClientProperty(FILE_ITEM_PROPERTY); if (object != null) { item = (LocalFileItem) object; } else { item = fileItemFactory.createCoreLocalFileItem(fileDesc); fileDesc.putClientProperty(FILE_ITEM_PROPERTY, item); } return item; }
/** Notification that meta information has changed in the filedesc. */ protected void updateFileDesc(FileDesc fd) { LocalFileItem item = (LocalFileItem) fd.getClientProperty(FILE_ITEM_PROPERTY); if (item != null) { threadSafeList.getReadWriteLock().writeLock().lock(); try { int idx = threadSafeList.indexOf(item); if (idx > 0) { threadSafeList.set(idx, item); } else { LOG.warnf( "Attempted to update FD w/ LocalFileItem that is not in list anymore. Item {0}", item); } } finally { threadSafeList.getReadWriteLock().writeLock().unlock(); } } else { LOG.warnf("Attempted to update FD without LocalFileItem, FD {0}", fd); } }
@Override protected LocalFileItem convertSource(FileDesc source) { return (LocalFileItem) source.getClientProperty(FILE_ITEM_PROPERTY); }
protected void removeFileDesc(FileDesc fd) { LocalFileItem item = (LocalFileItem) fd.getClientProperty(FILE_ITEM_PROPERTY); threadSafeList.remove(item); }