JDO
  1. JDO
  2. JDO-694

Automate OSGi bundling in JDO 3.1+ build

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JDO 3.1-rc1, JDO 3.2
    • Fix Version/s: JDO 3.1-rc1
    • Component/s: api
    • Labels:

      Description

      Alter maven build to ensure that the JDO API jar expresses its dependencies on other packages for the purposes of use in an OSGi environment.

      1. jdo-694.patch
        4 kB
        Matthew T. Adams

        Activity

        Hide
        Matthew T. Adams added a comment - - edited

        JDO-694.patch removes API2.MF, modifies API3.MF, and uses Apache Felix maven-bundle-plugin to automate OSGi-related manifest information in the JDO API jar.

        Show
        Matthew T. Adams added a comment - - edited JDO-694 .patch removes API2.MF, modifies API3.MF, and uses Apache Felix maven-bundle-plugin to automate OSGi-related manifest information in the JDO API jar.
        Hide
        Matthew T. Adams added a comment - - edited

        JDO-694.2.patch is a better version. Removes API2.MF & API3.MF, centralizing all manifest information in the pom.

        Show
        Matthew T. Adams added a comment - - edited JDO-694 .2.patch is a better version. Removes API2.MF & API3.MF, centralizing all manifest information in the pom.
        Hide
        Matthew T. Adams added a comment -

        Proposed fix. Sorry about the whitespace.

        Show
        Matthew T. Adams added a comment - Proposed fix. Sorry about the whitespace.
        Hide
        Matthew T. Adams added a comment -

        Please review patch. Upon successful review, I'll commit.

        Show
        Matthew T. Adams added a comment - Please review patch. Upon successful review, I'll commit.
        Hide
        Matthew T. Adams added a comment -

        Proposed final patch #1. Will commit upon successful review.

        Show
        Matthew T. Adams added a comment - Proposed final patch #1. Will commit upon successful review.
        Hide
        Matthew T. Adams added a comment -

        javax.naming.* should not be optional

        Show
        Matthew T. Adams added a comment - javax.naming.* should not be optional
        Hide
        Matthew T. Adams added a comment -

        I'll defer to bnd's expertise as to what should be listed in the Import-Package header (bnd is the tool that underlies maven-bundle-plugin). For example, we depend on javax.security, yet bnd does not add an import for that package, but it does add an import for javax.naming. Best Craig & I could figure is that bnd knows what should & shouldn't be listed in Import-Package. We're going with everything as optional because javax.naming & javax.rmi are used only if JNDI is used and the XML APIs are used only if a jdoconfig.xml is parsed.

        Show
        Matthew T. Adams added a comment - I'll defer to bnd's expertise as to what should be listed in the Import-Package header (bnd is the tool that underlies maven-bundle-plugin). For example, we depend on javax.security, yet bnd does not add an import for that package, but it does add an import for javax.naming. Best Craig & I could figure is that bnd knows what should & shouldn't be listed in Import-Package. We're going with everything as optional because javax.naming & javax.rmi are used only if JNDI is used and the XML APIs are used only if a jdoconfig.xml is parsed.
        Hide
        Matthew T. Adams added a comment - - edited

        Attached patch replaces prior patch. Bundle loads properly in Virgo 3.5.0.RELEASE. Produces output below.

        Manifest-Version: 1.0
        Bnd-LastModified: 1346788585621
        Build-Jdk: 1.6.0_33
        Built-By: matthew
        Bundle-Description: The Java Data Objects (JDO) API is a standard interf
        ace-based Java model abstraction of persistence, developed as Java Spec
        ification Request 243 under the auspices of the Java Community Process.
        Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
        Bundle-Localization: plugin
        Bundle-ManifestVersion: 2
        Bundle-Name: JDO API
        Bundle-SymbolicName: javax.jdo
        Bundle-Vendor: Apache Software Foundation
        Bundle-Version: 3.1.0.SNAPSHOT
        Created-By: Apache Maven Bundle Plugin
        Export-Package: javax.jdo;uses:="javax.jdo.spi,javax.jdo.listener,javax.
        jdo.metadata,org.xml.sax,javax.naming,javax.xml.parsers,org.w3c.dom,jav
        ax.rmi,javax.jdo.datastore,javax.transaction";version="3.1.0.SNAPSHOT",
        javax.jdo.annotations;version="3.1.0.SNAPSHOT",javax.jdo.datastore;vers
        ion="3.1.0.SNAPSHOT",javax.jdo.identity;uses:="javax.jdo.spi,javax.jdo"
        ;version="3.1.0.SNAPSHOT",javax.jdo.listener;uses:="javax.jdo.spi";vers
        ion="3.1.0.SNAPSHOT",javax.jdo.metadata;uses:="javax.jdo.annotations";v
        ersion="3.1.0.SNAPSHOT",javax.jdo.spi;uses:="javax.jdo,javax.xml.parser
        s,org.xml.sax";version="3.1.0.SNAPSHOT"
        Implementation-Title: JDO API
        Implementation-Vendor: Apache Software Foundation
        Implementation-Vendor-Id: javax.jdo
        Implementation-Version: 3.1-SNAPSHOT
        Import-Package: javax.naming,javax.rmi,javax.transaction,javax.xml.parse
        rs,org.w3c.dom,org.xml.sax
        Specification-Title: JDO API
        Specification-Vendor: Apache Software Foundation
        Specification-Version: 3.1-SNAPSHOT
        Tool: Bnd-1.50.0

        Show
        Matthew T. Adams added a comment - - edited Attached patch replaces prior patch. Bundle loads properly in Virgo 3.5.0.RELEASE. Produces output below. Manifest-Version: 1.0 Bnd-LastModified: 1346788585621 Build-Jdk: 1.6.0_33 Built-By: matthew Bundle-Description: The Java Data Objects (JDO) API is a standard interf ace-based Java model abstraction of persistence, developed as Java Spec ification Request 243 under the auspices of the Java Community Process. Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Localization: plugin Bundle-ManifestVersion: 2 Bundle-Name: JDO API Bundle-SymbolicName: javax.jdo Bundle-Vendor: Apache Software Foundation Bundle-Version: 3.1.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: javax.jdo;uses:="javax.jdo.spi,javax.jdo.listener,javax. jdo.metadata,org.xml.sax,javax.naming,javax.xml.parsers,org.w3c.dom,jav ax.rmi,javax.jdo.datastore,javax.transaction";version="3.1.0.SNAPSHOT", javax.jdo.annotations;version="3.1.0.SNAPSHOT",javax.jdo.datastore;vers ion="3.1.0.SNAPSHOT",javax.jdo.identity;uses:="javax.jdo.spi,javax.jdo" ;version="3.1.0.SNAPSHOT",javax.jdo.listener;uses:="javax.jdo.spi";vers ion="3.1.0.SNAPSHOT",javax.jdo.metadata;uses:="javax.jdo.annotations";v ersion="3.1.0.SNAPSHOT",javax.jdo.spi;uses:="javax.jdo,javax.xml.parser s,org.xml.sax";version="3.1.0.SNAPSHOT" Implementation-Title: JDO API Implementation-Vendor: Apache Software Foundation Implementation-Vendor-Id: javax.jdo Implementation-Version: 3.1-SNAPSHOT Import-Package: javax.naming,javax.rmi,javax.transaction,javax.xml.parse rs,org.w3c.dom,org.xml.sax Specification-Title: JDO API Specification-Vendor: Apache Software Foundation Specification-Version: 3.1-SNAPSHOT Tool: Bnd-1.50.0
        Hide
        Craig L Russell added a comment -

        The notation that the javax.transaction package is optional was not captured in the resulting MANIFEST.MF.

        There is no reference to the optional javax.persistence package. Perhaps this is because we don't have an explicit reference to it.

        The comment lines are broken in awkward places. Maybe we should update the project description in trunk/pom.xml to avoid this?

        Show
        Craig L Russell added a comment - The notation that the javax.transaction package is optional was not captured in the resulting MANIFEST.MF. There is no reference to the optional javax.persistence package. Perhaps this is because we don't have an explicit reference to it. The comment lines are broken in awkward places. Maybe we should update the project description in trunk/pom.xml to avoid this?
        Hide
        Michael Bouschen added a comment -

        I removed an outdated NOTICE.txt file under api/src/main/resources as part of this JIRA (Committed revision 1382137).

        Show
        Michael Bouschen added a comment - I removed an outdated NOTICE.txt file under api/src/main/resources as part of this JIRA (Committed revision 1382137).
        Hide
        Matthew T. Adams added a comment - - edited

        Craig L Russell
        > The notation that the javax.transaction package is optional was not captured in the resulting MANIFEST.MF.
        IIRC, our minimum supported Java version was 1.5. If that's correct, then javax.transaction and javax.naming are included in the JSE, so making them required shouldn't be an issue.

        > There is no reference to the optional javax.persistence package. Perhaps this is because we don't have an explicit reference to it.
        I didn't understand that this was still needed in JDO 3.1. Please clarify.

        > The comment lines are broken in awkward places. Maybe we should update the project description in trunk/pom.xml to avoid this?
        The manifest isn't intended for the convenience of human readability; it has a fixed maximum line length of 72 characters. When viewed using a utility like bnd, the description is rendered without the awkward line breaks. We could add them, but I think that would make readability where it's defined ($

        {pom.description}

        ) awkward.

        Show
        Matthew T. Adams added a comment - - edited Craig L Russell > The notation that the javax.transaction package is optional was not captured in the resulting MANIFEST.MF. IIRC, our minimum supported Java version was 1.5. If that's correct, then javax.transaction and javax.naming are included in the JSE, so making them required shouldn't be an issue. > There is no reference to the optional javax.persistence package. Perhaps this is because we don't have an explicit reference to it. I didn't understand that this was still needed in JDO 3.1. Please clarify. > The comment lines are broken in awkward places. Maybe we should update the project description in trunk/pom.xml to avoid this? The manifest isn't intended for the convenience of human readability; it has a fixed maximum line length of 72 characters. When viewed using a utility like bnd, the description is rendered without the awkward line breaks. We could add them, but I think that would make readability where it's defined ($ {pom.description} ) awkward.
        Hide
        Andy Jefferson added a comment -

        FYI The "javax.transaction" included in JRE is not full "javax.transaction", it's some very minimal set of exceptions only. Such as "Synchronization", "Transaction", "TransactionManager" aren't there.

        Show
        Andy Jefferson added a comment - FYI The "javax.transaction" included in JRE is not full "javax.transaction", it's some very minimal set of exceptions only. Such as "Synchronization", "Transaction", "TransactionManager" aren't there.
        Hide
        Matthew T. Adams added a comment -

        You're right, Andy. I saw the package and quickly assumed that everything was there. I'll set the javax.transaction package as optional, then. It looks like all of javax.naming is there.

        Show
        Matthew T. Adams added a comment - You're right, Andy. I saw the package and quickly assumed that everything was there. I'll set the javax.transaction package as optional, then. It looks like all of javax.naming is there.
        Hide
        Matthew T. Adams added a comment -

        Patch now makes javax.transaction optional.

        Show
        Matthew T. Adams added a comment - Patch now makes javax.transaction optional.
        Hide
        Matthew T. Adams added a comment -

        Patch just added produces the following MANIFEST.MF:

        Manifest-Version: 1.0
        Bnd-LastModified: 1347625699352
        Build-Jdk: 1.6.0_35
        Built-By: matthew
        Bundle-Description: The Java Data Objects (JDO) API is a standard interf
        ace-based Java model abstraction of persistence, developed as Java Spec
        ification Request 243 under the auspices of the Java Community Process.
        Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
        Bundle-Localization: plugin
        Bundle-ManifestVersion: 2
        Bundle-Name: JDO API
        Bundle-SymbolicName: javax.jdo
        Bundle-Vendor: Apache Software Foundation
        Bundle-Version: 3.1.0.SNAPSHOT
        Created-By: Apache Maven Bundle Plugin
        Export-Package: javax.jdo;uses:="javax.jdo.spi,javax.jdo.listener,javax.
        jdo.metadata,org.xml.sax,javax.naming,javax.xml.parsers,org.w3c.dom,jav
        ax.rmi,javax.jdo.datastore,javax.transaction";version="3.1.0.SNAPSHOT",
        javax.jdo.annotations;version="3.1.0.SNAPSHOT",javax.jdo.datastore;vers
        ion="3.1.0.SNAPSHOT",javax.jdo.identity;uses:="javax.jdo.spi,javax.jdo"
        ;version="3.1.0.SNAPSHOT",javax.jdo.listener;uses:="javax.jdo.spi";vers
        ion="3.1.0.SNAPSHOT",javax.jdo.metadata;uses:="javax.jdo.annotations";v
        ersion="3.1.0.SNAPSHOT",javax.jdo.spi;uses:="javax.jdo,javax.xml.parser
        s,org.xml.sax";version="3.1.0.SNAPSHOT"
        Implementation-Title: JDO API
        Implementation-Vendor: Apache Software Foundation
        Implementation-Vendor-Id: javax.jdo
        Implementation-Version: 3.1-SNAPSHOT
        Import-Package: javax.naming,javax.rmi,javax.transaction;resolution:=opt
        ional,javax.xml.parsers,org.w3c.dom,org.xml.sax
        Specification-Title: JDO API
        Specification-Vendor: Apache Software Foundation
        Specification-Version: 3.1-SNAPSHOT
        Tool: Bnd-1.50.0

        Show
        Matthew T. Adams added a comment - Patch just added produces the following MANIFEST.MF: Manifest-Version: 1.0 Bnd-LastModified: 1347625699352 Build-Jdk: 1.6.0_35 Built-By: matthew Bundle-Description: The Java Data Objects (JDO) API is a standard interf ace-based Java model abstraction of persistence, developed as Java Spec ification Request 243 under the auspices of the Java Community Process. Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt Bundle-Localization: plugin Bundle-ManifestVersion: 2 Bundle-Name: JDO API Bundle-SymbolicName: javax.jdo Bundle-Vendor: Apache Software Foundation Bundle-Version: 3.1.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: javax.jdo;uses:="javax.jdo.spi,javax.jdo.listener,javax. jdo.metadata,org.xml.sax,javax.naming,javax.xml.parsers,org.w3c.dom,jav ax.rmi,javax.jdo.datastore,javax.transaction";version="3.1.0.SNAPSHOT", javax.jdo.annotations;version="3.1.0.SNAPSHOT",javax.jdo.datastore;vers ion="3.1.0.SNAPSHOT",javax.jdo.identity;uses:="javax.jdo.spi,javax.jdo" ;version="3.1.0.SNAPSHOT",javax.jdo.listener;uses:="javax.jdo.spi";vers ion="3.1.0.SNAPSHOT",javax.jdo.metadata;uses:="javax.jdo.annotations";v ersion="3.1.0.SNAPSHOT",javax.jdo.spi;uses:="javax.jdo,javax.xml.parser s,org.xml.sax";version="3.1.0.SNAPSHOT" Implementation-Title: JDO API Implementation-Vendor: Apache Software Foundation Implementation-Vendor-Id: javax.jdo Implementation-Version: 3.1-SNAPSHOT Import-Package: javax.naming,javax.rmi,javax.transaction;resolution:=opt ional,javax.xml.parsers,org.w3c.dom,org.xml.sax Specification-Title: JDO API Specification-Vendor: Apache Software Foundation Specification-Version: 3.1-SNAPSHOT Tool: Bnd-1.50.0
        Hide
        Craig L Russell added a comment -

        I think that if we verify that with this manifest, the package loads in an OSGi environment, we're done for now.

        Ship it.

        Show
        Craig L Russell added a comment - I think that if we verify that with this manifest, the package loads in an OSGi environment, we're done for now. Ship it.
        Hide
        Matthew T. Adams added a comment -

        Verified that the bundle loads in Virgo. I'll apply the patch.

        Show
        Matthew T. Adams added a comment - Verified that the bundle loads in Virgo. I'll apply the patch.
        Hide
        Matthew T. Adams added a comment -

        Committed revision 1384880.

        Show
        Matthew T. Adams added a comment - Committed revision 1384880.

          People

          • Assignee:
            Matthew T. Adams
            Reporter:
            Matthew T. Adams
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development