| java.lang.Object com.tc.bundles.MavenToOSGi
MavenToOSGi | public class MavenToOSGi (Code) | | This class provides static helper methods to convert Maven identifiers to valid OSGi
bundle identifiers. For example, converting Maven artifactId to OSGi bundle symbolic names.
|
Method Summary | |
public static String | artifactIdToSymbolicName(String groupId, String artifactId) Valid OSGi symbolic name format from OSGi v4 spec:
token ::= ( alphanum | '_' | '-' )+
symbolic-name :: = token('.'token)*
However, I've seen errors from Knoplerfish using - in symbolic names, so we are
currently replacing anything other than alphanumeric or _ with _. | public static String | projectVersionToBundleVersion(int majorVersion, int minorVersion, int incrementalVersion, String classifier) Maven versions are defined as:
x[.y[.z]][-classifier][-i]
see: http://docs.codehaus.org/display/MAVENUSER/Dependency+Mechanism
The OSGi spec defines the OSGi bundle version as:
version ::= major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
major ::= number
minor ::= number
micro ::= number
qualifier ::= ( alphanum | '_' | '-' )+
The -classifer-i part (such as -ALPHA-1 or -SNAPSHOT) will be parsed upstream, specifically
the leading -, which should not be passed. | public static String | projectVersionToBundleVersion(String mavenVersion) Parse a Maven version string of the form "digits(.digits(.digits))-classifier". |
artifactIdToSymbolicName | public static String artifactIdToSymbolicName(String groupId, String artifactId)(Code) | | Valid OSGi symbolic name format from OSGi v4 spec:
token ::= ( alphanum | '_' | '-' )+
symbolic-name :: = token('.'token)*
However, I've seen errors from Knoplerfish using - in symbolic names, so we are
currently replacing anything other than alphanumeric or _ with _. If groupId and artifact are
both null or empty string, then you'll see some
Parameters: groupId - Maven groupId, like "org.terracotta.modules", might be null Parameters: artifactId - Maven artifactId, like "tim-terracotta-cache", might be null Valid OSGi symbolic name format based on the groupId and artifactId throws: IllegalArgumentException - If groupId AND artifactId are null or empty string |
projectVersionToBundleVersion | public static String projectVersionToBundleVersion(int majorVersion, int minorVersion, int incrementalVersion, String classifier)(Code) | | Maven versions are defined as:
x[.y[.z]][-classifier][-i]
see: http://docs.codehaus.org/display/MAVENUSER/Dependency+Mechanism
The OSGi spec defines the OSGi bundle version as:
version ::= major( '.' minor ( '.' micro ( '.' qualifier )? )? )?
major ::= number
minor ::= number
micro ::= number
qualifier ::= ( alphanum | '_' | '-' )+
The -classifer-i part (such as -ALPHA-1 or -SNAPSHOT) will be parsed upstream, specifically
the leading -, which should not be passed. So, a Maven version 1.0-SNAPSHOT should be passed as
{1, 0, 0, SNAPSHOT} to this method. This method will rebuild it and return it as "1.0.0.SNAPSHOT".
Parameters: majorVersion - Major version from Maven, must be >= 0 (0 if not specified) Parameters: minorVersion - Minor version from Maven, must be >= 0 (0 if not specified) Parameters: incrementalVersion - Incremental version from Maven, must be >= 0 (0 if not specified) Parameters: classifier - Classifier string from Maven, this is expected to be parsed and not contain the leading dash, may be null |
projectVersionToBundleVersion | public static String projectVersionToBundleVersion(String mavenVersion)(Code) | | Parse a Maven version string of the form "digits(.digits(.digits))-classifier". Maven
implements this parsing in a class called org.apache.maven.artifact.versioning.DefaultArtifactVersion,
which I theoretically could have used except I would have added a Maven dependency to common
which I didn't want to do.
Parameters: mavenVersion - Maven version string, such as 1.2.3-RC-1 OSGi bundle version to use, such as 1.2.3.RC_1 |
|
|