Package org.apache.maven.archiva.model

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


    private ArchivaArtifact getArtifact( String principle, List<String> observableRepositoryIds, String groupId,
                                         String artifactId, String version )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        ArchivaArtifact pomArtifact = null;

        try
        {
            pomArtifact = dao.getArtifactDAO().getArtifact( groupId, artifactId, version, null, "pom" );
        }
        catch ( ObjectNotFoundException e )
        {
            pomArtifact = handleGenericSnapshots( groupId, artifactId, version, pomArtifact );
        }

        if ( pomArtifact == null )
        {
            throw new ObjectNotFoundException( "Unable to find artifact [" + Keys.toKey( groupId, artifactId, version )
                + "]" );
        }

        // Allowed to see this?
        if ( observableRepositoryIds.contains( pomArtifact.getModel().getRepositoryId() ) )
        {
            return pomArtifact;
        }
        else
        {
View Full Code Here


    }
   
    public void testIfArtifactWasNotAPom()
      throws Exception
  {
      ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "jar" );

        projectModelDAOControl.replay();

        dbCleanupRemoveProjectConsumer.processArchivaArtifact( artifact );
View Full Code Here

    }

    public void testIfArtifactWasNotDeleted()
        throws Exception
    {
        ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "jar" );

        artifactDAOControl.replay();

        dbCleanupRemoveArtifactConsumer.processArchivaArtifact( artifact );
View Full Code Here

    }

    public void testIfArtifactWasDeleted()
        throws Exception
    {
        ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "jar" );

        artifactDAOMock.deleteArtifact( artifact );

        artifactDAOControl.replay();
View Full Code Here

    }

    protected LuceneRepositoryContentRecord createSimpleRecord()
    {
        Map dumps = getArchivaArtifactDumpMap();
        ArchivaArtifact artifact = (ArchivaArtifact) dumps.get( "archiva-common" );
       
        File dumpFile = getDumpFile( artifact );
        return BytecodeRecordLoader.loadRecord( dumpFile, artifact );
    }
View Full Code Here

    }

    private ArchivaArtifact createArchivaArtifact( String groupId, String artifactId, String version, String classifier,
                                                   String type )
    {
        ArchivaArtifact artifact = new ArchivaArtifact( groupId, artifactId, version, classifier, type );
        return artifact;
    }
View Full Code Here

    protected void populateDb( String groupId, String artifactId, List<String> versions )
        throws ArchivaDatabaseException
    {
        for ( String version : versions )
        {
            ArchivaArtifact artifact = dao.createArtifact( groupId, artifactId, version, "", "jar" );
            assertNotNull( artifact );
            artifact.getModel().setLastModified( new Date() );
            artifact.getModel().setOrigin( "test" );
            ArchivaArtifact savedArtifact = dao.saveArtifact( artifact );
            assertNotNull( savedArtifact );

            //POM
            artifact = dao.createArtifact( groupId, artifactId, version, "", "pom" );
            assertNotNull( artifact );
View Full Code Here

    {
        boolean satisfies = false;

        if ( object instanceof ArchivaArtifact )
        {
            ArchivaArtifact artifact = (ArchivaArtifact) object;
            satisfies = !artifact.getModel().isProcessed();
        }
        else if ( object instanceof ArchivaArtifactModel )
        {
            ArchivaArtifactModel model = (ArchivaArtifactModel) object;
            satisfies = !model.isProcessed();
View Full Code Here

    }

    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

    {
        try
        {
            ArtifactReference artifact = repository.toArtifactReference( path );

            ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(),
                                                                                artifact.getArtifactId(),
                                                                                artifact.getVersion(),
                                                                                artifact.getClassifier(),
                                                                                artifact.getType() );
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.