Package com.ngdata.hbaseindexer.model.api

Examples of com.ngdata.hbaseindexer.model.api.IndexerUpdateException


    public void updateIndexer(final IndexerDefinition indexer, String lock) throws InterruptedException, KeeperException,
            IndexerNotFoundException, IndexerConcurrentModificationException, ZkLockException, IndexerUpdateException,
            IndexerValidityException {

        if (!ZkLock.ownsLock(zk, lock)) {
            throw new IndexerUpdateException("You are not owner of the indexer's lock, the lock path is: " + lock);
        }

        assertValid(indexer);

        IndexerDefinition currentIndexer = getFreshIndexer(indexer.getName());

        if (currentIndexer.getLifecycleState() == LifecycleState.DELETE_REQUESTED ||
                currentIndexer.getLifecycleState() == LifecycleState.DELETING) {
            throw new IndexerUpdateException("An indexer in state " + indexer.getLifecycleState() + " cannot be modified.");
        }

        if (indexer.getBatchIndexingState() == BatchIndexingState.BUILD_REQUESTED &&
                currentIndexer.getBatchIndexingState() != BatchIndexingState.INACTIVE &&
                currentIndexer.getBatchIndexingState() != BatchIndexingState.BUILD_REQUESTED) {
            throw new IndexerUpdateException("Cannot move batch indexing state from " + currentIndexer.getBatchIndexingState() +
                    " to " + indexer.getBatchIndexingState());
        }

        if (currentIndexer.getLifecycleState() == LifecycleState.DELETE_REQUESTED) {
            throw new IndexerUpdateException("An indexer in the state " + LifecycleState.DELETE_REQUESTED +
                    " cannot be updated.");
        }

        if (!Objects.equal(currentIndexer.getActiveBatchBuildInfo(), indexer.getActiveBatchBuildInfo())) {
            throw new IndexerUpdateException("The active batch build info cannot be modified by users.");
        }

        if (!Objects.equal(currentIndexer.getLastBatchBuildInfo(), indexer.getLastBatchBuildInfo())) {
            throw new IndexerUpdateException("The last batch build info cannot be modified by users.");
        }

        updateIndexerInternal(indexer);

    }
View Full Code Here

TOP

Related Classes of com.ngdata.hbaseindexer.model.api.IndexerUpdateException

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.