private String toPath( ArchivaArtifact artifact ) { try { String repoId = artifact.getModel().getRepositoryId(); ManagedRepositoryContent repo = repositoryFactory.getManagedRepositoryContent( repoId ); return repo.toPath( artifact ); } catch ( RepositoryException e ) { log.warn( "Unable to calculate path for artifact: " + artifact ); return ""; } }
private String toPath( ArchivaArtifact artifact ) { try { String repoId = artifact.getModel().getRepositoryId(); ManagedRepositoryContent repo = repositoryFactory.getManagedRepositoryContent( repoId ); return repo.toPath( artifact ); } catch ( RepositoryException e ) { log.warn( "Unable to calculate path for artifact: " + artifact ); return ""; } }
public void processArchivaArtifact( ArchivaArtifact artifact ) throws ConsumerException { try { ManagedRepositoryContent repositoryContent = repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() ); File file = new File( repositoryContent.getRepoRoot(), repositoryContent.toPath( artifact ) ); if( !file.exists() ) { artifactDAO.deleteArtifact( artifact ); } } catch ( RepositoryException re ) { throw new ConsumerException( "Can't run database cleanup remove artifact consumer: " + re.getMessage() ); } catch ( ArchivaDatabaseException e ) { throw new ConsumerException( e.getMessage() ); } }
repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() ); File file = new File( repositoryContent.getRepoRoot(), repositoryContent.toPath( artifact ) );
repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() ); File file = new File( repositoryContent.getRepoRoot(), repositoryContent.toPath( artifact ) );
public void processArchivaArtifact( ArchivaArtifact artifact ) throws ConsumerException { HashcodesRecord record = new HashcodesRecord(); record.setRepositoryId( artifact.getModel().getRepositoryId() ); record.setArtifact( artifact ); IndexedRepositoryDetails pnl = getIndexedRepositoryDetails( artifact ); String artifactPath = pnl.repository.toPath( artifact ); record.setFilename( artifactPath ); try { pnl.index.modifyRecord( record ); } catch ( RepositoryIndexException e ) { triggerConsumerError( INDEX_ERROR, "Unable to index hashcodes: " + e.getMessage() ); } }
repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() ); File file = new File( repositoryContent.getRepoRoot(), repositoryContent.toPath( artifact ) );
private void addProblem( ArchivaArtifact artifact, String msg ) throws ConsumerException { ManagedRepositoryContent repo = getRepository( artifact ); RepositoryProblem problem = new RepositoryProblem(); problem.setRepositoryId( artifact.getModel().getRepositoryId() ); problem.setPath( repo.toPath( artifact ) ); problem.setGroupId( artifact.getGroupId() ); problem.setArtifactId( artifact.getArtifactId() ); problem.setVersion( artifact.getVersion() ); problem.setType( CorruptArtifactReport.PROBLEM_TYPE_CORRUPT_ARTIFACT ); problem.setOrigin( getId() ); problem.setMessage( msg ); try { dao.getRepositoryProblemDAO().saveRepositoryProblem( problem ); } catch ( ArchivaDatabaseException e ) { String emsg = "Unable to save problem with artifact location to DB: " + e.getMessage(); log.warn( emsg, e ); throw new ConsumerException( emsg, e ); } }
private void addProblem( ArchivaArtifact artifact, String msg ) throws ConsumerException { ManagedRepositoryContent repo = getRepository( artifact ); RepositoryProblem problem = new RepositoryProblem(); problem.setRepositoryId( artifact.getModel().getRepositoryId() ); problem.setPath( repo.toPath( artifact ) ); problem.setGroupId( artifact.getGroupId() ); problem.setArtifactId( artifact.getArtifactId() ); problem.setVersion( artifact.getVersion() ); problem.setType( CorruptArtifactReport.PROBLEM_TYPE_CORRUPT_ARTIFACT ); problem.setOrigin( getId() ); problem.setMessage( msg ); try { dao.getRepositoryProblemDAO().saveRepositoryProblem( problem ); } catch ( ArchivaDatabaseException e ) { String emsg = "Unable to save problem with artifact location to DB: " + e.getMessage(); getLogger().warn( emsg, e ); throw new ConsumerException( emsg, e ); } }