Use the Update Center

How to use the Check for Update support in JDeveloper 10.1.3

An Oracle JDeveloper How To Document
By Olivier Le Diouris, Oracle Corporation
January, 2005

Content

Introduction

Top
An extension for an IDE like JDeveloper is made out of two major types of components:

  • The required classes
  • An XML manifest file
These components are bundled into a JAR file, which is then placed into a specific directory. The "update center" manages this JAR file and its location. There are a couple of update center sites managed by Oracle which JDeveloper is aware of.

In JDeveloper 10.1.3 the update center mechanism has been enhanced so that, by providing the location of an "Update Center XML file" containing all the required information on the web, anyone who wishes to write an extension can benefit from this facility. JDeveloper will then automatically upgrade the installed extensions when and where necessary.

Before explaining this further it should be noted that each extension is uniquely identified by an attribute called id that belongs to the root element of the extension manifest, called extension.
We will have to refer to this unique id when it will be about having your extension managed by the JDeveloper update center facility.

First you will need to create an update center. An update center is a specific XML document that can be reached through http. This XML document will associate an extension - using the unique id we talked about above - and a ZIP file containing:

  • the JAR file for the extension
  • another xml file named bundle.xml, in a META-INF directory

bundle.xml

Top
Let us use an example:

      
<?xml version = '1.0' encoding = 'UTF-8'?>
<update-bundle version="1.0"
               xmlns="http://xmlns.oracle.com/jdeveloper/updatebundle"
               xmlns:u="http://xmlns.oracle.com/jdeveloper/update">
  <u:update id="oracle.jdeveloper.extensions.sdk.installer">
    <u:name>JDeveloper Extensions SDK Installer</u:name>
    <u:version>0.1</u:version>
    <u:author>Olivier Le Diouris</u:author>
    <u:author-url>http://jroller.com/page/oliv</u:author-url>
    <u:description>
      Install the Extension SDK in your instance of JDeveloper
    </u:description>
    <u:requirements>
      <u:requires-extension id="oracle.jdeveloper"
                            minVersion="10.1.3" 
                            maxVersion="10.1.4" />
    </u:requirements>
  </u:update>
</update-bundle>
      
The text in bold refers to the id of the extension, that is stored in the extension manifest file, the one called extension.xml, stored in the META-INF directory of the extension JAR file, as in the following XML snippet:
      
<?xml version="1.0" encoding="windows-1252" ?>
<ex:extension xmlns:ex="http://jcp.org/jsr/198/extension-manifest"
              xmlns="http://xmlns.oracle.com/jdeveloper/1013/extension"
              id="oracle.jdeveloper.extensions.sdk.installer">
  <ex:name>JDeveloper Extensions SDK Installer</ex:name>
  <ex:version>0.1</ex:version>
    ...
</ex:extension>  
      
As you can guess, it is critical to have a unique identifier for the extensions you might write.
It is also a good practice to give the JAR file containing the extension a name made of the extension id followed by the version.
The name of such a file would then be oracle.jdeveloper.extensions.sdk.installer.0.1.jar.

The zip file for the update center

Top
The bundle described above and the JAR file containing the extension have to be archived in a zip structured this way:

The Zip Structure

In the example above, installer.zip is the file that will be placed in the update center, and oracle.jdeveloper.extensions.sdk.installer.0.1.jar is the JAR file containing the extension.
If other archives are required for the extension to work, they can be stored in the zip as well. They would be unarchived where they figure in the zip, so it is probably a good idea to have them in a sub-directory so that the extension directory is not going to be polluted by too many files.
Giving that sub-directory a name based on the extension id is a good practice.

The Zip Structure

Update center XML document

Top
The last step is to refer to the zip described above from the update center.
As we said, the update center is an XML Document accessible on the web.
Again, let us take an example, we will call our XML document center.xml:


<?xml version="1.0" encoding="windows-1252" ?>
<updates version="1.0"
  xmlns="http://xmlns.oracle.com/jdeveloper/updatecenter"
  xmlns:u="http://xmlns.oracle.com/jdeveloper/update">
  <u:update id="oracle.jdeveloper.extensions.sdk.installer">
    <u:name>JDeveloper Extensions SDK Installer</u:name>
    <u:version>0.1</u:version>
    <u:author>JDeveloper Team</u:author>
    <u:author-url>http://otn.oracle.com/products/jdev</u:author-url>
    <u:description>Install the Extension SDK in your instance of JDeveloper</u:description>
    <u:bundle-url>http://olediour-pc.us.oracle.com/ESDKInstaller/installer.zip</u:bundle-url>
  </u:update>
  <u:update id="...">
    ...
  </u:update>
</updates>
      
Notice again the reference to the extension unique id.
Also, notice the element called bundle-url, that refers to the ZIP file described in the previous section. See that it does not need to be on the same machine as this XML document.

From JDeveloper

Top
From JDeveloper, you can access any update center from the menu Help | Check for Updates.
In the wizard that pops up, you can then refer to the document we've described in the previous section:

Then let the wizard drive the process, and you will have the possibility to update any extension, when necessary.
On the image above, the three first update centers come out-of-the-box with JDeveloper, the fourth line being an update center added for the purpose of this document.
You can also notice that this operation can happen from a local file, which would be in this case the ZIP file mentioned above, the one containing the bundle.xml, and the extension JAR file.

