Examples of RepositoryArtifactIndex


Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

        model = new Model();

        RepositoryArtifactIndexFactory factory =
            (RepositoryArtifactIndexFactory) lookup( RepositoryArtifactIndexFactory.ROLE, "lucene" );

        RepositoryArtifactIndex index = factory.createStandardIndex( indexDirectory );

        RepositoryIndexRecordFactory recordFactory =
            (RepositoryIndexRecordFactory) lookup( RepositoryIndexRecordFactory.ROLE, "standard" );

        index.indexRecords( Collections.singletonList( recordFactory.createRecord( artifact ) ) );

        processor = (ArtifactReportProcessor) lookup( ArtifactReportProcessor.ROLE, "duplicate" );
    }
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

        {
            System.out.println( "indexDirectory = " + indexDirectory );

            File indexDirectoryFile = new File( indexDirectory );

            RepositoryArtifactIndex index = indexFactory.createStandardIndex( indexDirectoryFile );

            String checksum = null;
            try
            {
                checksum = digester.calc( artifact.getFile() );
            }
            catch ( DigesterException e )
            {
                addWarning( artifact, "cant-checksum", "Unable to generate checksum for " + artifact.getFile() + ": " + e );
            }

            if ( checksum != null )
            {
                try
                {
                    List results = index
                        .search( new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, checksum
                            .toLowerCase() ) ) ) );

                    if ( !results.isEmpty() )
                    {
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

        MavenProject project = readProject();

        model = project.getModel();

        RepositoryArtifactIndex index = getIndex();

        String id = createId( groupId, artifactId, version );
        List records = index.search( new LuceneQuery( new TermQuery( new Term( "dependencies", id ) ) ) );

        dependencies = VersionMerger.merge( records );

        return SUCCESS;
    }
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

    private static long groupCacheTime;

    public String browse()
        throws RepositoryIndexException, IOException
    {
        RepositoryArtifactIndex index = getIndex();

        if ( !index.exists() )
        {
            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
            return ERROR;
        }
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

    }

    public String browseGroup()
        throws RepositoryIndexException, IOException, RepositoryIndexSearchException
    {
        RepositoryArtifactIndex index = getIndex();

        if ( !index.exists() )
        {
            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
            return ERROR;
        }

        GroupTreeNode rootNode = buildGroupTree( index );

        if ( StringUtils.isEmpty( groupId ) )
        {
            // TODO: i18n
            addActionError( "You must specify a group ID to browse" );
            return ERROR;
        }

        StringTokenizer tok = new StringTokenizer( groupId, GROUP_SEPARATOR );
        while ( tok.hasMoreTokens() )
        {
            String part = tok.nextToken();

            if ( !rootNode.getChildren().containsKey( part ) )
            {
                // TODO: i18n
                getLogger().debug(
                    "Can't find part: " + part + " for groupId " + groupId + " in children " + rootNode.getChildren() );
                addActionError( "The group specified was not found" );
                return ERROR;
            }
            else
            {
                rootNode = (GroupTreeNode) rootNode.getChildren().get( part );
            }
        }

        this.groups = collateGroups( rootNode );

        this.artifactIds = index.getArtifactIds( groupId );
        Collections.sort( this.artifactIds );

        return SUCCESS;
    }
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

    }

    public String browseArtifact()
        throws RepositoryIndexException, IOException, RepositoryIndexSearchException
    {
        RepositoryArtifactIndex index = getIndex();

        if ( StringUtils.isEmpty( groupId ) )
        {
            // TODO: i18n
            addActionError( "You must specify a group ID to browse" );
            return ERROR;
        }

        if ( StringUtils.isEmpty( artifactId ) )
        {
            // TODO: i18n
            addActionError( "You must specify a artifact ID to browse" );
            return ERROR;
        }

        this.versions = index.getVersions( groupId, artifactId );
        Collections.sort( this.versions );

        if ( versions.isEmpty() )
        {
            // TODO: i18n
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

    {
        // TODO: give action message if indexing is in progress

        assert q != null && q.length() != 0;

        RepositoryArtifactIndex index = getIndex();

        if ( !index.exists() )
        {
            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
            return ERROR;
        }

        MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{StandardIndexRecordFields.GROUPID,
            StandardIndexRecordFields.ARTIFACTID, StandardIndexRecordFields.BASE_VERSION,
            StandardIndexRecordFields.CLASSIFIER, StandardIndexRecordFields.CLASSES, StandardIndexRecordFields.FILES,
            StandardIndexRecordFields.TYPE, StandardIndexRecordFields.PROJECT_NAME,
            StandardIndexRecordFields.PROJECT_DESCRIPTION}, LuceneRepositoryArtifactIndex.getAnalyzer() );
        searchResults = index.search( new LuceneQuery( parser.parse( q ) ) );

        if ( searchResults.isEmpty() )
        {
            addActionError( "No results found" );
            return INPUT;
View Full Code Here

Examples of org.apache.maven.archiva.indexer.RepositoryArtifactIndex

    {
        // TODO: give action message if indexing is in progress

        assert md5 != null && md5.length() != 0;

        RepositoryArtifactIndex index = getIndex();

        if ( !index.exists() )
        {
            addActionError( "The repository is not yet indexed. Please wait, and then try again." );
            return ERROR;
        }

        searchResults = index.search(
            new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, md5.toLowerCase() ) ) ) );

        if ( searchResults.isEmpty() )
        {
            addActionError( "No results found" );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.