public @Override <T extends AbstractGeoGigOp<?>> T command(Class<T> commandClass) { T command = context.command(commandClass); command.setContext(this); return command; }
public WorkingTreeInsertHelper(Context context, RevTree workHead, final Function<Feature, String> treePathResolver, final ExecutorService treeBuildingService) { this.db = context.objectDatabase(); this.context = context; this.workHead = workHead; this.treePathResolver = treePathResolver; this.executorService = treeBuildingService; }
@Override public void configure() throws RepositoryConnectionException { context.refDatabase().configure(); context.objectDatabase().configure(); context.indexDatabase().configure(); }
/** * Closes the repository. */ @Override public synchronized void close() { open = false; close(context.refDatabase()); close(context.objectDatabase()); close(context.indexDatabase()); close(context.configDatabase()); close(context.conflictsDatabase()); for (RepositoryListener l : listeners) { try {// don't let a broken listener mess us up l.closed(); } catch (RuntimeException e) { e.printStackTrace(); } } }
public Map<String, RevFeatureType> getFeatureTypes(@NonNull String rootTreeIsh) { Context context = getContext(); List<NodeRef> treeNodes = context.command(FindFeatureTypeTrees.class) .setRootTreeRef(rootTreeIsh).call(); Iterator<RevFeatureType> types = context.objectDatabase().getAll( Iterables.transform(treeNodes, n -> n.getMetadataId()), BulkOpListener.NOOP_LISTENER, RevFeatureType.class); return Maps.uniqueIndex(types, t -> t.getName().getLocalPart()); }
/** * Shortcut for {@link Context#repository()} */ protected Repository repository() { return context.repository(); } }
@Override protected void setUpInternal() throws Exception { insertAndAdd(points1, points2, points3); commit("inital"); SimpleFeatureType fullSchema = pointsType; RevFeatureType nativeType = RevFeatureTypeBuilder.build(fullSchema); Context actualContext = repo.context(); context = spy(actualContext); difftree = spy(context.command(DiffTree.class)); doReturn(difftree).when(context).command(eq(DiffTree.class)); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); FeatureReaderBuilder b = FeatureReaderBuilder.builder(context, nativeType, typeRef); builder = spy(b); }
/** * Shortcut for {@link Context#indexDatabase()} */ protected IndexDatabase indexDatabase() { return context.indexDatabase(); }
/** * Shortcut for {@link Context#workingTree()} */ protected WorkingTree workingTree() { return context.workingTree(); }
/** * Shortcut for {@link Context#platform()} */ protected Platform platform() { return context.platform(); }
/** * Shortcut for {@link Context#configDatabase()} */ protected ConfigDatabase configDatabase() { return context.configDatabase(); }
/** * Closes the repository. */ @Override public synchronized void close() { open = false; close(context.refDatabase()); close(context.objectDatabase()); close(context.indexDatabase()); close(context.configDatabase()); close(context.conflictsDatabase()); for (RepositoryListener l : listeners) { try {// don't let a broken listener mess us up l.closed(); } catch (RuntimeException e) { e.printStackTrace(); } } }
/** * Shortcut for {@link Context#repository()} */ protected Repository repository() { return context.repository(); } }
@Override protected void setUpInternal() throws Exception { insertAndAdd(points1, points2, points3); commit("inital"); SimpleFeatureType fullSchema = pointsType; RevFeatureType nativeType = RevFeatureType.builder().type(fullSchema).build(); Context actualContext = repo.context(); context = spy(actualContext); difftree = spy(context.command(DiffTree.class)); doReturn(difftree).when(context).command(eq(DiffTree.class)); NodeRef typeRef = context.workingTree().getFeatureTypeTrees().get(0); FeatureReaderBuilder b = FeatureReaderBuilder.builder(context, nativeType, typeRef); builder = spy(b); }
/** * Shortcut for {@link Context#indexDatabase()} */ protected IndexDatabase indexDatabase() { return context.indexDatabase(); }
/** * Shortcut for {@link Context#workingTree()} */ protected WorkingTree workingTree() { return context.workingTree(); }
/** * @return the platform for this GeoGig facade */ public Platform getPlatform() { return context.platform(); }
@Override protected void setUpInternal() throws Exception { // These values should be used during a commit to set author/committer // TODO: author/committer roles need to be defined better, but for // now they are the same thing. injector.configDatabase().put("user.name", "groldan"); injector.configDatabase().put("user.email", "groldan@boundlessgeo.com"); }
/** * @return a list of all the feature type names in the working tree * @see FindFeatureTypeTrees */ @Override public List<NodeRef> getFeatureTypeTrees() { List<NodeRef> typeTrees = context.command(FindFeatureTypeTrees.class) .setRootTreeRef(Ref.WORK_HEAD).call(); return typeTrees; }
/** * Shortcut for {@link Context#objectDatabase()} */ protected ObjectDatabase objectDatabase() { return context.objectDatabase(); }