From d54c2b547262c73d25362d3ff8e4ce37a329034e Mon Sep 17 00:00:00 2001 From: Eric Barboni Date: Sat, 12 Apr 2014 02:14:57 +0200 Subject: [PATCH] fix fuzzy override placing failure on web --- .../web/api/DefaultDataValidatorService.java | 8 +- .../web/api/DefaultFileUploadService.java | 25 ++-- .../web/api/DefaultJavascriptLogger.java | 16 +-- .../web/api/DefaultRuntimeInfoService.java | 4 +- .../archiva/web/rss/RssFeedServlet.java | 4 +- .../ArchivaConfigurableUsersManager.java | 74 +++++------ .../ArchivaLdapRoleMapperConfiguration.java | 16 +-- .../web/security/ArchivaRbacManager.java | 106 +++++++-------- .../web/startup/SecuritySynchronization.java | 4 +- .../remotedownload/DownloadArtifactsTest.java | 7 +- .../memory/TestMetadataRepository.java | 124 +++++++++--------- 11 files changed, 191 insertions(+), 197 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultDataValidatorService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultDataValidatorService.java index 2faac2aa1..8d52ab5c2 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultDataValidatorService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultDataValidatorService.java @@ -61,10 +61,10 @@ public class DefaultDataValidatorService catch ( RepositoryAdminException e ) { throw new ArchivaRestServiceException( e.getMessage(), e ); - @Override - } + } } + @Override public Boolean remoteRepositoryIdNotExists( String id ) throws ArchivaRestServiceException { @@ -74,11 +74,11 @@ public class DefaultDataValidatorService } catch ( RepositoryAdminException e ) { - throw new ArchivaRestServiceException( e.getMessa @Override -ge(), e ); + throw new ArchivaRestServiceException( e.getMessage(), e ); } } + @Override public Boolean networkProxyIdNotExists( String id ) throws ArchivaRestServiceException { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java index 4b97ab942..2bbaf4b06 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultFileUploadService.java @@ -173,13 +173,13 @@ public class DefaultFileUploadService (List) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); if ( fileMetadatas == null ) { - fileMetadatas = new CopyOnWriteArrayList(); + fileMetadatas = new CopyOnWriteArrayList<>(); httpServletRequest.getSession().setAttribute( FILES_SESSION_KEY, fileMetadatas ); } - return fileMeta @Override -datas; + return fileMetadatas; } + @Override public Boolean deleteFile( String fileName ) throws ArchivaRestServiceException { @@ -195,10 +195,10 @@ datas; { return file.delete(); } - r @Override -eturn Boolean.FALSE; + return Boolean.FALSE; } + @Override public Boolean clearUploadedFiles() throws ArchivaRestServiceException { @@ -207,21 +207,21 @@ eturn Boolean.FALSE; { deleteFile( new File( fileMetadata.getServerFileName() ).getPath() ); } - getSessionFileMetadatas().cle @Override -ar(); + getSessionFileMetadatas().clear(); return Boolean.TRUE; } + @Override public List getSessionFileMetadatas() throws ArchivaRestServiceException { List fileMetadatas = (List) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); - return fileMetadatas == null ? Collec @Override -tions.emptyList() : fileMetadatas; + return fileMetadatas == null ? Collections.emptyList() : fileMetadatas; } + @Override public Boolean save( String repositoryId, String groupId, String artifactId, String version, String packaging, boolean generatePom ) throws ArchivaRestServiceException @@ -265,8 +265,7 @@ tions.emptyList() : fileMetadatas; // get from the session file with groupId/artifactId - Iterable filesToAdd = Ite @Override -rables.filter( fileMetadatas, new Predicate() + Iterable filesToAdd = Iterables.filter( fileMetadatas, new Predicate() { public boolean apply( FileMetadata fileMetadata ) { @@ -285,9 +284,9 @@ rables.filter( fileMetadatas, new Predicate() deleteFile( fileMetadata.getServerFileName() ); } - @Override - filesToAdd = Iterables.filter( fileMetadatas, new Predicate() + filesToAdd = Iterables.filter( fileMetadatas, new Predicate() { + @Override public boolean apply( FileMetadata fileMetadata ) { return fileMetadata != null && fileMetadata.isPomFile(); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultJavascriptLogger.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultJavascriptLogger.java index e2c3478ff..a030d1ab5 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultJavascriptLogger.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultJavascriptLogger.java @@ -43,10 +43,10 @@ public class DefaultJavascriptLogger return Boolean.TRUE; } toUse.trace( javascriptLog.getMessage() ); - return Boolean @Override -.TRUE; + return Boolean.TRUE; } + @Override public Boolean debug( JavascriptLog javascriptLog ) { Logger toUse = @@ -58,10 +58,10 @@ public class DefaultJavascriptLogger } toUse.debug( javascriptLog.getMessage() ); - @Override -return Boolean.TRUE; + return Boolean.TRUE; } + @Override public Boolean info( JavascriptLog javascriptLog ) { Logger toUse = @@ -72,11 +72,11 @@ return Boolean.TRUE; return Boolean.TRUE; } - toUse.info( javascriptLog.getMessage @Override -() ); + toUse.info( javascriptLog.getMessage() ); return Boolean.TRUE; } + @Override public Boolean warn( JavascriptLog javascriptLog ) { Logger toUse = @@ -87,11 +87,11 @@ return Boolean.TRUE; return Boolean.TRUE; } - toUse.warn( javascript @Override -Log.getMessage() ); + toUse.warn( javascriptLog.getMessage() ); return Boolean.TRUE; } + @Override public Boolean error( JavascriptLog javascriptLog ) { Logger toUse = diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultRuntimeInfoService.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultRuntimeInfoService.java index 25945513c..c0eaf3f7e 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultRuntimeInfoService.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/api/DefaultRuntimeInfoService.java @@ -102,10 +102,10 @@ public class DefaultRuntimeInfoService { return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80 ? "" - : ":" + req.getServerPort() ) + req.getContextP @Override -ath(); + : ":" + req.getServerPort() ) + req.getContextPath(); } + @Override public Boolean logMissingI18n( String key ) { i18nLogger.info( "missing i18n key : '{}'", key ); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java index 3e639e006..ddf22be14 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java @@ -103,10 +103,10 @@ public class RssFeedServlet servletAuth = wac.getBean( ServletAuthenticator.class ); httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class ); // TODO: what if there are other types? - repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.cl @Override -ass ); + repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.class ); } + @Override public void doGet( HttpServletRequest req, HttpServletResponse res ) throws ServletException, IOException { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java index 6fed3800a..70f75be15 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaConfigurableUsersManager.java @@ -25,10 +25,8 @@ import org.apache.archiva.redback.users.AbstractUserManager; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.UserManager; import org.apache.archiva.redback.users.UserManagerException; -import org.apache.archiva.redback.users.UserManagerListener; import org.apache.archiva.redback.users.UserNotFoundException; import org.apache.archiva.redback.users.UserQuery; -import org.apache.archiva.redback.users.configurable.ConfigurableUserManager; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Service; @@ -73,7 +71,7 @@ public class ArchivaConfigurableUsersManager redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getUserManagerImpls(); log.info( "use userManagerImpls: '{}'", userManagerImpls ); - userManagerPerId = new LinkedHashMap( userManagerImpls.size() ); + userManagerPerId = new LinkedHashMap<>( userManagerImpls.size() ); for ( String id : userManagerImpls ) { UserManager userManagerImpl = applicationContext.getBean( "userManager#" + id, UserManager.class ); @@ -93,10 +91,10 @@ public class ArchivaConfigurableUsersManager protected boolean useUsersCache() { - return this.useUsers @Override -Cache; + return this.useUsersCache; } + @Override public User addUser( User user ) throws UserManagerException { @@ -107,10 +105,10 @@ Cache; usersCache.put( user.getUsername(), user ); } - @Override return user; } + @Override public void addUserUnchecked( User user ) throws UserManagerException { @@ -118,11 +116,11 @@ Cache; if ( useUsersCache() ) { - usersCache.put( use @Override -r.getUsername(), user ); + usersCache.put( user.getUsername(), user ); } } + @Override public User createUser( String username, String fullName, String emailAddress ) throws UserManagerException { @@ -146,19 +144,19 @@ r.getUsername(), user ); } if ( lastException != null && allFailed ) { - throw new UserManagerException( lastException.getMessage(), @Override - lastException ); + throw new UserManagerException( lastException.getMessage(), lastException ); } return user; } + @Override public UserQuery createUserQuery() { - return u @Override -serManagerPerId.values().iterator().next().createUserQuery(); + return userManagerPerId.values().iterator().next().createUserQuery(); } + @Override public void deleteUser( String username ) throws UserNotFoundException, UserManagerException { @@ -182,11 +180,11 @@ serManagerPerId.values().iterator().next().createUserQuery(); } if ( lastException != null && allFailed ) { - throw new @Override -UserManagerException( lastException.getMessage(), lastException ); + throw new UserManagerException( lastException.getMessage(), lastException ); } } + @Override public void eraseDatabase() { for ( UserManager userManager : userManagerPerId.values() ) @@ -242,14 +240,14 @@ UserManagerException( lastException.getMessage(), lastException ); { throw (UserNotFoundException) lastException; } - throw new UserManagerException( @Override -lastException.getMessage(), lastException ); + throw new UserManagerException( lastException.getMessage(), lastException ); } } return user; } + @Override public User findUser( String username ) throws UserManagerException { @@ -259,12 +257,12 @@ lastException.getMessage(), lastException ); @Override public User getGuestUser() - @Override throws UserNotFoundException, UserManagerException { return findUser( GUEST_USERNAME ); } + @Override public List findUsersByEmailKey( String emailKey, boolean orderAscending ) throws UserManagerException { @@ -273,8 +271,7 @@ lastException.getMessage(), lastException ); for ( UserManager userManager : userManagerPerId.values() ) { List found = userManager.findUsersByEmailKey( emailKey, orderAscending ); - i @Override -f ( found != null ) + if ( found != null ) { users.addAll( found ); } @@ -282,6 +279,7 @@ f ( found != null ) return users; } + @Override public List findUsersByFullNameKey( String fullNameKey, boolean orderAscending ) throws UserManagerException { @@ -289,8 +287,7 @@ f ( found != null ) for ( UserManager userManager : userManagerPerId.values() ) { - List found = userManager.findUsersByFullNameKey( fullNameKey, orderAscending ); @Override - + List found = userManager.findUsersByFullNameKey( fullNameKey, orderAscending ); if ( found != null ) { users.addAll( found ); @@ -299,6 +296,7 @@ f ( found != null ) return users; } + @Override public List findUsersByQuery( UserQuery query ) throws UserManagerException { @@ -306,8 +304,7 @@ f ( found != null ) for ( UserManager userManager : userManagerPerId.values() ) { - List found = userManager.findUsersByQ @Override -uery( query ); + List found = userManager.findUsersByQuery( query ); if ( found != null ) { users.addAll( found ); @@ -316,6 +313,7 @@ uery( query ); return users; } + @Override public List findUsersByUsernameKey( String usernameKey, boolean orderAscending ) throws UserManagerException { @@ -323,10 +321,8 @@ uery( query ); for ( UserManager userManager : userManagerPerId.values() ) { - List found = userManager.findUsersByUsernameKey( us @Override -ernameKey, orderAscending ); - if ( @Override -found != null ) + List found = userManager.findUsersByUsernameKey( usernameKey, orderAscending ); + if ( found != null ) { users.addAll( found ); } @@ -334,19 +330,20 @@ found != null ) return users; } + @Override public String getId() { return null; } + @Override public List getUsers() throws UserManagerException { List users = new ArrayList<>(); for ( UserManager userManager : userManagerPerId.values() ) - @Override -{ + { List found = userManager.getUsers(); if ( found != null ) { @@ -356,6 +353,7 @@ found != null ) return users; } + @Override public List getUsers( boolean orderAscending ) throws UserManagerException { @@ -363,7 +361,6 @@ found != null ) for ( UserManager userManager : userManagerPerId.values() ) { - @Override List found = userManager.getUsers( orderAscending ); if ( found != null ) { @@ -373,8 +370,8 @@ found != null ) return users; } - public boolean isReadOnly( @Override -) + @Override + public boolean isReadOnly() { boolean readOnly = false; @@ -385,12 +382,12 @@ found != null ) return readOnly; } + @Override public User updateUser( User user ) throws UserNotFoundException, UserManagerException { - UserManager userManage @Override -r = userManagerPerId.get( user.getUserManagerId() ); + UserManager userManager = userManagerPerId.get( user.getUserManagerId() ); user = userManager.updateUser( user ); @@ -402,6 +399,7 @@ r = userManagerPerId.get( user.getUserManagerId() ); return user; } + @Override public User updateUser( User user, boolean passwordChangeRequired ) throws UserNotFoundException, UserManagerException { @@ -439,8 +437,7 @@ r = userManagerPerId.get( user.getUserManagerId() ); } } catch ( Exception e ) - @Override - { + { lastException = e; } } @@ -452,6 +449,7 @@ r = userManagerPerId.get( user.getUserManagerId() ); } + @Override public boolean userExists( String userName ) throws UserManagerException { @@ -475,8 +473,7 @@ r = userManagerPerId.get( user.getUserManagerId() ); lastException = e; } } - if ( las @Override -tException != null && allFailed ) + if ( lastException != null && allFailed ) { throw new UserManagerException( lastException.getMessage(), lastException ); } @@ -490,6 +487,7 @@ tException != null && allFailed ) return false; } + @Override public String getDescriptionKey() { return "archiva.redback.usermanager.configurable.archiva"; diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLdapRoleMapperConfiguration.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLdapRoleMapperConfiguration.java index 2ce58358b..e16800390 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLdapRoleMapperConfiguration.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaLdapRoleMapperConfiguration.java @@ -70,11 +70,11 @@ public class ArchivaLdapRoleMapperConfiguration catch ( RepositoryAdminException e ) { throw new MappingException( e.getMessage(), e ); - @Override - } + } } + @Override public void updateLdapMapping( String ldapGroup, List roles ) throws MappingException { @@ -96,11 +96,11 @@ public class ArchivaLdapRoleMapperConfiguration } catch ( RepositoryAdminException e ) { - throw new MappingException( e.getMessa @Override -ge(), e ); + throw new MappingException( e.getMessage(), e ); } } + @Override public void removeLdapMapping( String group ) throws MappingException { @@ -115,12 +115,12 @@ ge(), e ); } catch ( RepositoryAdminException e ) { - throw new MappingExceptio @Override -n( e.getMessage(), e ); + throw new MappingException( e.getMessage(), e ); } } + @Override public Map> getLdapGroupMappings() throws MappingException { @@ -147,11 +147,11 @@ n( e.getMessage(), e ); } catch ( RepositoryAdminException e ) { - throw new @Override -MappingException( e.getMessage(), e ); + throw new MappingException( e.getMessage(), e ); } } + @Override public void setLdapGroupMappings( Map> mappings ) throws MappingException { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java index 607d2dab6..0628eb12b 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaRbacManager.java @@ -132,10 +132,10 @@ public class ArchivaRbacManager @Override public Role createRole( String name ) { - return getRbacManagerForWrite().createRole( n @Override -ame ); + return getRbacManagerForWrite().createRole( name ); } + @Override public Role saveRole( Role role ) throws RbacObjectInvalidException, RbacManagerException { @@ -160,10 +160,10 @@ ame ); { throw new RbacManagerException( lastException.getMessage(), lastException ); } - @Override return role; } + @Override public void saveRoles( Collection roles ) throws RbacObjectInvalidException, RbacManagerException { @@ -186,11 +186,11 @@ ame ); } if ( lastException != null && allFailed ) { - throw new RbacManagerException( lastException.getMes @Override -sage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } } + @Override public Role getRole( String roleName ) throws RbacObjectNotFoundException, RbacManagerException { @@ -221,12 +221,12 @@ sage(), lastException ); log.debug( "cannot find role for name: ‘{}", roleName ); if ( lastException != null ) { - throw new RbacManagerException( lastException.getMessage(), @Override - lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } return null; } + @Override public List getAllRoles() throws RbacManagerException { @@ -253,12 +253,12 @@ sage(), lastException ); if ( lastException != null && allFailed ) { throw new RbacManagerException( lastException.getMessage(), lastException ); - @Override - } + } return new ArrayList<>( allRoles.values() ); } + @Override public void removeRole( Role role ) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException { @@ -280,25 +280,25 @@ sage(), lastException ); if ( lastException != null && allFailed ) { - throw new @Override -RbacManagerException( lastException.getMessage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } } + @Override public Permission createPermission( String name ) - throws Rb @Override -acManagerException + throws RbacManagerException { return getRbacManagerForWrite().createPermission( name ); } + @Override public Permission createPermission( String name, String operationName, String resourceIdentifier ) throws RbacManagerException - @Override { return getRbacManagerForWrite().createPermission( name, operationName, resourceIdentifier ); } + @Override public Permission savePermission( Permission permission ) throws RbacObjectInvalidException, RbacManagerException { @@ -322,13 +322,13 @@ acManagerException if ( lastException != null && allFailed ) { - @Override - throw new RbacManagerException( lastException.getMessage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } return permission; } + @Override public Permission getPermission( String permissionName ) throws RbacObjectNotFoundException, RbacManagerException { @@ -357,14 +357,14 @@ acManagerException } } - if ( lastException != null @Override - ) + if ( lastException != null ) { throw new RbacManagerException( lastException.getMessage(), lastException ); } return null; } + @Override public List getAllPermissions() throws RbacManagerException { @@ -390,12 +390,12 @@ acManagerException if ( lastException != null && allFailed ) { - @Override - throw new RbacManagerException( lastException.getMessage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } return new ArrayList<>( allPermissions.values() ); } + @Override public void removePermission( Permission permission ) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException { @@ -413,22 +413,22 @@ acManagerException { lastException = e; } - } @Override - + } if ( lastException != null && allFailed ) { throw new RbacManagerException( lastException.getMessage(), lastException ); - @Override } } + @Override public Operation createOperation( String name ) throws RbacManagerException { return getRbacManagerForWrite().createOperation( name ); } + @Override public Operation saveOperation( Operation operation ) throws RbacObjectInvalidException, RbacManagerException { @@ -448,8 +448,7 @@ acManagerException { lastException = e; } - @Override - } + } if ( lastException != null && allFailed ) { @@ -458,6 +457,7 @@ acManagerException return operation; } + @Override public Operation getOperation( String operationName ) throws RbacObjectNotFoundException, RbacManagerException { @@ -482,8 +482,7 @@ acManagerException } catch ( Exception e ) { - lastExce @Override -ption = e; + lastException = e; } } @@ -494,6 +493,7 @@ ption = e; return null; } + @Override public List getAllOperations() throws RbacManagerException { @@ -517,7 +517,6 @@ ption = e; } } - @Override if ( lastException != null && allFailed ) { throw new RbacManagerException( lastException.getMessage(), lastException ); @@ -525,6 +524,7 @@ ption = e; return new ArrayList<>( allOperations.values() ); } + @Override public void removeOperation( Operation operation ) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException { @@ -539,25 +539,25 @@ ption = e; allFailed = false; } catch ( Exception e ) - @Override - { + { lastException = e; } } if ( lastException != null && allFailed ) { - throw new RbacMan @Override -agerException( lastException.getMessage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } } + @Override public Resource createResource( String identifier ) throws RbacManagerException { return getRbacManagerForWrite().createResource( identifier ); } + @Override public Resource saveResource( Resource resource ) throws RbacObjectInvalidException, RbacManagerException { @@ -573,8 +573,7 @@ agerException( lastException.getMessage(), lastException ); allFailed = false; } } - catch ( Exception e ) @Override - + catch ( Exception e ) { lastException = e; } @@ -587,6 +586,7 @@ agerException( lastException.getMessage(), lastException ); return resource; } + @Override public Resource getResource( String resourceIdentifier ) throws RbacObjectNotFoundException, RbacManagerException { @@ -609,7 +609,6 @@ agerException( lastException.getMessage(), lastException ); return r; } } - @Override catch ( Exception e ) { lastException = e; @@ -623,6 +622,7 @@ agerException( lastException.getMessage(), lastException ); return null; } + @Override public List getAllResources() throws RbacManagerException { @@ -641,8 +641,7 @@ agerException( lastException.getMessage(), lastException ); allFailed = false; } catch ( Exception e ) - @Override - { + { lastException = e; } } @@ -654,6 +653,7 @@ agerException( lastException.getMessage(), lastException ); return new ArrayList<>( allResources.values() ); } + @Override public void removeResource( Resource resource ) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException { @@ -665,8 +665,7 @@ agerException( lastException.getMessage(), lastException ); { rbacManager.removeResource( resource ); resourcesCache.remove( resource.getIdentifier() ); - @Override - allFailed = false; + allFailed = false; } catch ( Exception e ) { @@ -674,19 +673,20 @@ agerException( lastException.getMessage(), lastException ); } } - if ( lastException != null @Override -&& allFailed ) + if ( lastException != null && allFailed ) { throw new RbacManagerException( lastException.getMessage(), lastException ); } } + @Override public UserAssignment createUserAssignment( String principal ) throws RbacManagerException { return getRbacManagerForWrite().createUserAssignment( principal ); } + @Override public UserAssignment saveUserAssignment( UserAssignment userAssignment ) throws RbacObjectInvalidException, RbacManagerException { @@ -700,7 +700,6 @@ agerException( lastException.getMessage(), lastException ); { userAssignment = rbacManager.saveUserAssignment( userAssignment ); allFailed = false; - @Override } } catch ( Exception e ) @@ -716,6 +715,7 @@ agerException( lastException.getMessage(), lastException ); return userAssignment; } + @Override public UserAssignment getUserAssignment( String principal ) throws RbacObjectNotFoundException, RbacManagerException { @@ -793,7 +793,6 @@ agerException( lastException.getMessage(), lastException ); { for ( RBACManager rbacManager : rbacManagersPerId.values() ) { - @Override try { boolean exists = rbacManager.userAssignmentExists( assignment ); @@ -811,6 +810,7 @@ agerException( lastException.getMessage(), lastException ); return false; } + @Override public List getAllUserAssignments() throws RbacManagerException { @@ -834,8 +834,7 @@ agerException( lastException.getMessage(), lastException ); } allUserAssignments.put( ua.getPrincipal(), ua ); } - allFai @Override -led = false; + allFailed = false; } catch ( Exception e ) { @@ -850,6 +849,7 @@ led = false; return new ArrayList<>( allUserAssignments.values() ); } + @Override public List getUserAssignmentsForRoles( Collection roleNames ) throws RbacManagerException { @@ -862,8 +862,7 @@ led = false; { List userAssignments = rbacManager.getUserAssignmentsForRoles( roleNames ); - allUserAssignments.addAll( @Override -userAssignments ); + allUserAssignments.addAll( userAssignments ); allFailed = false; } @@ -880,6 +879,7 @@ userAssignments ); return allUserAssignments; } + @Override public void removeUserAssignment( UserAssignment userAssignment ) throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException { @@ -929,27 +929,25 @@ userAssignments ); } catch ( Exception e ) { - @Override - lastException = e; + lastException = e; } } if ( lastException != null && allFailed ) { - throw new RbacManagerException( lastException.getMe @Override -ssage(), lastException ); + throw new RbacManagerException( lastException.getMessage(), lastException ); } return false; } @Override - public b @Override -oolean roleExists( Role role ) + public boolean roleExists( Role role ) throws RbacManagerException { return roleExists( role.getName() ); } + @Override public void eraseDatabase() { log.warn( "eraseDatabase not implemented" ); @@ -961,11 +959,13 @@ oolean roleExists( Role role ) return false; } + @Override public String getDescriptionKey() { return "archiva.redback.rbacmanager.archiva"; } + @Override public boolean isReadOnly() { return false; diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java index 7a7c87df8..0e28b51af 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java @@ -106,10 +106,10 @@ public class SecuritySynchronization { syncRepoConfiguration( (String) propertyValue ); } - @Override - } + } } + @Override public void beforeConfigurationChange( org.apache.archiva.redback.components.registry.Registry registry, String propertyName, Object propertyValue ) { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java index 14e5f1b4e..3192fce54 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/DownloadArtifactsTest.java @@ -44,9 +44,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Enumeration; import java.util.List; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; @@ -124,12 +121,12 @@ public class DownloadArtifactsTest redirectServer.setHandler( contextRedirect ); redirectServer.start(); this.redirectPort = redirectServer.getConnectors()[0].getLocalPort(); - log.info( "redirect server port {}", redirec @Override -tPort ); + log.info( "redirect server port {}", redirectPort ); } @After + @Override public void tearDown() throws Exception { diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java index 855f60056..32c43f12d 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java @@ -77,138 +77,136 @@ public class TestMetadataRepository @Override public ProjectMetadata getProject( String repoId, String namespace, String projectId ) { - throw new UnsupportedOperationExcept @Override -ion(); + throw new UnsupportedOperationException(); } + @Override public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) { - throw new UnsupportedO @Override -perationException(); + throw new UnsupportedOperationException(); } + @Override public Collection getArtifactVersions( String repoId, String namespace, String projectId, String projectVersion ) { - throw ne @Override -w UnsupportedOperationException(); + throw new UnsupportedOperationException(); } + @Override public Collection getProjectReferences( String repoId, String namespace, String projectId, String projectVersion ) { - @Override - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } - public Collection getRootNamespaces( String rep @Override -oId ) + @Override + public Collection getRootNamespaces( String repoId ) { throw new UnsupportedOperationException(); } - public Collection getNamespaces( String repoId, @Override - String namespace ) + @Override + public Collection getNamespaces( String repoId, String namespace ) { throw new UnsupportedOperationException(); } - public Collection getProjects( @Override -String repoId, String namespace ) + @Override + public Collection getProjects( String repoId, String namespace ) { throw new UnsupportedOperationException(); } - public Collection getProjectVersions( String repoId, String namespace, String projectId ) + @Override + public Collection getProjectVersions( String repoId, String namespace, String projectId ) { return versions; } - public @Override - void updateProject( String repoId, ProjectMetadata project ) + @Override + public void updateProject( String repoId, ProjectMetadata project ) { throw new UnsupportedOperationException(); } - public void updateArtifact( String repoId, String namespace, String projectId, String proj @Override -ectVersion, + @Override + public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion, ArtifactMetadata artifactMeta ) { throw new UnsupportedOperationException(); } - public void updateProjectVersion( String repoId, String namespace, String @Override -projectId, + @Override + public void updateProjectVersion( String repoId, String namespace, String projectId, ProjectVersionMetadata versionMetadata ) { - throw new Uns @Override -upportedOperationException(); + throw new UnsupportedOperationException(); } + @Override public void updateNamespace( String repoId, String namespace ) { - @Override - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } + @Override public List getMetadataFacets( String repodId, String facetId ) { - r @Override -eturn Collections.emptyList(); + return Collections.emptyList(); } + @Override public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) - @Override { throw new UnsupportedOperationException(); } - public void addMetadataFacet( String repositoryId, MetadataFa @Override -cet metadataFacet ) + @Override + public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet ) { throw new UnsupportedOperationException(); } + @Override public void removeMetadataFacets( String repositoryId, String facetId ) { - @Override - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } - public void removeMetadataFacet( String repoId, String facetId, Strin @Override -g name ) + @Override + public void removeMetadataFacet( String repoId, String facetId, String name ) { //To change body of implemented methods use File | Settings | File Templates. - @Override - } + } - public List getArtifactsByDateRange( String repoId, Date startTime, Date endTime ) @Override + public List getArtifactsByDateRange( String repoId, Date startTime, Date endTime ) { return artifacts; } + @Override public Collection getRepositories() { return Collections.singletonList( TEST_REPO ); } - public @Override - List getArtifactsByChecksum( String repoId, String checksum ) + @Override + public List getArtifactsByChecksum( String repoId, String checksum ) { return null; } + @Override public void removeArtifact( String repositoryId, String namespace, String project, String version, String id ) { - throw new Unsu @Override -pportedOperationException(); + throw new UnsupportedOperationException(); } - public void removeArtifact( String repositoryId, String name @Override -space, String project, String version, + @Override + public void removeArtifact( String repositoryId, String namespace, String project, String version, MetadataFacet metadataFacet ) throws MetadataRepositoryException { @@ -216,73 +214,74 @@ space, String project, String version, } @Override - public void remove @Override -Repository( String repo @Override -Id ) + public void removeRepository( String repoId ) { throw new UnsupportedOperationException(); } - pu @Override -blic Collection getArtifacts( String repoId, String names @Override -pace, String projectId, - @Override - String projectVersion ) + @Override + public Collection getArtifacts( String repoId, String namespace, String projectId, + String projectVersion ) { return artifacts; } - public void save() @Override - + @Override + public void save() { } + @Override public void close() { } + @Override public void revert() { throw new UnsupportedOperationException(); } - public boolean canObtainAccess( Class @Override - aClass ) + @Override + public boolean canObtainAccess( Class aClass ) { return false; } + @Override public T obtainAccess( Class aClass ) { - return @Override - null; + return null; } + @Override public List getArtifacts( String repositoryId ) { return artifacts; } - public void removeArtifact( A @Override -rtifactMetadata artifactMetadata, String baseVersion ) + @Override + public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion ) throws MetadataRepositoryException { throw new UnsupportedOperationException(); } - public void remov @Override -eNamespace( String repositoryId, String namespace ) + @Override + public void removeNamespace( String repositoryId, String namespace ) throws MetadataRepositoryException { } + @Override public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataRepositoryException { } + @Override public void removeProject( String repositoryId, String namespace, String projectId ) throws MetadataRepositoryException { @@ -290,6 +289,7 @@ eNamespace( String repositoryId, String namespace ) } + @Override public boolean hasMetadataFacet( String repositoryId, String facetId ) throws MetadataRepositoryException {