Package com.antlersoft.odb

Examples of com.antlersoft.odb.ObjectStoreException


            freePage.modified=true;
            freePage.freeArray[freePage.size++]=key.index;
        }
        catch ( ClassNotFoundException cnfe)
        {
            throw new ObjectStoreException(
                "Class of object not found when deleting", cnfe);
        }
        catch ( IOException ioe)
        {
            throw new ObjectStoreException( "Deleting: ", ioe);
        }
        catch ( DiskAllocatorException dae)
        {
            throw new ObjectStoreException( "Deleting: ", dae);
        }
        finally
        {
            pageFlushLock.leaveProtected();
            deleteLock.leaveCritical();
View Full Code Here


                classList.classChangeLock.leaveProtected();
            }
        }
        catch ( ClassNotFoundException cnfe)
        {
            throw new ObjectStoreException(
                "Retrieving: Class not found", cnfe);
        }
        catch ( IOException ioe)
        {
            throw new ObjectStoreException( "Retrieving: ", ioe);
        }
        catch ( DiskAllocatorException dae)
        {
            throw new ObjectStoreException( "Retrieving: ", dae);
        }
        finally
        {
            pageFlushLock.leaveProtected();
            deleteLock.leaveProtected();
View Full Code Here

                classList.classChangeLock.leaveProtected();
            }
        }
        catch ( ClassNotFoundException cnfe)
        {
            throw new ObjectStoreException(
                "Retrieving: Class not found", cnfe);
        }
        catch ( IOException ioe)
        {
            throw new ObjectStoreException( "Retrieving: ", ioe);
        }
        catch ( DiskAllocatorException dae)
        {
            throw new ObjectStoreException( "Retrieving: ", dae);
        }
        finally
        {
            pageFlushLock.leaveProtected();
            deleteLock.leaveProtected();
View Full Code Here

  static DAKey fromString(String keyString)
    throws ObjectStoreException
  {
    int colonIndex = keyString.indexOf(':');
    if (colonIndex <= 0)
      throw new ObjectStoreException("Invalid key string: " + keyString);
    String indexString = keyString.substring(0, colonIndex);
    String reuseString = keyString.substring(colonIndex + 1);
    try
    {
      return new DAKey(Integer.parseInt(indexString),
          Integer.parseInt(reuseString));
    }
    catch (NumberFormatException nfe)
    {
      throw new ObjectStoreException("Invalid key string: " + keyString, nfe);
    }
  }
View Full Code Here

                int offset=overhead.getInitialRegion();
                byte[] offsetBuffer=overhead.read( offset, INITIAL_REGION_SIZE);
                int version=NetByte.quadToInt( offsetBuffer, 0);
                if ( version!=DIR_ALLOC_VERSION)
                {
                  throw new ObjectStoreException( "Mismatched version:" + version);
                }
                entryOffset=NetByte.quadToInt( offsetBuffer, 4);
                classOffset=NetByte.quadToInt( offsetBuffer, 8);
                rootOffset=NetByte.quadToInt( offsetBuffer, 12);
                entryList=(EntryPageList)overheadStreams.readObject(
                    entryOffset);
                entryList.initialize( overheadStreams);
                classList=(ClassList)overheadStreams.readObject( classOffset);
                if ( rootOffset!=0)
                    rootObject=(Serializable)overheadStreams.
                        readObject( rootOffset);
            }
            // Traverse class list; create class and index maps and stream
            // pairs
            classList.factory=factory;
            classList.classMap=new HashMap();
            classList.classChangeLock=new Semaphore();
            classList.indexMap=new HashMap();
            indexPageFlushLock=new Semaphore();
            for ( Iterator i=classList.classEntries.iterator(); i.hasNext();)
            {
                ClassEntry entry=(ClassEntry)i.next();
                classList.classMap.put( Class.forName( entry.className),
                    entry);
                DiskAllocator allocator=createDiskAllocator(entry.fileName,128,DiskAllocator.FORCE_EXIST);
                ObjectStreamCustomizer customizer=factory.getCustomizer(
                    Class.forName( entry.className));
                entry.objectStreams=new StreamPair( allocator,
                    customizer);
                if ( entry.indices.size()>0)
                {
                    entry.indexStreams=new StreamPair(
                        createDiskAllocator(entry.fileName + "i", FAVORED_CHUNK_SIZE,DiskAllocator.FORCE_EXIST), customizer);
                    for ( Iterator j=entry.indices.iterator(); j.hasNext();)
                    {
                        IndexEntry indexEntry=(IndexEntry)j.next();
                        indexEntry.index=new Index( this,
                            indexEntry, entry.indexStreams);
                        classList.indexMap.put( indexEntry.indexName,
                            indexEntry.index);
                    }
                }
            }
        }
        catch ( ObjectStoreException ose)
        {
          emergencyCleanup( ose);
        }
        catch ( ClassNotFoundException cnfe)
        {
            emergencyCleanup( new ObjectStoreException( "Should never happen", cnfe));
        }
        catch ( IOException ioe)
        {
ioe.printStackTrace();
            emergencyCleanup( new ObjectStoreException( "Failed to initialize", ioe));
        }
        catch ( DiskAllocatorException dae)
        {
            emergencyCleanup( new ObjectStoreException( "Allocator failure", dae));
        }
        // Initialize index page cache
        indexPageMap=new HashMap( INDEX_PAGE_CACHE_SIZE+1);
        indexPageLRU=new ArrayList( INDEX_PAGE_CACHE_SIZE+1);
    }
View Full Code Here

        classList.classChangeLock.enterProtected();
        try
        {
            Index index=(Index)classList.indexMap.get( indexName);
            if ( index==null)
                throw new ObjectStoreException( "getIndexStatistics: Index "+indexName+
                " undefined");
            return index.getStatistics();
        }
        finally
        {
View Full Code Here

        }
        else
        {
          Index named=(Index)classList.indexMap.get(indexName);
                if ( named==null)
                    throw new ObjectStoreException( "validateIndex: Index "+indexName+
                    " undefined");
                named.validate(freeSet);
        }
      }
      finally
View Full Code Here

     
    }

    public void removeIndex(String indexName) throws ObjectStoreException
    {
        throw new ObjectStoreException( "Removing indexes not yet supported");
    }
View Full Code Here

    }

    public void removeClass( Class toRemove)
        throws ObjectStoreException
    {
        throw new ObjectStoreException( "Removing classes not yet supported");
    }
View Full Code Here

        classList.classChangeLock.enterProtected();
        try
        {
            Index index=(Index)classList.indexMap.get( indexName);
            if ( index==null)
                throw new ObjectStoreException( "Index "+indexName+
                " undefined");
            return index.findObject( toFind);
        }
        finally
        {
View Full Code Here

TOP

Related Classes of com.antlersoft.odb.ObjectStoreException

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.