Package org.apache.maven.shared.osgi
Class DefaultMaven2OsgiConverter
- java.lang.Object
-
- org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter
-
- All Implemented Interfaces:
Maven2OsgiConverter
public class DefaultMaven2OsgiConverter extends java.lang.Object implements Maven2OsgiConverter
Default implementation ofMaven2OsgiConverter- Version:
- $Id: DefaultMaven2OsgiConverter.java 661727 2008-05-30 14:21:49Z bentmann $
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringFILE_SEPARATOR(package private) static java.util.regex.PatternFUZZY_VERSIONClean up version parameters.
-
Constructor Summary
Constructors Constructor Description DefaultMaven2OsgiConverter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static voidcleanupModifier(java.lang.StringBuffer result, java.lang.String modifier)static java.lang.StringcleanupVersion(java.lang.String version)java.lang.StringgetBundleFileName(org.apache.maven.artifact.Artifact artifact)private java.lang.StringgetBundleSymbolicName(java.lang.String groupId, java.lang.String artifactId)java.lang.StringgetBundleSymbolicName(org.apache.maven.artifact.Artifact artifact)Get the symbolic name as groupId + "." + artifactId, with the following exceptions if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned.private java.lang.StringgetGroupIdFromPackage(java.io.File artifactFile)java.lang.StringgetVersion(java.lang.String version)Convert a Maven version into an OSGi compliant versionjava.lang.StringgetVersion(org.apache.maven.artifact.Artifact artifact)Convert a Maven version into an OSGi compliant version
-
-
-
Field Detail
-
FILE_SEPARATOR
private static final java.lang.String FILE_SEPARATOR
-
FUZZY_VERSION
static final java.util.regex.Pattern FUZZY_VERSION
Clean up version parameters. Other builders use more fuzzy definitions of the version syntax. This method cleans up such a version to match an OSGi version.
-
-
Method Detail
-
getBundleSymbolicName
private java.lang.String getBundleSymbolicName(java.lang.String groupId, java.lang.String artifactId)
-
getBundleSymbolicName
public java.lang.String getBundleSymbolicName(org.apache.maven.artifact.Artifact artifact)
Get the symbolic name as groupId + "." + artifactId, with the following exceptions- if artifact.getFile is not null and the jar contains a OSGi Manifest with Bundle-SymbolicName property then that value is returned
- if groupId has only one section (no dots) and artifact.getFile is not null then the first package name with classes is returned. eg. commons-logging:commons-logging -> org.apache.commons.logging
- if artifactId is equal to last section of groupId then groupId is returned. eg. org.apache.maven:maven -> org.apache.maven
- if artifactId starts with last section of groupId that portion is removed. eg. org.apache.maven:maven-core -> org.apache.maven.core
- if artifactId starts with groupId then the artifactId is removed. eg. org.apache:org.apache.maven.core -> org.apache.maven.core
- Specified by:
getBundleSymbolicNamein interfaceMaven2OsgiConverter- Returns:
- the Bundle-SymbolicName manifest property
-
getGroupIdFromPackage
private java.lang.String getGroupIdFromPackage(java.io.File artifactFile)
-
getBundleFileName
public java.lang.String getBundleFileName(org.apache.maven.artifact.Artifact artifact)
- Specified by:
getBundleFileNamein interfaceMaven2OsgiConverter
-
getVersion
public java.lang.String getVersion(org.apache.maven.artifact.Artifact artifact)
Description copied from interface:Maven2OsgiConverterConvert a Maven version into an OSGi compliant version- Specified by:
getVersionin interfaceMaven2OsgiConverter- Parameters:
artifact- Maven artifact- Returns:
- the OSGi version
-
getVersion
public java.lang.String getVersion(java.lang.String version)
Description copied from interface:Maven2OsgiConverterConvert a Maven version into an OSGi compliant version- Specified by:
getVersionin interfaceMaven2OsgiConverter- Parameters:
version- Maven version- Returns:
- the OSGi version
-
cleanupVersion
public static java.lang.String cleanupVersion(java.lang.String version)
-
cleanupModifier
static void cleanupModifier(java.lang.StringBuffer result, java.lang.String modifier)
-
-