Thursday, December 18, 2014

Announcing Sapphire 8.1.1 Release

On behalf of all who contributed, I am very proud to announce the availability of the Sapphire 8.1.1 release. This releases includes a fix for an issue preventing the scale property editor presentation from being used along with a fix for a NullPointerException that occurs under certain circumstances when creating Java types from an action in a table cell editor.

Tuesday, December 16, 2014

Adventures with p2 composites

Earlier this year, we changed the way Oracle Enterprise Pack for Eclipse (OEPE) repository is packaged from a monolithic repository to a composite of many component repositories. We made this change in order to have greater flexibility in how frequently or infrequently we update the various components of the product.

  1. Some of our components change rarely and some don’t change at all after the initial release. For instance, there is no point in re-releasing Java EE 7 documentation component with every OEPE release nor is there any point in having a separate copy of this component for every release kept on the download server.
  2. Some of our components are libraries from other products that update on their own schedule. For instance, we need the ability to update Oracle Mobile Application Framework and Oracle Cloud SDKs as new versions become available without orchestrating an entire OEPE release.

When it comes to assembling the composite repository, there are two types of components:

  1. Visible to the user
  2. Available for dependency resolution, but not visible to the user

The components that should be visible to the user are easy to handle. When p2 merges the child repositories listed in the composite repository metadata, it preserves the categorization of features as specified by the child repositories. The effect is a union of visible features.

The components that should be available for dependency resolution, but not visible to the user are harder to handle.

One approach would be to strip the categorization from the component repository and add the component repository to the composite. This is rarely a practical solution as the component repository may be hosted by a third party or there may be a need to retain the utility of being able to offer it separately, which requires features to be visible to the user.

Another approach is to utilize the repository references feature. This is the approach that we settled on, but there are some downsides.

  1. Bug 455422 - Unlike child repositories of a composite, referenced repositories are added to Eclipse repository registry. If you reference many components, the repository registry will bloat very quickly, something that the user is unlikely to appreciate. Further, the user can disable referenced repositories in the registry, interfering with the proper operation of you repository. One partial workaround is to create a separate composite repository for the dependencies and then use a repository reference to point to the dependencies composite. The benefit of this indirection is that you add only one extra repository to the repository registry, regardless of how many repositories you need to reference.
  2. Bug 409734 - Unlike child repositories of a composite, a referenced repository cannot be a relative URL. Depending on your build and release process, you may need to update repository references in various content.xml files when moving repositories around.

This concludes our adventures. Don’t forget to tip the guide.

Raising Sapphire minimum Java version

I am considering raising Sapphire's minimum supported Java version for the release 9 that will be contributed to Mars in the Summer of 2015.

The current minimum supported Java version is 6, last raised for the 0.7 release.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=409330

Java 6 (2006)

Dropping support for Java 6 would allow us to integrate Sapphire models with the try-with-resources feature by making Sapphire Element extend AutoCloseable.

try( Example element = Example.TYPE.instantiate() )
{
    ...
}

vs currently

final Example element = Example.TYPE.instantiate();

try
{
    ...
}
finally
{
    try
    {
        element.dispose();
    }
    catch( final Exception e ) {}
}

Java 7 (2011)

Dropping support for Java 7 would allow us to take advantage of multiple annotations per site improvement in Java 8 and allow us to remove the grouping annotations (@Service and @Services, @Validation and @Validations, etc.).

@Validation( rule = "${ Max >= Min }", message = "Must not be smaller than min" )
@Validation( rule = "${ Max <= 100 }", message = "Must be less than or equal to 100" )
    
ValueProperty PROP_MAX = new ValueProperty( TYPE, "Max" );

vs currently

@Validations
(
    {
        @Validation( rule = "${ Max >= Min }", message = "Must not be smaller than min" ),
        @Validation( rule = "${ Max <= 100 }", message = "Must be less than or equal to 100" )
    }
)
    
ValueProperty PROP_MAX = new ValueProperty( TYPE, "Max" );

Please respond to this post with your thoughts on what minimum Java version support you anticipate needing for Sapphire 9 in Summer of 2015.

Resolution: Based on the feedback received, the minimum Java version for Sapphire 9 and beyond has been changed to Java 8. As a consequence of this change, support for Indigo, Juno and Kepler was dropped (Eclipse added Java 8 support in Luna). Sapphire 8.x will continue to support Java 6 and all Eclipse releases going back to Indigo.

Thursday, December 4, 2014

Say no to naked p2 repositories!

The standard p2 repository generation tools do not create a landing page for the repository. This creates confusion for novice users who try to visit the published repository in a web browser and get the 404 (not found) error. Beyond novice users, developers and integrators are hampered by inability to easily browse repository content in a web browser.

To save the world from this travesty, I have created a toolkit that can generate a landing page with installation instructions and the content listing pages. These tools are accessible through Ant or directly on the command line.

The landing page contains instructions on how to use Eclipse install software wizard along with a link to browse the repository content.

FireShot Capture - Sapphire 8.1 Repository - http___download.eclipse.org_sapphire_8.1_repository_

The repository content pages show all files and folders along with size information. The listing pages have some interesting features that are worth highlighting.

  1. Size information is listed for folders, not just files
  2. Relative sizes are presented with a sparkline on the right
  3. A summary at the bottom shows the number of folders, the number of files, the total size and the last modified date

FireShot Capture - Folder Content - http___download.eclipse.org_sapphire_8.1_repository_content.html

FireShot Capture - Folder Content_ - http___download.eclipse.org_sapphire-reduced

I have put this to use on all Sapphire releases and builds today. I am also making it available for other projects and companies to use, under EPL terms, of course.

Download (Source)

The toolkit includes two utilities of interest to those wishing to dress up a p2 repository.

GenFolderListing - generates the content listing pages for the specified folder and all child folders

GenRepositoryLanding - generates a repository landing page with installation instructions and the content listing pages

Note that you don’t need to run both tools as GenRepositoryLanding leverages GenFolderListing internally.

Ant Usage

First, import the toolkit...

<import file="sapphire-releng-tools.xml"/>

Alternatively, the jar can be used by itself without the library xml file, but the matching targets will not be available. This may be sufficient if the only requirement is to integrate the tools into the flow of another target.

<taskdef resource="org/eclipse/sapphire/releng/antlib.xml">
  <classpath>
    <pathelement location="sapphire-releng-tools.jar"/>
  </classpath>
</taskdef>

Once the toolkit is imported, use the tools as part of your own target...

<gen-folder-listing folder="${folder}"/>
<gen-repository-landing repository="${repository}" name="${name}"/>

or by calling the provided targets directly...

ant gen-folder-listing -Dfolder=[folder]
ant gen-repository-landing -Drepository=[repository] -Dname=[name]

Command Line Usage

java -cp sapphire-releng-tools.jar org.eclipse.sapphire.releng.listing.GenFolderListingOp [folder]
java -cp sapphire-releng-tools.jar org.eclipse.sapphire.releng.landing.GenRepositoryLandingOp [repository] [name]