Package bm.db.index

Examples of bm.db.index.Index


        final int count = indexInfo != null ? indexInfo.length : 0;
        log.debug( "shutdown table: " + tableInfo.getName() );
        for( int i = 0; i < count; i++ )
        {
            //noinspection ConstantConditions
            final Index index = (Index) indexMap.get(
                    indexInfo[i].getFieldExpression().toLowerCase()
            );
            log.debug( "shutdown index: " + index.getName() );
            index.shutdown();
            index.drop();
        }
        open();
        try
        {
            //noinspection MethodCallInLoopCondition
            while( set.next() )
            {
                //noinspection MethodCallInLoopCondition
                for( Enumeration i = damaged.keys(); i.hasMoreElements(); )
                {
                    final String[] fieldNames = (String[]) i.nextElement();
                    final Index index = (Index) damaged.get( fieldNames );
                    final Row row = set.getCurrent();
                    index.insert(
                            buildIndexValue( row, fieldNames ),
                            row.getRecordId().intValue()
                    );
                }
            }
View Full Code Here


            indexCount = tableIndexInfo.length;
            indexMap = new Hashtable( indexCount );
            for( int i = 0; i < indexCount; i++ )
            {
                final IndexInfo idx = tableIndexInfo[i];
                final Index index = new Index(
                        idx.getName(),
                        idx.getOrder(),
                        idx.getKeyType(),
                        idx.isCaseSensitive()
                );
View Full Code Here

                damaged.clear();
                final Table table = (Table) tables.get( tableInfo.getName() );
                final int indexCount = indexInfo.length;
                for( int j = 0; j < indexCount; j++ )
                {
                    final Index index = table.getIndex( j );
                    if( index.isDamaged() )
                    {
                        damaged.put( indexInfo[j].getFieldNames(), index );
                    }
                }
                if( damaged.size() > 0 )
View Full Code Here

            throws PackException
    {
        System.out.println( "Writing resources to index file: " + out + ".index" );
        final File file = new File( out + ".index" );
        final Store store = Store.get( out, 1 );
        final Index index = new Index( out, order, Index.KT_STRING, true, false );
        index.setRecordStore( store );
        OutputStream os = null;
        try
        {
            if( !file.getParentFile().exists() )
            {
                file.getParentFile().mkdirs();
            }
            os = new FileOutputStream( file );
            for( final Iterator i = consolidated.keySet().iterator(); i.hasNext(); )
            {
                final String language = (String) i.next();
                final Properties lang = (Properties) consolidated.get( language );
                System.out.println( "Processing language: " + language + ", " + lang.size() + " entries" );
                for( final Iterator j = lang.keySet().iterator(); j.hasNext(); )
                {
                    final String key = (String) j.next();
                    final String value = lang.getProperty( key );
                    index.insertObject( language + "#" + key, value );
                }
            }
            System.out.println( "Index size: " + store.getSize() + " bytes" );
            writeIndex( index, os );
        }
View Full Code Here

            throws DBException, SerializationException,
                   RecordStoreFullException, RSException
    {
        if( tableInfo.getRecordId() != 0 )
        {
            final Index index = new Index(
                    indexInfo.getName(),
                    indexInfo.getOrder(),
                    indexInfo.getKeyType(),
                    indexInfo.isCaseSensitive()
            );
            indexMap.put( indexInfo.getFieldExpression().toLowerCase(), index );
            final RowSet set = findAll();
            open();
            try
            {
                //noinspection MethodCallInLoopCondition
                while( set.next() )
                {
                    final Row row = set.getCurrent();
                    index.insert(
                            buildIndexValue( row, indexInfo.getFieldNames() ),
                            row.getRecordId().intValue()
                    );
                }
            }
View Full Code Here

        final int count = indexInfo != null ? indexInfo.length : 0;
        log.debug( "shutdown table: " + tableInfo.getName() );
        for( int i = 0; i < count; i++ )
        {
            //noinspection ConstantConditions
            final Index index = (Index) indexMap.get(
                    indexInfo[i].getFieldExpression().toLowerCase()
            );
            log.debug( "shutdown index: " + index.getName() );
            index.shutdown();
        }
        if( rs != null )
        {
            rs.shutdown();
        }
View Full Code Here

        final Log log = Table.log;
        log.debug( "shutdown table: " + tableInfo.getName() );
        for( int i = 0; i < count; i++ )
        {
            //noinspection ConstantConditions
            final Index index = (Index) indexMap.get(
                    indexInfo[i].getFieldExpression().toLowerCase()
            );
            log.debug( "shutdown index: " + index.getName() );
//            index.shutdown();
            index.drop();
        }
        if( rs != null )
        {
            try
            {
View Full Code Here

    public static void init( final int indexOrder, final String resourceFile )
    {
        ViewFactory.indexOrder = indexOrder;
        ViewFactory.resourceFile = resourceFile;
        ViewFactory.index = new Index(
                COMPILED_VIEWS,
                indexOrder,
                Index.KT_STRING,
                true,
                false
View Full Code Here

            final String    indexName,
            final int       indexOrder,
            final String[]  languages
    )
    {
        index = new Index( indexName, indexOrder, Index.KT_STRING, true, false );
        index.setSendProgressEvents( false );
        this.languages = languages;
        setLocale( ResourceManager.getLocale() );
    }
View Full Code Here

            throws IOException,
                   RecordStoreFullException,
                   RSException,
                   DBException
    {
        final Index index = this.index;
        final int bundleCount = bundleNames.length;
        final int langCount = langs.length;
        final ProgressEvent pe = new ProgressEvent( this );
        pe.setAnimate( true );
        pe.setCancellable( false );
        pe.dispatch();
        index.drop();
        index.open();
        InputStream is = null;
        try
        {
            for( int i = 0; i < bundleCount; i++ )
            {
                for( int j = 0; j < langCount; j++ )
                {
                    final String fileName = "/" + bundleNames[i] + "." +
                                            langs[j] + ".properties";
                    is = getClass().getResourceAsStream( fileName );
                    if( is == null )
                    {
                        throw new IOException( "Not found: " + fileName );
                    }
                    else
                    {
                        final PropertiesReader r = new PropertiesReader( is );
                        String[] pair = r.next();
                        while( pair != null )
                        {
                            log.debug( "pair: " + pair[0] + " = " + pair[1] );
                            index.insertObject( pair[0], pair[1] );
                            pair = r.next();
                        }
                        is.close();
                        System.gc();
                    }
                }
            }
        }
        finally
        {
            if( is != null ) try{ is.close(); }catch( Exception e ){}
            index.close();
        }
    }
View Full Code Here

TOP

Related Classes of bm.db.index.Index

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.