Package org.chaidb.db.exception

Examples of org.chaidb.db.exception.ChaiDBException


                raf.writeInt(INIT_FLAG);
            } finally {
                raf.close();
            }
        } catch (IOException e) {
            throw new ChaiDBException(ErrorCode.BTREE_TRACKFILE_IO_ERROR);
        }
    }
View Full Code Here


            bp.addToFreeList(treeId, super.getPageNum(), new Integer(super.getTxnId()));

            return true;
        } catch (Exception e) {
            logger.debug(e);
            throw new ChaiDBException(ErrorCode.LOG_REDO_FAILED, e.toString());
        }
    }
View Full Code Here

            System.arraycopy(this.dataArr, 0, page, upperBound, BTreeSpec.PAGE_SIZE - upperBound);

            return true;
        } catch (Exception e) {
            logger.debug(e);
            throw new ChaiDBException(ErrorCode.LOG_UNDO_FAILED, e.toString());
        }

    }
View Full Code Here

            ArrayList params = new ArrayList(2);
            // required
            params.add(Key.KEY_TYPES[Key.INT_KEY]);
            // found
            params.add(Key.KEY_TYPES[keyType]);
            throw new ChaiDBException(ErrorCode.INDEX_KEY_TYPE_ERROR, params);
        }
    }
View Full Code Here

            ArrayList params = new ArrayList(2);
            // required
            params.add(Key.KEY_TYPES[Key.BYTEARRAY_KEY]);
            // found
            params.add(Key.KEY_TYPES[keyType]);
            throw new ChaiDBException(ErrorCode.INDEX_KEY_TYPE_ERROR, params);
        }
    }
View Full Code Here

            /*****************************/

            // fix the current page
            page = buffer.getPage(btreeSpec.btree.getBtreeId(), pageNumber);
            if (page == null)
                throw new ChaiDBException(ErrorCode.BTREE_INVALID_DATAPAGE, "Page is null: " + pageNumber.toHexString() + " of " + btreeSpec.getBtreeName());

            //====>>> 1. calculate the place to insert the node
            // sort insert
            boolean keyExist = nodeOff > 0;
            // check mode to replace existing key's value or just return
            if (keyExist && mode == IDBIndex.STORE_INSERT) {
                // untouch the node, may throw exception later &&&
                // unfix this page
                buffer.releasePage(pageNumber.getTreeId(), pageNumber, false);

                // details -ranjeet
                String details = "The key value is " + new String(key) + ".";
                throw new ChaiDBException(ErrorCode.ENTRY_ALREADY_EXIST, details);
            }

            //=====>>> 2. insert / replace key/data pair
            DataNode dataNode;
            // size in byte of the node needed
View Full Code Here

            /*****************************/

            // fix the page
            page = buffer.getPage(btreeSpec.btree.getBtreeId(), pageNumber);
            if (page == null)
                throw new ChaiDBException(ErrorCode.BTREE_INVALID_DATAPAGE, "Page is null: " + pageNumber.toHexString() + " of " + btreeSpec.getBtreeName());

            DataNode node = getNode(nodeOff);
            // 1. free the overflow pages
            if (node.isOverflow()) {
                PageNumber overflowPageNumber = new PageNumber(ByteTool.bytesToInt(page, node.getNodeOffset() + BTreeSpec.DATA_NODE_HEADER_SIZE, btreeSpec.isMsbFirst()));
View Full Code Here

            ArrayList params = new ArrayList(2);
            // required
            params.add(Key.KEY_TYPES[Key.STRING_KEY]);
            // found
            params.add(Key.KEY_TYPES[keyType]);
            throw new ChaiDBException(ErrorCode.INDEX_KEY_TYPE_ERROR, params);
        }
    }
View Full Code Here

            ArrayList params = new ArrayList(2);
            // required
            params.add(Key.KEY_TYPES[Key.DATE_KEY]);
            // found
            params.add(Key.KEY_TYPES[keyType]);
            throw new ChaiDBException(ErrorCode.INDEX_KEY_TYPE_ERROR, params);
        }
    }
View Full Code Here

            fo.flush();
        } catch (UnsupportedEncodingException e) {
            logger.error(e);
        } catch (IOException ioe) {
            String details = "The operation saving collection storage metadata into " + storageMetaFile + " failed" + ". " + ioe.toString() + ".";
            throw new ChaiDBException(ErrorCode.RUNTIME_IO_ERROR, details);
        } finally {
            if (fo != null) {
                try {
                    fo.close();
                } catch (Exception fe) {
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.