/** * Shortcut for {@link Context#refDatabase()} */ protected RefDatabase refDatabase() { return context.refDatabase(); }
/** * Shortcut for {@link Context#refDatabase()} */ protected RefDatabase refDatabase() { return context.refDatabase(); }
@Override public RefDatabase refDatabase() { return context.refDatabase(); }
@Override public RefDatabase refDatabase() { return context.refDatabase(); }
public @Override RefDatabase refDatabase() { return context.refDatabase(); }
public SnapshotContext(Context context) { super(context); this.refsSnapshot = new RefDatabaseSnapshot(context.refDatabase()); this.refsSnapshot.create(); }
public SnapshotContext(Context context) { this.context = context; this.refsSnapshot = new RefDatabaseSnapshot(context.refDatabase()); this.refsSnapshot.create(); }
/** * @return the resolved {@link GeogigTransaction}, or {@link Optional#absent()} if it could not * be resolved */ @Override protected Optional<GeogigTransaction> _call() { Preconditions.checkState(!(context instanceof GeogigTransaction), "Cannot resolve a transaction within a transaction!"); Preconditions.checkArgument(id != null, "No id was specified to resolve!"); final String transactionNamespace = TransactionRefDatabase.buildTransactionNamespace(id); GeogigTransaction transaction = null; if (!context.refDatabase().getAll(transactionNamespace).isEmpty()) { transaction = new GeogigTransaction(context, id); } return Optional.fromNullable(transaction); } }
/** * @return the resolved {@link GeogigTransaction}, or {@link Optional#absent()} if it could not * be resolved */ @Override protected Optional<GeogigTransaction> _call() { Preconditions.checkState(!(context instanceof GeogigTransaction), "Cannot resolve a transaction within a transaction!"); Preconditions.checkArgument(id != null, "No id was specified to resolve!"); final String transactionNamespace = TransactionRefDatabase.buildTransactionNamespace(id); GeogigTransaction transaction = null; if (!context.refDatabase().getAll(transactionNamespace).isEmpty()) { transaction = new GeogigTransaction(context, id); } return Optional.fromNullable(transaction); } }
@Override public void configure() throws RepositoryConnectionException { context.refDatabase().configure(); context.objectDatabase().configure(); context.indexDatabase().configure(); }
@Override public void configure() throws RepositoryConnectionException { context.refDatabase().configure(); context.objectDatabase().configure(); context.indexDatabase().configure(); }
/** * 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); }
/** * 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); }
@Override public void open() throws RepositoryConnectionException { Optional<URI> repoUrl = command(ResolveGeogigURI.class).call(); Preconditions.checkState(repoUrl.isPresent(), "Repository URL can't be located"); this.repositoryLocation = repoUrl.get(); if (!context.refDatabase().checkConfig()) { context.refDatabase().configure(); } if (!context.objectDatabase().checkConfig()) { context.objectDatabase().configure(); } if (!context.indexDatabase().checkConfig()) { context.indexDatabase().configure(); } context.refDatabase().create(); context.objectDatabase().open(); context.indexDatabase().open(); context.conflictsDatabase().open(); for (RepositoryListener l : listeners) { l.opened(this); } open = true; }
@Override public void open() throws RepositoryConnectionException { Optional<URI> repoUrl = command(ResolveGeogigURI.class).call(); Preconditions.checkState(repoUrl.isPresent(), "Repository URL can't be located"); this.repositoryLocation = repoUrl.get(); if (!context.refDatabase().checkConfig()) { context.refDatabase().configure(); } if (!context.objectDatabase().checkConfig()) { context.objectDatabase().configure(); } if (!context.indexDatabase().checkConfig()) { context.indexDatabase().configure(); } context.refDatabase().create(); context.objectDatabase().open(); context.indexDatabase().open(); context.conflictsDatabase().open(); for (RepositoryListener l : listeners) { l.opened(this); } open = true; }
/** * 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(); } } }
/** * 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(); } } }
when(mockCommandLocator.refDatabase()).thenReturn(mockRefDb); command.setContext(mockCommandLocator); ResolveObjectType mockResolveObjectType = mock(ResolveObjectType.class);
when(mockCommandLocator.refDatabase()).thenReturn(mockRefDb); command.setContext(mockCommandLocator); ResolveObjectType mockResolveObjectType = mock(ResolveObjectType.class);
verify(context).refDatabase();