Distribute your Extension with an JDeveloper Update Center

If you created an extension project, you can share this with others by creating a zip file. However, there is a powerful mechanism in JDeveloper called Update Centers. This blog will show you how you create an Update Center to share your own Extension Projects.

I’ll use my workspace from this blog about Audit Rules as example. Step 1 is creating an bundle.xml within your Project source. The bundle.xml should like like this:

        Audit Rules
        Richard Olrichs        

In this XML file you configure some properties about your extension, like the name, author and the requirements. Most of this information you already configured in the Extension.xml as well. 

After this we need to create a new deployment profile. Go to your Project Properties, create a new Jar File deployment Profile. In the jar options, change the extension from .jar to .zip:

Go to your Profile Dependencies and tick the Project:

Now there are a few steps you need to take in the File Groups section:
  • First select the predefined Project Output and press Delete
  • Select the File Groups again and press New:
    • Enter ‘Extension Jar’ as name and choose ‘Libraries’ as Type.
    • Go to the Contributors under Extension Jar and make sure the jar file is selected. 
  • Again select the File Group and press New:
    • Enter bundle.xml as name and leave the Packaging as Type.
    • As Target Directory in Archive, enter: META-INF
    • Go to Filters under bundle.xml and deselect everything except the bundle.xml

The result should looks like this:

Now press OK to exit the properties. Right click your Project, select deploy and select the newly created deployment profile. This should result in a zip file being created by JDeveloper:

We’re now done with creating the zip file and bundle. You could share this zip and let other people install it on their JDeveloper. However, we rather distribute this through an update center. Typically, you want this zip file on a network drive or on the web, but in this example we’ll leave it locally on the computer. The general idea is the same.
Now we’re going to create the update center, this is a simple XML file, you can create this anywhere on your file system.

        Audit Rules
        Richard Olrichs        

It looks a lot like the bundle.xml that we created, with the exception of a location being presented as bundle-url. This is pointing to your zip file, in this case I left the zip file in the deployment folder.
Now, when you go to Help -> Check for Updates, you can add a new Update Center:

Enter a name and browse to the created XML file and click OK.
After this, unselect the Oracle checkboxes and only check your own update center and click Next:

You’ll find your extension here, if you click next, you see it is under the New installs. Now press Finish and after the popup for a Restart press Yes. After JDeveloper has been restarted, your plug-in has been installed.

Now we can have a look at the power of creating an update center over sharing the zip file. Imagine you’ve been working on your extension for some time and want to create a 2.0 version. The steps involved here are:
  • Update the bundle.xml.
    • Update the bundle version to 2.0.
    • Update the version of the update to 2.0.
  • Redeploy to create a new zipfile (also a 2.0 version).
  • Update the UpdateCenter XMLfile to be in sync:
    • Update the version of updates
    • Update the version in update
    • Update the bundle-url to point to the 2.0 zip.

Next we go back to the Check for Updates menu. Select our update center and unselect the others and press Next:
Here we see the new version of our Audit Rules, version 2.0.

Now, without distributing the new zip file again, anyone who has installed the update center, will be able to get the 2.0 version of your Extension project. 

No comments:

Post a Comment