Package org.apache.maven.archiva.model

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


    }

    public void processFile( String path )
        throws ConsumerException
    {
        ArchivaArtifact artifact = getLiveArtifact( path );

        if ( artifact == null )
        {
            return;
        }

        try
        {
            artifact.getModel().setRepositoryId( this.repository.getId() );

            // Calculate the hashcodes.
            File artifactFile = new File( this.repositoryDir, path );
            try
            {
                artifact.getModel().setChecksumMD5( digestMd5.calc( artifactFile ) );
            }
            catch ( DigesterException e )
            {
                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the MD5 checksum: " + e.getMessage() );
            }

            try
            {
                artifact.getModel().setChecksumSHA1( digestSha1.calc( artifactFile ) );
            }
            catch ( DigesterException e )
            {
                triggerConsumerWarning( CHECKSUM_CALCULATION, "Unable to calculate the SHA1 checksum: "
                    + e.getMessage() );
            }

            artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) );
            artifact.getModel().setSize( artifactFile.length() );
            artifact.getModel().setOrigin( "FileSystem" );

            dao.getArtifactDAO().saveArtifact( artifact );
        }
        catch ( ArchivaDatabaseException e )
        {
View Full Code Here


     */
    public ArchivaArtifact getLiveArtifact( String path )
    {
        try
        {
            ArchivaArtifact artifact = layout.toArtifact( path );

            ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(),
                                                                                artifact.getArtifactId(),
                                                                                artifact.getVersion(),
                                                                                artifact.getClassifier(),
                                                                                artifact.getType() );

View Full Code Here

    public ArchivaArtifact toArtifact( String path )
        throws LayoutException
    {
        PathReferences pathrefs = toPathReferences( path, true );

        ArchivaArtifact artifact = new ArchivaArtifact( pathrefs.groupId, pathrefs.artifactId,
                                                        pathrefs.fileParts.version, pathrefs.fileParts.classifier,
                                                        pathrefs.type );

        return artifact;
    }
View Full Code Here

            }

            Iterator it = results.iterator();
            while ( it.hasNext() )
            {
                ArchivaArtifact dupArtifact = (ArchivaArtifact) it.next();

                if ( dupArtifact.equals( artifact ) )
                {
                    // Skip reference to itself.
                    continue;
                }

                RepositoryProblem problem = new RepositoryProblem();
                problem.setRepositoryId( dupArtifact.getModel().getRepositoryId() );
                problem.setPath( toPath( dupArtifact ) );
                problem.setGroupId( artifact.getGroupId() );
                problem.setArtifactId( artifact.getArtifactId() );
                problem.setVersion( artifact.getVersion() );
                problem.setType( DuplicateArtifactReport.PROBLEM_TYPE_DUPLICATE_ARTIFACTS );
View Full Code Here

    }

    public ArchivaProjectModel resolveProjectModel( VersionedReference reference )
        throws ProjectModelException
    {
        ArchivaArtifact artifact = new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference
            .getVersion(), "", "pom" );

        String path = layout.toPath( artifact );
        File repoFile = new File( this.repository.getUrl().getPath(), path );
View Full Code Here

    }

    public ArchivaProjectModel selectVersion( String groupId, String artifactId, String version )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        ArchivaArtifact pomArtifact = null;

        try
        {
            pomArtifact = dao.getArtifactDAO().getArtifact( groupId, artifactId, version, null, "pom" );

            if ( pomArtifact == null )
            {
                throw new ObjectNotFoundException( "Unable to find artifact [" + groupId + ":" + artifactId + ":"
                    + version + "]" );
            }
        }
        catch ( ObjectNotFoundException e )
        {
            throw e;
        }

        ArchivaProjectModel model;

        if ( pomArtifact.getModel().isProcessed() )
        {
            // It's been processed. return it.
            model = dao.getProjectModelDAO().getProjectModel( groupId, artifactId, version );
            return model;
        }
View Full Code Here

        dbSearch = (DatabaseSearch) lookup( DatabaseSearch.class.getName() );
    }
   
    public ArchivaArtifact createArtifact( String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, "", "jar" );
        artifact.getModel().setLastModified( new Date() );
        artifact.getModel().setRepositoryId( "testable_repo" );
        return artifact;
    }
View Full Code Here

    }

    public void testSearchByChecksum()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "org.apache.maven.test", "test-one", "1.2" );
        artifact.getModel().setChecksumMD5( MD5_HASH1 );
        artifactDao.saveArtifact( artifact );

        artifact = createArtifact( "org.apache.maven.test.foo", "test-two", "1.0" );
        artifact.getModel().setChecksumSHA1( SHA1_HASH1 );
        artifactDao.saveArtifact( artifact );

        List results = dbSearch.searchArtifactsByChecksum( MD5_HASH1 );
        assertEquals( 1, results.size() );
View Full Code Here

        {
            for ( ArtifactReference reference : references )
            {  
                File artifactFile = repository.toFile( reference );
               
                ArchivaArtifact artifact =
                    new ArchivaArtifact( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(),
                                         reference.getClassifier(), reference.getType(), repository.getId() );
   
                for ( RepositoryListener listener : listeners )
                {
                    listener.deleteArtifact( repository, artifact );
View Full Code Here

            VersionedReference versionRef = new VersionedReference();
            versionRef.setGroupId( artifactRef.getGroupId() );
            versionRef.setArtifactId( artifactRef.getArtifactId() );
           
            ArchivaArtifact artifact =
                new ArchivaArtifact( artifactRef.getGroupId(), artifactRef.getArtifactId(), artifactRef.getVersion(),
                                     artifactRef.getClassifier(), artifactRef.getType(), repository.getId() );
           
            for ( String version : snapshotVersions )
            {  
                if( releasedVersions.contains( VersionUtil.getReleaseVersion( version ) ) )
View Full Code Here

TOP

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

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.