Automation

Top
With JDeveloper and the Ant support that is now provided, it is very easy for an extension project to generate not only the JAR file required by the extension, but also the zip containing the bundle and the jar, plus the XML document for the update center. Here is an example of such an Ant build file, into which you might want to take a look at the "bundle" target:


<?xml version="1.0" encoding="windows-1252" ?>

<project name="ExtensionSDKInstaller" 
         default="all" 
         basedir=".">
         
  <property file="build.properties"/>
  
  <path id="library.JDeveloper.Extension.SDK">
    <pathelement location="${oracle.home}/ide/lib/javatools.jar"/>
    <pathelement location="${oracle.home}/ide/lib/ide.jar"/>
    <pathelement location="${oracle.home}/jdev/lib/jdev.jar"/>
    <pathelement location="${oracle.home}/jdev/lib/xmleditor.jar"/>
    <pathelement location="${oracle.home}/jdev/lib/xmladdin.jar"/>
    <pathelement location="${oracle.home}/jlib/jewt4.jar"/>
    <pathelement location="${oracle.home}/jlib/inspect4.jar"/>
    <pathelement location="${oracle.home}/lib/xmlparserv2.jar"/>
  </path>
  <path id="classpath">
    <path refid="library.JDeveloper.Extension.SDK"/>
  </path>
  <target name="init">
    <tstamp/>
    <mkdir dir="${output.dir}"/>
  </target>

  <target name="all" 
          description="Build the project" 
          depends="clean,compile,copy,deploy,bundle"/>

  <target name="clean" description="Clean the project">
    <delete includeemptydirs="true" quiet="true">
      <fileset dir="${output.dir}" includes="**/*"/>
    </delete>
    <delete dir="update-center-bundle"/>
  </target>

  <target name="compile" description="Compile Java source files" depends="init">
    <javac destdir="${output.dir}" classpathref="classpath"
           debug="${javac.debug}" nowarn="${javac.nowarn}"
           deprecation="${javac.deprecation}" encoding="Cp1252">
      <src path="src"/>
    </javac>
  </target>
  <target name="copy" description="Copy files to output directory"
          depends="init">
    <patternset id="copy.patterns">
      <include name="**/*.gif"/>
      <include name="**/*.jpg"/>
      <include name="**/*.jpeg"/>
      <include name="**/*.png"/>
      <include name="**/*.properties"/>
      <include name="**/*.xml"/>
      <include name="**/*-apf.xml"/>
      <include name="**/*.ejx"/>
      <include name="**/*.xcfg"/>
      <include name="**/*.cpx"/>
      <include name="**/*.wsdl"/>
      <include name="**/*.ini"/>
      <include name="**/*.tld"/>
      <include name="**/*.tag"/>
      <include name="**/*.zip"/>
    </patternset>
    <copy todir="${output.dir}">
      <fileset dir="src">
        <patternset refid="copy.patterns"/>
      </fileset>
    </copy>
  </target>
  
  <target name="deploy" description="Deploy the extension where it belongs" depends="copy">
    <jar destfile="${jdev.home}/jdev/extensions/oracle.jdeveloper.extensions.sdk.installer.0.1.jar"
         basedir="${output.dir}"
         compress="yes">
      <exclude name="**/*.cdi"/>
      <exclude name="**/connections.xml"/>
    </jar>
  </target>
  
  <target name="bundle" depends="deploy" description="Prepare whatever's required for the update center.">
    <echo message="Preparing the Update Center Material"/>
    <echo message="------------------------------------"/>
    <mkdir dir="update-center-bundle"/>
    <mkdir dir="update-center-bundle/META-INF"/>
    <copy file="update-center/center.xml" tofile="update-center-bundle/center.xml"/>
    <copy file="${jdev.home}/jdev/extensions/oracle.jdeveloper.extensions.sdk.installer.0.1.jar" 
          tofile="update-center-bundle/oracle.jdeveloper.extensions.sdk.installer.0.1.jar"/>
    <copy file="update-center/META-INF/bundle.xml" tofile="update-center-bundle/META-INF/bundle.xml"/>
    <zip destfile="update-center-bundle/installer.zip"
         basedir="update-center-bundle">
      <exclude name="center.xml"/>
      <exclude name="*.zip"/>
    </zip>
    <delete file="update-center-bundle/oracle.jdeveloper.extensions.sdk.installer.0.1.jar"/>
    <delete dir="update-center-bundle/META-INF"/>
    <echo message="+----------------------------------------------+"/>
    <echo message="| Check out the update-center-bundle directory |"/>
    <echo message="+----------------------------------------------+"/>
  </target>
  
</project>
      
This build-file refers to a properties file:

javac.debug=on
oracle.home=../../../../../JDev223/
jdev.home=C:/JDev223
output.dir=classes
javac.deprecation=on
javac.nowarn=off
      
As you can see, after running the "bundle" target, you have:
  • The extension JAR file
  • The update center ZIP file
  • The update center XML document
All those documnents are ready to use, and just need to be dropped into the appropriate place.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy