List of usage examples for org.eclipse.jgit.internal.storage.dfs DfsPackDescription getLastModified
public long getLastModified()
From source file:com.benhumphreys.jgitcassandra.store.ObjStore.java
License:Apache License
/** * Inserts a Pack description into the store. * If a description for this "name" already exists it will be overwritten. * * @param desc the pack description to insert * @throws IOException if an exception occurs when communicating to the * database/*ww w. j a v a2 s . co m*/ */ public void insertDesc(Collection<DfsPackDescription> desc) throws IOException { try { for (DfsPackDescription pd : desc) { Statement stmt = QueryBuilder.insertInto(keyspace, DESC_TABLE_NAME).value("name", pd.toString()) .value("source", pd.getPackSource().ordinal()).value("last_modified", pd.getLastModified()) .value("size_map", DescMapper.getFileSizeMap(pd)).value("object_count", pd.getObjectCount()) .value("delta_count", pd.getDeltaCount()).value("extensions", DescMapper.getExtBits(pd)) .value("index_version", pd.getIndexVersion()); session.execute(stmt); } } catch (RuntimeException e) { e.printStackTrace(); throw new IOException(e); } }
From source file:org.chodavarapu.jgitaws.repositories.PackDescriptionRepository.java
License:Eclipse Distribution License
private static String toJson(DfsPackDescription desc) { JSONObject json = new JSONObject().put("modified", desc.getLastModified()) .put("objects", desc.getObjectCount()).put("deltas", desc.getDeltaCount()) .put("ixVersion", desc.getIndexVersion()); for (PackExt ext : PackExt.values()) { if (desc.hasFileExt(ext)) { json.put(ext.getExtension() + "Size", desc.getFileSize(ext)); }/*from w w w . ja va 2s .c o m*/ } if (desc.getPackSource() != null) { json.put("source", desc.getPackSource().name()); } return json.toString(); }