Package org.apache.maven.archiva.model

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


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

        ArchivaProjectModel model;
        version = pomArtifact.getVersion();

        if ( !pomArtifact.getModel().isProcessed() )
        {
            // Process it.
            dbUpdater.updateUnprocessed( pomArtifact );
        }
View Full Code Here


    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

        if ( observableRepositoryIds.isEmpty() )
        {
            throw new ArchivaDatabaseException( "There are no observable repositories for the user " + principal );
        }

        ArchivaArtifact pomArtifact = getArtifact( principal, observableRepositoryIds, groupId, artifactId, version );
        ArchivaProjectModel model;

        if ( !pomArtifact.getModel().isProcessed() )
        {
            // Process it.
            dbUpdater.updateUnprocessed( pomArtifact );
        }

        model = getProjectModel( groupId, artifactId, pomArtifact.getVersion() );

        if ( model.getPackaging() == null || "".equals( model.getPackaging() ) )
        {
            model.setPackaging( pomArtifact.getType() );
        }

        return model;
    }
View Full Code Here

            throw new ArchivaDatabaseException( "There are no observable repositories for the user " + principal );
        }

        try
        {
            ArchivaArtifact pomArchivaArtifact =
                getArtifact( principal, observableRepositoryIds, groupId, artifactId, version );

            return pomArchivaArtifact.getModel().getRepositoryId();
        }
        catch ( ObjectNotFoundException e )
        {
            return getNoPomArtifactRepoId( principal, observableRepositoryIds, groupId, artifactId, version,
                                           observableRepositoryIds.get( 0 ) );
View Full Code Here

    private ArchivaArtifact getArtifact( final String principal, final List<String> observableRepositoryIds,
                                         final String groupId, final String artifactId, final String version )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        ArchivaArtifact pomArtifact = null;
        Constraint constraint = new ArtifactsRelatedConstraint( groupId, artifactId, version );

        try
        {
            List<ArchivaArtifact> artifacts = dao.getArtifactDAO().queryArtifacts( constraint );
View Full Code Here

    @SuppressWarnings("unchecked")
    private ArchivaArtifact handleGenericSnapshots( final String groupId, final String artifactId,
                                                    final String version, final String repositoryId )
        throws ArchivaDatabaseException
    {
        ArchivaArtifact result = null;

        if ( VersionUtil.isGenericSnapshot( version ) )
        {
            final List<String> versions = (List<String>) dao.query( new UniqueVersionConstraint( groupId, artifactId ) );
            Collections.sort( versions );
View Full Code Here

    private String getNoPomArtifactRepoId( String principal, List<String> observableRepos, String groupId,
                                           String artifactId, String version, String repositoryId )
        throws ObjectNotFoundException, ArchivaDatabaseException
    {
        ArchivaArtifact artifact = null;

        String type = getArtifactType( groupId, artifactId, version );

        artifact = dao.getArtifactDAO().createArtifact( groupId, artifactId, version, null, type, repositoryId );

        if ( artifact == null )
        {
            // Lets not persist these
            artifact = new ArchivaArtifact( groupId, artifactId, version, null, type, repositoryId );
        }

        // Allowed to see this?
        if ( !observableRepos.contains( artifact.getModel().getRepositoryId() ) )
        {
            throw new ObjectNotFoundException( "Unable to find artifact " + Keys.toKey( groupId, artifactId, version ) +
                " in observable repository [" + StringUtils.join( observableRepos.iterator(), ", " ) + "] for user " +
                principal );
        }

        return artifact.getModel().getRepositoryId();
    }
View Full Code Here

   
    private ArtifactDAO artifactDao;

    private ArchivaArtifact createArtifact( String groupId, String artifactId, String version )
    {
        ArchivaArtifact artifact = artifactDao.createArtifact( groupId, artifactId, version, "", "jar", "central" );
        artifact.getModel().setLastModified( new Date() ); // mandatory field.
        artifact.getModel().setRepositoryId( "central" );
        return artifact;
    }
View Full Code Here

    }

    private void saveTestData()
        throws Exception
    {
        ArchivaArtifact artifact;

        // Setup artifacts in fresh DB.
        artifact = createArtifact( "commons-lang", "commons-lang", "2.0" );
        artifactDao.saveArtifact( artifact );
        assertArtifactWasSaved( "commons-lang", "commons-lang", "2.0" );
View Full Code Here

        ArchivaArtifactModel model = new ArchivaArtifactModel();
        model.setGroupId( groupId );
        model.setArtifactId( artifactId );
        model.setVersion( version );
        model.setRepositoryId( repoId );
        return new ArchivaArtifact( model );
    }
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.