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

Introduction

  • The required classes
  • An XML manifest file

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



<?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>
     


<?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>  
     

oracle.jdeveloper.extensions.sdk.installer.0.1.jar

The zip file for the update center

The Zip Structure

The Zip Structure

Update center XML document



<?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>
     

From JDeveloper

Help | Check for Updates

From JDeveloper

Automation



<?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>


javac.debug=on
oracle.home=../../../../../JDev223/
jdev.home=C:/JDev223
output.dir=classes
javac.deprecation=on
javac.nowarn=off
     
  • The extension JAR file
  • The update center ZIP file
  • The update center XML document