diff options
author | Eike Stepper | 2007-06-30 08:03:46 +0000 |
---|---|---|
committer | Eike Stepper | 2007-06-30 08:03:46 +0000 |
commit | 463b6934877e925bcf32ba7885dded61267302c3 (patch) | |
tree | a879fb1fc463c4c57592a005bd819a5c564404d7 /plugins/org.eclipse.net4j.db | |
parent | e037a7f64ba3c9c8fdd8c377cf78b7d4a213f7cb (diff) | |
download | cdo-463b6934877e925bcf32ba7885dded61267302c3.tar.gz cdo-463b6934877e925bcf32ba7885dded61267302c3.tar.xz cdo-463b6934877e925bcf32ba7885dded61267302c3.zip |
task 1: Develop 0.8.0
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
27 files changed, 2113 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.db/.classpath b/plugins/org.eclipse.net4j.db/.classpath new file mode 100644 index 0000000000..751c8f2e50 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.net4j.db/.options b/plugins/org.eclipse.net4j.db/.options new file mode 100644 index 0000000000..d9d921add3 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/.options @@ -0,0 +1,3 @@ +org.eclipse.net4j.db/debug = true + +org.eclipse.net4j.db/debug.sql = true diff --git a/plugins/org.eclipse.net4j.db/.project b/plugins/org.eclipse.net4j.db/.project new file mode 100644 index 0000000000..12bb7c285e --- /dev/null +++ b/plugins/org.eclipse.net4j.db/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.net4j.db</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.net4j.db/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..a65aba119e --- /dev/null +++ b/plugins/org.eclipse.net4j.db/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.net4j.db;singleton:=true +Bundle-Version: 0.8.0.qualifier +Bundle-Activator: org.eclipse.net4j.internal.db.bundle.OM$Activator +Bundle-Vendor: %providerName +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.net4j.util;visibility:=reexport +Eclipse-LazyStart: true +Export-Package: org.eclipse.net4j.db;version="0.8.0", + org.eclipse.net4j.internal.db;version="0.8.0", + org.eclipse.net4j.internal.db.bundle;version="0.8.0" diff --git a/plugins/org.eclipse.net4j.db/about.html b/plugins/org.eclipse.net4j.db/about.html new file mode 100644 index 0000000000..81a265f458 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/about.html @@ -0,0 +1,42 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> + + <head> + + <meta content="text/html; charset=ISO-8859-1" + http-equiv="Content-Type"/> + + <title>About</title> + + </head> + + <body lang="EN-US"> + + <h2>About This Content</h2> + + <p>May 17, 2007</p> + + <h3>License</h3> + + <p>The Eclipse Foundation makes available all content in this + plug-in ("Content"). Unless otherwise indicated below, + the Content is provided to you under the terms and conditions of + the Eclipse Public License Version 1.0 ("EPL"). A copy of + the EPL is available at + <a href="http://www.eclipse.org/legal/epl-v10.html"> + http://www.eclipse.org/legal/epl-v10.html</a>. For purposes of the + EPL, "Program" will mean the Content.</p> + + <p>If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If + no such license exists, contact the Redistributor. Unless otherwise + indicated below, the terms and conditions of the EPL still apply to + any source code in the Content.</p> + + </body> + +</html> + diff --git a/plugins/org.eclipse.net4j.db/build.properties b/plugins/org.eclipse.net4j.db/build.properties new file mode 100644 index 0000000000..e85fe65780 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/build.properties @@ -0,0 +1,12 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + .options,\ + about.html,\ + copyright.txt,\ + epl-v10.html,\ + license.html,\ + plugin.properties,\ + plugin.xml,\ + schema/ diff --git a/plugins/org.eclipse.net4j.db/copyright.txt b/plugins/org.eclipse.net4j.db/copyright.txt new file mode 100644 index 0000000000..025f15218e --- /dev/null +++ b/plugins/org.eclipse.net4j.db/copyright.txt @@ -0,0 +1,8 @@ +Copyright (c) 2004 - 2007 Eike Stepper, Germany. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + +Contributors: + Eike Stepper - initial API and implementation
\ No newline at end of file diff --git a/plugins/org.eclipse.net4j.db/epl-v10.html b/plugins/org.eclipse.net4j.db/epl-v10.html new file mode 100644 index 0000000000..d7b88e9416 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/epl-v10.html @@ -0,0 +1,319 @@ +<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta name="ProgId" content="Word.Document"> +<meta name="Generator" content="Microsoft Word 9"> +<meta name="Originator" content="Microsoft Word 9"> +<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml> + <o:DocumentProperties> + <o:Revision>2</o:Revision> + <o:TotalTime>3</o:TotalTime> + <o:Created>2004-03-05T23:03:00Z</o:Created> + <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> + <o:Pages>4</o:Pages> + <o:Words>1626</o:Words> + <o:Characters>9270</o:Characters> + <o:Lines>77</o:Lines> + <o:Paragraphs>18</o:Paragraphs> + <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> + <o:Version>9.4402</o:Version> + </o:DocumentProperties> +</xml><![endif]--><!--[if gte mso 9]><xml> + <w:WordDocument> + <w:TrackRevisions/> + </w:WordDocument> +</xml><![endif]--> + + +<style> +<!-- + /* Font Definitions */ +@font-face + {font-family:Tahoma; + panose-1:2 11 6 4 3 5 4 4 2 4; + mso-font-charset:0; + mso-generic-font-family:swiss; + mso-font-pitch:variable; + mso-font-signature:553679495 -2147483648 8 0 66047 0;} + /* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal + {mso-style-parent:""; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p + {margin-right:0in; + mso-margin-top-alt:auto; + mso-margin-bottom-alt:auto; + margin-left:0in; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p.BalloonText, li.BalloonText, div.BalloonText + {mso-style-name:"Balloon Text"; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:8.0pt; + font-family:Tahoma; + mso-fareast-font-family:"Times New Roman";} +@page Section1 + {size:8.5in 11.0in; + margin:1.0in 1.25in 1.0in 1.25in; + mso-header-margin:.5in; + mso-footer-margin:.5in; + mso-paper-source:0;} +div.Section1 + {page:Section1;} +--> +</style></head> + +<body style="" lang="EN-US"> + +<div class="Section1"> + +<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b> +</p> + +<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.</span> </p> + +<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p> + +<p><span style="font-size: 10pt;">"Contribution" means:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and<br clear="left"> +b) in the case of each subsequent Contributor:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +changes to the Program, and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +additions to the Program;</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program. </span></p> + +<p><span style="font-size: 10pt;">"Contributor" means any person or +entity that distributes the Program.</span> </p> + +<p><span style="font-size: 10pt;">"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program. </span></p> + +<p><span style="font-size: 10pt;">"Program" means the Contributions +distributed in accordance with this Agreement.</span> </p> + +<p><span style="font-size: 10pt;">"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.</span> </p> + +<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder. </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement. </span></p> + +<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p> + +<p><span style="font-size: 10pt;">A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that:</span> +</p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it complies with the terms and conditions of this Agreement; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +its license agreement:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.<span style="color: blue;"> </span></span></p> + +<p><span style="font-size: 10pt;">When the Program is made available in source +code form:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it must be made available under this Agreement; and </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a +copy of this Agreement must be included with each copy of the Program. </span></p> + +<p><span style="font-size: 10pt;">Contributors may not remove or alter any +copyright notices contained within the Program. </span></p> + +<p><span style="font-size: 10pt;">Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution. </span></p> + +<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p> + +<p><span style="font-size: 10pt;">Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.</span> </p> + +<p><span style="font-size: 10pt;">For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.</span> </p> + +<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. </span></p> + +<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.</span> </p> + +<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p> + +<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.</span> </p> + +<p><span style="font-size: 10pt;">If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed. </span></p> + +<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive. </span></p> + +<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.</span> </p> + +<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.</span> </p> + +<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></p> + +</div> + +</body></html>
\ No newline at end of file diff --git a/plugins/org.eclipse.net4j.db/license.html b/plugins/org.eclipse.net4j.db/license.html new file mode 100644 index 0000000000..d7b88e9416 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/license.html @@ -0,0 +1,319 @@ +<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head> +<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> +<meta name="ProgId" content="Word.Document"> +<meta name="Generator" content="Microsoft Word 9"> +<meta name="Originator" content="Microsoft Word 9"> +<link rel="File-List" href="http://www.eclipse.org/org/documents/Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml"><title>Eclipse Public License - Version 1.0</title><!--[if gte mso 9]><xml> + <o:DocumentProperties> + <o:Revision>2</o:Revision> + <o:TotalTime>3</o:TotalTime> + <o:Created>2004-03-05T23:03:00Z</o:Created> + <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved> + <o:Pages>4</o:Pages> + <o:Words>1626</o:Words> + <o:Characters>9270</o:Characters> + <o:Lines>77</o:Lines> + <o:Paragraphs>18</o:Paragraphs> + <o:CharactersWithSpaces>11384</o:CharactersWithSpaces> + <o:Version>9.4402</o:Version> + </o:DocumentProperties> +</xml><![endif]--><!--[if gte mso 9]><xml> + <w:WordDocument> + <w:TrackRevisions/> + </w:WordDocument> +</xml><![endif]--> + + +<style> +<!-- + /* Font Definitions */ +@font-face + {font-family:Tahoma; + panose-1:2 11 6 4 3 5 4 4 2 4; + mso-font-charset:0; + mso-generic-font-family:swiss; + mso-font-pitch:variable; + mso-font-signature:553679495 -2147483648 8 0 66047 0;} + /* Style Definitions */ +p.MsoNormal, li.MsoNormal, div.MsoNormal + {mso-style-parent:""; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p + {margin-right:0in; + mso-margin-top-alt:auto; + mso-margin-bottom-alt:auto; + margin-left:0in; + mso-pagination:widow-orphan; + font-size:12.0pt; + font-family:"Times New Roman"; + mso-fareast-font-family:"Times New Roman";} +p.BalloonText, li.BalloonText, div.BalloonText + {mso-style-name:"Balloon Text"; + margin:0in; + margin-bottom:.0001pt; + mso-pagination:widow-orphan; + font-size:8.0pt; + font-family:Tahoma; + mso-fareast-font-family:"Times New Roman";} +@page Section1 + {size:8.5in 11.0in; + margin:1.0in 1.25in 1.0in 1.25in; + mso-header-margin:.5in; + mso-footer-margin:.5in; + mso-paper-source:0;} +div.Section1 + {page:Section1;} +--> +</style></head> + +<body style="" lang="EN-US"> + +<div class="Section1"> + +<p style="text-align: center;" align="center"><b>Eclipse Public License - v 1.0</b> +</p> + +<p><span style="font-size: 10pt;">THE ACCOMPANYING PROGRAM IS PROVIDED UNDER +THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, +REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE +OF THIS AGREEMENT.</span> </p> + +<p><b><span style="font-size: 10pt;">1. DEFINITIONS</span></b> </p> + +<p><span style="font-size: 10pt;">"Contribution" means:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +in the case of the initial Contributor, the initial code and documentation +distributed under this Agreement, and<br clear="left"> +b) in the case of each subsequent Contributor:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +changes to the Program, and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +additions to the Program;</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">where +such changes and/or additions to the Program originate from and are distributed +by that particular Contributor. A Contribution 'originates' from a Contributor +if it was added to the Program by such Contributor itself or anyone acting on +such Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in conjunction +with the Program under their own license agreement, and (ii) are not derivative +works of the Program. </span></p> + +<p><span style="font-size: 10pt;">"Contributor" means any person or +entity that distributes the Program.</span> </p> + +<p><span style="font-size: 10pt;">"Licensed Patents " mean patent +claims licensable by a Contributor which are necessarily infringed by the use +or sale of its Contribution alone or when combined with the Program. </span></p> + +<p><span style="font-size: 10pt;">"Program" means the Contributions +distributed in accordance with this Agreement.</span> </p> + +<p><span style="font-size: 10pt;">"Recipient" means anyone who +receives the Program under this Agreement, including all Contributors.</span> </p> + +<p><b><span style="font-size: 10pt;">2. GRANT OF RIGHTS</span></b> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +Subject to the terms of this Agreement, each Contributor hereby grants Recipient +a non-exclusive, worldwide, royalty-free copyright license to<span style="color: red;"> </span>reproduce, prepare derivative works of, publicly +display, publicly perform, distribute and sublicense the Contribution of such +Contributor, if any, and such derivative works, in source code and object code +form.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide,<span style="color: green;"> </span>royalty-free +patent license under Licensed Patents to make, use, sell, offer to sell, import +and otherwise transfer the Contribution of such Contributor, if any, in source +code and object code form. This patent license shall apply to the combination +of the Contribution and the Program if, at the time the Contribution is added +by the Contributor, such addition of the Contribution causes such combination +to be covered by the Licensed Patents. The patent license shall not apply to +any other combinations which include the Contribution. No hardware per se is +licensed hereunder. </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">c) +Recipient understands that although each Contributor grants the licenses to its +Contributions set forth herein, no assurances are provided by any Contributor +that the Program does not infringe the patent or other intellectual property +rights of any other entity. Each Contributor disclaims any liability to Recipient +for claims brought by any other entity based on infringement of intellectual +property rights or otherwise. As a condition to exercising the rights and +licenses granted hereunder, each Recipient hereby assumes sole responsibility +to secure any other intellectual property rights needed, if any. For example, +if a third party patent license is required to allow Recipient to distribute +the Program, it is Recipient's responsibility to acquire that license before +distributing the Program.</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">d) +Each Contributor represents that to its knowledge it has sufficient copyright +rights in its Contribution, if any, to grant the copyright license set forth in +this Agreement. </span></p> + +<p><b><span style="font-size: 10pt;">3. REQUIREMENTS</span></b> </p> + +<p><span style="font-size: 10pt;">A Contributor may choose to distribute the +Program in object code form under its own license agreement, provided that:</span> +</p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it complies with the terms and conditions of this Agreement; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) +its license agreement:</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">i) +effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">ii) +effectively excludes on behalf of all Contributors all liability for damages, +including direct, indirect, special, incidental and consequential damages, such +as lost profits; </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iii) +states that any provisions which differ from this Agreement are offered by that +Contributor alone and not by any other party; and</span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">iv) +states that source code for the Program is available from such Contributor, and +informs licensees how to obtain it in a reasonable manner on or through a +medium customarily used for software exchange.<span style="color: blue;"> </span></span></p> + +<p><span style="font-size: 10pt;">When the Program is made available in source +code form:</span> </p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">a) +it must be made available under this Agreement; and </span></p> + +<p class="MsoNormal" style="margin-left: 0.5in;"><span style="font-size: 10pt;">b) a +copy of this Agreement must be included with each copy of the Program. </span></p> + +<p><span style="font-size: 10pt;">Contributors may not remove or alter any +copyright notices contained within the Program. </span></p> + +<p><span style="font-size: 10pt;">Each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution. </span></p> + +<p><b><span style="font-size: 10pt;">4. COMMERCIAL DISTRIBUTION</span></b> </p> + +<p><span style="font-size: 10pt;">Commercial distributors of software may +accept certain responsibilities with respect to end users, business partners +and the like. While this license is intended to facilitate the commercial use +of the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes the +Program in a commercial product offering, such Contributor ("Commercial +Contributor") hereby agrees to defend and indemnify every other +Contributor ("Indemnified Contributor") against any losses, damages and +costs (collectively "Losses") arising from claims, lawsuits and other +legal actions brought by a third party against the Indemnified Contributor to +the extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may participate +in any such claim at its own expense.</span> </p> + +<p><span style="font-size: 10pt;">For example, a Contributor might include the +Program in a commercial product offering, Product X. That Contributor is then a +Commercial Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance claims and +warranties are such Commercial Contributor's responsibility alone. Under this +section, the Commercial Contributor would have to defend claims against the +other Contributors related to those performance claims and warranties, and if a +court requires any other Contributor to pay any damages as a result, the +Commercial Contributor must pay those damages.</span> </p> + +<p><b><span style="font-size: 10pt;">5. NO WARRANTY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, +WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and distributing the +Program and assumes all risks associated with its exercise of rights under this +Agreement , including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs or +equipment, and unavailability or interruption of operations. </span></p> + +<p><b><span style="font-size: 10pt;">6. DISCLAIMER OF LIABILITY</span></b> </p> + +<p><span style="font-size: 10pt;">EXCEPT AS EXPRESSLY SET FORTH IN THIS +AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF +THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGES.</span> </p> + +<p><b><span style="font-size: 10pt;">7. GENERAL</span></b> </p> + +<p><span style="font-size: 10pt;">If any provision of this Agreement is invalid +or unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.</span> </p> + +<p><span style="font-size: 10pt;">If Recipient institutes patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Program itself (excluding combinations of the Program with +other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed. </span></p> + +<p><span style="font-size: 10pt;">All Recipient's rights under this Agreement +shall terminate if it fails to comply with any of the material terms or +conditions of this Agreement and does not cure such failure in a reasonable +period of time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive. </span></p> + +<p><span style="font-size: 10pt;">Everyone is permitted to copy and distribute +copies of this Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The Agreement +Steward reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement Steward has +the right to modify this Agreement. The Eclipse Foundation is the initial +Agreement Steward. The Eclipse Foundation may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved.</span> </p> + +<p><span style="font-size: 10pt;">This Agreement is governed by the laws of the +State of New York and the intellectual property laws of the United States of +America. No party to this Agreement will bring a legal action under this +Agreement more than one year after the cause of action arose. Each party waives +its rights to a jury trial in any resulting litigation.</span> </p> + +<p class="MsoNormal"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></p> + +</div> + +</body></html>
\ No newline at end of file diff --git a/plugins/org.eclipse.net4j.db/plugin.properties b/plugins/org.eclipse.net4j.db/plugin.properties new file mode 100644 index 0000000000..6d4af8625e --- /dev/null +++ b/plugins/org.eclipse.net4j.db/plugin.properties @@ -0,0 +1,33 @@ +# /** +# * <copyright> +# * +# * Copyright (c) 2004 - 2007 Eike Stepper, Germany. +# * All rights reserved. This program and the accompanying materials +# * are made available under the terms of the Eclipse Public License v1.0 +# * which accompanies this distribution, and is available at +# * http://www.eclipse.org/legal/epl-v10.html +# * +# * Contributors: +# * Eike Stepper - Initial API and implementation +# * +# * </copyright> +# * +# * $Id$ +# */ + +# NLS_MESSAGEFORMAT_VAR + +# ============================================================================== +# Do not change the properties between this line and the last line containing: +# %%% END OF TRANSLATED PROPERTIES %%% +# Instead, either redefine an existing property, or create a new property, +# append it to the end of the file, and change the code to use the new name. +# ============================================================================== + +pluginName=JMS Support +providerName=Eclipse.org + +# ============================================================================== +# %%% END OF TRANSLATED PROPERTIES %%% +# The above properties have been shipped for translation. +# ============================================================================== diff --git a/plugins/org.eclipse.net4j.db/plugin.xml b/plugins/org.eclipse.net4j.db/plugin.xml new file mode 100644 index 0000000000..1914d077da --- /dev/null +++ b/plugins/org.eclipse.net4j.db/plugin.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.2"?> +<plugin> + <extension-point id="dbAdapters" name="Net4j DB Adapters" schema="schema/dbAdapters.exsd"/> + +</plugin> diff --git a/plugins/org.eclipse.net4j.db/schema/dbAdapters.exsd b/plugins/org.eclipse.net4j.db/schema/dbAdapters.exsd new file mode 100644 index 0000000000..65ef45203c --- /dev/null +++ b/plugins/org.eclipse.net4j.db/schema/dbAdapters.exsd @@ -0,0 +1,119 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.net4j.db"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.net4j.db" id="dbAdapters" name="Net4j DB Adapters"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + <element ref="dbAdapter" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="dbAdapter"> + <complexType> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="version" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn="org.eclipse.net4j.db.IDBAdapter"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + + </documentation> + </annotation> + +</schema> diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBException.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBException.java new file mode 100644 index 0000000000..2758cb17f1 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBException.java @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +/** + * @author Eike Stepper + */ +public class DBException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public DBException() + { + } + + public DBException(String message) + { + super(message); + } + + public DBException(Throwable cause) + { + super(cause); + } + + public DBException(String message, Throwable cause) + { + super(message, cause); + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java new file mode 100644 index 0000000000..ce4a704040 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBUtil.java @@ -0,0 +1,61 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +import org.eclipse.net4j.internal.db.Schema; +import org.eclipse.net4j.internal.db.bundle.OM; +import org.eclipse.net4j.util.ReflectUtil; + +import javax.sql.DataSource; + +import java.util.Map; + +/** + * @author Eike Stepper + */ +public final class DBUtil +{ + private DBUtil() + { + } + + public static ISchema createSchema(String name) + { + return new Schema(name); + } + + public static DataSource createDataSource(Map<Object, Object> properties) + { + return createDataSource(properties, null); + } + + public static DataSource createDataSource(Map<Object, Object> properties, String namespace) + { + return createDataSource(properties, namespace, "driverClass"); + } + + public static DataSource createDataSource(Map<Object, Object> properties, String namespace, String driverClassKey) + { + try + { + return (DataSource)ReflectUtil.instantiate(properties, namespace, driverClassKey, OM.class.getClassLoader()); + } + catch (Exception ex) + { + throw new DBException(ex); + } + } + + public static IDBAdapter getDBAdapter(String adapterName) + { + return IDBAdapter.REGISTRY.get(adapterName); + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java new file mode 100644 index 0000000000..b3ffba055c --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IDBAdapter.java @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +import org.eclipse.net4j.internal.db.DBAdapterRegistry; +import org.eclipse.net4j.internal.db.Table; +import org.eclipse.net4j.util.registry.IRegistry; + +import java.sql.Driver; +import java.sql.Statement; + +/** + * @author Eike Stepper + */ +public interface IDBAdapter +{ + public static final IRegistry<String, IDBAdapter> REGISTRY = DBAdapterRegistry.INSTANCE; + + public String getName(); + + public String getVersion(); + + public Driver getJDBCDriver(); + + public void createTable(Table table, Statement statement); +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IField.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IField.java new file mode 100644 index 0000000000..d644e6c99d --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IField.java @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +/** + * @author Eike Stepper + */ +public interface IField +{ + public static final int DEFAULT = -1; + + public ITable geTable(); + + public String getName(); + + public Type getType(); + + public int getPrecision(); + + public int getScale(); + + public boolean isNotNull(); + + public int getPosition(); + + public String getFullName(); + + /** + * @author Eike Stepper + */ + public enum Type + { + BOOLEAN(16), // + BIT(-7), // + TINYINT(-6), // + SMALLINT(5), // + INTEGER(4), // + BIGINT(-5), // + FLOAT(6), // + REAL(7), // + DOUBLE(8), // + NUMERIC(2), // + DECIMAL(3), // + CHAR(1), // + VARCHAR(12), // + LONGVARCHAR(-1), // + DATE(91), // + TIME(92), // + TIMESTAMP(93), // + BINARY(-2), // + VARBINARY(-3), // + LONGVARBINARY(-4), // + BLOB(2004), // + CLOB(2005); // + + private int code; + + private Type(int code) + { + this.code = code; + } + + public int getCode() + { + return code; + } + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IIndex.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IIndex.java new file mode 100644 index 0000000000..6347ff7345 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/IIndex.java @@ -0,0 +1,39 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +/** + * @author Eike Stepper + */ +public interface IIndex +{ + public ITable geTable(); + + public Type geType(); + + public IField getField(int index); + + public int getFieldCount(); + + public IField[] getFields(); + + public int getPosition(); + + public String getName(); + + /** + * @author Eike Stepper + */ + public enum Type + { + PRIMARY_KEY, UNIQUE, NON_UNIQUE + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ISchema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ISchema.java new file mode 100644 index 0000000000..36515c8132 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ISchema.java @@ -0,0 +1,29 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +import javax.sql.DataSource; + +/** + * @author Eike Stepper + */ +public interface ISchema +{ + public String getName(); + + public ITable addTable(String name); + + public ITable getTable(String name); + + public ITable[] getTables(); + + public void create(IDBAdapter dbAdapter, DataSource dataSource); +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ITable.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ITable.java new file mode 100644 index 0000000000..221b192133 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/ITable.java @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.db; + +import org.eclipse.net4j.internal.db.Field; + +/** + * @author Eike Stepper + */ +public interface ITable +{ + public ISchema getSchema(); + + public String getName(); + + public IField addField(String name, IField.Type type); + + public Field addField(String name, IField.Type type, boolean notNull); + + public Field addField(String name, IField.Type type, int precision); + + public Field addField(String name, IField.Type type, int precision, boolean notNull); + + public Field addField(String name, IField.Type type, int precision, int scale); + + public Field addField(String name, IField.Type type, int precision, int scale, boolean notNull); + + public IField getField(String name); + + public IField getField(int index); + + public int getFieldCount(); + + public IField[] getFields(); + + public IIndex addIndex(IIndex.Type type, IField field); + + public IIndex addIndex(IIndex.Type type, IField[] fields); + + public int getIndexCount(); + + public IIndex[] getIndices(); + + public IIndex getPrimaryKeyIndex(); +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/AbstractDBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/AbstractDBAdapter.java new file mode 100644 index 0000000000..552e77f15d --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/AbstractDBAdapter.java @@ -0,0 +1,186 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.DBException; +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.IField.Type; + +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; + +/** + * @author Eike Stepper + */ +public abstract class AbstractDBAdapter implements IDBAdapter +{ + private String name; + + private String version; + + public AbstractDBAdapter(String name, String version) + { + this.name = name; + this.version = version; + } + + public String getName() + { + return name; + } + + public String getVersion() + { + return version; + } + + public void createTable(Table table, Statement statement) + { + try + { + doCreateTable(table, statement); + } + catch (SQLException ex) + { + System.out.println(ex.getMessage()); + } + + validateTable(table, statement); + } + + @Override + public String toString() + { + return getName() + "-" + getVersion(); + } + + protected void doCreateTable(Table table, Statement statement) throws SQLException + { + StringBuilder builder = new StringBuilder(); + builder.append("CREATE TABLE "); + builder.append(table.getName()); + builder.append(" ("); + table.appendFieldDefs(builder, createFieldDefinitions(table)); + String constraints = createConstraints(table); + if (constraints != null) + { + builder.append(", "); + builder.append(constraints); + } + + builder.append(")"); + String sql = builder.toString(); + System.out.println(sql); + statement.execute(sql); + } + + protected String createConstraints(Table table) + { + return null; + } + + protected String createFieldDefinition(Field field) + { + return getTypeName(field) + (field.isNotNull() ? " NOT NULL" : ""); + } + + protected String getTypeName(Field field) + { + Type type = field.getType(); + switch (type) + { + case BOOLEAN: + case BIT: + case TINYINT: + case SMALLINT: + case INTEGER: + case BIGINT: + case FLOAT: + case REAL: + case DOUBLE: + case DATE: + case TIME: + case TIMESTAMP: + case BLOB: + case CLOB: + return type.toString(); + + case CHAR: + case VARCHAR: + case LONGVARCHAR: + case BINARY: + case VARBINARY: + case LONGVARBINARY: + return type.toString() + field.formatPrecision(); + + case NUMERIC: + case DECIMAL: + return type.toString() + field.formatPrecisionAndScale(); + } + + throw new IllegalArgumentException("Unknown type: " + type); + } + + protected void validateTable(Table table, Statement statement) + { + try + { + StringBuilder builder = new StringBuilder(); + builder.append("SELECT "); + table.appendFieldNames(builder); + builder.append(" FROM "); + builder.append(table.getName()); + String sql = builder.toString(); + + ResultSet resultSet = statement.executeQuery(sql); + ResultSetMetaData metaData = resultSet.getMetaData(); + int columnCount = metaData.getColumnCount(); + if (columnCount != table.getFieldCount()) + { + throw new DBException("Table " + table.getName() + " has " + columnCount + " columns instead of " + + table.getFieldCount()); + } + + for (int i = 0; i < columnCount; i++) + { + int existingCode = metaData.getColumnType(i + 1); + Field field = table.getField(i); + int code = field.getType().getCode(); + if (code != existingCode) + { + throw new DBException("Field " + field.getFullName() + " has type " + existingCode + " instead of " + code + + " (" + field.getType() + ")"); + } + } + } + catch (SQLException ex) + { + throw new DBException(ex.getMessage()); + } + } + + private String[] createFieldDefinitions(Table table) + { + Field[] fields = table.getFields(); + int fieldCount = fields.length; + + String[] result = new String[fieldCount]; + for (int i = 0; i < fieldCount; i++) + { + Field field = fields[i]; + result[i] = createFieldDefinition(field); + } + + return result; + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java new file mode 100644 index 0000000000..c6e0ace47b --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterDescriptor.java @@ -0,0 +1,23 @@ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.IDBAdapter; + +/** + * @author Eike Stepper + */ +public abstract class DBAdapterDescriptor +{ + private String name; + + public DBAdapterDescriptor(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public abstract IDBAdapter createDBAdapter(); +}
\ No newline at end of file diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java new file mode 100644 index 0000000000..5bb1b26b20 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapterRegistry.java @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.internal.util.registry.HashMapRegistry; +import org.eclipse.net4j.util.registry.IRegistry; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + */ +public class DBAdapterRegistry extends HashMapRegistry<String, IDBAdapter> implements IRegistry<String, IDBAdapter> +{ + public static final DBAdapterRegistry INSTANCE = new DBAdapterRegistry(); + + private Map<String, DBAdapterDescriptor> descriptors = new HashMap(); + + public DBAdapterRegistry() + { + } + + public DBAdapterRegistry(int initialCapacity) + { + super(initialCapacity); + } + + public DBAdapterRegistry(int initialCapacity, float loadFactor) + { + super(initialCapacity, loadFactor); + } + + public DBAdapterRegistry(Map<? extends String, ? extends IDBAdapter> m) + { + super(m); + } + + @Override + public IDBAdapter get(Object key) + { + IDBAdapter adapter = super.get(key); + if (adapter == null) + { + if (key instanceof String) + { + DBAdapterDescriptor descriptor = descriptors.get(key); + if (descriptor != null) + { + adapter = descriptor.createDBAdapter(); + if (adapter != null) + { + put((String)key, adapter); + } + } + } + } + + return adapter; + } + + public DBAdapterDescriptor addDescriptor(DBAdapterDescriptor descriptor) + { + return descriptors.put(descriptor.getName(), descriptor); + } + + public DBAdapterDescriptor removeDescriptor(String name) + { + return descriptors.remove(name); + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Field.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Field.java new file mode 100644 index 0000000000..461d41c8ea --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Field.java @@ -0,0 +1,107 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.IField; + +/** + * @author Eike Stepper + */ +public class Field implements IField +{ + private static final int DEFAULT_PRECISION = 255; + + private Table table; + + private String name; + + private Type type; + + private int precision; + + private int scale; + + private boolean notNull; + + private int position; + + public Field(Table table, String name, Type type, int precision, int scale, boolean notNull, int position) + { + this.table = table; + this.name = name; + this.type = type; + this.precision = precision; + this.scale = scale; + this.notNull = notNull; + this.position = position; + } + + public Table geTable() + { + return table; + } + + public String getName() + { + return name; + } + + public Type getType() + { + return type; + } + + public int getPrecision() + { + return precision == DEFAULT ? DEFAULT_PRECISION : precision; + } + + public int getScale() + { + return scale; + } + + public boolean isNotNull() + { + return notNull; + } + + public int getPosition() + { + return position; + } + + public String getFullName() + { + return table.getName() + "." + name; + } + + @Override + public String toString() + { + return getFullName(); + } + + public String formatPrecision() + { + return "(" + getPrecision() + ")"; + } + + public String formatPrecisionAndScale() + { + if (scale == DEFAULT) + { + return "(" + getPrecision() + ")"; + } + + return "(" + getPrecision() + ", " + scale + ")"; + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Index.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Index.java new file mode 100644 index 0000000000..a950e600df --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Index.java @@ -0,0 +1,77 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.IField; +import org.eclipse.net4j.db.IIndex; + +/** + * @author Eike Stepper + */ +public class Index implements IIndex +{ + private Table table; + + private Type type; + + private IField[] fields; + + public int position; + + public Index(Table table, Type type, IField[] fields, int position) + { + this.table = table; + this.type = type; + this.fields = fields; + this.position = position; + } + + public Table geTable() + { + return table; + } + + public Type geType() + { + return type; + } + + public IField getField(int index) + { + return fields[index]; + } + + public int getFieldCount() + { + return fields.length; + } + + public IField[] getFields() + { + return fields; + } + + public int getPosition() + { + return position; + } + + public String getName() + { + return "idx_" + table.getName() + "_" + position; + } + + @Override + public String toString() + { + return getName(); + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Schema.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Schema.java new file mode 100644 index 0000000000..04bd7dfbac --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Schema.java @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.DBException; +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.db.ISchema; + +import javax.sql.DataSource; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.HashMap; +import java.util.Map; + +/** + * @author Eike Stepper + */ +public class Schema implements ISchema +{ + private String name; + + private Map<String, Table> tables = new HashMap(); + + private boolean locked; + + public Schema(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + + public Table addTable(String name) + { + assertUnlocked(); + if (tables.containsKey(name)) + { + throw new IllegalStateException("Table exists: " + name); + } + + Table table = new Table(this, name); + tables.put(name, table); + return table; + } + + public Table getTable(String name) + { + return tables.get(name); + } + + public Table[] getTables() + { + return tables.values().toArray(new Table[tables.size()]); + } + + public boolean isLocked() + { + return locked; + } + + public boolean lock() + { + return locked = true; + } + + public void create(IDBAdapter dbAdapter, DataSource dataSource) + { + try + { + Connection connection = dataSource.getConnection(); + Statement statement = connection.createStatement(); + for (Table table : tables.values()) + { + dbAdapter.createTable(table, statement); + } + } + catch (SQLException ex) + { + throw new DBException(ex); + } + } + + @Override + public String toString() + { + return name; + } + + void assertUnlocked() + { + if (locked) + { + throw new IllegalStateException("Schema locked: " + name); + } + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Table.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Table.java new file mode 100644 index 0000000000..f119586bd8 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/Table.java @@ -0,0 +1,205 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db; + +import org.eclipse.net4j.db.IField; +import org.eclipse.net4j.db.IIndex; +import org.eclipse.net4j.db.ITable; +import org.eclipse.net4j.db.IIndex.Type; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Eike Stepper + */ +public class Table implements ITable +{ + private Schema schema; + + private String name; + + private List<Field> fields = new ArrayList(); + + private List<Index> indices = new ArrayList(); + + public Table(Schema schema, String name) + { + this.schema = schema; + this.name = name; + } + + public Schema getSchema() + { + return schema; + } + + public String getName() + { + return name; + } + + public Field addField(String name, IField.Type type) + { + return addField(name, type, IField.DEFAULT, IField.DEFAULT, false); + } + + public Field addField(String name, IField.Type type, boolean notNull) + { + return addField(name, type, IField.DEFAULT, IField.DEFAULT, notNull); + } + + public Field addField(String name, IField.Type type, int precision) + { + return addField(name, type, precision, IField.DEFAULT, false); + } + + public Field addField(String name, IField.Type type, int precision, boolean notNull) + { + return addField(name, type, precision, IField.DEFAULT, notNull); + } + + public Field addField(String name, IField.Type type, int precision, int scale) + { + return addField(name, type, precision, scale, false); + } + + public Field addField(String name, IField.Type type, int precision, int scale, boolean notNull) + { + schema.assertUnlocked(); + if (getField(name) != null) + { + throw new IllegalStateException("Field exists: " + name); + } + + Field field = new Field(this, name, type, precision, scale, notNull, fields.size()); + fields.add(field); + return field; + } + + public Field getField(String name) + { + for (Field field : fields) + { + if (name.equals(field.getName())) + { + return field; + } + } + + return null; + } + + public Field getField(int index) + { + return fields.get(index); + } + + public int getFieldCount() + { + return fields.size(); + } + + public Field[] getFields() + { + return fields.toArray(new Field[fields.size()]); + } + + public Index addIndex(Type type, IField field) + { + IField[] fields = { field }; + return addIndex(type, fields); + } + + public Index addIndex(Type type, IField[] fields) + { + schema.assertUnlocked(); + Index index = new Index(this, type, fields, indices.size()); + indices.add(index); + return index; + } + + public int getIndexCount() + { + return indices.size(); + } + + public Index[] getIndices() + { + return indices.toArray(new Index[indices.size()]); + } + + public IIndex getPrimaryKeyIndex() + { + for (IIndex index : indices) + { + if (index.geType() == IIndex.Type.PRIMARY_KEY) + { + return index; + } + } + + return null; + } + + public void appendFieldNames(Appendable appendable) + { + try + { + boolean first = true; + for (Field field : fields) + { + if (first) + { + first = false; + } + else + { + appendable.append(", "); + } + + appendable.append(field.getName()); + } + } + catch (IOException canNotHappen) + { + } + } + + public void appendFieldDefs(Appendable appendable, String[] defs) + { + try + { + for (int i = 0; i < fields.size(); i++) + { + Field field = fields.get(i); + if (i != 0) + { + appendable.append(", "); + } + + appendable.append(field.getName()); + appendable.append(" "); + appendable.append(defs[i]); + } + } + catch (IOException canNotHappen) + { + } + } + + @Override + public String toString() + { + return name; + } +} diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java new file mode 100644 index 0000000000..97ce7f3099 --- /dev/null +++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/bundle/OM.java @@ -0,0 +1,87 @@ +/*************************************************************************** + * Copyright (c) 2004 - 2007 Eike Stepper, Germany. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + **************************************************************************/ +package org.eclipse.net4j.internal.db.bundle; + +import org.eclipse.net4j.db.IDBAdapter; +import org.eclipse.net4j.internal.db.DBAdapterDescriptor; +import org.eclipse.net4j.internal.db.DBAdapterRegistry; +import org.eclipse.net4j.internal.util.om.OSGiActivator; +import org.eclipse.net4j.util.om.OMBundle; +import org.eclipse.net4j.util.om.OMLogger; +import org.eclipse.net4j.util.om.OMPlatform; +import org.eclipse.net4j.util.om.OMTracer; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; + +/** + * @author Eike Stepper + */ +public final class OM +{ + public static final String BUNDLE_ID = "org.eclipse.net4j.db"; //$NON-NLS-1$ + + public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class); + + public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$ + + public static final OMTracer DEBUG_SQL = DEBUG.tracer("sql"); //$NON-NLS-1$ + + public static final OMLogger LOG = BUNDLE.logger(); + + public static final String EXT_POINT = "dbAdapters"; + + private OM() + { + } + + public static final class Activator extends OSGiActivator + { + @Override + protected OMBundle getOMBundle() + { + return BUNDLE; + } + + @Override + protected void start() throws Exception + { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IConfigurationElement[] elements = registry.getConfigurationElementsFor(BUNDLE_ID, EXT_POINT); + for (final IConfigurationElement element : elements) + { + if ("dbAdapter".equals(element.getName())) + { + DBAdapterDescriptor descriptor = new DBAdapterDescriptor(element.getAttribute("name")) + { + @Override + public IDBAdapter createDBAdapter() + { + try + { + return (IDBAdapter)element.createExecutableExtension("class"); + } + catch (CoreException ex) + { + OM.LOG.error(ex); + return null; + } + } + }; + + DBAdapterRegistry.INSTANCE.addDescriptor(descriptor); + } + } + } + } +} |