fix fuzzy override placing failure on web

This commit is contained in:
Eric Barboni 2014-04-12 02:14:57 +02:00
parent 99117364be
commit d54c2b5472
11 changed files with 191 additions and 197 deletions

View File

@ -61,10 +61,10 @@ public class DefaultDataValidatorService
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new ArchivaRestServiceException( e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e );
@Override
} }
} }
@Override
public Boolean remoteRepositoryIdNotExists( String id ) public Boolean remoteRepositoryIdNotExists( String id )
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {
@ -74,11 +74,11 @@ public class DefaultDataValidatorService
} }
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new ArchivaRestServiceException( e.getMessa @Override throw new ArchivaRestServiceException( e.getMessage(), e );
ge(), e );
} }
} }
@Override
public Boolean networkProxyIdNotExists( String id ) public Boolean networkProxyIdNotExists( String id )
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {

View File

@ -173,13 +173,13 @@ public class DefaultFileUploadService
(List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); (List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY );
if ( fileMetadatas == null ) if ( fileMetadatas == null )
{ {
fileMetadatas = new CopyOnWriteArrayList<FileMetadata>(); fileMetadatas = new CopyOnWriteArrayList<>();
httpServletRequest.getSession().setAttribute( FILES_SESSION_KEY, fileMetadatas ); httpServletRequest.getSession().setAttribute( FILES_SESSION_KEY, fileMetadatas );
} }
return fileMeta @Override return fileMetadatas;
datas;
} }
@Override
public Boolean deleteFile( String fileName ) public Boolean deleteFile( String fileName )
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {
@ -195,10 +195,10 @@ datas;
{ {
return file.delete(); return file.delete();
} }
r @Override return Boolean.FALSE;
eturn Boolean.FALSE;
} }
@Override
public Boolean clearUploadedFiles() public Boolean clearUploadedFiles()
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {
@ -207,21 +207,21 @@ eturn Boolean.FALSE;
{ {
deleteFile( new File( fileMetadata.getServerFileName() ).getPath() ); deleteFile( new File( fileMetadata.getServerFileName() ).getPath() );
} }
getSessionFileMetadatas().cle @Override getSessionFileMetadatas().clear();
ar();
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public List<FileMetadata> getSessionFileMetadatas() public List<FileMetadata> getSessionFileMetadatas()
throws ArchivaRestServiceException throws ArchivaRestServiceException
{ {
List<FileMetadata> fileMetadatas = List<FileMetadata> fileMetadatas =
(List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY ); (List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY );
return fileMetadatas == null ? Collec @Override return fileMetadatas == null ? Collections.<FileMetadata>emptyList() : fileMetadatas;
tions.<FileMetadata>emptyList() : fileMetadatas;
} }
@Override
public Boolean save( String repositoryId, String groupId, String artifactId, String version, String packaging, public Boolean save( String repositoryId, String groupId, String artifactId, String version, String packaging,
boolean generatePom ) boolean generatePom )
throws ArchivaRestServiceException throws ArchivaRestServiceException
@ -265,8 +265,7 @@ tions.<FileMetadata>emptyList() : fileMetadatas;
// get from the session file with groupId/artifactId // get from the session file with groupId/artifactId
Iterable<FileMetadata> filesToAdd = Ite @Override Iterable<FileMetadata> filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>()
rables.filter( fileMetadatas, new Predicate<FileMetadata>()
{ {
public boolean apply( FileMetadata fileMetadata ) public boolean apply( FileMetadata fileMetadata )
{ {
@ -285,9 +284,9 @@ rables.filter( fileMetadatas, new Predicate<FileMetadata>()
deleteFile( fileMetadata.getServerFileName() ); deleteFile( fileMetadata.getServerFileName() );
} }
@Override
filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>() filesToAdd = Iterables.filter( fileMetadatas, new Predicate<FileMetadata>()
{ {
@Override
public boolean apply( FileMetadata fileMetadata ) public boolean apply( FileMetadata fileMetadata )
{ {
return fileMetadata != null && fileMetadata.isPomFile(); return fileMetadata != null && fileMetadata.isPomFile();

View File

@ -43,10 +43,10 @@ public class DefaultJavascriptLogger
return Boolean.TRUE; return Boolean.TRUE;
} }
toUse.trace( javascriptLog.getMessage() ); toUse.trace( javascriptLog.getMessage() );
return Boolean @Override return Boolean.TRUE;
.TRUE;
} }
@Override
public Boolean debug( JavascriptLog javascriptLog ) public Boolean debug( JavascriptLog javascriptLog )
{ {
Logger toUse = Logger toUse =
@ -58,10 +58,10 @@ public class DefaultJavascriptLogger
} }
toUse.debug( javascriptLog.getMessage() ); toUse.debug( javascriptLog.getMessage() );
@Override
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public Boolean info( JavascriptLog javascriptLog ) public Boolean info( JavascriptLog javascriptLog )
{ {
Logger toUse = Logger toUse =
@ -72,11 +72,11 @@ return Boolean.TRUE;
return Boolean.TRUE; return Boolean.TRUE;
} }
toUse.info( javascriptLog.getMessage @Override toUse.info( javascriptLog.getMessage() );
() );
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public Boolean warn( JavascriptLog javascriptLog ) public Boolean warn( JavascriptLog javascriptLog )
{ {
Logger toUse = Logger toUse =
@ -87,11 +87,11 @@ return Boolean.TRUE;
return Boolean.TRUE; return Boolean.TRUE;
} }
toUse.warn( javascript @Override toUse.warn( javascriptLog.getMessage() );
Log.getMessage() );
return Boolean.TRUE; return Boolean.TRUE;
} }
@Override
public Boolean error( JavascriptLog javascriptLog ) public Boolean error( JavascriptLog javascriptLog )
{ {
Logger toUse = Logger toUse =

View File

@ -102,10 +102,10 @@ public class DefaultRuntimeInfoService
{ {
return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80 return req.getScheme() + "://" + req.getServerName() + ( req.getServerPort() == 80
? "" ? ""
: ":" + req.getServerPort() ) + req.getContextP @Override : ":" + req.getServerPort() ) + req.getContextPath();
ath();
} }
@Override
public Boolean logMissingI18n( String key ) public Boolean logMissingI18n( String key )
{ {
i18nLogger.info( "missing i18n key : '{}'", key ); i18nLogger.info( "missing i18n key : '{}'", key );

View File

@ -103,10 +103,10 @@ public class RssFeedServlet
servletAuth = wac.getBean( ServletAuthenticator.class ); servletAuth = wac.getBean( ServletAuthenticator.class );
httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class ); httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
// TODO: what if there are other types? // TODO: what if there are other types?
repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.cl @Override repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.class );
ass );
} }
@Override
public void doGet( HttpServletRequest req, HttpServletResponse res ) public void doGet( HttpServletRequest req, HttpServletResponse res )
throws ServletException, IOException throws ServletException, IOException
{ {

View File

@ -25,10 +25,8 @@ import org.apache.archiva.redback.users.AbstractUserManager;
import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager; import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserManagerException; 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.UserNotFoundException;
import org.apache.archiva.redback.users.UserQuery; import org.apache.archiva.redback.users.UserQuery;
import org.apache.archiva.redback.users.configurable.ConfigurableUserManager;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -73,7 +71,7 @@ public class ArchivaConfigurableUsersManager
redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getUserManagerImpls(); redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getUserManagerImpls();
log.info( "use userManagerImpls: '{}'", userManagerImpls ); log.info( "use userManagerImpls: '{}'", userManagerImpls );
userManagerPerId = new LinkedHashMap<String, UserManager>( userManagerImpls.size() ); userManagerPerId = new LinkedHashMap<>( userManagerImpls.size() );
for ( String id : userManagerImpls ) for ( String id : userManagerImpls )
{ {
UserManager userManagerImpl = applicationContext.getBean( "userManager#" + id, UserManager.class ); UserManager userManagerImpl = applicationContext.getBean( "userManager#" + id, UserManager.class );
@ -93,10 +91,10 @@ public class ArchivaConfigurableUsersManager
protected boolean useUsersCache() protected boolean useUsersCache()
{ {
return this.useUsers @Override return this.useUsersCache;
Cache;
} }
@Override
public User addUser( User user ) public User addUser( User user )
throws UserManagerException throws UserManagerException
{ {
@ -107,10 +105,10 @@ Cache;
usersCache.put( user.getUsername(), user ); usersCache.put( user.getUsername(), user );
} }
@Override
return user; return user;
} }
@Override
public void addUserUnchecked( User user ) public void addUserUnchecked( User user )
throws UserManagerException throws UserManagerException
{ {
@ -118,11 +116,11 @@ Cache;
if ( useUsersCache() ) if ( useUsersCache() )
{ {
usersCache.put( use @Override usersCache.put( user.getUsername(), user );
r.getUsername(), user );
} }
} }
@Override
public User createUser( String username, String fullName, String emailAddress ) public User createUser( String username, String fullName, String emailAddress )
throws UserManagerException throws UserManagerException
{ {
@ -146,19 +144,19 @@ r.getUsername(), user );
} }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new UserManagerException( lastException.getMessage(), @Override throw new UserManagerException( lastException.getMessage(), lastException );
lastException );
} }
return user; return user;
} }
@Override
public UserQuery createUserQuery() public UserQuery createUserQuery()
{ {
return u @Override return userManagerPerId.values().iterator().next().createUserQuery();
serManagerPerId.values().iterator().next().createUserQuery();
} }
@Override
public void deleteUser( String username ) public void deleteUser( String username )
throws UserNotFoundException, UserManagerException throws UserNotFoundException, UserManagerException
{ {
@ -182,11 +180,11 @@ serManagerPerId.values().iterator().next().createUserQuery();
} }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new @Override throw new UserManagerException( lastException.getMessage(), lastException );
UserManagerException( lastException.getMessage(), lastException );
} }
} }
@Override
public void eraseDatabase() public void eraseDatabase()
{ {
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
@ -242,14 +240,14 @@ UserManagerException( lastException.getMessage(), lastException );
{ {
throw (UserNotFoundException) lastException; throw (UserNotFoundException) lastException;
} }
throw new UserManagerException( @Override throw new UserManagerException( lastException.getMessage(), lastException );
lastException.getMessage(), lastException );
} }
} }
return user; return user;
} }
@Override
public User findUser( String username ) public User findUser( String username )
throws UserManagerException throws UserManagerException
{ {
@ -259,12 +257,12 @@ lastException.getMessage(), lastException );
@Override @Override
public User getGuestUser() public User getGuestUser()
@Override
throws UserNotFoundException, UserManagerException throws UserNotFoundException, UserManagerException
{ {
return findUser( GUEST_USERNAME ); return findUser( GUEST_USERNAME );
} }
@Override
public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending ) public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
throws UserManagerException throws UserManagerException
{ {
@ -273,8 +271,7 @@ lastException.getMessage(), lastException );
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
{ {
List<User> found = userManager.findUsersByEmailKey( emailKey, orderAscending ); List<User> found = userManager.findUsersByEmailKey( emailKey, orderAscending );
i @Override if ( found != null )
f ( found != null )
{ {
users.addAll( found ); users.addAll( found );
} }
@ -282,6 +279,7 @@ f ( found != null )
return users; return users;
} }
@Override
public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending ) public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
throws UserManagerException throws UserManagerException
{ {
@ -289,8 +287,7 @@ f ( found != null )
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
{ {
List<User> found = userManager.findUsersByFullNameKey( fullNameKey, orderAscending ); @Override List<User> found = userManager.findUsersByFullNameKey( fullNameKey, orderAscending );
if ( found != null ) if ( found != null )
{ {
users.addAll( found ); users.addAll( found );
@ -299,6 +296,7 @@ f ( found != null )
return users; return users;
} }
@Override
public List<User> findUsersByQuery( UserQuery query ) public List<User> findUsersByQuery( UserQuery query )
throws UserManagerException throws UserManagerException
{ {
@ -306,8 +304,7 @@ f ( found != null )
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
{ {
List<User> found = userManager.findUsersByQ @Override List<User> found = userManager.findUsersByQuery( query );
uery( query );
if ( found != null ) if ( found != null )
{ {
users.addAll( found ); users.addAll( found );
@ -316,6 +313,7 @@ uery( query );
return users; return users;
} }
@Override
public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending ) public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
throws UserManagerException throws UserManagerException
{ {
@ -323,10 +321,8 @@ uery( query );
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
{ {
List<User> found = userManager.findUsersByUsernameKey( us @Override List<User> found = userManager.findUsersByUsernameKey( usernameKey, orderAscending );
ernameKey, orderAscending ); if ( found != null )
if ( @Override
found != null )
{ {
users.addAll( found ); users.addAll( found );
} }
@ -334,18 +330,19 @@ found != null )
return users; return users;
} }
@Override
public String getId() public String getId()
{ {
return null; return null;
} }
@Override
public List<User> getUsers() public List<User> getUsers()
throws UserManagerException throws UserManagerException
{ {
List<User> users = new ArrayList<>(); List<User> users = new ArrayList<>();
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
@Override
{ {
List<User> found = userManager.getUsers(); List<User> found = userManager.getUsers();
if ( found != null ) if ( found != null )
@ -356,6 +353,7 @@ found != null )
return users; return users;
} }
@Override
public List<User> getUsers( boolean orderAscending ) public List<User> getUsers( boolean orderAscending )
throws UserManagerException throws UserManagerException
{ {
@ -363,7 +361,6 @@ found != null )
for ( UserManager userManager : userManagerPerId.values() ) for ( UserManager userManager : userManagerPerId.values() )
{ {
@Override
List<User> found = userManager.getUsers( orderAscending ); List<User> found = userManager.getUsers( orderAscending );
if ( found != null ) if ( found != null )
{ {
@ -373,8 +370,8 @@ found != null )
return users; return users;
} }
public boolean isReadOnly( @Override @Override
) public boolean isReadOnly()
{ {
boolean readOnly = false; boolean readOnly = false;
@ -385,12 +382,12 @@ found != null )
return readOnly; return readOnly;
} }
@Override
public User updateUser( User user ) public User updateUser( User user )
throws UserNotFoundException, UserManagerException throws UserNotFoundException, UserManagerException
{ {
UserManager userManage @Override UserManager userManager = userManagerPerId.get( user.getUserManagerId() );
r = userManagerPerId.get( user.getUserManagerId() );
user = userManager.updateUser( user ); user = userManager.updateUser( user );
@ -402,6 +399,7 @@ r = userManagerPerId.get( user.getUserManagerId() );
return user; return user;
} }
@Override
public User updateUser( User user, boolean passwordChangeRequired ) public User updateUser( User user, boolean passwordChangeRequired )
throws UserNotFoundException, UserManagerException throws UserNotFoundException, UserManagerException
{ {
@ -439,7 +437,6 @@ r = userManagerPerId.get( user.getUserManagerId() );
} }
} }
catch ( Exception e ) catch ( Exception e )
@Override
{ {
lastException = e; lastException = e;
} }
@ -452,6 +449,7 @@ r = userManagerPerId.get( user.getUserManagerId() );
} }
@Override
public boolean userExists( String userName ) public boolean userExists( String userName )
throws UserManagerException throws UserManagerException
{ {
@ -475,8 +473,7 @@ r = userManagerPerId.get( user.getUserManagerId() );
lastException = e; lastException = e;
} }
} }
if ( las @Override if ( lastException != null && allFailed )
tException != null && allFailed )
{ {
throw new UserManagerException( lastException.getMessage(), lastException ); throw new UserManagerException( lastException.getMessage(), lastException );
} }
@ -490,6 +487,7 @@ tException != null && allFailed )
return false; return false;
} }
@Override
public String getDescriptionKey() public String getDescriptionKey()
{ {
return "archiva.redback.usermanager.configurable.archiva"; return "archiva.redback.usermanager.configurable.archiva";

View File

@ -70,11 +70,11 @@ public class ArchivaLdapRoleMapperConfiguration
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new MappingException( e.getMessage(), e ); throw new MappingException( e.getMessage(), e );
}
}
@Override @Override
}
}
public void updateLdapMapping( String ldapGroup, List<String> roles ) public void updateLdapMapping( String ldapGroup, List<String> roles )
throws MappingException throws MappingException
{ {
@ -96,11 +96,11 @@ public class ArchivaLdapRoleMapperConfiguration
} }
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new MappingException( e.getMessa @Override throw new MappingException( e.getMessage(), e );
ge(), e );
} }
} }
@Override
public void removeLdapMapping( String group ) public void removeLdapMapping( String group )
throws MappingException throws MappingException
{ {
@ -115,12 +115,12 @@ ge(), e );
} }
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new MappingExceptio @Override throw new MappingException( e.getMessage(), e );
n( e.getMessage(), e );
} }
} }
@Override
public Map<String, Collection<String>> getLdapGroupMappings() public Map<String, Collection<String>> getLdapGroupMappings()
throws MappingException throws MappingException
{ {
@ -147,11 +147,11 @@ n( e.getMessage(), e );
} }
catch ( RepositoryAdminException e ) catch ( RepositoryAdminException e )
{ {
throw new @Override throw new MappingException( e.getMessage(), e );
MappingException( e.getMessage(), e );
} }
} }
@Override
public void setLdapGroupMappings( Map<String, List<String>> mappings ) public void setLdapGroupMappings( Map<String, List<String>> mappings )
throws MappingException throws MappingException
{ {

View File

@ -132,10 +132,10 @@ public class ArchivaRbacManager
@Override @Override
public Role createRole( String name ) public Role createRole( String name )
{ {
return getRbacManagerForWrite().createRole( n @Override return getRbacManagerForWrite().createRole( name );
ame );
} }
@Override
public Role saveRole( Role role ) public Role saveRole( Role role )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -160,10 +160,10 @@ ame );
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
} }
@Override
return role; return role;
} }
@Override
public void saveRoles( Collection<Role> roles ) public void saveRoles( Collection<Role> roles )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -186,11 +186,11 @@ ame );
} }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacManagerException( lastException.getMes @Override throw new RbacManagerException( lastException.getMessage(), lastException );
sage(), lastException );
} }
} }
@Override
public Role getRole( String roleName ) public Role getRole( String roleName )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
@ -221,12 +221,12 @@ sage(), lastException );
log.debug( "cannot find role for name: {}", roleName ); log.debug( "cannot find role for name: {}", roleName );
if ( lastException != null ) if ( lastException != null )
{ {
throw new RbacManagerException( lastException.getMessage(), @Override throw new RbacManagerException( lastException.getMessage(), lastException );
lastException );
} }
return null; return null;
} }
@Override
public List<Role> getAllRoles() public List<Role> getAllRoles()
throws RbacManagerException throws RbacManagerException
{ {
@ -253,12 +253,12 @@ sage(), lastException );
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
@Override
} }
return new ArrayList<>( allRoles.values() ); return new ArrayList<>( allRoles.values() );
} }
@Override
public void removeRole( Role role ) public void removeRole( Role role )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
@ -280,25 +280,25 @@ sage(), lastException );
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new @Override throw new RbacManagerException( lastException.getMessage(), lastException );
RbacManagerException( lastException.getMessage(), lastException );
} }
} }
@Override
public Permission createPermission( String name ) public Permission createPermission( String name )
throws Rb @Override throws RbacManagerException
acManagerException
{ {
return getRbacManagerForWrite().createPermission( name ); return getRbacManagerForWrite().createPermission( name );
} }
@Override
public Permission createPermission( String name, String operationName, String resourceIdentifier ) public Permission createPermission( String name, String operationName, String resourceIdentifier )
throws RbacManagerException throws RbacManagerException
@Override
{ {
return getRbacManagerForWrite().createPermission( name, operationName, resourceIdentifier ); return getRbacManagerForWrite().createPermission( name, operationName, resourceIdentifier );
} }
@Override
public Permission savePermission( Permission permission ) public Permission savePermission( Permission permission )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -322,13 +322,13 @@ acManagerException
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
@Override
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
} }
return permission; return permission;
} }
@Override
public Permission getPermission( String permissionName ) public Permission getPermission( String permissionName )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
@ -357,14 +357,14 @@ acManagerException
} }
} }
if ( lastException != null @Override if ( lastException != null )
)
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
} }
return null; return null;
} }
@Override
public List<Permission> getAllPermissions() public List<Permission> getAllPermissions()
throws RbacManagerException throws RbacManagerException
{ {
@ -390,12 +390,12 @@ acManagerException
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
@Override
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
} }
return new ArrayList<>( allPermissions.values() ); return new ArrayList<>( allPermissions.values() );
} }
@Override
public void removePermission( Permission permission ) public void removePermission( Permission permission )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
@ -413,22 +413,22 @@ acManagerException
{ {
lastException = e; lastException = e;
} }
} @Override }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
@Override
} }
} }
@Override
public Operation createOperation( String name ) public Operation createOperation( String name )
throws RbacManagerException throws RbacManagerException
{ {
return getRbacManagerForWrite().createOperation( name ); return getRbacManagerForWrite().createOperation( name );
} }
@Override
public Operation saveOperation( Operation operation ) public Operation saveOperation( Operation operation )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -448,7 +448,6 @@ acManagerException
{ {
lastException = e; lastException = e;
} }
@Override
} }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
@ -458,6 +457,7 @@ acManagerException
return operation; return operation;
} }
@Override
public Operation getOperation( String operationName ) public Operation getOperation( String operationName )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
@ -482,8 +482,7 @@ acManagerException
} }
catch ( Exception e ) catch ( Exception e )
{ {
lastExce @Override lastException = e;
ption = e;
} }
} }
@ -494,6 +493,7 @@ ption = e;
return null; return null;
} }
@Override
public List<Operation> getAllOperations() public List<Operation> getAllOperations()
throws RbacManagerException throws RbacManagerException
{ {
@ -517,7 +517,6 @@ ption = e;
} }
} }
@Override
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
@ -525,6 +524,7 @@ ption = e;
return new ArrayList<>( allOperations.values() ); return new ArrayList<>( allOperations.values() );
} }
@Override
public void removeOperation( Operation operation ) public void removeOperation( Operation operation )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
@ -539,7 +539,6 @@ ption = e;
allFailed = false; allFailed = false;
} }
catch ( Exception e ) catch ( Exception e )
@Override
{ {
lastException = e; lastException = e;
} }
@ -547,17 +546,18 @@ ption = e;
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacMan @Override throw new RbacManagerException( lastException.getMessage(), lastException );
agerException( lastException.getMessage(), lastException );
} }
} }
@Override
public Resource createResource( String identifier ) public Resource createResource( String identifier )
throws RbacManagerException throws RbacManagerException
{ {
return getRbacManagerForWrite().createResource( identifier ); return getRbacManagerForWrite().createResource( identifier );
} }
@Override
public Resource saveResource( Resource resource ) public Resource saveResource( Resource resource )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -573,8 +573,7 @@ agerException( lastException.getMessage(), lastException );
allFailed = false; allFailed = false;
} }
} }
catch ( Exception e ) @Override catch ( Exception e )
{ {
lastException = e; lastException = e;
} }
@ -587,6 +586,7 @@ agerException( lastException.getMessage(), lastException );
return resource; return resource;
} }
@Override
public Resource getResource( String resourceIdentifier ) public Resource getResource( String resourceIdentifier )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
@ -609,7 +609,6 @@ agerException( lastException.getMessage(), lastException );
return r; return r;
} }
} }
@Override
catch ( Exception e ) catch ( Exception e )
{ {
lastException = e; lastException = e;
@ -623,6 +622,7 @@ agerException( lastException.getMessage(), lastException );
return null; return null;
} }
@Override
public List<Resource> getAllResources() public List<Resource> getAllResources()
throws RbacManagerException throws RbacManagerException
{ {
@ -641,7 +641,6 @@ agerException( lastException.getMessage(), lastException );
allFailed = false; allFailed = false;
} }
catch ( Exception e ) catch ( Exception e )
@Override
{ {
lastException = e; lastException = e;
} }
@ -654,6 +653,7 @@ agerException( lastException.getMessage(), lastException );
return new ArrayList<>( allResources.values() ); return new ArrayList<>( allResources.values() );
} }
@Override
public void removeResource( Resource resource ) public void removeResource( Resource resource )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
@ -665,7 +665,6 @@ agerException( lastException.getMessage(), lastException );
{ {
rbacManager.removeResource( resource ); rbacManager.removeResource( resource );
resourcesCache.remove( resource.getIdentifier() ); resourcesCache.remove( resource.getIdentifier() );
@Override
allFailed = false; allFailed = false;
} }
catch ( Exception e ) catch ( Exception e )
@ -674,19 +673,20 @@ agerException( lastException.getMessage(), lastException );
} }
} }
if ( lastException != null @Override if ( lastException != null && allFailed )
&& allFailed )
{ {
throw new RbacManagerException( lastException.getMessage(), lastException ); throw new RbacManagerException( lastException.getMessage(), lastException );
} }
} }
@Override
public UserAssignment createUserAssignment( String principal ) public UserAssignment createUserAssignment( String principal )
throws RbacManagerException throws RbacManagerException
{ {
return getRbacManagerForWrite().createUserAssignment( principal ); return getRbacManagerForWrite().createUserAssignment( principal );
} }
@Override
public UserAssignment saveUserAssignment( UserAssignment userAssignment ) public UserAssignment saveUserAssignment( UserAssignment userAssignment )
throws RbacObjectInvalidException, RbacManagerException throws RbacObjectInvalidException, RbacManagerException
{ {
@ -700,7 +700,6 @@ agerException( lastException.getMessage(), lastException );
{ {
userAssignment = rbacManager.saveUserAssignment( userAssignment ); userAssignment = rbacManager.saveUserAssignment( userAssignment );
allFailed = false; allFailed = false;
@Override
} }
} }
catch ( Exception e ) catch ( Exception e )
@ -716,6 +715,7 @@ agerException( lastException.getMessage(), lastException );
return userAssignment; return userAssignment;
} }
@Override
public UserAssignment getUserAssignment( String principal ) public UserAssignment getUserAssignment( String principal )
throws RbacObjectNotFoundException, RbacManagerException throws RbacObjectNotFoundException, RbacManagerException
{ {
@ -793,7 +793,6 @@ agerException( lastException.getMessage(), lastException );
{ {
for ( RBACManager rbacManager : rbacManagersPerId.values() ) for ( RBACManager rbacManager : rbacManagersPerId.values() )
{ {
@Override
try try
{ {
boolean exists = rbacManager.userAssignmentExists( assignment ); boolean exists = rbacManager.userAssignmentExists( assignment );
@ -811,6 +810,7 @@ agerException( lastException.getMessage(), lastException );
return false; return false;
} }
@Override
public List<UserAssignment> getAllUserAssignments() public List<UserAssignment> getAllUserAssignments()
throws RbacManagerException throws RbacManagerException
{ {
@ -834,8 +834,7 @@ agerException( lastException.getMessage(), lastException );
} }
allUserAssignments.put( ua.getPrincipal(), ua ); allUserAssignments.put( ua.getPrincipal(), ua );
} }
allFai @Override allFailed = false;
led = false;
} }
catch ( Exception e ) catch ( Exception e )
{ {
@ -850,6 +849,7 @@ led = false;
return new ArrayList<>( allUserAssignments.values() ); return new ArrayList<>( allUserAssignments.values() );
} }
@Override
public List<UserAssignment> getUserAssignmentsForRoles( Collection<String> roleNames ) public List<UserAssignment> getUserAssignmentsForRoles( Collection<String> roleNames )
throws RbacManagerException throws RbacManagerException
{ {
@ -862,8 +862,7 @@ led = false;
{ {
List<UserAssignment> userAssignments = rbacManager.getUserAssignmentsForRoles( roleNames ); List<UserAssignment> userAssignments = rbacManager.getUserAssignmentsForRoles( roleNames );
allUserAssignments.addAll( @Override allUserAssignments.addAll( userAssignments );
userAssignments );
allFailed = false; allFailed = false;
} }
@ -880,6 +879,7 @@ userAssignments );
return allUserAssignments; return allUserAssignments;
} }
@Override
public void removeUserAssignment( UserAssignment userAssignment ) public void removeUserAssignment( UserAssignment userAssignment )
throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException throws RbacObjectNotFoundException, RbacObjectInvalidException, RbacManagerException
{ {
@ -929,27 +929,25 @@ userAssignments );
} }
catch ( Exception e ) catch ( Exception e )
{ {
@Override
lastException = e; lastException = e;
} }
} }
if ( lastException != null && allFailed ) if ( lastException != null && allFailed )
{ {
throw new RbacManagerException( lastException.getMe @Override throw new RbacManagerException( lastException.getMessage(), lastException );
ssage(), lastException );
} }
return false; return false;
} }
@Override @Override
public b @Override public boolean roleExists( Role role )
oolean roleExists( Role role )
throws RbacManagerException throws RbacManagerException
{ {
return roleExists( role.getName() ); return roleExists( role.getName() );
} }
@Override
public void eraseDatabase() public void eraseDatabase()
{ {
log.warn( "eraseDatabase not implemented" ); log.warn( "eraseDatabase not implemented" );
@ -961,11 +959,13 @@ oolean roleExists( Role role )
return false; return false;
} }
@Override
public String getDescriptionKey() public String getDescriptionKey()
{ {
return "archiva.redback.rbacmanager.archiva"; return "archiva.redback.rbacmanager.archiva";
} }
@Override
public boolean isReadOnly() public boolean isReadOnly()
{ {
return false; return false;

View File

@ -106,10 +106,10 @@ public class SecuritySynchronization
{ {
syncRepoConfiguration( (String) propertyValue ); syncRepoConfiguration( (String) propertyValue );
} }
@Override
} }
} }
@Override
public void beforeConfigurationChange( org.apache.archiva.redback.components.registry.Registry registry, public void beforeConfigurationChange( org.apache.archiva.redback.components.registry.Registry registry,
String propertyName, Object propertyValue ) String propertyName, Object propertyValue )
{ {

View File

@ -44,9 +44,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
@ -124,12 +121,12 @@ public class DownloadArtifactsTest
redirectServer.setHandler( contextRedirect ); redirectServer.setHandler( contextRedirect );
redirectServer.start(); redirectServer.start();
this.redirectPort = redirectServer.getConnectors()[0].getLocalPort(); this.redirectPort = redirectServer.getConnectors()[0].getLocalPort();
log.info( "redirect server port {}", redirec @Override log.info( "redirect server port {}", redirectPort );
tPort );
} }
@After @After
@Override
public void tearDown() public void tearDown()
throws Exception throws Exception
{ {

View File

@ -77,138 +77,136 @@ public class TestMetadataRepository
@Override @Override
public ProjectMetadata getProject( String repoId, String namespace, String projectId ) public ProjectMetadata getProject( String repoId, String namespace, String projectId )
{ {
throw new UnsupportedOperationExcept @Override throw new UnsupportedOperationException();
ion();
} }
@Override
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
{ {
throw new UnsupportedO @Override throw new UnsupportedOperationException();
perationException();
} }
@Override
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
{ {
throw ne @Override throw new UnsupportedOperationException();
w UnsupportedOperationException();
} }
@Override
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId, public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
{ {
throw new UnsupportedOperationException();
}
@Override @Override
throw new UnsupportedOperationException(); public Collection<String> getRootNamespaces( String repoId )
}
public Collection<String> getRootNamespaces( String rep @Override
oId )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public Collection<String> getNamespaces( String repoId, @Override @Override
String namespace ) public Collection<String> getNamespaces( String repoId, String namespace )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public Collection<String> getProjects( @Override @Override
String repoId, String namespace ) public Collection<String> getProjects( String repoId, String namespace )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public Collection<String @Override @Override
> getProjectVersions( String repoId, String namespace, String projectId ) public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
{ {
return versions; return versions;
} }
public @Override @Override
void updateProject( String repoId, ProjectMetadata project ) public void updateProject( String repoId, ProjectMetadata project )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void updateArtifact( String repoId, String namespace, String projectId, String proj @Override @Override
ectVersion, public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
ArtifactMetadata artifactMeta ) ArtifactMetadata artifactMeta )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void updateProjectVersion( String repoId, String namespace, String @Override @Override
projectId, public void updateProjectVersion( String repoId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata ) ProjectVersionMetadata versionMetadata )
{ {
throw new Uns @Override throw new UnsupportedOperationException();
upportedOperationException();
} }
@Override
public void updateNamespace( String repoId, String namespace ) public void updateNamespace( String repoId, String namespace )
{ {
@Override
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public List<String> getMetadataFacets( String repodId, String facetId ) public List<String> getMetadataFacets( String repodId, String facetId )
{ {
r @Override return Collections.emptyList();
eturn Collections.emptyList();
} }
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
@Override @Override
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void addMetadataFacet( String repositoryId, MetadataFa @Override @Override
cet metadataFacet ) public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void removeMetadataFacets( String repositoryId, String facetId ) public void removeMetadataFacets( String repositoryId, String facetId )
{ {
@Override
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void removeMetadataFacet( String repoId, String facetId, Strin @Override @Override
g name ) public void removeMetadataFacet( String repoId, String facetId, String name )
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
@Override
} }
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
@Override @Override
public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
{ {
return artifacts; return artifacts;
} }
@Override
public Collection<String> getRepositories() public Collection<String> getRepositories()
{ {
return Collections.singletonList( TEST_REPO ); return Collections.singletonList( TEST_REPO );
} }
public @Override @Override
List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum ) public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
{ {
return null; return null;
} }
@Override
public void removeArtifact( String repositoryId, String namespace, String project, String version, String id ) public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
{ {
throw new Unsu @Override throw new UnsupportedOperationException();
pportedOperationException();
} }
public void removeArtifact( String repositoryId, String name @Override @Override
space, String project, String version, public void removeArtifact( String repositoryId, String namespace, String project, String version,
MetadataFacet metadataFacet ) MetadataFacet metadataFacet )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
@ -216,73 +214,74 @@ space, String project, String version,
} }
@Override @Override
public void remove @Override public void removeRepository( String repoId )
Repository( String repo @Override
Id )
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
pu @Override
blic Collection<ArtifactMetadata> getArtifacts( String repoId, String names @Override
pace, String projectId,
@Override @Override
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
{ {
return artifacts; return artifacts;
} }
public void save() @Override @Override
public void save()
{ {
} }
@Override
public void close() public void close()
{ {
} }
@Override
public void revert() public void revert()
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public boolean canObtainAccess( Class @Override @Override
<?> aClass ) public boolean canObtainAccess( Class<?> aClass )
{ {
return false; return false;
} }
@Override
public <T>T obtainAccess( Class<T> aClass ) public <T>T obtainAccess( Class<T> aClass )
{ {
return @Override return null;
null;
} }
@Override
public List<ArtifactMetadata> getArtifacts( String repositoryId ) public List<ArtifactMetadata> getArtifacts( String repositoryId )
{ {
return artifacts; return artifacts;
} }
public void removeArtifact( A @Override @Override
rtifactMetadata artifactMetadata, String baseVersion ) public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public void remov @Override @Override
eNamespace( String repositoryId, String namespace ) public void removeNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
} }
@Override
public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
} }
@Override
public void removeProject( String repositoryId, String namespace, String projectId ) public void removeProject( String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
@ -290,6 +289,7 @@ eNamespace( String repositoryId, String namespace )
} }
@Override
public boolean hasMetadataFacet( String repositoryId, String facetId ) public boolean hasMetadataFacet( String repositoryId, String facetId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {