Package org.appng.core.model
Class RepositoryUtils
- java.lang.Object
-
- org.appng.core.model.RepositoryUtils
-
public class RepositoryUtils extends Object
Utility class offering methods that help dealing withPackageVersion
s andPackageInfo
rmations.- Author:
- Matthias Herlitzius
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getContextPath()
Returns the JAXB context-pathorg.appng.core.xml.repository
.static Date
getDate(PackageInfo packageInfo)
Retrieves theDate
from the givenPackageInfo
by parsing its timestampstatic PackageArchive
getPackage(Repository repo, File file, String archiveName)
Checks whether the given file is a validPackageArchive
and matches toRepositoryMode
of theRepository
.static Comparator<PackageInfo>
getVersionComparator()
static boolean
isNewer(PackageVersion versionA, PackageVersion versionB)
Checks whetherversionA
is newer thanversionB
static boolean
isNewer(PackageInfo packageA, PackageInfo packageB)
Checks whetherpackageA
is newer thanpackageB
.static boolean
isSnapshot(String name)
Check whether the given name represent a snapshot version
-
-
-
Field Detail
-
SNAPSHOT
public static final String SNAPSHOT
The "-SNAPSHOT"-suffix- See Also:
- Constant Field Values
-
-
Method Detail
-
getContextPath
public static String getContextPath()
Returns the JAXB context-pathorg.appng.core.xml.repository
.- Returns:
- the context-path
-
isNewer
public static boolean isNewer(PackageVersion versionA, PackageVersion versionB)
Checks whetherversionA
is newer thanversionB
- Parameters:
versionA
-versionB
-- Returns:
true
ifversionA
is newer thanversionB
,false
otherwise- See Also:
isNewer(PackageInfo, PackageInfo)
-
isNewer
public static boolean isNewer(PackageInfo packageA, PackageInfo packageB)
Checks whetherpackageA
is newer thanpackageB
. Comparison is first done by the version and then by the timestamp of thePackageInfo
.- Parameters:
packageA
-packageB
-- Returns:
true
ifpackageA
is newer thanpackageB
,false
otherwise- See Also:
getDate(PackageInfo)
-
getVersionComparator
public static Comparator<PackageInfo> getVersionComparator()
-
getDate
public static Date getDate(PackageInfo packageInfo)
Retrieves theDate
from the givenPackageInfo
by parsing its timestamp- Parameters:
packageInfo
- thePackageInfo
- Returns:
- the date (never
null
, in case of aParseException
, the "zero-time" is used)
-
isSnapshot
public static boolean isSnapshot(String name)
Check whether the given name represent a snapshot version- Parameters:
name
- the name- Returns:
true
if the given name contains "-SNAPSHOT",false
otherwise
-
getPackage
public static PackageArchive getPackage(Repository repo, File file, String archiveName)
Checks whether the given file is a validPackageArchive
and matches toRepositoryMode
of theRepository
.- Parameters:
repo
- theRepository
file
- the file containing the archivearchiveName
- the name of the archive- Returns:
- the
PackageArchive
, if the given file is a valid archive and matches theRepositoryMode
of theRepository
.
-
-