Skip to content

Commit 2c5e5dd

Browse files
committed
reorg java example doc, add cfu example
1 parent ba20f99 commit 2c5e5dd

26 files changed

+182
-48
lines changed

sqldeveloper/extension/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.md.html

sqldeveloper/extension/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ extension.owner.url=https://github.com/oracle/oracle-db-examples/sqldeveloper
1515
#
1616
# Base location of the CFU site.
1717
# This is where the produced updates.xml will say the cfu bundle files are.
18-
update.url=http://localhost/
18+
update.url=http://localhost
1919

sqldeveloper/extension/buildtools/ant/includes.xml

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
1717

18-
<project name="includes">
18+
<project name="includes" xmlns:if="ant:if">
1919
<import file="./buildutils.xml"/>
2020
<import file="./classpaths.xml"/>
2121

@@ -45,7 +45,7 @@ limitations under the License.
4545
<target name="clean-inc">
4646
<!-- wipe them out, all of them -->
4747
<delete dir="${built}" failonerror="false" />
48-
<echo>${extension.filename}</echo>
48+
<echo>Deleting ${ide.home}/sqldeveloper/extensions/${extension.id}[.jar, /*]</echo>
4949
<delete failonerror="false">
5050
<fileset dir="${ide.home}/sqldeveloper/extensions" includes="${extension.filename}"></fileset>
5151
<fileset dir="${ide.home}/sqldeveloper/extensions/${extension.id}"></fileset>
@@ -200,12 +200,68 @@ limitations under the License.
200200
<param name="bundle.location" value="../sqldeveloper/extensions/${extension.filename}"/>
201201
</antcall>
202202
</target>
203-
<target name="bundleupdate-inc" description="Update the bundle.info file">
203+
<target name="bundleupdate-inc" description="Update the bundle.info file in the deployment target">
204204
<echo message="${extension.id},${extension.version},${bundle.location},4,false"/>
205205
<echo file="${ide.home}/configuration/bundles.info" append="yes">
206206
${extension.id},${extension.version},${bundle.location},4,false</echo>
207207
</target>
208-
209-
210208

209+
<property name="update.snippet" value="${built}/update.snippet"/>
210+
<property name="bundle.xml" value="${built}/bundle.xml"/>
211+
<property name="update-center.xml" value="${cfu.dir}/update-center.xml"/>
212+
<property name="bundle.filename" value="${extension.id}-${extension.version}.zip"/>
213+
<property name="extension.bundle.url" value="${update.url}/${bundle.filename}"/>
214+
<target name="cfu-inc" description="Create CFU bundle">
215+
<mkdir dir="${cfu.dir}"/>
216+
<mkdir dir="${cfu.dir}/tmp"/>
217+
<!-- ${built} has the jar and lib if any -->
218+
<antcall target="create-update-snippet"/>
219+
<antcall target="create-bundle-xml"/>
220+
<antcall target="create-update-center-xml"/>
221+
<antcall target="create-update-bundle"/>
222+
</target>
223+
<target name="create-update-snippet" description="Create the update snippet to be used in bundle and center xml files">
224+
<loadmf jar="${ide.home}/sqldeveloper/extensions/oracle.sqldeveloper.jar" prefix="oracle.sqldeveloper.jar" />
225+
<copy file="${buildtools.dir}/update.template.xml" tofile="${update.snippet}" />
226+
<!-- replace some strings -->
227+
<replace file="${update.snippet}">
228+
<replacefilter token="@@extension.owner@@" value="${extension.owner}" />
229+
<replacefilter token="@@extension.owner.url@@" value="${extension.owner.url}" />
230+
<replacefilter token="@@extension.id@@" value="${extension.id}" />
231+
<replacefilter token="@@extension.name@@" value="${extension.name}" />
232+
<replacefilter token="@@extension.resources@@" value="${extension.resources}" />
233+
<replacefilter token="@@extension.descr@@" value="${extension.descr}" />
234+
<replacefilter token="@@extension.version@@" value="${extension.version}" />
235+
<replacefilter token="@@extension.build@@" value="${build.number}" />
236+
<replacefilter token="@@extension.agreement@@" value="${extension.agreement}" />
237+
<replacefilter token="@@extension.bundle.url@@" value="${extension.bundle.url}" />
238+
<replacefilter token="@@sqldeveloper.min.version@@" value="${oracle.sqldeveloper.jar.Bundle-Version}" />
239+
</replace>
240+
</target>
241+
<target name="create-bundle-xml" description="">
242+
<copy file="${buildtools.dir}/update-bundle.template.xml" tofile="${bundle.xml}" />
243+
<loadfile property="update" srcFile="${update.snippet}"/>
244+
<replace file="${bundle.xml}">
245+
<replacefilter token="@@update@@" value="${update}" />
246+
</replace>
247+
</target>
248+
<target name="create-update-center-xml" description="">
249+
<copy file="${buildtools.dir}/update-center.template.xml" tofile="${update-center.xml}" />
250+
<loadfile property="update" srcFile="${update.snippet}"/>
251+
<replace file="${update-center.xml}">
252+
<replacefilter token="@@update@@" value="${update}" />
253+
</replace>
254+
</target>
255+
<target name="create-update-bundle" description="">
256+
<!-- zip extension, lib, and bundle.xml to bundle.filename in cfu dir -->
257+
<move file="${built.destination.file}" tofile="${cfu.dir}/tmp/sqldeveloper/extensions/${extension.filename}" />
258+
<!-- If there is a lib file or other resource file, it will get put in "extension name" dir in extension -->
259+
<copy todir="${cfu.dir}/tmp/sqldeveloper/extensions/${extension.id}/lib" failonerror="false">
260+
<fileset dir="${built}/lib" />
261+
</copy>
262+
<zip basedir="${cfu.dir}/tmp" destfile="${cfu.dir}/${bundle.filename}">
263+
<zipfileset prefix="META-INF" dir="${built}" includes="bundle.xml" />
264+
</zip>
265+
<delete dir="${cfu.dir}/tmp" failonerror="false" />
266+
</target>
211267
</project>

sqldeveloper/extension/buildtools/ant/properties.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
-->
1717

18-
<project name="properties">
18+
<project name="properties" xmlns:if="ant:if" xmlns:unless="ant:unless">
1919
<!-- buildtools -->
2020
<dirname property="ant.build.dir" file="${ant.file.props}"/>
2121
<property name="root.directory" value="${ant.build.dir}/../.."/>
22-
<property name="buildutils.dir" value="${root.directory}/buildtools/buildutils" />
22+
<property name="buildtools.dir" value="${root.directory}/buildtools" />
23+
<property name="buildutils.dir" value="${buildtools.dir}/buildutils" />
2324

2425
<!-- master properties -->
2526
<property file="${root.directory}/build.properties" />
@@ -52,7 +53,8 @@ limitations under the License.
5253
<property name="built.classpath" value="${built}/classes"/>
5354
<property name="gen-src.dir" value="${built}/gen-src"/>
5455
<property name="built.destination.file" value="${built}/${extension.filename}"/>
55-
56+
<property name="cfu.dir" value="${built}/cfu"/>
57+
5658
<property name="jar.manifest.template" value="${built}/manifest.template" />
5759
<property name="module.default.exported.packages" value=""/>
5860

@@ -64,5 +66,8 @@ limitations under the License.
6466
<property name="cfu.bundle.template" value="cfu.bundle.template"/>
6567
<property name="cfu.master.template" value="cfu.master.template"/>
6668
<property name="built.cfu" value="${built.dir}/cfu"/>
67-
69+
<property if:set="extension.agreement.url" name="extension.agreement"
70+
value="
71+
&lt;requires-agreement url=&quot;${extension.agreement.url}&quot;/>"/>
72+
<property unless:set="extension.agreement.url" name="extension.agreement" value=""/>
6873
</project>

sqldeveloper/extension/buildtools/ant/targets.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ limitations under the License.
6565
<target name="manifest" depends="jar" description="Create the jar manifest">
6666
<antcall target="manifest-inc" inheritAll="true" inheritRefs="true" />
6767
</target>
68-
<target name="rebuild" depends="clean,deploy" description="Shortcut to clean and then rebuild/deploy"/>
69-
<target name="deploy" depends="jar, manifest" description="Deploy into the SQLDeveloper extensions directory">
68+
<target name="_deploy" depends="jar, manifest" description="Deploy into the SQLDeveloper extensions directory">
7069
<antcall target="deploy-inc" inheritAll="true" inheritRefs="true" />
7170
</target>
72-
<target name="cfu" depends="jar,manifest" description="Create CFU bundle">
71+
<target name="_cfu" depends="clean,jar,manifest" description="Create CFU bundle">
7372
<antcall target="cfu-inc" inheritAll="true" inheritRefs="true" />
7473
</target>
74+
<target name="_rebuild" depends="clean,_deploy" description="Shortcut to clean and then rebuild/deploy"/>
7575

7676
</project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<update-bundle version="1.0" xmlns="http://xmlns.oracle.com/jdeveloper/updatebundle">
19+
@@update@@
20+
</update-bundle>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<updates version="2.0" xmlns="http://xmlns.oracle.com/jdeveloper/updatecenter" xmlns:u="http://xmlns.oracle.com/jdeveloper/update">
19+
@@update@@
20+
</updates>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<update id="@@extension.id@@" xmlns="http://xmlns.oracle.com/jdeveloper/update">
2+
<name>@@extension.name@@</name>
3+
<version>@@extension.version@@.@@extension.build@@</version>
4+
<author>@@extension.owner@@</author>
5+
<author-url>@@extension.owner.url@@</author-url>
6+
<description>@@extension.descr@@</description>
7+
<requirements>@@extension.agreement@@
8+
<requires-extension id="oracle.sqldeveloper" minVersion="@@sqldeveloper.min.version@@"/>
9+
</requirements>
10+
<bundle-url>
11+
@@extension.bundle.url@@
12+
</bundle-url>
13+
<destination>${oracle.home}</destination>
14+
</update>
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# SQL Developer Examples
22
## Check For Updates (cfu)
3-
Coming soon(tm)
4-
3+
This is a bit of a table of contents trick to bring cfu closer to the top.
4+
Go to one of the projects and run the cfu ant task. The results will be in the built/cfu directory in the project.
5+
* [Packaged XML extension](../xml/packaged)
6+
* [Java extension](../java/DependencyExample)

sqldeveloper/extension/java/.README.md.html

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -643,14 +643,8 @@ <h1> <a id="sql-developer-examples" class="anchor" href="#sql-developer-examples
643643
<h2> <a id="standard-extensions-java" class="anchor" href="#standard-extensions-java" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Standard Extensions (java)</h2>
644644
<p>Standard extensions are jar files with an <a href="https://en.wikipedia.org/wiki/OSGi">OSGi</a> manifest and an extension.xml defining the extension and how it integrates with SQL Developer.</p>
645645
<ul>
646-
<li>DependencyExample<br /> This example is built with ant but is also set up for editing &amp; (remote) debugging in the eclipse extension project.<br /> </li>
647-
<li>Building this example requires two external libraries. Copy the required jar files to DependencyExample/lib.<br /> The exact jars needed from them as well as SQL Developer can be found in <em>DependencyExample/DependencyExample.userlibraries</em> which you will also need to modify (SQL Developer paths) and import to use eclipse.<br />
648-
<ul>
649-
<li> <a href="http://dl.bintray.com/jankoehnlein/FXDiagram/standalone/:fxdiagram-jars-0.35.0.zip" title="fxdiagram-jars-0.35.0.zip">FXDiagram 0.35.0</a><br /> </li>
650-
<li><a href="http://rtsys.informatik.uni-kiel.de/%7Ekieler/files/release_pragmatics_2015-02/klay/klay_2015-02.jar" title="klay_2015-02.jar">KIELER KLay Layouters 0.14.0</a></li>
651-
</ul> </li>
652-
</ul>
653-
<p><a href="..\..\.setup.md.html">Set up your environment</a>, get the required libraries (see above), build the (default) deploy target, and start SQLDeveloper from the command line WITH THE (sqldeveloper/bin/)sqldeveloper -clean OPTION. </p>
654-
<p>On the first run, only the triggers defined in extension.xml will load.<br /> <a href="images/DependencyExampleAbout.png" target="_blank"><img src="images/DependencyExampleAbout.png" alt="DependencyExampleAbout diagram" style="max-width:100%;" /></a><br /> In our case, that means the context menu entry only and NOT the dependency viewer tab referenced in the hook section (via DependencyExampleGraphViewer.xml which is in the directory the hook says to load xml from) <a href="images/DependencyExampleContextMenu.png" target="_blank"><img src="images/DependencyExampleContextMenu.png" alt="DependencyExampleContextMenu diagram" style="max-width:100%;" /></a><br /> Which opens the dependency diagram AND causes the rest of the extension hooks to load. (The editor tab name is pulled from the 1st selected node but will switch when focus goes to another editor and back. TODO: This really should be implemented as it's own dockable, not as an 'editor'.) <a href="images/DependencyExampleZoomedOut.png" target="_blank"><img src="images/DependencyExampleZoomedOut.png" alt="DependencyExampleZoomedOut diagram" style="max-width:100%;" /></a><br /> the diagram is scrollable, zoomable, editable, and can be exported to svg (all thanks to the FXDiagram library.) Double clicking on a node performs a &quot;DrillLink&quot; to open the SQL Developer editor for that node.<br /> <a href="images/DependencyExampleZoomedIn.png" target="_blank"><img src="images/DependencyExampleZoomedIn.png" alt="DependencyExampleZoomedIn diagram" style="max-width:100%;" /></a><br /> Now that it is fully loaded, the viewer definition is active and a dependency graph tab is added to the object viewers. (The next time a new one is opened.) <a href="images/DependencyExampleViewer.png" target="_blank"><img src="images/DependencyExampleViewer.png" alt="DependencyExampleViewer diagram" style="max-width:100%;" /></a> </p>
646+
<li><p><a href="..\xml\.packaged.md.html">packaged XML</a><br /> XML Examples packaged as an extension.jar </p></li>
647+
<li><p><a href=".DependencyExample.md.html">DependencyExample</a> An example editor and viewer for object dependency graphs. </p></li>
648+
</ul>
655649
</body>
656650
</html>

0 commit comments

Comments
 (0)