@Test public void testGetProjects() { ItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven" ).build(); Namespace ns = repoContent.getNamespace( selector ); assertNotNull( ns ); List<? extends Project> projects = repoContent.getProjects( ns ); assertEquals( 12, projects.size( ) ); String[] expected = new String[]{ "A", "B", "C", "archiva", "discovery", "maven-parent", "samplejar", "shared", "some-ejb", "test", "testing", "update" }; Object[] actual = projects.stream( ).map( p -> p.getId( ) ).sorted( ).toArray( ); assertArrayEquals( expected, actual); }
@Override public List<? extends Project> getProjects( Namespace namespace ) { return namespace.getAsset( ).list( ).stream( ) .filter( StorageAsset::isContainer ) .map( a -> { try { return getProjectFromPath( a ); } catch ( LayoutException e ) { log.error( "Not a valid project path " + a.getPath( ), e ); return null; } } ) .filter( Objects::nonNull ) .collect( Collectors.toList( ) ); }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public List<? extends Project> getProjects( Namespace namespace ) { return namespace.getAsset( ).list( ).stream( ) .filter( StorageAsset::isContainer ) .map( a -> { try { return getProjectFromPath( a ); } catch ( LayoutException e ) { log.error( "Not a valid project path " + a.getPath( ), e ); return null; } } ) .filter( Objects::nonNull ) .collect( Collectors.toList( ) ); } }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public List<? extends Project> getProjects( Namespace namespace ) { return namespace.getAsset( ).list( ).stream( ) .filter( StorageAsset::isContainer ) .map( a -> { try { return getProjectFromPath( a ); } catch ( LayoutException e ) { log.error( "Not a valid project path " + a.getPath( ), e ); return null; } } ) .filter( Objects::nonNull ) .collect( Collectors.toList( ) ); } ManagedDefaultRepositoryContent( );  ManagedDefaultRepositoryContent( ManagedRepository repository, FileTypes fileTypes, FileLockManager lockManager ); }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public List<? extends Project> getProjects( Namespace namespace ) { return namespace.getAsset( ).list( ).stream( ) .filter( StorageAsset::isContainer ) .map( a -> { try { return getProjectFromPath( a ); } catch ( LayoutException e ) { log.error( "Not a valid project path " + a.getPath( ), e ); return null; } } ) .filter( Objects::nonNull ) .collect( Collectors.toList( ) ); } ManagedDefaultRepositoryContent( );  ManagedDefaultRepositoryContent( ManagedRepository repository, FileTypes fileTypes, FileLockManager lockManager ); void setFileTypes( FileTypes fileTypes ); @Override T adaptItem( Class<T> clazz, ContentItem item ); @Override void deleteAllItems( ItemSelector selector, Consumer<ItemDeleteStatus> consumer ); @Override void deleteItem( ContentItem item ); @Override ContentItem getItem( ItemSelector selector ); @Override Namespace getNamespace( final ItemSelector namespaceSelector ); @Override Project getProject( final ItemSelector selector ); @Override Version getVersion( final ItemSelector selector ); Artifact createArtifact( final StorageAsset artifactPath, final ItemSelector selector,
                                    final String classifier ); Namespace getNamespaceFromArtifactPath( final StorageAsset artifactPath ); Namespace getNamespaceFromPath( final StorageAsset nsPath ); Namespace createNamespaceFromPath( final StorageAsset namespacePath); @Override ManagedRepositoryContent getGenericContent( ); @Override Artifact getArtifact( final ItemSelector selectorArg ); @Override Artifact getArtifact( String path ); @Override List<? extends Project> getProjects( Namespace namespace ); @Override List<? extends Project> getProjects( ItemSelector selector ); @Override List<? extends Version> getVersions( final Project project ); @Override List<? extends Version> getVersions( final ItemSelector selector ); List<String> getArtifactVersions( final ItemSelector selector ); @Override List<? extends Artifact> getArtifacts( ItemSelector selector ); @Override Stream<? extends Artifact> newArtifactStream( ItemSelector selector ); @Override List<? extends Artifact> getArtifacts( ContentItem item ); Stream<? extends Artifact> newArtifactStream( Namespace item ); Stream<? extends Artifact> newArtifactStream( Project item ); Stream<? extends Artifact> newArtifactStream( Version item ); Stream<? extends Artifact> newArtifactStream( Artifact item ); @Override Stream<? extends Artifact> newArtifactStream( ContentItem item ); @Override Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ); @Override boolean hasContent( ItemSelector selector ); @Override ContentItem getParent( ContentItem item ); @Override List<? extends ContentItem> getChildren( ContentItem item ); @Override T applyCharacteristic( Class<T> clazz, ContentItem item ); @Override T getLayout( Class<T> clazz ); @Override boolean supportsLayout( Class<T> clazz ); @Override List<Class<? extends ManagedRepositoryContentLayout>> getSupportedLayouts( ); @Override void addArtifact( Path sourceFile, Artifact destination ); @Override ContentItem toItem( String path ); @Override ContentItem toItem( StorageAsset assetPath ); @Override String toPath( ContentItem item ); @Override DataItem getMetadataItem( Version version ); @Override DataItem getMetadataItem( Project project ); @Override String getId( ); @Override ManagedRepository getRepository( ); @Override void setRepository( final ManagedRepository repo ); void setFiletypes( FileTypes filetypes ); void setMavenContentHelper( MavenContentHelper contentHelper ); MavenMetadataReader getMetadataReader( ); void setMetadataReader( MavenMetadataReader metadataReader ); }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public List<? extends Project> getProjects( Namespace namespace ) { return namespace.getAsset( ).list( ).stream( ) .filter( StorageAsset::isContainer ) .map( a -> { try { return getProjectFromPath( a ); } catch ( LayoutException e ) { log.error( "Not a valid project path " + a.getPath( ), e ); return null; } } ) .filter( Objects::nonNull ) .collect( Collectors.toList( ) ); } ManagedDefaultRepositoryContent( );  ManagedDefaultRepositoryContent( ManagedRepository repository, FileTypes fileTypes, FileLockManager lockManager ); void setFileTypes( FileTypes fileTypes ); @Override T adaptItem( Class<T> clazz, ContentItem item ); @Override void deleteAllItems( ItemSelector selector, Consumer<ItemDeleteStatus> consumer ); @Override void deleteItem( ContentItem item ); @Override ContentItem getItem( ItemSelector selector ); @Override Namespace getNamespace( final ItemSelector namespaceSelector ); @Override Project getProject( final ItemSelector selector ); @Override Version getVersion( final ItemSelector selector ); Artifact createArtifact( final StorageAsset artifactPath, final ItemSelector selector,
                                    final String classifier ); Namespace getNamespaceFromArtifactPath( final StorageAsset artifactPath ); Namespace getNamespaceFromPath( final StorageAsset nsPath ); Namespace createNamespaceFromPath( final StorageAsset namespacePath); @Override ManagedRepositoryContent getGenericContent( ); @Override Artifact getArtifact( final ItemSelector selectorArg ); @Override Artifact getArtifact( String path ); @Override List<? extends Project> getProjects( Namespace namespace ); @Override List<? extends Project> getProjects( ItemSelector selector ); @Override List<? extends Version> getVersions( final Project project ); @Override List<? extends Version> getVersions( final ItemSelector selector ); List<String> getArtifactVersions( final ItemSelector selector ); @Override List<? extends Artifact> getArtifacts( ItemSelector selector ); @Override Stream<? extends Artifact> newArtifactStream( ItemSelector selector ); @Override List<? extends Artifact> getArtifacts( ContentItem item ); Stream<? extends Artifact> newArtifactStream( Namespace item ); Stream<? extends Artifact> newArtifactStream( Project item ); Stream<? extends Artifact> newArtifactStream( Version item ); Stream<? extends Artifact> newArtifactStream( Artifact item ); @Override Stream<? extends Artifact> newArtifactStream( ContentItem item ); @Override Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ); @Override boolean hasContent( ItemSelector selector ); @Override ContentItem getParent( ContentItem item ); @Override List<? extends ContentItem> getChildren( ContentItem item ); @Override T applyCharacteristic( Class<T> clazz, ContentItem item ); @Override T getLayout( Class<T> clazz ); @Override boolean supportsLayout( Class<T> clazz ); @Override List<Class<? extends ManagedRepositoryContentLayout>> getSupportedLayouts( ); @Override void addArtifact( Path sourceFile, Artifact destination ); @Override ContentItem toItem( String path ); @Override ContentItem toItem( StorageAsset assetPath ); @Override String toPath( ContentItem item ); @Override DataItem getMetadataItem( Version version ); @Override DataItem getMetadataItem( Project project ); @Override String getId( ); @Override ManagedRepository getRepository( ); @Override void setRepository( final ManagedRepository repo ); void setFiletypes( FileTypes filetypes ); void setMavenContentHelper( MavenContentHelper contentHelper ); MavenMetadataReader getMetadataReader( ); void setMetadataReader( MavenMetadataReader metadataReader ); static final String SNAPSHOT_ARTIFACT_VERSION; static final String SNAPSHOT; static final Pattern UNIQUE_SNAPSHOT_PATTERN; static final Pattern CLASSIFIER_PATTERN; static final Pattern COMMON_EXTENSIONS; static final Pattern TIMESTAMP_PATTERN; static final Pattern GENERIC_SNAPSHOT_PATTERN; }