mirror of https://github.com/apache/archiva.git
fix formatting no functionnal changes
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1203664 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
046cc5f5d9
commit
fcb3e8c534
|
@ -24,7 +24,7 @@ import java.net.URI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
|
* BaseFile - convenient File object that tracks the Base Directory and can provide relative path values
|
||||||
* for the file object based on that Base Directory value.
|
* for the file object based on that Base Directory value.
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -78,8 +78,8 @@ public class BaseFile
|
||||||
public BaseFile( URI uri )
|
public BaseFile( URI uri )
|
||||||
{
|
{
|
||||||
super( uri ); // only to satisfy java compiler.
|
super( uri ); // only to satisfy java compiler.
|
||||||
throw new IllegalStateException( "The " + BaseFile.class.getName()
|
throw new IllegalStateException(
|
||||||
+ " object does not support URI construction." );
|
"The " + BaseFile.class.getName() + " object does not support URI construction." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getBaseDir()
|
public File getBaseDir()
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DateUtil - some (not-so) common date utility methods.
|
* DateUtil - some (not-so) common date utility methods.
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -34,7 +34,7 @@ public class DateUtil
|
||||||
{
|
{
|
||||||
return getDuration( new Date( 0 ), new Date( duration ) );
|
return getDuration( new Date( 0 ), new Date( duration ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDuration( long ms1, long ms2 )
|
public static String getDuration( long ms1, long ms2 )
|
||||||
{
|
{
|
||||||
return getDuration( new Date( ms1 ), new Date( ms2 ) );
|
return getDuration( new Date( ms1 ), new Date( ms2 ) );
|
||||||
|
@ -90,7 +90,7 @@ public class DateUtil
|
||||||
leftMins += 60;
|
leftMins += 60;
|
||||||
--leftHours;
|
--leftHours;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( leftHours < 0 )
|
if ( leftHours < 0 )
|
||||||
{
|
{
|
||||||
leftHours += 24;
|
leftHours += 24;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.io.File;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PathUtil - simple utility methods for path manipulation.
|
* PathUtil - simple utility methods for path manipulation.
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -62,9 +62,9 @@ public class PathUtil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a basedir and a child file, return the relative path to the child.
|
* Given a basedir and a child file, return the relative path to the child.
|
||||||
*
|
*
|
||||||
* @param basedir the basedir.
|
* @param basedir the basedir.
|
||||||
* @param file the file to get the relative path for.
|
* @param file the file to get the relative path for.
|
||||||
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
||||||
*/
|
*/
|
||||||
public static String getRelative( String basedir, File file )
|
public static String getRelative( String basedir, File file )
|
||||||
|
@ -74,9 +74,9 @@ public class PathUtil
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a basedir and a child file, return the relative path to the child.
|
* Given a basedir and a child file, return the relative path to the child.
|
||||||
*
|
*
|
||||||
* @param basedir the basedir.
|
* @param basedir the basedir.
|
||||||
* @param child the child path (can be a full path)
|
* @param child the child path (can be a full path)
|
||||||
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
* @return the relative path to the child. (NOTE: this path will NOT start with a {@link File#separator} character)
|
||||||
*/
|
*/
|
||||||
public static String getRelative( String basedir, String child )
|
public static String getRelative( String basedir, String child )
|
||||||
|
@ -100,7 +100,7 @@ public class PathUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
// File is not within basedir.
|
// File is not within basedir.
|
||||||
throw new IllegalStateException( "Unable to obtain relative path of file " + child
|
throw new IllegalStateException(
|
||||||
+ ", it is not within basedir " + basedir + "." );
|
"Unable to obtain relative path of file " + child + ", it is not within basedir " + basedir + "." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,102 +28,134 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class Slf4JPlexusLogger implements org.codehaus.plexus.logging.Logger {
|
public class Slf4JPlexusLogger
|
||||||
|
implements org.codehaus.plexus.logging.Logger
|
||||||
|
{
|
||||||
private Logger log;
|
private Logger log;
|
||||||
|
|
||||||
public Slf4JPlexusLogger(Class<?> clazz) {
|
public Slf4JPlexusLogger( Class<?> clazz )
|
||||||
log = LoggerFactory.getLogger(clazz);
|
{
|
||||||
|
log = LoggerFactory.getLogger( clazz );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Slf4JPlexusLogger(String name) {
|
public Slf4JPlexusLogger( String name )
|
||||||
log = LoggerFactory.getLogger(name);
|
{
|
||||||
|
log = LoggerFactory.getLogger( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String message) {
|
public void debug( String message )
|
||||||
log.debug(message);
|
{
|
||||||
|
log.debug( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String message, Throwable throwable) {
|
public void debug( String message, Throwable throwable )
|
||||||
log.debug(message, throwable);
|
{
|
||||||
|
log.debug( message, throwable );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String message) {
|
public void error( String message )
|
||||||
log.error(message);
|
{
|
||||||
|
log.error( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String message, Throwable throwable) {
|
public void error( String message, Throwable throwable )
|
||||||
log.error(message, throwable);
|
{
|
||||||
|
log.error( message, throwable );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fatalError(String message) {
|
public void fatalError( String message )
|
||||||
log.error(message);
|
{
|
||||||
|
log.error( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fatalError(String message, Throwable throwable) {
|
public void fatalError( String message, Throwable throwable )
|
||||||
log.error(message, throwable);
|
{
|
||||||
|
log.error( message, throwable );
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.codehaus.plexus.logging.Logger getChildLogger(String name) {
|
public org.codehaus.plexus.logging.Logger getChildLogger( String name )
|
||||||
return new Slf4JPlexusLogger(log.getName() + "." + name);
|
{
|
||||||
|
return new Slf4JPlexusLogger( log.getName() + "." + name );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName()
|
||||||
|
{
|
||||||
return log.getName();
|
return log.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getThreshold() {
|
public int getThreshold()
|
||||||
if (log.isTraceEnabled()) {
|
{
|
||||||
|
if ( log.isTraceEnabled() )
|
||||||
|
{
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
|
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
|
||||||
} else if (log.isDebugEnabled()) {
|
}
|
||||||
|
else if ( log.isDebugEnabled() )
|
||||||
|
{
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
|
return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
|
||||||
} else if (log.isInfoEnabled()) {
|
}
|
||||||
|
else if ( log.isInfoEnabled() )
|
||||||
|
{
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
|
return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
|
||||||
} else if (log.isWarnEnabled()) {
|
}
|
||||||
|
else if ( log.isWarnEnabled() )
|
||||||
|
{
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
|
return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
|
||||||
} else if (log.isErrorEnabled()) {
|
}
|
||||||
|
else if ( log.isErrorEnabled() )
|
||||||
|
{
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
|
return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
|
return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String message) {
|
public void info( String message )
|
||||||
log.info(message);
|
{
|
||||||
|
log.info( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String message, Throwable throwable) {
|
public void info( String message, Throwable throwable )
|
||||||
log.info(message, throwable);
|
{
|
||||||
|
log.info( message, throwable );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDebugEnabled() {
|
public boolean isDebugEnabled()
|
||||||
|
{
|
||||||
return log.isDebugEnabled();
|
return log.isDebugEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isErrorEnabled() {
|
public boolean isErrorEnabled()
|
||||||
|
{
|
||||||
return log.isErrorEnabled();
|
return log.isErrorEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFatalErrorEnabled() {
|
public boolean isFatalErrorEnabled()
|
||||||
|
{
|
||||||
return log.isErrorEnabled();
|
return log.isErrorEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInfoEnabled() {
|
public boolean isInfoEnabled()
|
||||||
|
{
|
||||||
return log.isInfoEnabled();
|
return log.isInfoEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWarnEnabled() {
|
public boolean isWarnEnabled()
|
||||||
|
{
|
||||||
return log.isWarnEnabled();
|
return log.isWarnEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThreshold(int threshold) {
|
public void setThreshold( int threshold )
|
||||||
|
{
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warn(String message) {
|
public void warn( String message )
|
||||||
log.warn(message);
|
{
|
||||||
|
log.warn( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warn(String message, Throwable throwable) {
|
public void warn( String message, Throwable throwable )
|
||||||
log.warn(message, throwable);
|
{
|
||||||
|
log.warn( message, throwable );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version utility methods.
|
* Version utility methods.
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -35,26 +35,12 @@ public class VersionUtil
|
||||||
* These are the version patterns found in the filenames of the various artifact's versions IDs.
|
* These are the version patterns found in the filenames of the various artifact's versions IDs.
|
||||||
* These patterns are all tackling lowercase version IDs.
|
* These patterns are all tackling lowercase version IDs.
|
||||||
*/
|
*/
|
||||||
private static final String versionPatterns[] = new String[] {
|
private static final String versionPatterns[] =
|
||||||
"([0-9][_.0-9a-z]*)",
|
new String[]{ "([0-9][_.0-9a-z]*)", "(snapshot)", "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)", "(dev[_.0-9]*)",
|
||||||
"(snapshot)",
|
"(alpha[_.0-9]*)", "(beta[_.0-9]*)", "(rc[_.0-9]*)",
|
||||||
"(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
|
|
||||||
"(dev[_.0-9]*)",
|
|
||||||
"(alpha[_.0-9]*)",
|
|
||||||
"(beta[_.0-9]*)",
|
|
||||||
"(rc[_.0-9]*)",
|
|
||||||
// "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712
|
// "(test[_.0-9]*)", -- omitted for MRM-681, can be reinstated as part of MRM-712
|
||||||
"(debug[_.0-9]*)",
|
"(debug[_.0-9]*)", "(unofficial[_.0-9]*)", "(current)", "(latest)", "(fcs)", "(release[_.0-9]*)",
|
||||||
"(unofficial[_.0-9]*)",
|
"(nightly)", "(final)", "(incubating)", "(incubator)", "([ab][_.0-9]+)" };
|
||||||
"(current)",
|
|
||||||
"(latest)",
|
|
||||||
"(fcs)",
|
|
||||||
"(release[_.0-9]*)",
|
|
||||||
"(nightly)",
|
|
||||||
"(final)",
|
|
||||||
"(incubating)",
|
|
||||||
"(incubator)",
|
|
||||||
"([ab][_.0-9]+)" };
|
|
||||||
|
|
||||||
public static final String SNAPSHOT = "SNAPSHOT";
|
public static final String SNAPSHOT = "SNAPSHOT";
|
||||||
|
|
||||||
|
@ -64,19 +50,20 @@ public class VersionUtil
|
||||||
|
|
||||||
public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT );
|
public static final Pattern GENERIC_SNAPSHOT_PATTERN = Pattern.compile( "^(.*)-" + SNAPSHOT );
|
||||||
|
|
||||||
private static final Pattern VERSION_MEGA_PATTERN = Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );
|
private static final Pattern VERSION_MEGA_PATTERN =
|
||||||
|
Pattern.compile( StringUtils.join( versionPatterns, '|' ), Pattern.CASE_INSENSITIVE );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Tests if the unknown string contains elements that identify it as a version string (or not).
|
* Tests if the unknown string contains elements that identify it as a version string (or not).
|
||||||
* </p>
|
* </p>
|
||||||
*
|
* <p/>
|
||||||
* <p>
|
* <p>
|
||||||
* The algorithm tests each part of the string that is delimited by a '-' (dash) character.
|
* The algorithm tests each part of the string that is delimited by a '-' (dash) character.
|
||||||
* If 75% or more of the sections are identified as 'version' strings, the result is
|
* If 75% or more of the sections are identified as 'version' strings, the result is
|
||||||
* determined to be of a high probability to be version identifier string.
|
* determined to be of a high probability to be version identifier string.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param unknown the unknown string to test.
|
* @param unknown the unknown string to test.
|
||||||
* @return true if the unknown string is likely a version string.
|
* @return true if the unknown string is likely a version string.
|
||||||
*/
|
*/
|
||||||
|
@ -115,12 +102,12 @@ public class VersionUtil
|
||||||
* <p>
|
* <p>
|
||||||
* Tests if the identifier is a known simple version keyword.
|
* Tests if the identifier is a known simple version keyword.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
* <p/>
|
||||||
* <p>
|
* <p>
|
||||||
* This method is different from {@link #isVersion(String)} in that it tests the whole input string in
|
* This method is different from {@link #isVersion(String)} in that it tests the whole input string in
|
||||||
* one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
|
* one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param identifier the identifier to test.
|
* @param identifier the identifier to test.
|
||||||
* @return true if the unknown string is likely a version string.
|
* @return true if the unknown string is likely a version string.
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +127,7 @@ public class VersionUtil
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return isGenericSnapshot(version);
|
return isGenericSnapshot( version );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,43 +143,43 @@ public class VersionUtil
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Get the release version of the snapshot version.
|
* Get the release version of the snapshot version.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
* <p/>
|
||||||
* <p>
|
* <p>
|
||||||
* If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0
|
* If snapshot version is 1.0-SNAPSHOT, then release version would be 1.0
|
||||||
* And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0
|
* And if snapshot version is 1.0-20070113.163208-1.jar, then release version would still be 1.0
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @param snapshotVersion
|
* @param snapshotVersion
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getReleaseVersion( String snapshotVersion )
|
public static String getReleaseVersion( String snapshotVersion )
|
||||||
{
|
{
|
||||||
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion );
|
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( snapshotVersion );
|
||||||
|
|
||||||
if( isGenericSnapshot( snapshotVersion ) )
|
if ( isGenericSnapshot( snapshotVersion ) )
|
||||||
{
|
{
|
||||||
m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion );
|
m = GENERIC_SNAPSHOT_PATTERN.matcher( snapshotVersion );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m.matches() )
|
if ( m.matches() )
|
||||||
{
|
{
|
||||||
return m.group( 1 );
|
return m.group( 1 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return snapshotVersion;
|
return snapshotVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUniqueSnapshot( String version )
|
public static boolean isUniqueSnapshot( String version )
|
||||||
{
|
{
|
||||||
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
|
Matcher m = UNIQUE_SNAPSHOT_PATTERN.matcher( version );
|
||||||
if( m.matches() )
|
if ( m.matches() )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -202,6 +189,6 @@ public class VersionUtil
|
||||||
|
|
||||||
public static boolean isGenericSnapshot( String version )
|
public static boolean isGenericSnapshot( String version )
|
||||||
{
|
{
|
||||||
return version.endsWith( SNAPSHOT );
|
return version.endsWith( SNAPSHOT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue