Package org.chaidb.db.exception

Examples of org.chaidb.db.exception.ChaiDBException


            fileNumber += pageinfile / MAX_FILESIZE_IN_PAGE;
            pageinfile = pageinfile % MAX_FILESIZE_IN_PAGE + 1;
            if (fileNumber >= MAX_FILE_NUMBER + 1) {
                // details -ranjeet
                String details = "Reached the file number limit of 127.";
                throw new ChaiDBException(ErrorCode.BTREE_FILENUMBER_OVERFLOW, details);
            }
        }
    }
View Full Code Here


            fileNumber++;
        }
        if (fileNumber >= MAX_FILE_NUMBER + 1) {
            // details -ranjeet
            String details = "Reached the file number limit of 127.";
            throw new ChaiDBException(ErrorCode.BTREE_FILENUMBER_OVERFLOW, details);
        }
    }
View Full Code Here

                        //modified by Stanley
                        virtualFiles.remove(file.getAbsolutePath());
                    } catch (Exception e) {
                        // moved to details -ranjeet
                        String details = "Open for file " + file.getName() + " failed. " + e.toString() + ".";
                        throw new ChaiDBException(ErrorCode.BTREE_NOT_FOUND, details);
                    }
                } catch (IOException ioe) {
                    // moved to details -ranjeet
                    String details = "Open for file " + file.getName() + " failed. " + ioe.toString() + ".";
                    throw new ChaiDBException(ErrorCode.BTREE_IO_ERROR, details);
                }
            }
View Full Code Here

                try {
                    _file.close();
                } catch (IOException ioe) {
                    // moved to details -ranjeet
                    String details = "Close for the page file failed. " + ioe.toString() + ".";
                    throw new ChaiDBException(ErrorCode.BTREE_IO_ERROR, details);
                }
            }
View Full Code Here

            synchronized void sync() throws ChaiDBException {
                try {
                    _file.getFD().sync();
                } catch (IOException ioe) {
                    String details = "Sync file to disk failed." + ioe.toString() + ".";
                    throw new ChaiDBException(ErrorCode.BTREE_IO_ERROR, details);
                }
            }
View Full Code Here

                    _file.read(page);
                    return true;
                } catch (IOException e) {
                    // details -ranjeet
                    String details = "The operation read page failed for page index " + pageIndex + ". " + e.toString() + ".";
                    throw new ChaiDBException(ErrorCode.BTREE_IO_ERROR, details);
                }
            }
View Full Code Here

             */
            synchronized void writePage(int pageIndex, byte[] data) throws ChaiDBException {
                if (data.length > _pageSize) {
                    // details -ranjeet
                    String details = "Data length is less than page size.";
                    throw new ChaiDBException(ErrorCode.BTREE_DATA_SIZE_OVERFLOW, details);
                }
                try {
                    _file.seek(((long) pageIndex) * _pageSize);
                    _file.write(data);
                } catch (IOException ioe) {
                    // details -ranjeet
                    String details = "The operation write page failed for page index " + pageIndex + ". " + ioe.toString() + ".";
                    throw new ChaiDBException(ErrorCode.BTREE_IO_ERROR, details);
                }
            }
View Full Code Here

        setKeyTypes(keyTypes);
    }

    public void setKeyTypes(int[] keyTypes) throws ChaiDBException {
        if (keyTypes.length > BTreeSpec.KEYTYPE_SPACE_RESERVED)
            throw new ChaiDBException(ErrorCode.SUPERBTREE_HAS_TOO_MANY_LAYERS, "key's length is " + keyTypes.length + " is more than the maximum limit " + BTreeSpec.KEYTYPE_SPACE_RESERVED);
        this.getBTreeSpec().setModified(true);
        this.keyTypes = new int[keyTypes.length];
        System.arraycopy(keyTypes, 0, this.keyTypes, 0, keyTypes.length);
        try {
            btreeSpec.setLayer((byte) keyTypes.length, null);
View Full Code Here

                return converter.decodeFromByteArray(null, data);
            } catch (EncodingException ee) {
                logger.error(ee);
                // details -ranjeet
                String details = "Converter failed to decode : " + ee.toString() + ".";
                throw new ChaiDBException(ErrorCode.CONVERTER_DECODING_ERROR, details);
            }
            else return data;
        } else {
            PageNumber pg = new PageNumber(ByteTool.bytesToInt(data, 0, btreeSpec.isMsbFirst()));
            pg.setTreeId(id);
View Full Code Here

        return newRoot;
    }


    public void store(Key[] keys, boolean[] canNotBeNulls, Object value, short mode, KernelContext kContext) throws ChaiDBException {
        if (DbEnvironment.READ_ONLY) throw new ChaiDBException(ErrorCode.DATABASE_IS_READONLY);

        kContext.checkLock(getBTreeName());
        checkKeyPath(keys, canNotBeNulls);
        boolean succ = false;
        this.getBTreeSpec().setModified(true);
        byte[] data;
        try {
            if (converter != null) data = converter.encodeToByteArray(value);
            else data = (byte[]) value;
        } catch (EncodingException ee) {
            logger.error(ee);
            // details -ranjeet
            String details = "Converter failed in encoding " + ee.toString() + ".";
            throw new ChaiDBException(ErrorCode.CONVERTER_ENCODING_ERROR, details);
        }


        for (int retry = 0; retry < BTreeLock.MAX_RETRYS + 1 && !succ; retry++) {
            try {
View Full Code Here

TOP

Related Classes of org.chaidb.db.exception.ChaiDBException

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.