Package org.apache.commons.collections

Examples of org.apache.commons.collections.Closure


        }

        consumerProcessFile.setBasefile( basefile );
        consumerWantsFile.setBasefile( basefile );

        Closure processIfWanted = IfClosure.getInstance( consumerWantsFile, consumerProcessFile );
        CollectionUtils.forAllDo( this.knownConsumers, processIfWanted );

        if ( consumerWantsFile.getWantedFileCount() <= 0 )
        {
            // Nothing known processed this file.  It is invalid!
View Full Code Here


        throws RepositoryAdminException
    {
        // Run the repository consumers
        try
        {
            Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false );

            List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();

            // MRM-1212/MRM-1197
            // - do not create missing/fix invalid checksums and update metadata when deploying from webdav since these are uploaded by maven
            if ( updateRelatedArtifacts == false )
            {
                List<KnownRepositoryContentConsumer> clone = new ArrayList<KnownRepositoryContentConsumer>();
                clone.addAll( selectedKnownConsumers );

                for ( KnownRepositoryContentConsumer consumer : clone )
                {
                    if ( consumer.getId().equals( "create-missing-checksums" ) || consumer.getId().equals(
                        "metadata-updater" ) )
                    {
                        selectedKnownConsumers.remove( consumer );
                    }
                }
            }

            List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
            CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan );
            CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan );

            // yuck. In case you can't read this, it says
            // "process the file if the consumer has it in the includes list, and not in the excludes list"
            BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
            ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
            predicate.setBasefile( baseFile );
            predicate.setCaseSensitive( false );

            ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure();
            closure.setBasefile( baseFile );
            closure.setExecuteOnEntireRepo( false );

            Closure processIfWanted = IfClosure.getInstance( predicate, closure );

            CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );

            if ( predicate.getWantedFileCount() <= 0 )
            {
View Full Code Here

     * Load rollup rule definitions.
     *
     * @param is InputStream object.
     */
    public void load(final InputStream is) {
        RollupManager.rollupRulesContext(this, new Closure() {
            @Override
            public void execute(Object input) {
                Reader r = null;
                try {
                    String packageName = RollupManager.class.getPackage().getName();
View Full Code Here

        this.consumerWantsFile = new ConsumerWantsFilePredicate();

        stats = new RepositoryScanStatistics();
        stats.setRepositoryId( repository.getId() );

        Closure triggerBeginScan = new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ), true );

        CollectionUtils.forAllDo( knownConsumerList, triggerBeginScan );
        CollectionUtils.forAllDo( invalidConsumerList, triggerBeginScan );

        if ( SystemUtils.IS_OS_WINDOWS )
View Full Code Here

        }

        consumerProcessFile.setBasefile( basefile );
        consumerWantsFile.setBasefile( basefile );

        Closure processIfWanted = IfClosure.getInstance( consumerWantsFile, consumerProcessFile );
        CollectionUtils.forAllDo( this.knownConsumers, processIfWanted );

        if ( consumerWantsFile.getWantedFileCount() <= 0 )
        {
            // Nothing known processed this file.  It is invalid!
View Full Code Here

    public void executeConsumers( ManagedRepositoryConfiguration repository, File localFile, boolean updateRelatedArtifacts )
    {
        // Run the repository consumers
        try
        {
            Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false );

            List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();
           
            // MRM-1212/MRM-1197
            // - do not create missing/fix invalid checksums and update metadata when deploying from webdav since these are uploaded by maven         
            if( updateRelatedArtifacts == false )
            { 
                List<KnownRepositoryContentConsumer> clone = new ArrayList<KnownRepositoryContentConsumer>();
                clone.addAll( selectedKnownConsumers );
               
                for( KnownRepositoryContentConsumer consumer : clone )
                {
                    if( consumer.getId().equals( "create-missing-checksums" ) ||
                                    consumer.getId().equals( "metadata-updater" ) )
                    {
                        selectedKnownConsumers.remove( consumer );
                    }
                }              
            }
           
            List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
            CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan );
            CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan );

            // yuck. In case you can't read this, it says
            // "process the file if the consumer has it in the includes list, and not in the excludes list"
            BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
            ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
            predicate.setBasefile( baseFile );
            predicate.setCaseSensitive( false );

            ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure();
            closure.setBasefile( baseFile );
            closure.setExecuteOnEntireRepo( false );
           
            Closure processIfWanted = IfClosure.getInstance( predicate, closure );

            CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );

            if ( predicate.getWantedFileCount() <= 0 )
            {
View Full Code Here

        }
        if (predicatesAndClosures.size() == 0) {
            return NOPClosure.INSTANCE;
        }
        // convert to array like this to guarantee iterator() ordering
        Closure defaultClosure = (Closure) predicatesAndClosures.remove(null);
        int size = predicatesAndClosures.size();
        if (size == 0) {
            return (defaultClosure == null ? NOPClosure.INSTANCE : defaultClosure);
        }
        closures = new Closure[size];
View Full Code Here

        throws RepositoryAdminException
    {
        // Run the repository consumers
        try
        {
            Closure triggerBeginScan = new TriggerBeginScanClosure( repository, getStartTime(), false );

            List<KnownRepositoryContentConsumer> selectedKnownConsumers = getSelectedKnownConsumers();

            // MRM-1212/MRM-1197
            // - do not create missing/fix invalid checksums and update metadata when deploying from webdav since these are uploaded by maven
            if ( !updateRelatedArtifacts )
            {
                List<KnownRepositoryContentConsumer> clone = new ArrayList<KnownRepositoryContentConsumer>();
                clone.addAll( selectedKnownConsumers );

                for ( KnownRepositoryContentConsumer consumer : clone )
                {
                    if ( consumer.getId().equals( "create-missing-checksums" ) || consumer.getId().equals(
                        "metadata-updater" ) )
                    {
                        selectedKnownConsumers.remove( consumer );
                    }
                }
            }

            List<InvalidRepositoryContentConsumer> selectedInvalidConsumers = getSelectedInvalidConsumers();
            CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan );
            CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan );

            // yuck. In case you can't read this, it says
            // "process the file if the consumer has it in the includes list, and not in the excludes list"
            BaseFile baseFile = new BaseFile( repository.getLocation(), localFile );
            ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
            predicate.setBasefile( baseFile );
            predicate.setCaseSensitive( false );

            ConsumerProcessFileClosure closure = new ConsumerProcessFileClosure();
            closure.setBasefile( baseFile );
            closure.setExecuteOnEntireRepo( false );

            Closure processIfWanted = IfClosure.getInstance( predicate, closure );

            CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted );

            if ( predicate.getWantedFileCount() <= 0 )
            {
View Full Code Here

                    null,
                    Long.class,
                    String.class,
                    true,
                    false);    
        serverCache.forAllHostsDo(new Closure() {
            @Override
            public void execute(Object hostObj) {
                CrawlHost host = (CrawlHost) hostObj;
                sortedMap.put(-host.getSubstats().getFetchSuccesses(), host.getHostName());
            }
View Full Code Here

     * was ended early, for example at a time limit.
     *
     * @throws DatabaseException
     */
    public void dumpAllPendingToLog() throws DatabaseException {
        Closure tolog = new Closure() {
            public void execute(Object curi) {
                log((CrawlURI) curi);
            }
        };
        forAllPendingDo(tolog);
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.Closure

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.