Package org.locationtech.geogig.api

Examples of org.locationtech.geogig.api.Context


    }

    static GeoGIG loadGeoGIG(String repo) {
        Platform platform = new DefaultPlatform();
        platform.setWorkingDir(new File(repo));
        Context inj = GlobalContextBuilder.builder.build();
        GeoGIG geogig = new GeoGIG(inj, platform.pwd());

        if (geogig.command(ResolveGeogigDir.class).call().isPresent()) {
            geogig.getRepository();
            return geogig;
View Full Code Here


            this.description = description;
            this.taskId = String.valueOf(ID_SEQ.incrementAndGet());
        }

        public Optional<UUID> getTransactionId() {
            Context context = command.command.context();
            if (context instanceof GeogigTransaction) {
                GeogigTransaction tx = (GeogigTransaction) context;
                UUID txId = tx.getTransactionId();
                return Optional.of(txId);
            }
View Full Code Here

        } else {
            if (this.geogigTx != null) {
                geogigTx.abort();
            }
            GeoGigDataStore dataStore = (GeoGigDataStore) entry.getDataStore();
            Context commandLocator = dataStore.getCommandLocator(this.tx);
            this.geogigTx = commandLocator.command(TransactionBegin.class).call();
            // checkout the working branch
            final String workingBranch = dataStore.getOrFigureOutBranch();
            this.geogigTx.command(CheckoutOp.class).setForce(true).setSource(workingBranch).call();
        }
    }
View Full Code Here

        Collections.sort(list);
        return ImmutableList.copyOf(list);
    }

    public Context getCommandLocator(@Nullable Transaction transaction) {
        Context commandLocator = null;

        if (transaction != null && !Transaction.AUTO_COMMIT.equals(transaction)) {
            GeogigTransactionState state;
            state = (GeogigTransactionState) transaction.getState(GeogigTransactionState.class);
            Optional<GeogigTransaction> geogigTransaction = state.getGeogigTransaction();
View Full Code Here

    }

    private List<NodeRef> findTypeRefs(@Nullable Transaction tx) {

        final String rootRef = getRootRef(tx);
        Context commandLocator = getCommandLocator(tx);
        List<NodeRef> typeTrees = commandLocator.command(FindFeatureTypeTrees.class)
                .setRootTreeRef(rootRef).call();
        return typeTrees;
    }
View Full Code Here

    protected Context getContext(Request request) {
        Optional<GeoGIG> geogig = getGeogig(request);
        checkState(geogig.isPresent());

        Context geogigContext = geogig.get().getContext();

        Form options = getRequest().getResourceRef().getQueryAsForm();
        String txId = options.getFirstValue("transactionId");
        if (txId != null) {
            UUID transactionId = UUID.fromString(txId);
View Full Code Here

    @Before
    public void setUp() throws IOException {
        File envHome = tempFolder.getRoot();
        Platform testPlatform = new TestPlatform(envHome);
        Context injector = Guice.createInjector(Modules.override(new GeogigModule()).with(
                new MemoryModule(testPlatform))).getInstance(Context.class);

        fakeGeogig = new GeoGIG(injector);
        Repository fakeRepo = fakeGeogig.getOrCreateRepository();
        odb = fakeRepo.objectDatabase();
View Full Code Here

    }

    private RevTreeBuilder addTree(RevTreeBuilder root, final String treePath,
            String... singleNodeNames) {

        Context mockInjector = mock(Context.class);
        when(mockInjector.objectDatabase()).thenReturn(odb);
        CreateTree op = new CreateTree().setIndex(false);
        op.setContext(mockInjector);
        RevTreeBuilder subTreeBuilder =op.call();
       
        if (singleNodeNames != null) {
View Full Code Here

        }
        return geogigInjector;
    }

    private Context newGeogigInjector(Hints hints) {
        Context geogigInjector = GlobalContextBuilder.builder.build(hints);
        return geogigInjector;
    }
View Full Code Here

        File workingDirectory = tmp.newFolder("repo");
        File userHomeDirectory = tmp.newFolder("home");
        TestPlatform platform = new TestPlatform(workingDirectory);
        platform.setUserHome(userHomeDirectory);
        Context injector = new CLITestContextBuilder(platform).build();
        GeoGIG geogig = new GeoGIG(injector);
        geogig.command(InitOp.class).call();
        geogig.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name")
                .setValue("gabriel").call();
        geogig.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email")
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.