rid of plexus utils usage

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1417083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-12-04 18:19:03 +00:00
parent 7ebf8f68ab
commit 5d166ecce8
30 changed files with 73 additions and 55 deletions

View File

@ -52,7 +52,7 @@ public class DefaultUserConfiguration
/**
*
*
* @deprecated Please configure the Plexus registry instead
* @deprecated Please configure the Redback registry instead
*/
private List<String> configs;
@ -111,7 +111,7 @@ public class DefaultUserConfiguration
{
// TODO: plexus should be able to do this on it's own.
log.warn(
"DEPRECATED: the <configs> elements is deprecated. Please configure the Plexus registry instead" );
"DEPRECATED: the <configs> elements is deprecated. Please configure the Redback registry instead" );
}
for ( String configName : configs )

View File

@ -20,7 +20,7 @@ package org.apache.archiva.redback.configuration;
*/
import junit.framework.TestCase;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;

View File

@ -52,7 +52,11 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva.redback</groupId>
<artifactId>redback-rbac-tests</artifactId>

View File

@ -55,7 +55,7 @@ import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.jdo.UserDatabase;
import org.apache.archiva.redback.users.jdo.io.stax.UsersManagementStaxReader;
import org.apache.archiva.redback.users.jdo.io.stax.UsersManagementStaxWriter;
import org.codehaus.plexus.util.IOUtil;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Service;
/**
@ -92,7 +92,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileWriter );
IOUtils.closeQuietly( fileWriter );
}
}
@ -110,7 +110,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileWriter );
IOUtils.closeQuietly( fileWriter );
}
}
@ -137,7 +137,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileWriter );
IOUtils.closeQuietly( fileWriter );
}
}
@ -156,7 +156,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileReader );
IOUtils.closeQuietly( fileReader );
}
Map<String, Permission> permissionMap = new HashMap<String, Permission>();
@ -245,7 +245,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileReader );
IOUtils.closeQuietly( fileReader );
}
for ( User user : (List<User>) database.getUsers() )
@ -269,7 +269,7 @@ public class JdoDataManagementTool
}
finally
{
IOUtil.close( fileReader );
IOUtils.closeQuietly( fileReader );
}
for ( AuthenticationKey key : (List<AuthenticationKey>) database.getKeys() )

View File

@ -28,13 +28,13 @@ import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.rbac.Role;
import org.apache.archiva.redback.rbac.UserAssignment;
import org.apache.archiva.redback.users.UserManager;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.SystemUtils;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.tests.utils.RBACDefaults;
import org.apache.archiva.redback.users.User;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.custommonkey.xmlunit.XMLAssert;
import org.junit.Before;
import org.junit.Test;
@ -134,10 +134,10 @@ public class DataManagementTest
StringWriter sw = new StringWriter();
IOUtil.copy( getClass().getResourceAsStream( "/expected-rbac.xml" ), sw );
IOUtils.copy( getClass().getResourceAsStream( "/expected-rbac.xml" ), sw );
XMLAssert.assertXMLEqual( new StringReader( sw.toString() ),
new StringReader( FileUtils.fileRead( backupFile ) ) );
new StringReader( FileUtils.readFileToString( backupFile ) ) );
}
@ -173,9 +173,9 @@ public class DataManagementTest
StringWriter sw = new StringWriter();
IOUtil.copy( getClass().getResourceAsStream( "/expected-users.xml" ), sw );
IOUtils.copy( getClass().getResourceAsStream( "/expected-users.xml" ), sw );
String actual = FileUtils.fileRead( backupFile ).trim();
String actual = FileUtils.readFileToString( backupFile ).trim();
String expected = sw.toString().trim();
XMLAssert.assertXMLEqual( removeTimestampVariance( expected ), removeTimestampVariance( actual ) );
@ -215,9 +215,9 @@ public class DataManagementTest
StringWriter sw = new StringWriter();
IOUtil.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), sw );
IOUtils.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), sw );
String actual = FileUtils.fileRead( backupFile ).trim();
String actual = FileUtils.readFileToString( backupFile ).trim();
String expected = sw.toString().trim();
XMLAssert.assertXMLEqual( removeKeyAndTimestampVariance( expected ), removeKeyAndTimestampVariance( actual ) );
@ -245,7 +245,7 @@ public class DataManagementTest
File backupFile = new File( targetDirectory, "rbac.xml" );
IOUtil.copy( getClass().getResourceAsStream( "/expected-rbac.xml" ), new FileWriter( backupFile ) );
IOUtils.copy( getClass().getResourceAsStream( "/expected-rbac.xml" ), new FileWriter( backupFile ) );
dataManagementTool.restoreRBACDatabase( manager, targetDirectory );
@ -324,7 +324,7 @@ public class DataManagementTest
File backupFile = new File( targetDirectory, "users.xml" );
IOUtil.copy( getClass().getResourceAsStream( "/expected-users.xml" ), new FileWriter( backupFile ) );
IOUtils.copy( getClass().getResourceAsStream( "/expected-users.xml" ), new FileWriter( backupFile ) );
dataManagementTool.restoreUsersDatabase( manager, targetDirectory );
@ -377,7 +377,7 @@ public class DataManagementTest
File backupFile = new File( targetDirectory, "keys.xml" );
IOUtil.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), new FileWriter( backupFile ) );
IOUtils.copy( getClass().getResourceAsStream( "/expected-keys.xml" ), new FileWriter( backupFile ) );
dataManagementTool.restoreKeysDatabase( manager, targetDirectory );

View File

@ -148,6 +148,10 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<!-- === Test Dependencies ======================= -->
<dependency>
<groupId>org.hsqldb</groupId>

View File

@ -30,6 +30,7 @@ import org.apache.archiva.redback.system.check.EnvironmentCheck;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -127,7 +128,7 @@ public class AdminAutoCreateCheck
}
finally
{
IOUtils.close( fis );
IOUtils.closeQuietly( fis );
}
// ensure we have all properties

View File

@ -29,7 +29,7 @@ import org.apache.archiva.redback.policy.AccountLockedException;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.system.SecuritySystemConstants;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -32,8 +32,8 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
import org.apache.archiva.redback.system.SecuritySession;
import org.codehaus.plexus.util.StringUtils;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
/**

View File

@ -27,7 +27,6 @@ import java.security.NoSuchAlgorithmException;
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
*
* @todo move to plexus-utils in future
*/
public class Digest
{

View File

@ -24,7 +24,6 @@ package org.apache.archiva.redback.integration.filter.authentication.digest;
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
*
* @todo should probably move this to plexus-utils or plexus-security-common
*/
public class Hex
{

View File

@ -28,9 +28,9 @@ import org.apache.archiva.redback.authentication.TokenBasedAuthenticationDataSou
import org.apache.archiva.redback.policy.AccountLockedException;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.codehaus.plexus.util.StringUtils;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticationException;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import javax.inject.Inject;

View File

@ -21,9 +21,9 @@ package org.apache.archiva.redback.integration.filter.authentication.digest;
import org.apache.commons.codec.binary.Base64;
import org.codehaus.plexus.util.StringUtils;
import org.apache.archiva.redback.integration.HttpUtils;
import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticationException;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;

View File

@ -22,8 +22,8 @@ package org.apache.archiva.redback.integration.filter.authorization;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.apache.archiva.redback.integration.filter.SpringServletFilter;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -38,7 +38,7 @@ import org.apache.archiva.redback.keys.AuthenticationKey;
import org.apache.archiva.redback.policy.UserSecurityPolicy;
import org.apache.archiva.redback.policy.UserValidationSettings;
import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.mail.javamail.JavaMailSender;

View File

@ -21,7 +21,8 @@ package org.apache.archiva.redback.integration.model;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import java.io.Serializable;
@ -29,7 +30,6 @@ import java.io.Serializable;
* UserCredentials
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
*
*/
public abstract class UserCredentials
implements Serializable

View File

@ -30,7 +30,7 @@ import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.keys.KeyNotFoundException;
import org.apache.archiva.redback.policy.CookieSettings;
import org.apache.archiva.redback.system.SecuritySystem;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

View File

@ -21,8 +21,6 @@ package org.apache.archiva.redback.integration.filter.authentication.digest;
import junit.framework.TestCase;
import org.codehaus.plexus.digest.Hex;
public class HexTest
extends TestCase
{

View File

@ -44,7 +44,7 @@ public interface UtilServices
/**
* <b>not intended to be exposed as a REST service.</b>
* will load i18N resource org/codehaus/plexus/redback/users/messages in default en then in the asked locale.
* will load i18N resource org/apache/archiva/redback/users/messages in default en then in the asked locale.
* @param locale
* @return
* @throws RedbackServiceException

View File

@ -796,7 +796,7 @@ public class DefaultUserService
{
RedbackServiceException redbackServiceException =
new RedbackServiceException( "issues during validating user" );
if ( org.codehaus.plexus.util.StringUtils.isEmpty( user.getUsername() ) )
if ( StringUtils.isEmpty( user.getUsername() ) )
{
redbackServiceException.addErrorMessage( new ErrorMessage( "username.required", null ) );
}
@ -808,17 +808,17 @@ public class DefaultUserService
}
}
if ( org.codehaus.plexus.util.StringUtils.isEmpty( user.getFullName() ) )
if ( StringUtils.isEmpty( user.getFullName() ) )
{
redbackServiceException.addErrorMessage( new ErrorMessage( "fullName.required", null ) );
}
if ( org.codehaus.plexus.util.StringUtils.isEmpty( user.getEmail() ) )
if ( StringUtils.isEmpty( user.getEmail() ) )
{
redbackServiceException.addErrorMessage( new ErrorMessage( "email.required", null ) );
}
if ( !org.codehaus.plexus.util.StringUtils.equals( user.getPassword(), user.getConfirmPassword() ) )
if ( !StringUtils.equals( user.getPassword(), user.getConfirmPassword() ) )
{
redbackServiceException.addErrorMessage( new ErrorMessage( "passwords.does.not.match", null ) );
}

View File

@ -52,10 +52,6 @@
<interfaces>
<interface>org.apache.archiva.redback.keys.AuthenticationKey</interface>
</interfaces>
<description>
@plexus.component role="org.apache.archiva.redback.keys.AuthenticationKey"
role-hint="jdo"
</description>
<fields>
<field jpox.primary-key="true"
jpox.value-strategy="off"

View File

@ -40,6 +40,10 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>

View File

@ -23,8 +23,7 @@ import org.apache.archiva.redback.keys.AbstractKeyManager;
import org.apache.archiva.redback.keys.AuthenticationKey;
import org.apache.archiva.redback.keys.KeyManagerException;
import org.apache.archiva.redback.keys.KeyNotFoundException;
import org.apache.archiva.redback.keys.memory.MemoryAuthenticationKey;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

View File

@ -32,6 +32,14 @@
<name>Redback :: RBAC Model</name>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
@ -49,6 +57,7 @@
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -16,8 +16,8 @@ package org.apache.archiva.redback.rbac;
* limitations under the License.
*/
import org.codehaus.plexus.util.CollectionUtils;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -16,7 +16,8 @@ package org.apache.archiva.redback.rbac;
* limitations under the License.
*/
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
/**
* RBACObjectAssertions

View File

@ -25,7 +25,7 @@ import org.apache.archiva.redback.rbac.RbacManagerException;
import org.apache.archiva.redback.rbac.RbacObjectNotFoundException;
import org.apache.archiva.redback.rbac.Role;
import org.apache.archiva.redback.components.jdo.JdoFactory;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;

View File

@ -31,7 +31,7 @@ import org.apache.archiva.redback.rbac.Resource;
import org.apache.archiva.redback.rbac.Role;
import org.apache.archiva.redback.rbac.UserAssignment;
import org.apache.archiva.redback.rbac.RbacPermanentException;
import org.codehaus.plexus.util.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;

View File

@ -52,7 +52,11 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<artifactId>redback-rbac-memory</artifactId>
<groupId>org.apache.archiva.redback</groupId>

View File

@ -29,12 +29,12 @@ import org.apache.archiva.redback.role.model.ModelTemplate;
import org.apache.archiva.redback.role.model.RedbackRoleModel;
import org.apache.archiva.redback.role.model.io.stax.RedbackRoleModelStaxReader;
import org.apache.archiva.redback.role.processor.RoleModelProcessor;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.SystemUtils;
import org.apache.archiva.redback.rbac.Resource;
import org.apache.archiva.redback.role.template.RoleTemplateProcessor;
import org.apache.archiva.redback.role.util.RoleModelUtils;
import org.apache.archiva.redback.role.validator.RoleModelValidator;
import org.codehaus.plexus.util.IOUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@ -135,7 +135,7 @@ public class DefaultRoleManager
}
finally
{
IOUtil.close( inputStreamReader );
IOUtils.closeQuietly( inputStreamReader );
}
}