Package org.exist.util

Examples of org.exist.util.ProgressIndicator


        final ProgressBar parseProgress = new ProgressBar("storing nodes   ");
        final ProgressBar wordsProgress = new ProgressBar("storing words   ");
       
        @Override
        public void update(final Observable o, final Object obj) {
            final ProgressIndicator ind = (ProgressIndicator) obj;
            if (lastObservable == null || o != lastObservable) {
                System.out.println();
            }
           
            if (o instanceof ElementIndex) {
                elementsProgress.set(ind.getValue(), ind.getMax());
            } else if (o instanceof TextSearchEngine) {
                wordsProgress.set(ind.getValue(), ind.getMax());
            } else {
                parseProgress.set(ind.getValue(), ind.getMax());
            }
           
            lastObservable = o;
        }
View Full Code Here


 
  class ProgressObserver implements Observer {
    int mode = 0;
    public void update(Observable o, Object arg) {
      progress.setIndeterminate(false);
      final ProgressIndicator ind = (ProgressIndicator) arg;
      progress.setValue(ind.getPercentage());
      if (o instanceof TextSearchEngine)
        {progress.setString("Storing words");} //$NON-NLS-1$
      else if (o instanceof ElementIndex)
        {progress.setString("Storing elements");} //$NON-NLS-1$
    }
View Full Code Here

                {return;}
            final int wordsCount = words[TEXT_NODES].size() +
                words[ATTRIBUTE_NODES].size() + words[BY_QNAME].size();
            if (wordsCount == 0)
                {return;}
            final ProgressIndicator progress = new ProgressIndicator(wordsCount, 100);
            final int collectionId = this.doc.getCollection().getId();
            int count = 0;
            for (byte currentSection = 0; currentSection <= QNAME_SECTION; currentSection++) {
                //Not very necessary, but anyway...
                switch (currentSection) {
                case TEXT_SECTION :
                case ATTRIBUTE_SECTION :
                case QNAME_SECTION :
                    break;
                default :
                    throw new IllegalArgumentException("Invalid section type in '" +
                        dbTokens.getFile().getName() + "' (inverted index)");
                }
                for (final Iterator i = words[currentSection].entrySet().iterator(); i.hasNext(); count++) {
                    final Map.Entry entry = (Map.Entry) i.next();
                    final Object token = entry.getKey();
                    final OccurrenceList occurences = (OccurrenceList) entry.getValue();
                    if (occurences == null)
                        {continue;} // may happen if the index is in an invalid state due to earlier errors
                    //Don't forget this one
                    occurences.sort();
                    os.clear();
                    os.writeInt(this.doc.getDocId());
                    os.writeByte(currentSection);
                    os.writeInt(occurences.getTermCount());
                    //Mark position
                    final int lenOffset = os.position();
                    //Dummy value : actual one will be written below
                    os.writeFixedInt(0);
                    NodeId previous = null;
                    for (int m = 0; m < occurences.getSize(); ) {
                        try {
                            previous = occurences.getNode(m).write(previous, os);
                        } catch (final IOException e) {
                            LOG.error("IOException while writing fulltext index: " + e.getMessage(), e);
                            //TODO : throw exception ? -pb
                        }
                        int freq = occurences.getOccurrences(m);
                        os.writeInt(freq);
                        for (int n = 0; n < freq; n++) {
                            os.writeInt(occurences.getOffset(m + n));
                        }
                        m += freq;
                    }
                    //Write (variable) length of node IDs + frequency + offsets
                    os.writeFixedInt(lenOffset, os.position() - lenOffset - LENGTH_NODE_IDS_FREQ_OFFSETS);
                    flushWord(currentSection, collectionId, token, os.data());
                    progress.setValue(count);
                    if (progress.changed()) {
                        setChanged();
                        notifyObservers(progress);
                    }
                }
                //TOUNDERSTAND : is this a flush ?
                //If so, the ProgressIndicator should be reinitialized -pb
                if (wordsCount > 100) {
                    progress.finish();
                    setChanged();
                    notifyObservers(progress);
                }
                words[currentSection].clear();
            }
View Full Code Here

        insideDTD = true;
    }

    public void startDocument() {
        if (!validate) {
            progress = new ProgressIndicator(currentLine, 100);
            document.setChildCount(0);
            elementCnt = 0;
        }
        docSize = 0;
View Full Code Here

        private long timestamp = System.currentTimeMillis();

        public void update(Observable o, Object arg) {
            if (System.currentTimeMillis() - timestamp > 20000) {
                ProgressIndicator ind = (ProgressIndicator) arg;
                if (!(o instanceof org.exist.storage.ElementIndex || o instanceof TextSearchEngine)) {
                    LOG.debug("Stored: " + (int)((ind.getValue() / ind.getMax()) * 100) + " %");
                }
                timestamp = System.currentTimeMillis();
            }
        }
View Full Code Here

        int mode = 0;

        public void update( Observable o, Object arg )
        {
            progress.setIndeterminate( false );
            final ProgressIndicator ind = (ProgressIndicator)arg;
            progress.setValue( ind.getPercentage() );

            if( o instanceof TextSearchEngine ) {
                progress.setString( "Storing words" );
            } else if( o instanceof ElementIndex ) {
                progress.setString( "Storing elements" );
View Full Code Here

    int mode = 0;

    public void update(Observable o, Object arg) {
      progress.setIndeterminate(false);
      final ProgressIndicator ind = (ProgressIndicator) arg;
      progress.setValue(ind.getPercentage());
      if (o instanceof TextSearchEngine)
        {progress.setString(Messages.getString("UploadDialog.17"));} //$NON-NLS-1$
      else if (o instanceof ElementIndex)
        {progress.setString(Messages.getString("UploadDialog.18"));} //$NON-NLS-1$
      else
View Full Code Here

TOP

Related Classes of org.exist.util.ProgressIndicator

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.