@Test public void testFindRemoteArtifact() throws Exception { addRemoteArtifact( artifact ); LocalArtifactRequest request = new LocalArtifactRequest( artifact, Arrays.asList( repository ), testContext ); LocalArtifactResult result = manager.find( session, request ); assertTrue( result.isAvailable() ); assertEquals( repository, result.getRepository() ); addRemoteArtifact( snapshot ); request = new LocalArtifactRequest( snapshot, Arrays.asList( repository ), testContext ); result = manager.find( session, request ); assertTrue( result.isAvailable() ); assertEquals( repository, result.getRepository() ); }
@Override public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ) { String path = getPathForArtifact( request.getArtifact(), false ); File file = new File( getRepository().getBasedir(), path ); LocalArtifactResult result = new LocalArtifactResult( request ); if ( file.isFile() ) { result.setFile( file ); Properties props = readRepos( file ); if ( props.get( getKey( file, LOCAL_REPO_ID ) ) != null ) { result.setAvailable( true ); } else { String context = request.getContext(); for ( RemoteRepository repository : request.getRepositories() ) { if ( props.get( getKey( file, getRepositoryKey( repository, context ) ) ) != null ) { result.setAvailable( true ); result.setRepository( repository ); break; } } if ( !result.isAvailable() && !isTracked( props, file ) ) { result.setAvailable( true ); } } } return result; }
EnhancedLocalRepositoryManager extends SimpleLocalRepositoryManager { @Override public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ) { String path = getPathForArtifact( request.getArtifact(), false ); File file = new File( getRepository().getBasedir(), path ); LocalArtifactResult result = new LocalArtifactResult( request ); if ( file.isFile() ) { result.setFile( file ); Properties props = readRepos( file ); if ( props.get( getKey( file, LOCAL_REPO_ID ) ) != null ) { result.setAvailable( true ); } else { String context = request.getContext(); for ( RemoteRepository repository : request.getRepositories() ) { if ( props.get( getKey( file, getRepositoryKey( repository, context ) ) ) != null ) { result.setAvailable( true ); result.setRepository( repository ); break; } } if ( !result.isAvailable() && !isTracked( props, file ) ) { result.setAvailable( true ); } } } return result; } }
EnhancedLocalRepositoryManager extends SimpleLocalRepositoryManager { @Override public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ) { String path = getPathForArtifact( request.getArtifact(), false ); File file = new File( getRepository().getBasedir(), path ); LocalArtifactResult result = new LocalArtifactResult( request ); if ( file.isFile() ) { result.setFile( file ); Properties props = readRepos( file ); if ( props.get( getKey( file, LOCAL_REPO_ID ) ) != null ) { result.setAvailable( true ); } else { String context = request.getContext(); for ( RemoteRepository repository : request.getRepositories() ) { if ( props.get( getKey( file, getRepositoryKey( repository, context ) ) ) != null ) { result.setAvailable( true ); result.setRepository( repository ); break; } } if ( !result.isAvailable() && !isTracked( props, file ) ) { result.setAvailable( true ); } } } return result; } EnhancedLocalRepositoryManager( File basedir, RepositorySystemSession session ); }
EnhancedLocalRepositoryManager extends SimpleLocalRepositoryManager { @Override public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ) { String path = getPathForArtifact( request.getArtifact(), false ); File file = new File( getRepository().getBasedir(), path ); LocalArtifactResult result = new LocalArtifactResult( request ); if ( file.isFile() ) { result.setFile( file ); Properties props = readRepos( file ); if ( props.get( getKey( file, LOCAL_REPO_ID ) ) != null ) { result.setAvailable( true ); } else { String context = request.getContext(); for ( RemoteRepository repository : request.getRepositories() ) { if ( props.get( getKey( file, getRepositoryKey( repository, context ) ) ) != null ) { result.setAvailable( true ); result.setRepository( repository ); break; } } if ( !result.isAvailable() && !isTracked( props, file ) ) { result.setAvailable( true ); } } } return result; } EnhancedLocalRepositoryManager( File basedir, RepositorySystemSession session ); @Override EnhancedLocalRepositoryManager setLogger( Logger logger ); @Override LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ); @Override void add( RepositorySystemSession session, LocalArtifactRegistration request ); }
EnhancedLocalRepositoryManager extends SimpleLocalRepositoryManager { @Override public LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ) { String path = getPathForArtifact( request.getArtifact(), false ); File file = new File( getRepository().getBasedir(), path ); LocalArtifactResult result = new LocalArtifactResult( request ); if ( file.isFile() ) { result.setFile( file ); Properties props = readRepos( file ); if ( props.get( getKey( file, LOCAL_REPO_ID ) ) != null ) { result.setAvailable( true ); } else { String context = request.getContext(); for ( RemoteRepository repository : request.getRepositories() ) { if ( props.get( getKey( file, getRepositoryKey( repository, context ) ) ) != null ) { result.setAvailable( true ); result.setRepository( repository ); break; } } if ( !result.isAvailable() && !isTracked( props, file ) ) { result.setAvailable( true ); } } } return result; } EnhancedLocalRepositoryManager( File basedir, RepositorySystemSession session ); @Override EnhancedLocalRepositoryManager setLogger( Logger logger ); @Override LocalArtifactResult find( RepositorySystemSession session, LocalArtifactRequest request ); @Override void add( RepositorySystemSession session, LocalArtifactRegistration request );  }