Package org.apache.archiva.metadata.repository

Examples of org.apache.archiva.metadata.repository.RepositorySession


            //  the ambiguities in the API where session & repository are the inverse of JCR; and the resolver is
            //  retrieved from the session but must have it passed in. These should be reviewed before finalising the
            //  API.
            MetadataRepository metadataRepository = new JcrMetadataRepository( metadataFacetFactories, repository );

            return new RepositorySession( metadataRepository, metadataResolver );
        }
        catch ( RepositoryException e )
        {
            // FIXME: a custom exception requires refactoring for callers to handle it
            throw new RuntimeException( e );
View Full Code Here


public class MockRepositorySessionFactory
    implements RepositorySessionFactory
{
    public RepositorySession createSession( )
    {
        return new RepositorySession( null, null )
        {
            @Override
            public void close( )
            {
                return;
View Full Code Here

        // TODO: this logic should be optional, particularly remembering we want to keep this code simple
        //       it is located here to avoid the content repository implementation needing to do too much for what
        //       is essentially presentation code
        Set<String> namespacesToCollapse;
        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataResolver metadataResolver = repositorySession.getResolver();
            namespacesToCollapse = new LinkedHashSet<String>();
            for ( String repoId : selectedRepos )
            {
                namespacesToCollapse.addAll( metadataResolver.resolveRootNamespaces( repositorySession, repoId ) );
            }

            for ( String n : namespacesToCollapse )
            {
                // TODO: check performance of this
                namespaces.add( collapseNamespaces( repositorySession, metadataResolver, selectedRepos, n ) );
            }
        }
        finally
        {
            repositorySession.close();
        }

        this.namespaces = getSortedList( namespaces );
        return SUCCESS;
    }
View Full Code Here

            return GlobalResults.ACCESS_TO_NO_REPOS;
        }

        Set<String> projects = new LinkedHashSet<String>();

        RepositorySession repositorySession = repositorySessionFactory.createSession();
        Set<String> namespaces;
        try
        {
            MetadataResolver metadataResolver = repositorySession.getResolver();

            Set<String> namespacesToCollapse = new LinkedHashSet<String>();
            for ( String repoId : selectedRepos )
            {
                namespacesToCollapse.addAll( metadataResolver.resolveNamespaces( repositorySession, repoId, groupId ) );

                projects.addAll( metadataResolver.resolveProjects( repositorySession, repoId, groupId ) );
            }

            // TODO: this logic should be optional, particularly remembering we want to keep this code simple
            //       it is located here to avoid the content repository implementation needing to do too much for what
            //       is essentially presentation code
            namespaces = new LinkedHashSet<String>();
            for ( String n : namespacesToCollapse )
            {
                // TODO: check performance of this
                namespaces.add(
                    collapseNamespaces( repositorySession, metadataResolver, selectedRepos, groupId + "." + n ) );
            }
        }
        finally
        {
            repositorySession.close();
        }

        this.namespaces = getSortedList( namespaces );
        this.projectIds = getSortedList( projects );
        return SUCCESS;
View Full Code Here

        if ( CollectionUtils.isEmpty( selectedRepos ) )
        {
            return GlobalResults.ACCESS_TO_NO_REPOS;
        }

        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataResolver metadataResolver = repositorySession.getResolver();

            Set<String> versions = new LinkedHashSet<String>();
            for ( String repoId : selectedRepos )
            {
                versions.addAll(
                    metadataResolver.resolveProjectVersions( repositorySession, repoId, groupId, artifactId ) );
            }

            // TODO: sort by known version ordering method
            this.projectVersions = new ArrayList<String>( versions );

            populateSharedModel( repositorySession, metadataResolver, selectedRepos, versions );
        }
        finally
        {
            repositorySession.close();
        }

        return SUCCESS;
    }
View Full Code Here

            control.expectAndReturn( metadataRepository.getMetadataFacet( "snapshots", RepositoryStatistics.FACET_ID,
                                                                          "20091112.012345.012" ),
                                     new RepositoryStatistics() );
            control.replay();

            RepositorySession session = mock( RepositorySession.class );
            when( session.getRepository() ).thenReturn( metadataRepository );
            TestRepositorySessionFactory factory =
                applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
            factory.setRepositorySession( session );

            ServletRunner sr = new ServletRunner();
View Full Code Here

    {
        super.setUp();
        setObservableRepos( Lists.<String>newArrayList( "test-repo" ) );
        action = (BrowseAction) getActionProxy( "/browse.action" ).getAction();
        metadataResolver = new TestMetadataResolver();
        RepositorySession repositorySession = mock( RepositorySession.class );
        when( repositorySession.getResolver() ).thenReturn( metadataResolver );
        TestRepositorySessionFactory factory =
            applicationContext.getBean( "repositorySessionFactory#test", TestRepositorySessionFactory.class );
        factory.setRepositorySession( repositorySession );
    }
View Full Code Here

        archivaConfiguration.addListener( this );

        List<ManagedRepositoryConfiguration> repositories =
            archivaConfiguration.getConfiguration().getManagedRepositories();

        RepositorySession repositorySession = repositorySessionFactory.createSession();
        try
        {
            MetadataRepository metadataRepository = repositorySession.getRepository();
            for ( ManagedRepositoryConfiguration repoConfig : repositories )
            {
                if ( repoConfig.isScanned() )
                {
                    try
                    {
                        scheduleRepositoryJobs( repoConfig );
                    }
                    catch ( SchedulerException e )
                    {
                        throw new ArchivaException( "Unable to start scheduler: " + e.getMessage(), e );
                    }

                    try
                    {
                        if ( !isPreviouslyScanned( repoConfig, metadataRepository ) )
                        {
                            queueInitialRepoScan( repoConfig );
                        }
                    }
                    catch ( MetadataRepositoryException e )
                    {
                        log.warn( "Unable to determine if a repository is already scanned, skipping initial scan: "
                                      + e.getMessage(), e );
                    }
                }
            }
        }
        finally
        {
            repositorySession.close();
        }

    }
View Full Code Here

        this.repositorySession = repositorySession;
    }

    public RepositorySession createSession()
    {
        return repositorySession != null ? repositorySession : new RepositorySession( new TestMetadataRepository(),
                                                                                      new TestMetadataResolver() );
    }
View Full Code Here

public class MockRepositorySessionFactory
    implements RepositorySessionFactory
{
    public RepositorySession createSession( )
    {
        return new RepositorySession( null, null )
        {
            @Override
            public void close( )
            {
                return;
View Full Code Here

TOP

Related Classes of org.apache.archiva.metadata.repository.RepositorySession

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.