@Override public BlobStore blobStore() { return context.blobStore(); }
public @Override BlobStore blobStore() { return context.blobStore(); }
@Override public BlobStore blobStore() { return context().blobStore(); }
@Override public BlobStore blobStore() { return context().blobStore(); }
@Override protected String _call() { BlobStore blobStore = context.blobStore(); Optional<InputStream> blobAsStream = blobStore.getBlobAsStream(MergeOp.MERGE_MSG); if (!blobAsStream.isPresent()) { return ""; } try (InputStream in = blobAsStream.get()) { List<String> lines = CharStreams.readLines(new InputStreamReader(in, Charsets.UTF_8)); return Joiner.on("\n").join(lines); } catch (IOException e) { throw Throwables.propagate(e); } }
@Override protected List<OSMLogEntry> _call() { BlobStore blobStore = context.blobStore(); List<String> encodedEntries = Blobs.readLines(blobStore, "osm/log"); List<OSMLogEntry> entries = new ArrayList<>(encodedEntries.size()); for (String encodedEntry : encodedEntries) { OSMLogEntry entry = OSMLogEntry.valueOf(encodedEntry); entries.add(entry); } return entries; }
private void skipCurrentCommit() { List<String> nextFile = Blobs.readLines(context().blobStore(), REBASE_NEXT_BLOB); try { String idx = nextFile.get(0); String blobName = REBASE_BLOB_PREFIX + idx; context().blobStore().removeBlob(blobName); int newIdx = Integer.parseInt(idx) + 1; Blobs.putBlob(context().blobStore(), REBASE_NEXT_BLOB, String.valueOf(newIdx)); } catch (Exception e) { throw new IllegalStateException("Cannot read/write rebase commits index", e); } }
@Override protected String _call() { BlobStore blobStore = context.blobStore(); Optional<InputStream> blobAsStream = blobStore.getBlobAsStream(MergeOp.MERGE_MSG); if (!blobAsStream.isPresent()) { return ""; } try (InputStream in = blobAsStream.get()) { List<String> lines = CharStreams.readLines(new InputStreamReader(in, Charsets.UTF_8)); return Joiner.on("\n").join(lines); } catch (IOException e) { throw new RuntimeException(e); } }
@Override protected Void _call() { BlobStore blobStore = context().blobStore(); byte[] blob = message.getBytes(Charsets.UTF_8); blobStore.putBlob(MergeOp.MERGE_MSG, blob); return null; }
private void skipCurrentCommit() { List<String> nextFile = Blobs.readLines(context().blobStore(), REBASE_NEXT_BLOB); try { String idx = nextFile.get(0); String blobName = REBASE_BLOB_PREFIX + idx; context().blobStore().removeBlob(blobName); int newIdx = Integer.parseInt(idx) + 1; Blobs.putBlob(context().blobStore(), REBASE_NEXT_BLOB, String.valueOf(newIdx)); } catch (Exception e) { throw new IllegalStateException("Cannot read/write rebase commits index", e); } }
@Override protected Void _call() { BlobStore blobStore = context().blobStore(); byte[] blob = message.getBytes(Charsets.UTF_8); blobStore.putBlob(MergeOp.MERGE_MSG, blob); return null; }
@Override protected Void _call() { BlobStore blobStore = context().blobStore(); final String logPath = "osm/log"; Optional<String> log = Blobs.getBlobAsString(blobStore, logPath); StringBuilder newLog = new StringBuilder(); if (log.isPresent()) { newLog.append(log.get()); } newLog.append(entry.toString()).append('\n'); Blobs.putBlob(blobStore, logPath, newLog); return null; }
private long getCurrentBranchChangeset(GeoGIG geogig) throws IOException { String path = getBranchChangesetPath(geogig); BlobStore blobStore = geogig.getContext().blobStore(); Optional<String> blob = Blobs.getBlobAsString(blobStore, path); return blob.isPresent() ? Long.parseLong(blob.get()) : 0L; }
@Override protected Optional<OSMMappingLogEntry> _call() { BlobStore blobStore = context().blobStore(); final String pathPrefix = "osm/map/"; final String path = pathPrefix + this.path; Optional<String> blob = Blobs.getBlobAsString(blobStore, path); OSMMappingLogEntry entry = null; if (blob.isPresent()) { entry = OSMMappingLogEntry.fromString(blob.get()); } return Optional.fromNullable(entry); } }
@Override protected Void _call() { Preconditions.checkNotNull(entry); Preconditions.checkNotNull(filter); BlobStore blobStore = context().blobStore(); final String logPath = "osm/log/"; final String filterPath = logPath + "filter" + entry.getId(); Blobs.putBlob(blobStore, filterPath, filter); return null; }
/** * @param geogig * @param id * @throws IOException */ private void updateBranchChangeset(GeoGIG geogig, long id) throws IOException { String path = getBranchChangesetPath(geogig); BlobStore blobStore = geogig.getContext().blobStore(); Blobs.putBlob(blobStore, path, String.valueOf(id)); }
private void createRevertCommitsInfoFiles(List<RevCommit> commitsToRebase) { for (int i = 0; i < commitsToRebase.size(); i++) { try { String blobName = REVERT_PREFIX + Integer.toString(i + 1); CharSequence contents = commitsToRebase.get(i).getId().toString(); putBlob(context().blobStore(), blobName, contents); } catch (Exception e) { throw new IllegalStateException("Cannot create revert commits info", e); } } try { putBlob(context().blobStore(), NEXT, "1"); } catch (Exception e) { throw new IllegalStateException("Cannot create next revert commit info", e); } }
@Override protected Optional<Mapping> _call() { Preconditions.checkNotNull(entry); BlobStore blobStore = context().blobStore(); final String pathPrefix = "osm/map/"; final String path = pathPrefix + entry.getPostMappingId(); Optional<String> blob = Blobs.getBlobAsString(blobStore, path); Mapping mapping = null; if (blob.isPresent()) { mapping = Mapping.fromString(blob.get()); } return Optional.fromNullable(mapping); } }
@Override protected Optional<String> _call() { Preconditions.checkNotNull(entry); BlobStore blobStore = context().blobStore(); final String logPath = "osm/log/"; final String filterPath = logPath + "filter" + entry.getId(); Optional<String> filter = Blobs.getBlobAsString(blobStore, filterPath); return filter; }
/** * Constructs the transaction with the given ID and Injector. * * @param context the non transactional command locator * @param transactionId the id of the transaction */ public GeogigTransaction(Context context, UUID transactionId) { Preconditions.checkArgument(!(context instanceof GeogigTransaction)); this.context = context; this.transactionId = transactionId; transactionIndex = new TransactionStagingArea(new StagingAreaImpl(this), transactionId); transactionWorkTree = new WorkingTreeImpl(this); transactionRefDatabase = new TransactionRefDatabase(context.refDatabase(), transactionId); transactionBlobStore = new TransactionBlobStoreImpl( (TransactionBlobStore) context.blobStore(), transactionId); }