Class DefaultMaven2OsgiConverter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String FILE_SEPARATOR  
      private static java.util.regex.Pattern ONLY_NUMBERS
      pattern that matches strings that contain only numbers
      private static java.util.regex.Pattern OSGI_VERSION_PATTERN
      Bundle-Version must match this pattern
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getBundleFileName​(org.apache.maven.artifact.Artifact artifact)  
      private java.lang.String getBundleSymbolicName​(java.lang.String groupId, java.lang.String artifactId)  
      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.
      private java.lang.String getGroupIdFromPackage​(java.io.File artifactFile)  
      java.lang.String getVersion​(java.lang.String version)
      Convert a Maven version into an OSGi compliant version
      private java.lang.String getVersion​(java.lang.String major, java.lang.String minor, java.lang.String service, java.lang.String qualifier)  
      java.lang.String getVersion​(org.apache.maven.artifact.Artifact artifact)
      Convert a Maven version into an OSGi compliant version
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OSGI_VERSION_PATTERN

        private static final java.util.regex.Pattern OSGI_VERSION_PATTERN
        Bundle-Version must match this pattern
      • ONLY_NUMBERS

        private static final java.util.regex.Pattern ONLY_NUMBERS
        pattern that matches strings that contain only numbers
      • FILE_SEPARATOR

        private static final java.lang.String FILE_SEPARATOR
    • Constructor Detail

      • DefaultMaven2OsgiConverter

        public DefaultMaven2OsgiConverter()
    • 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
        Specified by:
        getBundleSymbolicName in interface Maven2OsgiConverter
        Returns:
        the Bundle-SymbolicName manifest property
      • getGroupIdFromPackage

        private java.lang.String getGroupIdFromPackage​(java.io.File artifactFile)
      • getVersion

        public java.lang.String getVersion​(org.apache.maven.artifact.Artifact artifact)
        Description copied from interface: Maven2OsgiConverter
        Convert a Maven version into an OSGi compliant version
        Specified by:
        getVersion in interface Maven2OsgiConverter
        Parameters:
        artifact - Maven artifact
        Returns:
        the OSGi version
      • getVersion

        public java.lang.String getVersion​(java.lang.String version)
        Description copied from interface: Maven2OsgiConverter
        Convert a Maven version into an OSGi compliant version
        Specified by:
        getVersion in interface Maven2OsgiConverter
        Parameters:
        version - Maven version
        Returns:
        the OSGi version
      • getVersion

        private java.lang.String getVersion​(java.lang.String major,
                                            java.lang.String minor,
                                            java.lang.String service,
                                            java.lang.String qualifier)