cache.put(comp, new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0); else return false;
public String toString() { boolean is_file=Util.isFlagSet(flags, FILE); StringBuilder sb=new StringBuilder(); sb.append(getType()); if(is_file) sb.append(", len=" + Util.printBytes(length) + ", chunk_size=" + chunk_size); sb.append(", mod_time=" + new Date(modification_time)); return sb.toString(); }
void setLength(int new_length) { Metadata metadata=cache.get(getPath()); if(metadata != null) { metadata.length=new_length; metadata.setModificationTime(System.currentTimeMillis()); cache.put(getPath(), metadata, (short)-1, 0, false); } else System.err.println("metadata for " + getPath() + " not found !"); }
cache.put(comp, new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0); else return false;
public boolean isFile() { Metadata val=cache.get(getPath()); return val.isFile(); }
public boolean isDirectory() { Metadata val=cache.get(getPath()); return val.isDirectory(); }
private boolean isFile(String key) { Metadata val=cache.get(key); return val.isFile(); }
public boolean mkdirs() { try { boolean parents_exist=checkParentDirs(getPath(), true); if(!parents_exist) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0, true); return true; } catch(IOException e) { return false; } }
void setLength(int new_length) { Metadata metadata=cache.get(getPath()); if(metadata != null) { metadata.length=new_length; metadata.setModificationTime(System.currentTimeMillis()); cache.put(getPath(), metadata, (short)-1, 0, false); } else System.err.println("metadata for " + getPath() + " not found !"); }
public boolean createNewFile() throws IOException { if(exists()) return true; if(!checkParentDirs(getPath(), false)) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.FILE), (short)-1, 0, true); return true; }
public String toString() { boolean is_file=Util.isFlagSet(flags, FILE); StringBuilder sb=new StringBuilder(); sb.append(getType()); if(is_file) sb.append(", len=" + Util.printBytes(length) + ", chunk_size=" + chunk_size); sb.append(", mod_time=" + new Date(modification_time)); return sb.toString(); }
public void remove(String path, boolean synchronous) { if(path == null) return; GridFile.Metadata md=metadata.get(path); if(md == null) return; int num_chunks=md.getLength() / md.getChunkSize() + 1; for(int i=0; i < num_chunks; i++) data.remove(path + ".#" + i, synchronous); } }
public boolean mkdir() { try { boolean parents_exist=checkParentDirs(getPath(), false); if(!parents_exist) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0, true); return true; } catch(IOException e) { e.printStackTrace(); return false; } }
protected void initMetadata() { Metadata metadata=cache.get(getPath()); if(metadata != null) this.chunk_size=metadata.getChunkSize(); }
private boolean isFile(String key) { Metadata val=cache.get(key); return val.isFile(); }
public boolean isFile() { Metadata val=cache.get(getPath()); return val.isFile(); }
public boolean isDirectory() { Metadata val=cache.get(getPath()); return val.isDirectory(); }
public boolean mkdir() { try { boolean parents_exist=checkParentDirs(getPath(), false); if(!parents_exist) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0, true); return true; } catch(IOException e) { e.printStackTrace(); return false; } }
public boolean mkdirs() { try { boolean parents_exist=checkParentDirs(getPath(), true); if(!parents_exist) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.DIR), (short)-1, 0, true); return true; } catch(IOException e) { return false; } }
public boolean createNewFile() throws IOException { if(exists()) return true; if(!checkParentDirs(getPath(), false)) return false; cache.put(getPath(), new Metadata(0, System.currentTimeMillis(), chunk_size, Metadata.FILE), (short)-1, 0, true); return true; }