Package bm.core.log

Examples of bm.core.log.Log


     */
    public static void copyIndex( final String name, final InputStream is )
            throws SerializationException, RecordStoreFullException,
                   RSException, IOException
    {
        final Log log = Util.log;

        ZInputStream zis = null;
        SerializerInputStream in = null;
        try
        {
            zis = new ZInputStream( is );
            in = new SerializerInputStream( zis );

            final int       order           = in.readInt(); // ToDo: should do something with this?
            final byte      type            = in.readByte();
            final boolean   caseSensitive   = in.readBoolean();
            Store rs = null;
            boolean burstMode = Store.isBurstMode();
            try
            {
                System.gc();
                Store.safeDeleteRecordStore( name );
                Store.setBurstMode( !ControlledTask.isBackgroundTask() );
                rs = Store.get( name, 1 );
                rs.open( true );
                log.debug( "created recordstore" );
                final int size = in.readInt();
                log.debug( "index size (entries): " + size );
                if( size > 0 )
                {
                    final ProgressEvent event = new ProgressEvent();
                    event.setAnimate( false );
                    event.setCurrentValue( 0 );
                    event.setMaxValue( new Integer( size ) );
                    event.dispatch();
                    for( int j = 0; j < size; j++ )
                    {
                        log.debug( "record: " + j );
                        final byte[] data = in.readBlob();
                        int rid = rs.addRecord( data, 0, data.length );
                        log.debug( "record added (" + rid + "): " + data.length + " bytes" );
                        event.increment();
                        event.dispatch();
                        if( j == 0 && rid != 1 )
                        {
                            ErrorLog.addError(
                                    "DbTool",
                                    "processIndex",
                                    null,
                                    "Old not erased, recordId is not 1 (" + rid + ")",
                                    null
                            );
                            log.error( "RecordId is not 1!!!!" );
                            throw new IOException( "Old not erased" );
                        }
                        if( j % 100 == 0 )
                        {
                            System.gc();
                        }
                    }
                }
                System.gc();
                log.debug( "index " + name + " finished" );
            }
            finally
            {
                try{ if( rs != null ) rs.close(); }catch( Exception e ){}
                Store.setBurstMode( burstMode );
View Full Code Here


     * Start application.
     */
    public void startApplication()
    {
        // Local variable to improve speed on CDC
        final Log log = MainController.log;
        bm.core.ErrorHandler.setHandler( new ErrorHandler() );
        Event.register( this, Event.LANGUAGE_CHANGE );
        ProgressEvent pe = new ProgressEvent( this, new Integer( 4 ), 0 );
        pe.setTitle( ResourceManager.getResource( "main.StartApplication" ) );
        pe.dispatch();
        try
        {
            init();
            pe.increment();
            pe.dispatch();

            log.debug( "Starting application" );
            if( !checkConfig() )
            {
                exitApplication();
                return;
            }
            setup();
            pe.increment();
            pe.dispatch();

            View nextView = startDatabase();
            checkDatabaseSanity();
            pe.increment();
            pe.dispatch();
            final Database database = Model.getDatabase();
            DefaultFieldResolver.setDatabase( database );
            if( nextView == null )
            {
                nextView = restoreLastView();
            }
            if( nextView == null )
            {
                nextView = ViewFactory.getMenu( "mainMenu" );
            }
            Event.unregisterAll( Event.PROGRESS );
            Event.register( progressListener, Event.PROGRESS );
            nextView.show();
        }
        catch( RuntimeException e )
        {
            e.printStackTrace();
            log.error( e );
            Application.getManager().showError(
                    ResourceManager.getResource( "error.cantStartApp" ),
                    e
            );
            exitApplication();
        }
        catch( Throwable e )
        {
            e.printStackTrace();
            log.error( e );
            Application.getManager().showError(
                    ResourceManager.getResource( "error.cantStartApp" ) +
                    ": " + e.toString()
            );
            exitApplication();
View Full Code Here

TOP

Related Classes of bm.core.log.Log

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.