public void optimizeRepositoryIndex( String repositoryId ) throws IOException { try { optimizeIndex( repositoryRegistry.getRepository( repositoryId ) ); } catch ( NoSuchRepositoryException e ) { // should never happen getLogger().error( e.getMessage(), e ); } }
public Repository getRepository( final String repoId ) throws NoSuchRepositoryException { final Map<String, Repository> repositories = getRepositoriesMap(); if ( repositories.containsKey( repoId ) ) { return repositories.get( repoId ); } else { throw new NoSuchRepositoryException( repoId ); } }
public void optimizeGroupIndex( String groupId ) throws IOException { try { GroupRepository group = repositoryRegistry.getRepositoryWithFacet( groupId, GroupRepository.class ); optimizeIndex( group ); } catch ( NoSuchRepositoryException e ) { // should never happen getLogger().error( e.getMessage(), e ); } }
public <T> T getRepositoryWithFacet( final String repoId, final Class<T> f ) throws NoSuchRepositoryException { final Repository r = getRepository( repoId ); if ( r.getRepositoryKind().isFacetAvailable( f ) ) { return r.adaptToFacet( f ); } else { throw new NoSuchRepositoryException( repoId ); } }
getLogger().error(e.getMessage(), e); continue; getLogger().error(e.getMessage(), e);
throw new NoSuchRepositoryException( id );
getLogger().error( e.getMessage(), e ); continue; getLogger().error( e.getMessage(), e );
protected Repository getRepositoryForPathPrefixOrId( String pathPrefixOrId, Class<? extends Repository> kind ) throws NoSuchRepositoryException { List<? extends Repository> repositories = repositoryRegistry.getRepositoriesWithFacet( kind ); Repository idMatched = null; Repository pathPrefixMatched = null; for ( Repository repository : repositories ) { if ( StringUtils.equals( repository.getId(), pathPrefixOrId ) ) { idMatched = repository; } if ( StringUtils.equals( repository.getPathPrefix(), pathPrefixOrId ) ) { pathPrefixMatched = repository; } } if ( idMatched != null ) { // id wins return idMatched; } if ( pathPrefixMatched != null ) { // if no id found, prefix wins return pathPrefixMatched; } // nothing found throw new NoSuchRepositoryException( "pathPrefixOrId: '" + pathPrefixOrId + "'" ); }
protected MavenRepository getMavenRepository(String id) throws ResourceException { try { Repository repository = getUnprotectedRepositoryRegistry().getRepository(id); if (!repository.getRepositoryKind().isFacetAvailable(MavenRepository.class)) { throw new ResourceException(Status.CLIENT_ERROR_BAD_REQUEST, "This is not a Maven repository!"); } return repository.adaptToFacet(MavenRepository.class); } catch (NoSuchRepositoryException e) { throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage(), e); } }
protected MavenRepository getMavenRepository( String id ) throws ResourceException { try { Repository repository = getUnprotectedRepositoryRegistry().getRepository( id ); if ( !repository.getRepositoryKind().isFacetAvailable( MavenRepository.class ) ) { throw new ResourceException( Status.CLIENT_ERROR_BAD_REQUEST, "This is not a Maven repository!" ); } return repository.adaptToFacet( MavenRepository.class ); } catch ( NoSuchRepositoryException e ) { throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage(), e ); } }
throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage() );
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage());
getLogger().error( e.getMessage(), e );
getLogger().error(e.getMessage(), e);
new ValidationMessage( "shadowOf", e.getMessage(), "The source nexus repository is not existing." );
public void handleDelete(NexusTask<?> task, Request request) throws ResourceException { try { // check reposes if (getRepositoryGroupId(request) != null) { getRepositoryRegistry().getRepositoryWithFacet(getRepositoryGroupId(request), GroupRepository.class); } else if (getRepositoryId(request) != null) { try { getRepositoryRegistry().getRepository(getRepositoryId(request)); } catch (NoSuchRepositoryException e) { getRepositoryRegistry().getRepositoryWithFacet(getRepositoryId(request), ShadowRepository.class); } } getNexusScheduler().submit("Internal", task); throw new ResourceException(Status.SUCCESS_NO_CONTENT); } catch (RejectedExecutionException e) { throw new ResourceException(Status.CLIENT_ERROR_CONFLICT, e.getMessage()); } catch (NoSuchRepositoryException e) { throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage()); } }
public void handleDelete(NexusTask<?> task, Request request) throws ResourceException { try { // check reposes if (getRepositoryGroupId(request) != null) { getRepositoryRegistry().getRepositoryWithFacet(getRepositoryGroupId(request), GroupRepository.class); } else if (getRepositoryId(request) != null) { try { getRepositoryRegistry().getRepository(getRepositoryId(request)); } catch (NoSuchRepositoryException e) { getRepositoryRegistry().getRepositoryWithFacet(getRepositoryId(request), ShadowRepository.class); } } getNexusScheduler().submit("Internal", task); throw new ResourceException(Status.SUCCESS_NO_CONTENT); } catch (RejectedExecutionException e) { throw new ResourceException(Status.CLIENT_ERROR_CONFLICT, e.getMessage()); } catch (NoSuchRepositoryException e) { throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, e.getMessage()); } }
throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage() );
throw new ResourceException( Status.CLIENT_ERROR_NOT_FOUND, e.getMessage() );