@Test public void testNewItemStreamWithNamespace2() { ItemSelector selector = ArchivaItemSelector.builder( ) .withNamespace( "org.apache.maven" ) .recurse() .build(); Stream<? extends ContentItem> stream = repoContent.newItemStream( selector, false ); List<? extends ContentItem> result = stream.collect( Collectors.toList( ) ); assertEquals( 170, result.size( ) ); assertEquals( 92, result.stream( ).filter( a -> a instanceof DataItem ).count( ) ); }
@Override public Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException { final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); } else if ( selector.hasProjectId() && selector.hasVersion() && selector.getVersion().contains("*")) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else if ( selector.hasProjectId( ) && selector.hasVersion( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ), selector.getVersion() ); } else if ( selector.hasProjectId( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else { startDir = getAsset( selector.getNamespace( ) ); if ( !selector.recurse( ) ) { return startDir.list( ).stream( ) .flatMap( a -> getChildrenDF( a, 1 ) ) .map( this::getItemFromPath ); } } return StorageUtil.newAssetStream( startDir, parallel ) .filter( filter ) .map( this::getItemFromPath ); }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException { final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); } else if ( selector.hasProjectId() && selector.hasVersion() && selector.getVersion().contains("*")) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else if ( selector.hasProjectId( ) && selector.hasVersion( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ), selector.getVersion() ); } else if ( selector.hasProjectId( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else { startDir = getAsset( selector.getNamespace( ) ); if ( !selector.recurse( ) ) { return startDir.list( ).stream( ) .flatMap( a -> getChildrenDF( a, 1 ) ) .map( this::getItemFromPath ); } } return StorageUtil.newAssetStream( startDir, parallel ) .filter( filter ) .map( this::getItemFromPath ); } }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException { final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); } else if ( selector.hasProjectId() && selector.hasVersion() && selector.getVersion().contains("*")) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else if ( selector.hasProjectId( ) && selector.hasVersion( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ), selector.getVersion() ); } else if ( selector.hasProjectId( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else { startDir = getAsset( selector.getNamespace( ) ); if ( !selector.recurse( ) ) { return startDir.list( ).stream( ) .flatMap( a -> getChildrenDF( a, 1 ) ) .map( this::getItemFromPath ); } } return StorageUtil.newAssetStream( startDir, parallel ) .filter( filter ) .map( this::getItemFromPath ); } ManagedDefaultRepositoryContent( );  ManagedDefaultRepositoryContent( ManagedRepository repository, FileTypes fileTypes, FileLockManager lockManager ); }
ManagedDefaultRepositoryContent extends AbstractDefaultRepositoryContent implements ManagedRepositoryContent, BaseRepositoryContentLayout { @Override public Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException { final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); } else if ( selector.hasProjectId() && selector.hasVersion() && selector.getVersion().contains("*")) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else if ( selector.hasProjectId( ) && selector.hasVersion( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ), selector.getVersion() ); } else if ( selector.hasProjectId( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else { startDir = getAsset( selector.getNamespace( ) ); if ( !selector.recurse( ) ) { return startDir.list( ).stream( ) .flatMap( a -> getChildrenDF( a, 1 ) ) .map( this::getItemFromPath ); } } return StorageUtil.newAssetStream( startDir, parallel ) .filter( filter ) .map( this::getItemFromPath ); } 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 Stream<? extends ContentItem> newItemStream( ItemSelector selector, boolean parallel ) throws ContentAccessException, IllegalArgumentException { final Predicate<StorageAsset> filter = getItemFileFilterFromSelector( selector ); StorageAsset startDir; if (selector.getNamespace().contains("*")) { startDir = getAsset(""); } else if ( selector.hasProjectId( ) && selector.getProjectId().contains("*") ) { startDir = getAsset( selector.getNamespace( ) ); } else if ( selector.hasProjectId() && selector.hasVersion() && selector.getVersion().contains("*")) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else if ( selector.hasProjectId( ) && selector.hasVersion( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ), selector.getVersion() ); } else if ( selector.hasProjectId( ) ) { startDir = getAsset( selector.getNamespace( ), selector.getProjectId( ) ); } else { startDir = getAsset( selector.getNamespace( ) ); if ( !selector.recurse( ) ) { return startDir.list( ).stream( ) .flatMap( a -> getChildrenDF( a, 1 ) ) .map( this::getItemFromPath ); } } return StorageUtil.newAssetStream( startDir, parallel ) .filter( filter ) .map( this::getItemFromPath ); } 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; }