Package org.xtreemfs.babudb.api.exception

Examples of org.xtreemfs.babudb.api.exception.BabuDBException


       
        InetSocketAddress master;
        try {
            master = dbMan.getReplicationManager().getMaster();
        } catch (InterruptedException e) {
            throw new BabuDBException(ErrorCode.INTERRUPTED,
                "Waiting for a lease holder was interrupted.", e);
        }
       
        boolean isMaster = dbMan.getReplicationManager().isItMe(master);
       
        if (isMaster || !dbMan.getReplicationPolicy().lookUpIsMasterRestricted()) {
               
            // this service is allowed to retrieve the local database for lookups
            if (isMaster || !dbMan.getReplicationPolicy().dbModificationIsMasterRestricted()) {
                localDB = dbMan.getLocalDatabase(name);
               
            // existence of the database has to be verified at the master
            } else {
                try {
                    dbMan.getClient().getDatabase(name, master).get();
                    localDB = dbMan.getLocalDatabase(name);
                } catch (BabuDBException e) {
                    throw e;
                } catch (ErrorCodeException e) {
                    throw new BabuDBException(mapTransmissionError(e.getCode()), e.getMessage(), e);
                } catch (Exception e) {
                    throw new BabuDBException(ErrorCode.IO_ERROR, e.getMessage(), e);
                }
            }
            
            return null;
        }
View Full Code Here


           
            int dbId = babuDBProxy.getClient().getDatabase(dbName, master).get();
            return new DatabaseProxy(dbName, dbId, this);
           
        } catch (ErrorCodeException ece) {
            throw new BabuDBException(mapTransmissionError(ece.getCode()),ece.getMessage());
        } catch (Exception e) {
            throw new BabuDBException(ErrorCode.REPLICATION_FAILURE, e.getMessage());
        }
    }
View Full Code Here

    private InetSocketAddress getServerToPerformAt() throws BabuDBException {
        InetSocketAddress master;
        try {
            master = replicationManager.getMaster();
        } catch (InterruptedException e) {
            throw new BabuDBException(ErrorCode.INTERRUPTED,
                "Waiting for a lease holder was interrupted.", e);
        }
       
        if (replicationManager.isItMe(master) ||
            !replicationPolicy.dbModificationIsMasterRestricted()) {
View Full Code Here

        try {
            String dbName = babuDBProxy.getClient().getDatabase(dbId, master).get();
            return new DatabaseProxy(dbName, dbId, this);
        } catch (ErrorCodeException ece) {
            throw new BabuDBException(mapTransmissionError(ece.getCode()),ece.getMessage());
        } catch (Exception e) {
            throw new BabuDBException(ErrorCode.REPLICATION_FAILURE, e.getMessage());
        }
    }
View Full Code Here

    }
   
    public byte[] lookup(int indexId, byte[] key) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key);
    }
View Full Code Here

    }
   
    public byte[] lookup(int indexId, byte[] key, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index " + indexId + " does not exist");
        return tree.lookup(key,snapId);
    }
View Full Code Here

    }
   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey);
    }
View Full Code Here

    }
   
    public Iterator<Entry<byte[],byte[]>> prefixLookup(int indexId, byte[] startKey, int snapId) throws BabuDBException {
        LSMTree tree = database.getIndex(indexId);
        if (tree == null)
            throw new BabuDBException(BabuDBException.ErrorCode.NO_SUCH_INDEX, "index does not exist");
        return tree.prefixLookup(startKey,snapId);
    }
View Full Code Here

        try {
            babuDB = PluginLoader.init(babuDB);
        } catch (IOException e) {
            if (e.getMessage() == null)
                Logging.logError(Logging.LEVEL_ERROR, babuDB, e);
            throw new BabuDBException(ErrorCode.BROKEN_PLUGIN, e.getMessage(), e.getCause());
        }
       
        /*
         * initialize all services provided
         */
 
View Full Code Here

                if (!finished.get()) {
                    finished.wait();
                }
            }
        } catch (InterruptedException e) {
            throw new BabuDBException(ErrorCode.INTERRUPTED,
                    "Thread was interrupted while waiting for the response.");
        }
        if (error != null) throw error;
        return result;
    }
View Full Code Here

TOP

Related Classes of org.xtreemfs.babudb.api.exception.BabuDBException

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.