Package org.apache.maven.archiva.model

Examples of org.apache.maven.archiva.model.RepositoryContentStatistics


        return artifact;
    }
   
    private RepositoryContentStatistics createRepositoryContentStatistics( Date startDate, String repositoryId )
    {
        RepositoryContentStatistics repoContentStats = new RepositoryContentStatistics();
        repoContentStats.setRepositoryId( repositoryId );
        repoContentStats.setDuration( 10000 );
        repoContentStats.setNewFileCount( 100 );
        repoContentStats.setTotalArtifactCount( 200 );
        repoContentStats.setTotalFileCount( 250 );
        repoContentStats.setTotalGroupCount( 100 );
        repoContentStats.setTotalProjectCount( 180 );
        repoContentStats.setTotalSize( 200000 );
        repoContentStats.setWhenGathered( startDate );
       
        return repoContentStats;
    }
View Full Code Here


   
                List<RepositoryContentStatistics> results = (List<RepositoryContentStatistics>) dao.query( new MostRecentRepositoryScanStatistics( arepo.getId() ) );
   
                if ( CollectionUtils.isNotEmpty( results ) )
                {
                    RepositoryContentStatistics lastStats = results.get( 0 );
                    sinceWhen = lastStats.getWhenGathered().getTime() + lastStats.getDuration();
                }
   
                RepositoryScanStatistics stats = repoScanner.scan( arepo, sinceWhen );
   
                log.info( "Finished repository task: " + stats.toDump( arepo ) );
               
                RepositoryContentStatistics dbstats = constructRepositoryStatistics( arepo, sinceWhen, results, stats );
               
                dao.getRepositoryContentStatisticsDAO().saveRepositoryContentStatistics( dbstats );  
               
                this.task = null;
            }
View Full Code Here

                                                                       long sinceWhen,
                                                                       List<RepositoryContentStatistics> results,
                                                                       RepositoryScanStatistics stats )       
    {
        // I hate jpox and modello <-- and so do I
        RepositoryContentStatistics dbstats = new RepositoryContentStatistics();
        dbstats.setDuration( stats.getDuration() );
        dbstats.setNewFileCount( stats.getNewFileCount() );
        dbstats.setRepositoryId( stats.getRepositoryId() );
        dbstats.setTotalFileCount( stats.getTotalFileCount() );
        dbstats.setWhenGathered( stats.getWhenGathered() );
               
        // total artifact count
        try
        {
            List<ArchivaArtifact> artifacts = dao.getArtifactDAO().queryArtifacts(
                      new ArtifactsByRepositoryConstraint( arepo.getId(), stats.getWhenGathered(), "groupId", true ) );           
            dbstats.setTotalArtifactCount( artifacts.size() );
        }
        catch ( ObjectNotFoundException oe )
        {
            log.error( "Object not found in the database : " + oe.getMessage() );
        }
        catch ( ArchivaDatabaseException ae )
        {  
            log.error( "Error occurred while querying artifacts for artifact count : " + ae.getMessage() );
        }
       
        // total repo size
        long size = FileUtils.sizeOfDirectory( new File( arepo.getLocation() ) );
        dbstats.setTotalSize( size );
         
          // total unique groups
        List<String> repos = new ArrayList<String>();
        repos.add( arepo.getId() );
       
        List<String> groupIds = (List<String>) dao.query( new UniqueGroupIdConstraint( repos ) );
        dbstats.setTotalGroupCount( groupIds.size() );
               
        List<Object[]> artifactIds = (List<Object[]>) dao.query( new UniqueArtifactIdConstraint( arepo.getId(), true ) );
        dbstats.setTotalProjectCount( artifactIds.size() );
                       
        return dbstats;
    }  
View Full Code Here

        ArtifactDAO artifactDao = dao.getArtifactDAO();   
       
        List<RepositoryStatistics> repoStatisticsList = new ArrayList<RepositoryStatistics>();
        for( int i = start; i <= end; i++ )
        {  
            RepositoryContentStatistics repoContentStat = (RepositoryContentStatistics) repoContentStats.get( i );
            RepositoryStatistics repoStatistics = new RepositoryStatistics();
            repoStatistics.setRepositoryId( repository );
           
            // get only the latest               
            repoStatistics.setArtifactCount( repoContentStat.getTotalArtifactCount() );
            repoStatistics.setGroupCount( repoContentStat.getTotalGroupCount() );
            repoStatistics.setProjectCount( repoContentStat.getTotalProjectCount() );
            repoStatistics.setTotalSize( repoContentStat.getTotalSize() );
            repoStatistics.setFileCount( repoContentStat.getTotalFileCount() );
            repoStatistics.setDateOfScan( repoContentStat.getWhenGathered() );
               
            try
            {
                //TODO use the repo content stats whenGathered date instead of endDate for single repo reports
                List<ArchivaArtifact> types = artifactDao.queryArtifacts(
View Full Code Here

        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();

        RepositoryContentStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
                                                          getTimestampAsMillis( "20061101.000000" ) );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 3, stats.getNewFileCount() );
        assertEquals( "Processed Count", 2, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 4, stats.getNewFileCount() );
        assertEquals( "Processed Count", 3, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats = scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(),
                                                          getTimestampAsMillis( "20061101.000000" ) );

        assertNotNull( "Stats should not be null.", stats );
        assertEquals( "Stats.totalFileCount", 4, stats.getTotalFileCount() );
        assertEquals( "Stats.newFileCount", 3, stats.getNewFileCount() );
        assertEquals( "Processed Count", 3, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 1, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertMinimumHits( "Stats.totalFileCount", 17, stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", 17, consumer.getProcessCount() );
        assertEquals( "Processed Count (of invalid items)", 6, badconsumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertMinimumHits( "Stats.totalFileCount", actualArtifactPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualArtifactPaths.size(), consumer.getProcessCount() );
    }
View Full Code Here

        List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>();
        InvalidScanConsumer badconsumer = new InvalidScanConsumer();
        invalidConsumers.add( badconsumer );

        RepositoryScanner scanner = lookupRepositoryScanner();
        RepositoryContentStatistics stats =
            scanner.scan( repository, knownConsumers, invalidConsumers, getIgnoreList(), RepositoryScanner.FRESH_SCAN );

        assertNotNull( "Stats should not be null.", stats );
        assertMinimumHits( "Stats.totalFileCount", actualMetadataPaths.size(), stats.getTotalFileCount() );
        assertMinimumHits( "Processed Count", actualMetadataPaths.size(), knownConsumer.getProcessCount() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.archiva.model.RepositoryContentStatistics

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.