aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjad2013-12-23 17:08:03 (EST)
committerSamuel Padgett2014-02-18 09:16:18 (EST)
commitd2096d3fec1b1ab742b1510141dac1d51a35cbde (patch)
treedaf87094579a8c18a0280172a5cbbf4adc96fdd6
parenta2502d880ec1bd9b1d8774b47e53355db6f5bad7 (diff)
downloadorg.eclipse.lyo.core-d2096d3fec1b1ab742b1510141dac1d51a35cbde.zip
org.eclipse.lyo.core-d2096d3fec1b1ab742b1510141dac1d51a35cbde.tar.gz
org.eclipse.lyo.core-d2096d3fec1b1ab742b1510141dac1d51a35cbde.tar.bz2
Bug 422448 - A OSLC4J code generator based on an EMF model of OSLCrefs/changes/61/20161/5
domain specifications This is an initial prototype that proves the concept of such a code generator. Change-Id: I78634ee60162bddf4fa976421ff3fb5c040d124a Signed-off-by: jad <jad@kth.se>
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/.classpath7
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/.gitignore1
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/.project28
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/license/edl-v10html60
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/license/epl-v10.html259
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/license/notice.html109
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore140
-rw-r--r--org.eclipse.lyo.oslc4j.adaptormodel/src/README.txt1
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/.classpath8
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/.gitignore1
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/.project46
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/META-INF/MANIFEST.MF23
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/build.acceleo26
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/build.properties6
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/license/edl-v10html60
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/license/epl-v10.html259
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/license/notice.html109
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/Activator.java66
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl154
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl89
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl162
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl77
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl135
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServletListener.mtl162
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDelegatedUIJavaScripts.mtl140
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateFilteredResourceCollectionJsp.mtl87
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateGetResourceJsp.mtl146
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl346
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCollectionJsp.mtl137
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl130
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceSelectorJsp.mtl117
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateService.mtl545
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogHTML.mtl164
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogService.mtl200
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogSingleton.mtl336
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderHTML.mtl209
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderInfo.mtl71
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderService.mtl181
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/Generate.java406
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl79
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl173
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/jspServices.mtl83
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl231
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl74
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderCatalogServices.mtl62
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderServices.mtl42
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceServices.mtl57
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl42
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEDLV10HTML.mtl87
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEPLV10HTML.mtl287
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateLicenseFiles.mtl32
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateNoticeHTML.mtl136
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/tasks/generate.xml66
-rw-r--r--org.eclipse.lyo.oslc4j.codegenerator/tasks/generateTarget.xml19
55 files changed, 6679 insertions, 0 deletions
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/.classpath b/org.eclipse.lyo.oslc4j.adaptormodel/.classpath
new file mode 100644
index 0000000..3bc2475
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/.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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/.gitignore b/org.eclipse.lyo.oslc4j.adaptormodel/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/.project b/org.eclipse.lyo.oslc4j.adaptormodel/.project
new file mode 100644
index 0000000..73a1441
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.lyo.oslc4j.adaptormodel</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/META-INF/MANIFEST.MF b/org.eclipse.lyo.oslc4j.adaptormodel/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..3224feb
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.lyo.oslc4j.adaptor_model
+Bundle-SymbolicName: org.eclipse.lyo.oslc4j.adaptormodel;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Require-Bundle: org.eclipse.emf.ecore
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/license/edl-v10html b/org.eclipse.lyo.oslc4j.adaptormodel/license/edl-v10html
new file mode 100644
index 0000000..5c8549b
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/license/edl-v10html
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer. </li>
+<li>Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution. </li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission. </li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+</body>
+
+</html>
+
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/license/epl-v10.html b/org.eclipse.lyo.oslc4j.adaptormodel/license/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/license/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>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.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">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.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"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.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to 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.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+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.</p>
+
+<p class="list">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.</p>
+
+<p class="list">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.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">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;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">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.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>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.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>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.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>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.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/license/notice.html b/org.eclipse.lyo.oslc4j.adaptormodel/license/notice.html
new file mode 100644
index 0000000..160febd
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/license/notice.html
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>13 December, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also 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, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
+
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore
new file mode 100644
index 0000000..475abb7
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/model/adaptorInterface.ecore
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="adaptorInterface" nsURI="org.eclipse.lyo.oslc4j.adaptorInterface"
+ nsPrefix="ai">
+ <eClassifiers xsi:type="ecore:EClass" name="AdaptorInterface">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="serviceProviderCatalog"
+ lowerBound="1" eType="#//ServiceProviderCatalog" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaClassBaseNamespace"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="specification" lowerBound="1"
+ eType="#//Specification" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaFilesBasePath" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="jspFilesBasePath" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="javascriptFilesBasePath"
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Specification">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="domainSpecifications" upperBound="-1"
+ eType="#//DomainSpecification" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="domainPrefixes" upperBound="-1"
+ eType="#//NamespacePrefix" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="DomainSpecification">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="namespaceURI" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="namespacePrefix" lowerBound="1"
+ eType="#//NamespacePrefix"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resources" upperBound="-1"
+ eType="#//Resource" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resourceProperties" upperBound="-1"
+ eType="#//ResourceProperty" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="NamespacePrefix">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ServiceProviderCatalog">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="publisher" eType="#//Publisher"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="serviceProviders" upperBound="-1"
+ eType="#//ServiceProvider" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ServiceProvider">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="publisher" eType="#//Publisher"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="services" lowerBound="1"
+ upperBound="-1" eType="#//Service" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Service">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="domainSpecification" lowerBound="1"
+ eType="#//DomainSpecification"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="creationFactories" upperBound="-1"
+ eType="#//CreationFactory" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="queryCapabilities" upperBound="-1"
+ eType="#//QueryCapability" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="selectionDialogs" upperBound="-1"
+ eType="#//Dialog" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="creationDialogs" upperBound="-1"
+ eType="#//Dialog" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Resource">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="extends" eType="#//Resource"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resourceProperties" upperBound="-1"
+ eType="#//ResourceProperty"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ResourceProperty">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="occurs" eType="#//ResourcePropertyOccurs"
+ defaultValueLiteral="exactlyOne"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="readOnly" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueType" eType="#//ResourcePropertyValueType"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="representation" eType="#//ResourcePropertyRepresentation"
+ defaultValueLiteral="n/a"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="range" eType="#//Resource"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ResourcePropertyOccurs">
+ <eLiterals name="exactlyOne" literal="exactlyOne"/>
+ <eLiterals name="zeroOrOne" value="1" literal="zeroOrOne"/>
+ <eLiterals name="zeroOrMany" value="2" literal="zeroOrMany"/>
+ <eLiterals name="oneOrMany" value="3" literal="oneOrMany"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ResourcePropertyValueType">
+ <eLiterals name="Boolean" literal="Boolean"/>
+ <eLiterals name="String" value="1" literal="String"/>
+ <eLiterals name="DateTime" value="2" literal="DateTime"/>
+ <eLiterals name="XMLLiteral" value="3" literal="XMLLiteral"/>
+ <eLiterals name="Resource" value="4" literal="Resource"/>
+ <eLiterals name="LocalResource" value="5" literal="LocalResource"/>
+ <eLiterals name="URI" value="6" literal="URI"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="ResourcePropertyRepresentation">
+ <eLiterals name="reference" literal="reference"/>
+ <eLiterals name="inline" value="1" literal="inline"/>
+ <eLiterals name="either" value="2" literal="either"/>
+ <eLiterals name="n/a" value="3" literal="n/a"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="CreationFactory">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="creationURI" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resourceTypes" upperBound="-1"
+ eType="#//Resource"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="QueryCapability">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="queryBaseURI" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resourceTypes" upperBound="-1"
+ eType="#//Resource"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Dialog">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="dialogURI" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="hintWidth" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="hintHeight" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="resourceTypes" upperBound="-1"
+ eType="#//Resource"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Publisher">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="label" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="identifier" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="icon" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/org.eclipse.lyo.oslc4j.adaptormodel/src/README.txt b/org.eclipse.lyo.oslc4j.adaptormodel/src/README.txt
new file mode 100644
index 0000000..f50bb11
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.adaptormodel/src/README.txt
@@ -0,0 +1 @@
+I need a src folder to avoid java errors in eclipse. But I have nothing to put it. and does not like empty folders. Hence the need for this README file. \ No newline at end of file
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/.classpath b/org.eclipse.lyo.oslc4j.codegenerator/.classpath
new file mode 100644
index 0000000..f12f52f
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" output="bin" path="src"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.lyo.oslc4j.adaptormodel"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/.gitignore b/org.eclipse.lyo.oslc4j.codegenerator/.gitignore
new file mode 100644
index 0000000..5e56e04
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/.gitignore
@@ -0,0 +1 @@
+/bin
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/.project b/org.eclipse.lyo.oslc4j.codegenerator/.project
new file mode 100644
index 0000000..b861aad
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/.project
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.lyo.oslc4j.codegenerator</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>
+ <buildCommand>
+ <name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>compilation.kind</key>
+ <value>compilation.platform.resource</value>
+ </dictionary>
+ <dictionary>
+ <key>compliance</key>
+ <value>pragmatic</value>
+ </dictionary>
+ <dictionary>
+ <key>resource.kind</key>
+ <value>xmi</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/META-INF/MANIFEST.MF b/org.eclipse.lyo.oslc4j.codegenerator/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c03f84e
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Acceleo Codegenerator Module Runtime Plug-in
+Bundle-SymbolicName: org.eclipse.lyo.oslc4j.codegenerator
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.lyo.oslc4j.codegenerator.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.ocl,
+ org.eclipse.ocl.ecore,
+ org.eclipse.acceleo.common;bundle-version="3.3.0",
+ org.eclipse.acceleo.model;bundle-version="3.3.0",
+ org.eclipse.acceleo.profiler;bundle-version="3.3.0",
+ org.eclipse.acceleo.engine;bundle-version="3.3.0",
+ com.google.guava
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.lyo.oslc4j.codegenerator.main
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/build.acceleo b/org.eclipse.lyo.oslc4j.codegenerator/build.acceleo
new file mode 100644
index 0000000..fb82556
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/build.acceleo
@@ -0,0 +1,26 @@
+<!-- ===================================================================== -->
+<!-- Custom targets. -->
+<!-- Set customBuildCallbacks = build.acceleo in your build.properties. -->
+<!-- ===================================================================== -->
+<project name="Build Acceleo Module" default="noDefault">
+ <!-- ================================================================= -->
+ <!-- Default target -->
+ <!-- ================================================================= -->
+ <target name="noDefault">
+ <echo message="This file must be called with explicit targets" />
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- This will be called automatically after the compilation of each -->
+ <!-- Bundle... in dependency order. -->
+ <!-- ================================================================= -->
+ <target name="post.compile.@dot">
+ <acceleoCompiler
+ sourceFolder="${target.folder}"
+ outputFolder="${target.folder}"
+ dependencies="${target.folder}/../../org.eclipse.lyo.oslc4j.adaptormodel;"
+ binaryResource="false"
+ packagesToRegister="">
+ </acceleoCompiler>
+ </target>
+</project>
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/build.properties b/org.eclipse.lyo.oslc4j.codegenerator/build.properties
new file mode 100644
index 0000000..d850aca
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
+customBuildCallbacks = build.acceleo
+jre.compilation.profile = JavaSE-1.7
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/license/edl-v10html b/org.eclipse.lyo.oslc4j.codegenerator/license/edl-v10html
new file mode 100644
index 0000000..5c8549b
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/license/edl-v10html
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer. </li>
+<li>Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution. </li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission. </li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+</body>
+
+</html>
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/license/epl-v10.html b/org.eclipse.lyo.oslc4j.codegenerator/license/epl-v10.html
new file mode 100644
index 0000000..b398acc
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/license/epl-v10.html
@@ -0,0 +1,259 @@
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>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.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">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.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"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.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to 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.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+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.</p>
+
+<p class="list">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.</p>
+
+<p class="list">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.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">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;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">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.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>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.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>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.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>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.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+
+
+</body></html> \ No newline at end of file
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/license/notice.html b/org.eclipse.lyo.oslc4j.codegenerator/license/notice.html
new file mode 100644
index 0000000..160febd
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/license/notice.html
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>13 December, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also 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, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/Activator.java b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/Activator.java
new file mode 100644
index 0000000..4e6c9ea
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/Activator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.codegenerator;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends Plugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.lyo.oslc4j.codegenerator";
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl
new file mode 100644
index 0000000..292d778
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorApplication.mtl
@@ -0,0 +1,154 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Michael Fiedler - initial API and implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateAdaptorApplication('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+
+[template public generateAdaptorApplication(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForAdaptorApplication(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Michael Fiedler - initial API and implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaClassPackageNameForAdaptorApplication(anAdaptorInterface) /];
+
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+
+import org.eclipse.lyo.oslc4j.application.OslcWinkApplication;
+import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException;
+import org.eclipse.lyo.oslc4j.core.model.AllowedValues;
+import org.eclipse.lyo.oslc4j.core.model.Compact;
+import org.eclipse.lyo.oslc4j.core.model.CreationFactory;
+import org.eclipse.lyo.oslc4j.core.model.Dialog;
+import org.eclipse.lyo.oslc4j.core.model.Error;
+import org.eclipse.lyo.oslc4j.core.model.ExtendedError;
+import org.eclipse.lyo.oslc4j.core.model.OAuthConfiguration;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.PrefixDefinition;
+import org.eclipse.lyo.oslc4j.core.model.Preview;
+import org.eclipse.lyo.oslc4j.core.model.Property;
+import org.eclipse.lyo.oslc4j.core.model.Publisher;
+import org.eclipse.lyo.oslc4j.core.model.QueryCapability;
+import org.eclipse.lyo.oslc4j.core.model.ResourceShape;
+import org.eclipse.lyo.oslc4j.core.model.Service;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog;
+import org.eclipse.lyo.oslc4j.provider.jena.JenaProvidersRegistry;
+import org.eclipse.lyo.oslc4j.provider.json4j.Json4JProvidersRegistry;
+
+import [javaClassFullNameForService(anAdaptorInterface.serviceProviderCatalog) /];
+[for (aServiceProvider: ServiceProvider | anAdaptorInterface.serviceProviderCatalog.serviceProviders->sortedBy(x: ServiceProvider | javaClassFullNameForService(x)))]
+ import [javaClassFullNameForService(aServiceProvider)/];
+[/for]
+
+[for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name)) separator(lineSeparator())]import [javaClassFullName(aResource) /];[/for]
+import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /];
+[for (aService: Service | anAdaptorInterface.serviceProviderCatalog.serviceProviders.services) separator(lineSeparator())]import [javaClassFullName(aService) /];[/for]
+
+public class [javaClassNameForAdaptorApplication(anAdaptorInterface) /] extends OslcWinkApplication {
+
+ private static final Set<Class<?>> RESOURCE_CLASSES = new HashSet<Class<?>>();
+ private static final Map<String, Class<?>> RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP = new HashMap<String, Class<?>>();
+
+ static
+ {
+ try
+ {
+ RESOURCE_CLASSES.addAll(JenaProvidersRegistry.getProviders());
+ RESOURCE_CLASSES.addAll(Json4JProvidersRegistry.getProviders());
+ [for (aService: Service | anAdaptorInterface.serviceProviderCatalog.serviceProviders.services) separator(lineSeparator())]RESOURCE_CLASSES.add([javaClassName(aService)/].class);[/for]
+ [for (aResource: Resource | relevantResources(anAdaptorInterface)) separator(lineSeparator())]RESOURCE_CLASSES.add([javaClassName(aResource)/].class);[/for]
+ RESOURCE_CLASSES.add(Class.forName("org.eclipse.lyo.server.oauth.webapp.services.ConsumersService"));
+ RESOURCE_CLASSES.add(Class.forName("org.eclipse.lyo.server.oauth.webapp.services.OAuthService"));
+
+ //Catalog resources.
+
+ RESOURCE_CLASSES.add([javaClassNameForService(anAdaptorInterface.serviceProviderCatalog) /].class);
+ [for (aServiceProvider: ServiceProvider | anAdaptorInterface.serviceProviderCatalog.serviceProviders)]
+ RESOURCE_CLASSES.add([javaClassNameForService(aServiceProvider)/].class);
+ [/for]
+
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_ALLOWED_VALUES, AllowedValues.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_COMPACT, Compact.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_CREATION_FACTORY, CreationFactory.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_DIALOG, Dialog.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_ERROR, Error.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_EXTENDED_ERROR, ExtendedError.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_OAUTH_CONFIGURATION, OAuthConfiguration.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_PREFIX_DEFINITION, PrefixDefinition.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_PREVIEW, Preview.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_PROPERTY, Property.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_PUBLISHER, Publisher.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_QUERY_CAPABILITY, QueryCapability.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_RESOURCE_SHAPE, ResourceShape.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_SERVICE, Service.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_SERVICE_PROVIDER, ServiceProvider.class);
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put(OslcConstants.PATH_SERVICE_PROVIDER_CATALOG, ServiceProviderCatalog.class);
+ } catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+ System.err.println("[javaClassNameForAdaptorApplication(anAdaptorInterface) /] failed to initialize");
+ }
+
+ [for (aResource: Resource | relevantResources(anAdaptorInterface))]
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP.put([javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /].[resourcePathConstantName(aResource) /], [javaClassName(aResource)/].class);
+ [/for]
+ }
+
+ public [javaClassNameForAdaptorApplication(anAdaptorInterface) /]()
+ throws OslcCoreApplicationException,
+ URISyntaxException
+ {
+ super(RESOURCE_CLASSES,
+ OslcConstants.PATH_RESOURCE_SHAPES,
+ RESOURCE_SHAPE_PATH_TO_RESOURCE_CLASS_MAP);
+ }
+}
+
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl
new file mode 100644
index 0000000..15950b7
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorConstants.mtl
@@ -0,0 +1,89 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - Bugzilla adpater implementations
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateAdaptorConstants('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[query public generateDomainSpecificationConstants(aDomainSpecification : DomainSpecification) : String =
+'public static String '.concat(domainSpecificationConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('#";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespaceConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespaceURI).concat('#";').concat(lineSeparator()).concat('public static String ').concat(domainSpecificationNamespacePrefixConstantName(aDomainSpecification)).concat(' = "').concat(aDomainSpecification.namespacePrefix.name).concat('";').concat(lineSeparator())
+/]
+
+[query public generateResourceConstants(aResource : Resource) : String =
+'public static String '.concat(resourceConstantName(aResource)).concat(' = "').concat(aResource.name.toLowerFirst()).concat('"').concat(';').concat(lineSeparator()).concat('public static String ').concat(resourcePathConstantName(aResource)).concat(' = "').concat(aResource.name.toLowerFirst()).concat('"').concat(';').concat(lineSeparator()).concat('public static String ').concat(resourceTypeConstantName(aResource)).concat(' = ').concat(domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification())).concat(' + "').concat(aResource.name).concat('";')
+/]
+
+[template public generateAdaptorConstants(anAdaptorInterface : AdaptorInterface)]
+[file (javaInterfaceFullFileNameForAdaptorConstants(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - Bugzilla adpater implementations
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaInterfacePackageNameForAdaptorConstants(anAdaptorInterface) /];
+
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+
+// [protected ('imports')]
+// [/protected]
+
+public interface [javaInterfaceNameForAdaptorConstants(anAdaptorInterface) /]
+{
+ // [protected ('user constants')]
+ // [/protected]
+
+ [for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)->sortedBy(name))]
+ [generateDomainSpecificationConstants(aDomainSpecification) /]
+ [/for]
+
+ [for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name))]
+ [generateResourceConstants(aResource) /]
+ [/for]
+
+ public static final String HDR_OSLC_VERSION = "OSLC-Core-Version";
+
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl
new file mode 100644
index 0000000..4d29b41
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorManager.mtl
@@ -0,0 +1,162 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateAdaptorManager('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateAdaptorManager(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForAdaptorManager(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+package [javaClassPackageNameForAdaptorManager(anAdaptorInterface) /];
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletContextEvent;
+import java.util.List;
+
+import [javaClassFullNameForServiceProviderInfo(anAdaptorInterface) /];
+[for (aResource: Resource | relevantResources(anAdaptorInterface)->sortedBy(name))]
+ import [javaClassFullName(aResource) /];
+[/for]
+
+// [protected ('imports')]
+// [/protected]
+
+
+// [protected ('pre_class_code')]
+// [/protected]
+
+public class [javaClassNameForAdaptorManager(anAdaptorInterface) /] {
+
+ // [protected ('class_attributes')]
+ // [/protected]
+
+ // [protected ('class_methods')]
+ // [/protected]
+
+
+ public static void contextInitializeServletListener(final ServletContextEvent servletContextEvent)
+ {
+ [comment TODO: {PATTERNS} there could be a pattern we can further develop on for file-based vs. database/web base tools.
+ A pattern on how to esablish the connection between the adaptor and the tool.
+ For file-based tools, you would want to establish a single connection between the adaptor and the tool,
+ with which you can handle all calls from all users/sessions. Otherwise, it is a challenge if 2 sessions/connections
+ want to access the same file. Such tools are not made for multiple users at the same time.
+ Such single connection can be created here in contextInitialized.
+ For web/database-based tools, you would want to establish a connection from adaptor to tool for each session/tool.
+ Such tools are used to handle multiple connections from different users at the same time.
+ The model for how to establish such session-based connections can be borrowed from the Lyo CM Workshop.
+ /]
+ // Establish connection to data backbone etc ...
+ // [protected ('contextInitializeServletListener')]
+ // [/protected]
+ }
+
+ public static void contextDestroyServletListener(ServletContextEvent servletContextEvent)
+ {
+ // Shutdown connections to data backbone etc...
+ // [protected ('contextDestroyed')]
+ // [/protected]
+ }
+
+ [comment TODO: {PATTERNS} generate Genric code that allows developer to create/store identifiers persistently in a database.
+ This would allow for the persistent mapping from URIs to specifiic internal data elements.
+ This is for identifiers of the serviceProviders, as well as for individual resources.
+ /]
+
+ [comment TODO: {PATTERNS} generate Genric code that allows developer to cache resources.
+ /]
+
+ public static [javaClassNameForServiceProviderInfo(anAdaptorInterface) /] [ '[' ']' /] getServiceProviderInfos(HttpServletRequest httpServletRequest)
+ {
+ [javaClassNameForServiceProviderInfo(anAdaptorInterface) /] [ '[' ']' /] serviceProviderInfos = {};
+ // [protected ('(MUST_FILL_IN) getServiceProviderInfos userCode')]
+ // [/protected]
+ return serviceProviderInfos;
+ }
+
+ [for (aService: Service | anAdaptorInterface.serviceProviderCatalog.serviceProviders.services)]
+ [comment TODO: I am looping through services. This code will cause problems if 2 services have the same coveredResource
+ since I will be producing the same functions twice.
+ Fix, so that I first work out the set of coveredResources of all services, and then
+ produce the functions for them.
+ The reason I don't loop through all resources, is that I only want to produce functions for the resources
+ that are needed in the services. Resources with no rol in a service should not be produced. /]
+ public static [javaClassName(coveredResource(aService)) /] get[coveredResource(aService).name.toUpperFirst() /](HttpServletRequest httpServletRequest, String [coveredResource(aService).name.toLowerFirst() /]Id, String serviceProviderId)
+ {
+ [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /] = null;
+ // [protected ('(MUST_FILL_IN) getResource userCode')]
+ // [/protected]
+ return a[coveredResource(aService).name.toUpperFirst() /];
+ }
+
+ public static List<[javaClassName(coveredResource(aService)) /]> get[coveredResource(aService).name.toUpperFirst() /]s(HttpServletRequest httpServletRequest, String serviceProviderId, int page, int limit)
+ {
+ List<[javaClassName(coveredResource(aService)) /]> [coveredResource(aService).name.toLowerFirst() /]s = null;
+ // [protected ('(MUST_FILL_IN) getResources userCode')]
+ // [/protected]
+ return [coveredResource(aService).name.toLowerFirst() /]s;
+ }
+
+ public static List<[javaClassName(coveredResource(aService)) /]> search[coveredResource(aService).name.toUpperFirst() /]s(HttpServletRequest httpServletRequest, String serviceProviderId, String terms)
+ {
+ List<[javaClassName(coveredResource(aService)) /]> [coveredResource(aService).name.toLowerFirst() /]s = null;
+ // [protected ('(MUST_FILL_IN) searchResources userCode')]
+ // [/protected]
+ return [coveredResource(aService).name.toLowerFirst() /]s;
+ }
+
+ public static [javaClassName(coveredResource(aService)) /] create[coveredResource(aService).name.toUpperFirst() /](HttpServletRequest httpServletRequest, final [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /], final String serviceProviderId)
+ {
+ [javaClassName(coveredResource(aService)) /] new[coveredResource(aService).name.toUpperFirst() /] = null;
+ // [protected ('(MUST_FILL_IN) createResource userCode')]
+ // [/protected]
+ return new[coveredResource(aService).name.toUpperFirst() /];
+ }
+ [/for]
+
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl
new file mode 100644
index 0000000..e873b27
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorPackageInfo.mtl
@@ -0,0 +1,77 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateAdaptorPackageInfo('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+
+[template public generateAdaptorPackageInfo(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForAdaptorPackageInfo(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+@OslcSchema ({
+ @OslcNamespaceDefinition(prefix = OslcConstants.DCTERMS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.DCTERMS_NAMESPACE),
+ @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_CORE_NAMESPACE),
+ @OslcNamespaceDefinition(prefix = OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, namespaceURI = OslcConstants.OSLC_DATA_NAMESPACE),
+ @OslcNamespaceDefinition(prefix = OslcConstants.RDF_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDF_NAMESPACE),
+ @OslcNamespaceDefinition(prefix = OslcConstants.RDFS_NAMESPACE_PREFIX, namespaceURI = OslcConstants.RDFS_NAMESPACE),
+ [for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)) separator(','.concat(lineSeparator()))]
+ @OslcNamespaceDefinition(prefix = [javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], namespaceURI = [javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /])
+ [/for]
+})
+package [javaClassPackageNameForAdaptorPackageInfo(anAdaptorInterface) /];
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespaceDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcSchema;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+
+import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /];
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl
new file mode 100644
index 0000000..8098ba4
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServiceProviderFactory.mtl
@@ -0,0 +1,135 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - Bugzilla adapter implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateAdaptorServiceProviderFactory('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+
+[template public generateAdaptorServiceProviderFactory(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForServiceProviderFactory(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - Bugzilla adapter implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+package [javaClassPackageNameForServiceProviderFactory(anAdaptorInterface) /];
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+import org.eclipse.lyo.oslc4j.client.ServiceProviderRegistryURIs;
+import org.eclipse.lyo.oslc4j.core.exception.OslcCoreApplicationException;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.PrefixDefinition;
+import org.eclipse.lyo.oslc4j.core.model.Publisher;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProviderFactory;
+
+import [javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface) /];
+[for (aService: Service | anAdaptorInterface.serviceProviderCatalog.serviceProviders.services)]
+import [javaClassFullName(aService) /];
+[/for]
+
+
+// [protected ('imports')]
+// [/protected]
+
+public class [javaClassNameForServiceProviderFactory(anAdaptorInterface) /]
+{
+ private static Class<?>[ '[' ']' /] RESOURCE_CLASSES =
+ {
+ [for (aService: Service | anAdaptorInterface.serviceProviderCatalog.serviceProviders.services) separator(', ')]
+ [javaClassName(aService)/].class
+ [/for]
+ };
+
+ private [javaClassNameForServiceProviderFactory(anAdaptorInterface) /]()
+ {
+ super();
+ }
+
+ /**
+ * Create ža new Bugzilla OSLC change management service provider.
+ * @param baseURI
+ * @param serviceProviderTitle
+ * @param parameterValueMap - a map containing the path replacement value for {serviceProviderId}. See ServiceProviderCatalogSingleton.initServiceProviders()
+ * @return
+ * @throws OslcCoreApplicationException
+ * @throws URISyntaxException
+ */
+ public static ServiceProvider createServiceProvider(final String baseURI, final String title, final String description, final Publisher publisher, final Map<String,Object> parameterValueMap)
+ throws OslcCoreApplicationException, URISyntaxException
+ {
+ final ServiceProvider serviceProvider = ServiceProviderFactory.createServiceProvider(baseURI,
+ ServiceProviderRegistryURIs.getUIURI(),
+ title,
+ description,
+ publisher,
+ RESOURCE_CLASSES,
+ parameterValueMap);
+ URI detailsURIs[ '[' ']' /] = {new URI(baseURI)};
+ serviceProvider.setDetails(detailsURIs);
+
+ final PrefixDefinition[ '[' ']' /] prefixDefinitions =
+ {
+ new PrefixDefinition(OslcConstants.DCTERMS_NAMESPACE_PREFIX, new URI(OslcConstants.DCTERMS_NAMESPACE)),
+ new PrefixDefinition(OslcConstants.OSLC_CORE_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_CORE_NAMESPACE)),
+ new PrefixDefinition(OslcConstants.OSLC_DATA_NAMESPACE_PREFIX, new URI(OslcConstants.OSLC_DATA_NAMESPACE)),
+ new PrefixDefinition(OslcConstants.RDF_NAMESPACE_PREFIX, new URI(OslcConstants.RDF_NAMESPACE)),
+ new PrefixDefinition(OslcConstants.RDFS_NAMESPACE_PREFIX, new URI(OslcConstants.RDFS_NAMESPACE)),
+ [for (aDomainSpecification: DomainSpecification | relevantDomainSpecifications(anAdaptorInterface)) separator(','.concat(lineSeparator()))]
+ new PrefixDefinition([javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespacePrefixConstantName(aDomainSpecification) /], new URI([javaInterfaceNameForAdaptorConstants(anAdaptorInterface)/].[domainSpecificationNamespaceConstantName(aDomainSpecification) /]))
+ [/for]
+ };
+
+ serviceProvider.setPrefixDefinitions(prefixDefinitions);
+
+ return serviceProvider;
+ }
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServletListener.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServletListener.mtl
new file mode 100644
index 0000000..b60b62a
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateAdaptorServletListener.mtl
@@ -0,0 +1,162 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateAdaptorServletListener('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateAdaptorServletListener(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForAdaptorServletListener(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+package [javaClassPackageNameForAdaptorServletListener(anAdaptorInterface) /];
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import [javaClassFullNameForAdaptorManager(anAdaptorInterface) /];
+
+// [protected ('imports')]
+// [/protected]
+
+
+public class [javaClassNameForAdaptorServletListener(anAdaptorInterface) /] implements ServletContextListener {
+
+ private static String servletBase = null;
+ private static String servicesBase = null;
+
+ private static final String SERVICES_PATH = "/services";
+
+ private static final String PROPERTY_SCHEME = [javaClassNameForAdaptorServletListener(anAdaptorInterface) /].class.getPackage().getName() + ".scheme";
+ private static final String PROPERTY_PORT = [javaClassNameForAdaptorServletListener(anAdaptorInterface) /].class.getPackage().getName() + ".port";
+ private static final Logger LOGGER = Logger.getLogger([javaClassNameForAdaptorServletListener(anAdaptorInterface) /].class.getName());
+ private static final String HOST = getHost();
+
+ // [protected ('class_attributes')]
+ // [/protected]
+
+ // [protected ('class_methods')]
+ // [/protected]
+
+ public ServletListener() {
+ super();
+ }
+
+ private static String getHost() {
+ try {
+ return InetAddress.getLocalHost().getCanonicalHostName();
+ } catch (final UnknownHostException exception) {
+ return "localhost";
+ }
+ }
+
+ public static String getServletBase() {
+ return servletBase;
+ }
+
+ public static String getServicesBase() {
+ return servicesBase;
+ }
+
+ private static String generateBasePath(final ServletContextEvent servletContextEvent)
+ {
+ final ServletContext servletContext = servletContextEvent.getServletContext();
+
+ String scheme = System.getProperty(PROPERTY_SCHEME);
+ if (scheme == null)
+ {
+ scheme = servletContext.getInitParameter(PROPERTY_SCHEME);
+ }
+
+ String port = System.getProperty(PROPERTY_PORT);
+ if (port == null)
+ {
+ port = servletContext.getInitParameter(PROPERTY_PORT);
+ }
+
+ System.out.println(scheme + "://" + HOST + ":" + port + servletContext.getContextPath());
+
+ return scheme + "://" + HOST + ":" + port + servletContext.getContextPath();
+ }
+
+ @Override
+ public void contextInitialized(final ServletContextEvent servletContextEvent)
+ {
+ // [protected ('contextInitialized_init')]
+ // [/protected]
+
+ String basePath=generateBasePath(servletContextEvent);
+ servletBase = basePath;
+ servicesBase = basePath + SERVICES_PATH;
+
+ LOGGER.log(Level.INFO, "servletListner contextInitialized.");
+
+ // Establish connection to data backbone etc ...
+ [javaClassNameForAdaptorManager(anAdaptorInterface) /].contextInitializeServletListener(servletContextEvent);
+
+ // [protected ('contextInitialized_final')]
+ // [/protected]
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent servletContextEvent)
+ {
+ // [protected ('contextDestroyed_init')]
+ // [/protected]
+
+ // Shutdown connections to data backbone etc...
+ [javaClassNameForAdaptorManager(anAdaptorInterface) /].contextDestroyServletListener(servletContextEvent);
+
+ // [protected ('contextDestroyed_final')]
+ // [/protected]
+ }
+
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDelegatedUIJavaScripts.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDelegatedUIJavaScripts.mtl
new file mode 100644
index 0000000..0276a5d
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateDelegatedUIJavaScripts.mtl
@@ -0,0 +1,140 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * IBM Corporation - initial API and implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateDelegatedUIJavaScripts('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateDelegatedUIJavaScripts(anAdaptorInterface : AdaptorInterface)]
+[file (delegatedUIJavaScriptsFullFileName(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * IBM Corporation - initial API and implementation
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+function search(baseUrl){
+ var ie = window.navigator.userAgent.indexOf("MSIE");
+ list = document.getElementById("results");
+ list.options.length = 0;
+ var searchMessage = document.getElementById('searchMessage');
+ var loadingMessage = document.getElementById('loadingMessage');
+ xmlhttp = new XMLHttpRequest();
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState==4 && xmlhttp.status==200) {
+ // populate results
+ txt = xmlhttp.responseText;
+ resp = eval('(' + txt + ')');
+ for( var i=0; i<resp.results.length; i=i+1 ) {
+ var item=document.createElement('option');
+ item.text = resp.results['[i]'/].label;
+ item.value = resp.results['[i]'/].resourceUrl;
+ if (ie > 0) {
+ list.add(item);
+ } else {
+ list.add(item, null);
+ }
+ }
+
+ searchMessage.style.display = 'block';
+ loadingMessage.style.display = 'none';
+ }
+ };
+ terms = document.getElementById("searchTerms").value;
+ xmlhttp.open("GET", baseUrl + "?terms=" + encodeURIComponent(terms), true);
+ searchMessage.style.display = 'none';
+ loadingMessage.style.display = 'block';
+ xmlhttp.send();
+}
+
+function select(){
+
+ list = document.getElementById("results");
+ if( list.length>0 && list.selectedIndex >= 0 ) {
+ option = list.options['[list.selectedIndex]'/];
+ sendResponse(option.text, option.value);
+ }
+}
+
+function sendResponse(label, resourceUrl) {
+
+ var oslcResponse = 'oslc-response:{ "oslc:results": ['['/] ' +
+ ' { "oslc:label" : "' + label + '", "rdf:resource" : "' + resourceUrl + '"} ' +
+ ' [']'/] }';
+
+ if (window.location.hash == '#oslc-core-windowName-1.0') {
+ // Window Name protocol in use
+ respondWithWindowName(oslcResponse);
+ } else if (window.location.hash == '#oslc-core-postMessage-1.0') {
+ // Post Message protocol in use
+ respondWithPostMessage(oslcResponse);
+ }
+
+}
+
+function sendCancelResponse() {
+ var oslcResponse = 'oslc-response:{ "oslc:results": ['[ ]'/]}';
+
+ if (window.location.hash == '#oslc-core-windowName-1.0') {
+ // Window Name protocol in use
+ respondWithWindowName(oslcResponse);
+ } else if (window.location.hash == '#oslc-core-postMessage-1.0') {
+ // Post Message protocol in use
+ respondWithPostMessage(oslcResponse);
+ }
+}
+
+
+function respondWithWindowName(/*string*/ response) {
+ var returnURL = window.name;
+ window.name = response;
+ window.location.href = returnURL;
+
+}
+
+function respondWithPostMessage(/*string*/ response) {
+ if( window.parent != null ) {
+ window.parent.postMessage(response, "*");
+ } else {
+ window.postMessage(response, "*");
+ }
+}
+
+function cancel(){
+ sendCancelResponse();
+}
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateFilteredResourceCollectionJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateFilteredResourceCollectionJsp.mtl
new file mode 100644
index 0000000..b1b31bb
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateFilteredResourceCollectionJsp.mtl
@@ -0,0 +1,87 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateFilteredResourceCollectionJsp('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateFilteredResourceCollectionJsp(aResource : Resource)]
+[file (filteredResourceCollectionJspFullFileName(aResource), false, 'UTF-8')]
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+
+<%@ page import="java.net.*" %>
+<%@ page import="java.util.*" %>
+<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
+<%@page import="[javaClassFullName(aResource) /]"%>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+<%@ page contentType="application/json" language="java" pageEncoding="UTF-8" %>
+
+{
+<%
+ ServiceProvider serviceProvider = (ServiceProvider) request.getAttribute("serviceProvider");
+ String selectionUri = (String) request.getAttribute("selectionUri");
+ List<[javaClassName(aResource) /]> resources = (List<[javaClassName(aResource) /]>) request.getAttribute("resources");
+ String terms = (String) request.getAttribute("terms");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+results: ['['/]
+<% int i = 0; for ([javaClassName(aResource) /] r : resources) { %>
+ <% if (i > 0) { %>,<% } %>
+ { "label" : "<%= r.toString() %>",
+ "resourceUrl" : "<%= r.getAbout() %>"
+ }
+<% i++; } %>
+[']'/]
+}
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateGetResourceJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateGetResourceJsp.mtl
new file mode 100644
index 0000000..d65e4d7
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateGetResourceJsp.mtl
@@ -0,0 +1,146 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateGetResourceJsp('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateGetResourceJsp(aResource : Resource)]
+[file (getResourceJspFullFileName(aResource), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
+<%@page import="java.util.List" %>
+<%@page import="[javaClassFullName(aResource) /]"%>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ [javaClassName(aResource) /] a[aResource.name.toUpperFirst() /] = ([javaClassName(aResource) /]) request.getAttribute("a[aResource.name.toUpperFirst() /]");
+ ServiceProvider serviceProvider = (ServiceProvider) request.getAttribute("serviceProvider");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title><%= serviceProvider.getTitle() %></title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </head>
+ <body onload="">
+ <div id="header">
+ <div id="banner"></div>
+ <table border="0" cellspacing="0" cellpadding="0" id="titles">
+ <tr>
+ <td id="title">
+ <p>
+ <%= serviceProvider.getTitle() %>
+ </p>
+ </td>
+ <td id="information">
+ <p class="header_addl_info">
+ version 0.1
+ </p>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="bugzilla-body">
+ <div id="page-index">
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff1')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+
+ <h1>Resource Presentation</h1>
+ <p>Summary: <%= a[aResource.name.toUpperFirst() /].toHtml() %><br /></p>
+ <h2>Properties</h2>
+ <table style="clear: both;">
+ [for (aProperty: ResourceProperty | allProperties(aResource))]
+ <tr>
+ <td><%= a[aResource.name.toUpperFirst() /].[javaAttributeName(aProperty, aResource) /]ToHtml()%></td>
+ </tr>
+ [/for]
+ </table>
+
+ </div>
+ </div>
+
+ <div id="footer">
+ <div class="intro"></div>
+ <div class="outro">
+ <div style="margin: 0 1em 1em 1em; line-height: 1.6em; text-align: left">
+ <b>OSLC Tools Adapter Server 0.1</b> brought to you by <a href="http://eclipse.org/lyo">Eclipse Lyo</a><br />
+ </div>
+ </div>
+ </div>
+
+
+
+ </body>
+</html>
+
+
+
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl
new file mode 100644
index 0000000..9323c86
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResource.mtl
@@ -0,0 +1,346 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateResource('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateResource(aResource : Resource)]
+[file (javaClassFullFileName(aResource), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Sam Padgett - initial API and implementation
+ * Michael Fiedler - adapted for OSLC4J
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+package [javaClassPackageName(aResource) /];
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Iterator;
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcName;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRange;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType;
+import org.eclipse.lyo.oslc4j.core.model.AbstractResource;
+import org.eclipse.lyo.oslc4j.core.model.Link;
+import org.eclipse.lyo.oslc4j.core.model.Occurs;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.Representation;
+import org.eclipse.lyo.oslc4j.core.model.ValueType;
+
+import [javaClassFullNameForAdaptorServletListener(aResource.eContainer(AdaptorInterface)) /];
+import [javaInterfaceFullNameForAdaptorConstants(aResource.eContainer(AdaptorInterface)) /];
+[for (aProperty: ResourceProperty | allProperties(aResource))]
+[if(Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString())) ]
+[if (not aProperty.range.oclIsUndefined())]
+import [javaClassFullName(aProperty.range) /];
+[/if]
+[/if]
+[/for]
+
+// [protected ('imports')]
+// [/protected]
+
+@OslcNamespace([javaInterfaceNameForAdaptorConstants(aResource.eContainer(AdaptorInterface)) /].[domainSpecificationNamespaceConstantName(aResource.definingDomainSpecification()) /])
+@OslcName([javaInterfaceNameForAdaptorConstants(aResource.eContainer(AdaptorInterface)) /].[resourceConstantName(aResource) /])
+@OslcResourceShape(title = "[aResource.name /] Resource Shape", describes = [javaInterfaceNameForAdaptorConstants(aResource.eContainer(AdaptorInterface)) /].[resourceTypeConstantName(aResource) /])
+public class [javaClassName(aResource) /]
+ extends [parentJavaClassName(aResource) /]
+{
+
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+private [javaAttributeTypeDeclaration(aProperty) /] [javaAttributeName(aProperty, aResource)/][if javaAttributeTypeNeedsConstruction(aProperty)] = new [javaAttributeTypeDeclaration(aProperty)/]()[/if];
+[/for]
+
+public [javaClassName(aResource) /]()
+ throws URISyntaxException
+{
+ super();
+
+ // [protected ('constructor1')]
+ // [/protected]
+}
+
+public [javaClassName(aResource) /](final URI about)
+ throws URISyntaxException
+{
+ super(about);
+
+ // [protected ('constructor2')]
+ // [/protected]
+}
+
+public static URI constructURI(String serviceProviderId, String [aResource.name.toLowerFirst() /]Id) throws URISyntaxException, UnsupportedEncodingException
+{
+ [comment TODO: The URI below should be constructed using the same methods that construct the "@Path" of the services.
+ These are currently hard coded as well. Change that, so that both use the same source. THis way, if there is a coder-define
+ customisation of the method, the rest of the code will work fine./]
+ return new URI([javaClassNameForAdaptorServletListener(aResource.eContainer(AdaptorInterface))/].getServicesBase() + "/" + serviceProviderId + "/[aResource.name.toLowerFirst() /]s/"+ [aResource.name.toLowerFirst() /]Id);
+}
+
+public String toString()
+{
+ String result = "";
+ // [protected ('toString_init')]
+ // [/protected]
+
+ result = getAbout().toString();
+
+ // [protected ('toString_finalize')]
+ // [/protected]
+
+ return result;
+}
+
+public String toHtml()
+{
+ String result = "";
+ // [protected ('toHtml_init')]
+ // [/protected]
+
+ result = "<a href=\"" + getAbout() + "\">" + toString() + "</a>";
+
+ // [protected ('toHtml_finalize')]
+ // [/protected]
+
+ return result;
+}
+
+
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+ [if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))]
+ public void add[aProperty.name.toUpperFirst() /](final [javaAttributeBaseType(aProperty) /] [aProperty.name /] )
+ {
+ this.[javaAttributeName(aProperty, aResource) /].add([aProperty.name /]);
+ }
+ [/if]
+[/for]
+
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+ [nameAnnotation(aProperty) /]
+ [propertyDefinitionAnnotation(aProperty, aResource) /]
+ [descriptionAnnotation(aProperty) /]
+ [occursAnnotation(aProperty) /]
+ [valueTypeAnnotation(aProperty) /]
+ [representationAnnotation(aProperty) /]
+ [rangeAnnotation(aProperty, aResource) /]
+ [readOnlyAnnotation(aProperty) /]
+ [titleAnnotation(aProperty) /]
+ public [javaAttributeTypeDeclaration(aProperty) /] [if (aProperty.valueType.toString() = 'Boolean')]is[else]get[/if][javaAttributeName(aProperty, aResource).toUpperFirst() /]()
+ {
+ return [javaAttributeName(aProperty, aResource) /];
+ }
+
+[/for]
+
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+ public void set[javaAttributeName(aProperty, aResource).toUpperFirst() /](final [javaAttributeTypeDeclaration(aProperty) /] [aProperty.name /] )
+ {
+ [if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))]
+ this.[javaAttributeName(aProperty, aResource) /].clear();
+ if ([aProperty.name /] != null)
+ {
+ this.[javaAttributeName(aProperty, aResource) /].addAll([aProperty.name /]);
+ }
+
+ [else]
+ this.[javaAttributeName(aProperty, aResource) /] = [aProperty.name /];
+ [/if]
+ }
+[/for]
+
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+ static public String [javaAttributeName(aProperty, aResource) /]ToHtmlForCreation (final HttpServletRequest httpServletRequest, final String serviceProviderId)
+ {
+ String s = "";
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('asHtmlForCreation_init'))]
+ // [/protected]
+
+ s = s + "<label for=\"[aProperty.name/]\">[aProperty.name/]: </LABEL>";
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('asHtmlForCreation_mid'))]
+ // [/protected]
+
+ [let valueType : String = aProperty.valueType.toString()]
+ [if (Sequence{'String', 'XMLLiteral', 'DateTime', 'URI'}->includes(valueType))]
+ s= s + [resourcePropertyAsTextInputForCreation(aProperty) /];
+ [elseif(valueType = 'Boolean')]
+ s= s + "<input name=\"[aProperty.name/]\" type=\"radio\" value=\"true\">True<br><input name=\"[aProperty.name/]\" type=\"radio\" value=\"false\">False";
+ [elseif(Sequence{'Resource', 'LocalResource'}->includes(valueType))]
+ [comment TODO: How to deal with properties that are resources? Should then also be created, or should hte user get a list of existing such resources to choose from.
+ Latter sounds most reasonable. For now just ignore such properties./]
+ [/if]
+ [/let]
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('asHtmlForCreation_finalize'))]
+ // [/protected]
+
+ return s;
+ }
+[/for]
+
+[comment TODO: This ToHTML is quite complicated. At the moment, I get expections because some of the properties are null.
+I am getting to many if/else-ses. I think I need to rethink calmely to have a cleaner structure. Good enough for now I hope. /]
+[for (aProperty: ResourceProperty | aResource.resourceProperties)]
+ public String [javaAttributeName(aProperty, aResource) /]ToHtml()
+ {
+ String s = "";
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('toHtml_init'))]
+ // [/protected]
+
+ s = s + "<label for=\"[aProperty.name/]\"><strong>[aProperty.name/]</strong>: </LABEL>";
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('toHtml_mid'))]
+ // [/protected]
+
+ try {
+ [comment For these basic valueTypes, one can simply call toString on the attribte /]
+ [if (Sequence{'Boolean', 'String', 'XMLLiteral', 'DateTime', 'URI'}->includes(aProperty.valueType.toString()))]
+ [if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))]
+ s = s + "<ul>";
+ Iterator<[javaAttributeBaseType(aProperty) /]> itr = [javaAttributeName(aProperty, aResource) /].iterator();
+ while(itr.hasNext()) {
+ s = s + "<li>";
+ s= s + itr.next().toString();
+ s = s + "</li>";
+ }
+ s = s + "</ul>";
+ [else]
+ if ([javaAttributeName(aProperty, aResource)/] == null) {
+ s= s + "<em>null</em>";
+ }
+ else {
+ s= s + [javaAttributeName(aProperty, aResource)/].toString();
+ }
+ [/if]
+ [comment a property with valueType of resource or LocalResource can return either a Class directly referring to a Resource, or Link.
+ If we get a Link, we want to check if we can also work out which kind of resource class this Link refers to. If we can find out,
+ we want to call toHtml on that class. if we cannot, we simply print the Link as a string. /]
+ [elseif(Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString()))]
+ [if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))]
+ s = s + "<ul>";
+ Iterator<[javaAttributeBaseType(aProperty) /]> itr = [javaAttributeName(aProperty, aResource) /].iterator();
+ while(itr.hasNext()) {
+ s = s + "<li>";
+ [if (javaAttributeBaseType(aProperty) = 'Link')]
+ [if (not aProperty.range.oclIsUndefined())]
+ [comment Even if it is a Link, there are cases where I actually know that the link should point to a particular resource class.
+ (For example, for valueType = Resource, we get a Link irrespective of whether the valueType is set to a specific resource or not. ) /]
+ s = s + (new [javaClassName(aProperty.range) /] (itr.next().getValue())).toHtml();
+ [else]
+ [comment just print the Link's URI as a String /]
+ s = s + itr.next().getValue().toString();
+ [/if]
+ [else]
+ [comment itr refers to direct Resource class, and hence can simply call toHtml() on /]
+ s = s + itr.next().toHtml();
+ [/if]
+ s = s + "</li>";
+ }
+ s = s + "</ul>";
+ [else]
+ [if (javaAttributeBaseType(aProperty) = 'Link')]
+ [if (not aProperty.range.oclIsUndefined())]
+ [comment Even if it is a Link, there are cases where I actually know that the link should point to a particular resource class.
+ (For example, for valueType = Resource, we get a Link irrespective of whether the valueType is set to a specific resource or not. ) /]
+ s = s + (new [javaClassName(aProperty.range) /] ([javaAttributeName(aProperty, aResource)/].getValue())).toHtml();
+ [else]
+ [comment just print the Link's URI as a String /]
+ s = s + [javaAttributeName(aProperty, aResource)/].getValue().toString();
+ [/if]
+
+ [else]
+ [comment the attribute refers to direct Resource class, and hence can simply call toHtml() on /]
+ s = s + [javaAttributeName(aProperty, aResource)/].toHtml();
+ [/if]
+
+ [/if]
+ [/if]
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ // [protected (javaAttributeName(aProperty, aResource).concat('toHtml_finalize'))]
+ // [/protected]
+
+ return s;
+ }
+[/for]
+
+}
+
+[/file]
+[/template]
+
+
+[template public resourcePropertyAsTextInputForCreation(aProperty: ResourceProperty)]
+"<input name=\"[aProperty.name/]\" type=\"text\" style=\"width: 400px\" id=\"[aProperty.name/]\" [if (Sequence{'excatlyOne', 'oneOrMany'}->includes(aProperty.occurs.toString()))]required[/if]>"
+[/template]
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCollectionJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCollectionJsp.mtl
new file mode 100644
index 0000000..3eff998
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCollectionJsp.mtl
@@ -0,0 +1,137 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateResourceCollectionJsp('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateResourceCollectionJsp(aResource : Resource)]
+[file (resourceCollectionJspFullFileName(aResource), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
+<%@page import="java.util.List" %>
+<%@page import="[javaClassFullName(aResource) /]"%>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ List<[javaClassName(aResource) /]> resources = (List<[javaClassName(aResource) /]>) request.getAttribute("resources");
+ ServiceProvider serviceProvider = (ServiceProvider) request.getAttribute("serviceProvider");
+ String queryUri = (String)request.getAttribute("queryUri");
+ String nextPageUri = (String)request.getAttribute("nextPageUri");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title><%= serviceProvider.getTitle() %></title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </head>
+ <body onload="">
+ <div id="header">
+ <div id="banner"></div>
+ <table border="0" cellspacing="0" cellpadding="0" id="titles">
+ <tr>
+ <td id="title">
+ <p>
+ <%= serviceProvider.getTitle() %>
+ </p>
+ </td>
+ <td id="information">
+ <p class="header_addl_info">
+ version 0.1
+ </p>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="bugzilla-body">
+ <div id="page-index">
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff1')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+
+ <h1>Query Results</h1>
+
+ <% for ([aResource.name.toUpperFirst() /] a[aResource.name.toUpperFirst() /] : resources) { %>
+ <p>Summary: <%= a[aResource.name.toUpperFirst() /].toHtml() %><br /></p>
+ <% } %>
+ <% if (nextPageUri != null) { %><a href="<%= nextPageUri %>">Next Page</a><% } %>
+
+ </div>
+ </div>
+
+ <div id="footer">
+ <div class="intro"></div>
+ <div class="outro">
+ <div style="margin: 0 1em 1em 1em; line-height: 1.6em; text-align: left">
+ <b>OSLC Tools Adapter Server 0.1</b> brought to you by <a href="http://eclipse.org/lyo">Eclipse Lyo</a><br />
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl
new file mode 100644
index 0000000..fc4fcf9
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceCreatorJsp.mtl
@@ -0,0 +1,130 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateResourceCreatorJsp('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateResourceCreatorJsp(aResource : Resource)]
+[file (resourceCreatorJspFullFileName(aResource), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
+<%@page import="java.util.List" %>
+<%@page import="[javaClassFullName(aResource) /]"%>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ ServiceProvider serviceProvider = (ServiceProvider) request.getAttribute("serviceProvider");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>Resource Creator</title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </head>
+ <body style="padding: 10px;">
+ <div id="bugzilla-body">
+ <form id="Create" method="POST" class="enter_bug_form">
+ <%--
+ [protected ('(RECOMMENDED) formStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ <table style="clear: both;">
+
+ [comment TODO: This whole way of producing the form should be rethought. Which approach gives the programmer
+ best possibility to modify the generated stuff. (hiding fields, changing the format, removing fields, etc.)/]
+ [for (aProperty: ResourceProperty | allProperties(aResource))]
+ <tr>
+ <td><%= [javaClassName(aResource)/].[javaAttributeName(aProperty, aResource) /]ToHtmlForCreation(request, serviceProvider.getIdentifier())%></td>
+ </tr>
+ [/for]
+
+
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="Submit">
+ <input type="reset">
+ </td>
+ </tr>
+ </table>
+
+
+ <div style="width: 500px;">
+
+ </div>
+
+ </form>
+
+ <div style="clear: both;"></div>
+ </div>
+ </body>
+</html>
+
+
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceSelectorJsp.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceSelectorJsp.mtl
new file mode 100644
index 0000000..3a2ced7
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateResourceSelectorJsp.mtl
@@ -0,0 +1,117 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateResourceSelectorJsp('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateResourceSelectorJsp(aResource : Resource)]
+[file (resourceSelectorJspFullFileName(aResource), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider"%>
+<%@page import="[javaClassFullName(aResource) /]"%>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ ServiceProvider serviceProvider = (ServiceProvider) request.getAttribute("serviceProvider");
+ String selectionUri = (String) request.getAttribute("selectionUri");
+
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>[aResource.name /] Resource Selector</title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ [comment TODO: I need to work out how to properly set hte javascript path. This is hard-coded :-)/]
+ <script type="text/javascript" src="../../../[delegatedUIJavaScriptsRelativeFileName(aResource.eContainer(AdaptorInterface)) /]"></script>
+ </head>
+ [comment TODO: make a more powerfull/flexible search form, by allowing user to entry values on each resource property, and not just "summary" as is expected here./]
+ <body style="padding: 10px;">
+ <div id="selector-body">
+ <p id="searchMessage">Find a specific resource through a free-text search.</p>
+
+ <p id="loadingMessage" style="display: none;">Pondering your search. Please stand by ...</p>
+
+ <div>
+ <input type="search" style="width: 335px" id="searchTerms" placeholder="Enter search terms" autofocus>
+ <button type="button" onclick="search( '<%= selectionUri %>' )">Search</button>
+ </div>
+
+ <div style="margin-top: 5px;">
+ <select id="results" size="10" style="width: 400px"></select>
+ </div>
+
+ <div style="width: 400px; margin-top: 5px;">
+ <button style="float: right;" type="button"
+ onclick="javascript: cancel()">Cancel</button>
+ <button style="float: right;" type="button"
+ onclick="javascript: select();">OK</button>
+ </div>
+ <div style="clear: both;"></div>
+ </div>
+
+ </body>
+</html>
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateService.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateService.mtl
new file mode 100644
index 0000000..9609c27
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateService.mtl
@@ -0,0 +1,545 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Michael Fiedler - initial API and implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateService('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateResourceCollectionJsp/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateFilteredResourceCollectionJsp/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateGetResourceJsp/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateResourceCreatorJsp/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateResourceSelectorJsp/]
+
+[template public generateService(aService : Service)]
+[file (javaClassFullFileName(aService), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Michael Fiedler - initial API and implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaClassPackageName(aService) /];
+
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.text.SimpleDateFormat;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.FormParam;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcCreationFactory;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDialog;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDialogs;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcQueryCapability;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcService;
+import org.eclipse.lyo.oslc4j.core.model.Compact;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+import org.eclipse.lyo.oslc4j.core.model.Preview;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
+import org.eclipse.lyo.oslc4j.core.model.Link;
+
+import [javaClassFullNameForAdaptorManager(containingAdaptorInterface(aService)) /];
+import [javaInterfaceFullNameForAdaptorConstants(containingAdaptorInterface(aService)) /];
+import [javaClassFullNameForSingleton(containingServiceProviderCatalog(aService)) /];
+import [javaClassFullName(coveredResource(aService)) /];
+
+[for (aProperty: ResourceProperty | allProperties(coveredResource(aService)))]
+[if(Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString())) ]
+[if (not aProperty.range.oclIsUndefined())]
+import [javaClassFullName(aProperty.range) /];
+[/if]
+[/if]
+[/for]
+
+
+// [protected ('imports')]
+// [/protected]
+
+
+@OslcService([javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[domainSpecificationConstantName(aService.domainSpecification) /])
+@Path("{serviceProviderId}/[coveredResource(aService).name.toLowerFirst() /]s")
+public class [javaClassName(aService) /]
+
+{
+
+ @Context private HttpServletRequest httpServletRequest;
+ @Context private HttpServletResponse httpServletResponse;
+ @Context private UriInfo uriInfo;
+
+ public [javaClassName(aService) /]()
+ {
+ super();
+ }
+
+ /**
+ * RDF/XML, XML and JSON representation of a change request collection
+ *
+ * TODO: add query support
+ *
+ * @param productId
+ * @param where
+ * @param pageString
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+
+ @OslcDialogs(
+ {
+ [for (aSelectionDialog: Dialog | aService.selectionDialogs)]
+ @OslcDialog
+ (
+ title = "[aSelectionDialog.title /]",
+ label = "[aSelectionDialog.label /]",
+ [comment TODO: the URI should not be asked from the model. We should automatically deduce it here./]
+ uri = "[aSelectionDialog.dialogURI /]",
+ hintWidth = "[aSelectionDialog.hintWidth /]px",
+ hintHeight = "[aSelectionDialog.hintHeight /]px",
+ resourceTypes = {[for (aResource: Resource | aSelectionDialog.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourceTypeConstantName(aResource) /][/for]},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ [/for]
+ })
+
+ [for (aQueryCapability: QueryCapability | aService.queryCapabilities)]
+ @OslcQueryCapability
+ (
+ title = "[aQueryCapability.title /]",
+ label = "[aQueryCapability.label /]",
+ resourceShape = OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourcePathConstantName(coveredResource(aService)) /],
+ resourceTypes = {[for (aResource: Resource | aQueryCapability.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourceTypeConstantName(aResource) /][/for]},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ [/for]
+
+ @GET
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public [javaClassName(coveredResource(aService)) /] [ '[]' /] get[coveredResource(aService).name.toUpperFirst() /]s(@PathParam("serviceProviderId") final String serviceProviderId,
+ @QueryParam("oslc.where") final String where,
+ @QueryParam("page") final String pageString) throws IOException, ServletException
+ {
+ int page=0;
+ int limit=999;
+
+ // [protected ('(MUST_FILL_IN) getResourceCollection_init')]
+ // [/protected]
+
+ final List<[javaClassName(coveredResource(aService)) /]> resources = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].get[coveredResource(aService).name.toUpperFirst() /]s(httpServletRequest, serviceProviderId, page, limit);
+ return resources.toArray(new [javaClassName(coveredResource(aService)) /] [ '[' /]resources.size()[ ']' /]);
+
+
+ }
+
+ /**
+ * HTML representation of change request collection
+ *
+ * Forwards to changerequest_collection_html.jsp to build the html page
+ *
+ * @param productId
+ * @param changeRequestId
+ * @param pageString
+ * @return
+ * @throws ServletException
+ * @throws IOException
+ */
+
+
+
+ @GET
+ @Produces({ MediaType.TEXT_HTML })
+ public Response get[coveredResource(aService).name.toUpperFirst() /]sAsHtml(@PathParam("serviceProviderId") final String serviceProviderId,
+ @PathParam("[coveredResource(aService).name.toLowerFirst() /]Id") final String [coveredResource(aService).name.toLowerFirst() /]Id,
+ @QueryParam("page") final String pageString) throws ServletException, IOException
+ {
+ int page=0;
+ int limit=20;
+
+ if (null != pageString) {
+ page = Integer.parseInt(pageString);
+ }
+
+ // [protected ('(MUST_FILL_IN) getResourceCollectionAsHTML_init')]
+ // [/protected]
+
+ final List<[javaClassName(coveredResource(aService)) /]> resources = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].get[coveredResource(aService).name.toUpperFirst() /]s(httpServletRequest, serviceProviderId, page, limit);
+
+ if (resources!= null) {
+ httpServletRequest.setAttribute("resources", resources);
+ // [protected ('(RECOMMENDED) getResourceCollectionAsHTML_setAttributes')]
+ // [/protected]
+
+ httpServletRequest.setAttribute("queryUri",
+ uriInfo.getAbsolutePath().toString() + "?oslc.paging=true");
+ if (resources.size() > limit) {
+ resources.remove(resources.size() - 1);
+ httpServletRequest.setAttribute("nextPageUri",
+ uriInfo.getAbsolutePath().toString() + "?oslc.paging=true&amp;page=" + (page + 1));
+ }
+
+ ServiceProvider serviceProvider = [javaClassNameForSingleton(containingServiceProviderCatalog(aService)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ httpServletRequest.setAttribute("serviceProvider", serviceProvider);
+
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[resourceCollectionJspRelativeFileName(coveredResource(aService)) /]");
+ [coveredResource(aService).generateResourceCollectionJsp() /]
+ rd.forward(httpServletRequest,httpServletResponse);
+ }
+
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+
+
+
+ /**
+ * RDF/XML, XML and JSON representation of a single change request
+ *
+ * @param productId
+ * @param changeRequestId
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ * @throws URISyntaxException
+ */
+
+
+
+ @GET
+ @Path("{[coveredResource(aService).name.toLowerFirst() /]Id}")
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public [javaClassName(coveredResource(aService)) /] get[coveredResource(aService).name.toUpperFirst() /](@PathParam("serviceProviderId") final String serviceProviderId,
+ @PathParam("[coveredResource(aService).name.toLowerFirst() /]Id") final String [coveredResource(aService).name.toLowerFirst() /]Id) throws IOException, ServletException, URISyntaxException
+ {
+
+ // [protected ('(MUST_FILL_IN) getResource_init')]
+ // [/protected]
+
+ final [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /] = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].get[coveredResource(aService).name.toUpperFirst() /](httpServletRequest, [coveredResource(aService).name.toLowerFirst() /]Id, serviceProviderId);
+
+ if (a[coveredResource(aService).name.toUpperFirst() /] != null) {
+ // [protected ('(RECOMMENDED) getResource_body')]
+ // [/protected]
+
+ return a[coveredResource(aService).name.toUpperFirst() /];
+ }
+
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+
+
+
+
+ /**
+ *
+ * HTML representation for a single change request - redirect the request directly to Bugzilla
+ *
+ * @param productId
+ * @param changeRequestId
+ * @throws ServletException
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+
+
+
+ @GET
+ @Path("{[coveredResource(aService).name.toLowerFirst() /]Id}")
+ @Produces({ MediaType.TEXT_HTML })
+ public Response get[coveredResource(aService).name.toUpperFirst() /]AsHtml(@PathParam("serviceProviderId") final String serviceProviderId,
+ @PathParam("[coveredResource(aService).name.toLowerFirst() /]Id") final String [coveredResource(aService).name.toLowerFirst() /]Id) throws ServletException, IOException, URISyntaxException
+ {
+ // [protected ('(MUST_FILL_IN) getResourceAsHTML_init')]
+ // [/protected]
+
+ final [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /] = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].get[coveredResource(aService).name.toUpperFirst() /](httpServletRequest, [coveredResource(aService).name.toLowerFirst() /]Id, serviceProviderId);
+
+ if (a[coveredResource(aService).name.toUpperFirst() /] != null) {
+ httpServletRequest.setAttribute("a[coveredResource(aService).name.toUpperFirst() /]", a[coveredResource(aService).name.toUpperFirst() /]);
+ // [protected ('getResourceAsHTML_setAttributes')]
+ // [/protected]
+
+ ServiceProvider serviceProvider = [javaClassNameForSingleton(containingServiceProviderCatalog(aService)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ httpServletRequest.setAttribute("serviceProvider", serviceProvider);
+
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[getResourceJspRelativeFileName(coveredResource(aService)) /]");
+ [coveredResource(aService).generateGetResourceJsp() /]
+ rd.forward(httpServletRequest,httpServletResponse);
+
+
+ }
+
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+
+
+ /**
+ * OSLC delegated selection dialog for change requests
+ *
+ * If called without a "terms" parameter, forwards to changerequest_selector.jsp to
+ * build the html for the IFrame
+ *
+ * If called with a "terms" parameter, sends a Bug search to Bugzilla and then
+ * forwards to changerequest_filtered_json.jsp to build a JSON response
+ *
+ *
+ * @param terms
+ * @param productId
+ * @throws ServletException
+ * @throws IOException
+ */
+
+ @GET
+ @Path("selector")
+ @Consumes({ MediaType.TEXT_HTML, MediaType.WILDCARD })
+ public void [coveredResource(aService).name.toLowerFirst() /]Selector(@QueryParam("terms") final String terms,
+ @PathParam("serviceProviderId") final String serviceProviderId) throws ServletException, IOException
+ {
+ try {
+ // [protected ('(MUST_FILL_IN) resourceSelector_init')]
+ // [/protected]
+
+ ServiceProvider serviceProvider = [javaClassNameForSingleton(containingServiceProviderCatalog(aService)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ httpServletRequest.setAttribute("serviceProvider", serviceProvider);
+ httpServletRequest.setAttribute("selectionUri",uriInfo.getAbsolutePath().toString());
+ // [protected ('(RECOMMENDED) resourceSelector_setAttributes')]
+ // [/protected]
+
+ if (terms != null ) {
+ httpServletRequest.setAttribute("terms", terms);
+ final List<[javaClassName(coveredResource(aService)) /]> resources = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].search[coveredResource(aService).name.toUpperFirst() /]s(httpServletRequest, serviceProviderId, terms);
+ if (resources!= null) {
+ httpServletRequest.setAttribute("resources", resources);
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[filteredResourceCollectionJspRelativeFileName(coveredResource(aService)) /]");
+ [coveredResource(aService).generateFilteredResourceCollectionJsp() /]
+ rd.forward(httpServletRequest, httpServletResponse);
+ }
+ //a empty search should return an empty list and not NULL!
+ throw new WebApplicationException(Status.NOT_FOUND);
+
+ } else {
+ try {
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[resourceSelectorJspRelativeFileName(coveredResource(aService)) /]");
+ [coveredResource(aService).generateResourceSelectorJsp() /]
+ rd.forward(httpServletRequest, httpServletResponse);
+
+ } catch (Exception e) {
+ throw new ServletException(e);
+ }
+ }
+ } catch (Exception e) {
+ throw new WebApplicationException(e);
+ }
+
+ }
+
+
+ /**
+ * OSLC delegated creation dialog for a single change request
+ *
+ * Forwards to changerequest_creator.jsp to build the html form
+ *
+ * @param productId
+ * @throws IOException
+ * @throws ServletException
+ */
+
+ @GET
+ @Path("creator")
+ @Consumes({MediaType.WILDCARD})
+ public void [coveredResource(aService).name.toLowerFirst() /]CreatorAsHtml(@PathParam("serviceProviderId") final String serviceProviderId) throws IOException, ServletException
+ {
+ // [protected ('(MUST_FILL_IN) resourceCreatorAsHTML_init')]
+ // [/protected]
+
+ ServiceProvider serviceProvider = [javaClassNameForSingleton(containingServiceProviderCatalog(aService)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ httpServletRequest.setAttribute("serviceProvider", serviceProvider);
+
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[resourceCreatorJspRelativeFileName(coveredResource(aService)) /]");
+ [coveredResource(aService).generateResourceCreatorJsp() /]
+ rd.forward(httpServletRequest, httpServletResponse);
+ }
+
+
+ /**
+ * Backend creator for the OSLC delegated creation dialog.
+ *
+ * Accepts the input in FormParams and returns a small JSON response
+ *
+ * @param productId
+ * @param component
+ * @param version
+ * @param summary
+ * @param op_sys
+ * @param platform
+ * @param description
+ */
+ @POST
+ @Path("creator")
+ @Consumes({ MediaType.APPLICATION_FORM_URLENCODED})
+ public void create[coveredResource(aService).name.toUpperFirst() /](@PathParam("serviceProviderId") final String serviceProviderId)
+ {
+ try {
+ [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /] = new [javaClassName(coveredResource(aService)) /]();
+
+ String['[]'/] paramValues;
+
+ [comment TODO: Check for valid parameters (1) that the oneOrMore, or oneOrMany are set. (2) things have right format. (3) Allow end_user to also add own checks
+ In the Resource class, automtiacally generate a "propertyValidValue" (similar to propertyAsHtmlForCreation) for each of the properties.
+ There you can add all automatic checks, as well as allow for end-user ones./]
+ [for (aProperty: ResourceProperty | allProperties(coveredResource(aService)))]
+ paramValues = httpServletRequest.getParameterValues("[aProperty.name /]");
+ if (paramValues != null) {
+ [if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))]
+ for(int i=0; i<paramValues.length; i++) {
+ a[coveredResource(aService).name.toUpperFirst() /].add[aProperty.name.toUpperFirst() /]([javaAttributeBaseTypeCastFromString(aProperty, 'paramValues[i]') /]);
+ }
+ [else]
+ if (paramValues.length == 1) {
+ if (paramValues['[0]'/].length() != 0)
+ a[coveredResource(aService).name.toUpperFirst() /].set[javaAttributeName(aProperty, coveredResource(aService)).toUpperFirst() /]([javaAttributeBaseTypeCastFromString(aProperty, 'paramValues[0]') /]);
+ // else, there is an empty value for that parameter, and hence ignore since the parameter is not actually set.
+ }
+
+ [/if]
+ }
+ [/for]
+
+
+ final [javaClassName(coveredResource(aService)) /] new[coveredResource(aService).name.toUpperFirst() /] = [javaClassNameForAdaptorManager(containingAdaptorInterface(aService)) /].create[coveredResource(aService).name.toUpperFirst() /](httpServletRequest, a[coveredResource(aService).name.toUpperFirst() /], serviceProviderId);
+
+ httpServletRequest.setAttribute("newResource", new[coveredResource(aService).name.toUpperFirst() /]);
+ httpServletRequest.setAttribute("newResourceUri", new[coveredResource(aService).name.toUpperFirst() /].getAbout().toString());
+
+ // Send back to the form a small JSON response
+ httpServletResponse.setContentType("application/json");
+ httpServletResponse.setStatus(Status.CREATED.getStatusCode());
+ httpServletResponse.addHeader("Location", new[coveredResource(aService).name.toUpperFirst() /].getAbout().toString());
+ PrintWriter out = httpServletResponse.getWriter();
+ [comment TODO: What should be outputed as a result? Is this even necessary? /]
+ out.print("{" + "\"resource\" : \"" + new[coveredResource(aService).name.toUpperFirst() /].getAbout().toString() + "\"}");
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WebApplicationException(e);
+ }
+
+ }
+
+ /**
+ * Create a single BugzillaChangeRequest via RDF/XML, XML or JSON POST
+ * @param productId
+ * @param changeRequest
+ * @return
+ * @throws IOException
+ * @throws ServletException
+ */
+
+ [for (aCreationDialog: Dialog | aService.creationDialogs)]
+ @OslcDialog
+ (
+ title = "[aCreationDialog.title /]",
+ label = "[aCreationDialog.label /]",
+ [comment TODO: the URI should not be asked from the model. We should automatically deduce it here./]
+ uri = "[aCreationDialog.dialogURI /]",
+ hintWidth = "[aCreationDialog.hintWidth /]px",
+ hintHeight = "[aCreationDialog.hintHeight /]px",
+ resourceTypes = {[for (aResource: Resource | aCreationDialog.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourceTypeConstantName(aResource) /][/for]},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ [/for]
+
+ [for (aCreationFactory: CreationFactory | aService.creationFactories)]
+ @OslcCreationFactory
+ (
+ title = "[aCreationFactory.title /]",
+ label = "[aCreationFactory.label /]",
+ resourceShapes = {OslcConstants.PATH_RESOURCE_SHAPES + "/" + [javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourcePathConstantName(coveredResource(aService)) /]},
+ resourceTypes = {[for (aResource: Resource | aCreationFactory.resourceTypes) separator(', ') ][javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aService)) /].[resourceTypeConstantName(aResource) /][/for]},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ [/for]
+
+ @POST
+ @Consumes({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public Response addChangeRequest(@PathParam("productId") final String productId,
+ final [javaClassName(coveredResource(aService)) /] a[coveredResource(aService).name.toUpperFirst() /]) throws IOException, ServletException
+
+ {
+
+ return null; // See LAB 5 of the Lyo workshop for implementation
+ }
+
+ // [protected ('(RECOMMENDED) functions')]
+ // [/protected]
+
+}
+
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogHTML.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogHTML.mtl
new file mode 100644
index 0000000..f41b2e5
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogHTML.mtl
@@ -0,0 +1,164 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - OSLC4J adaptation
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateServiceProviderCatalogHTML('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateServiceProviderCatalogHTML(aServiceProviderCatalog : ServiceProviderCatalog)]
+[file (serviceProviderCatalogJspFullFileName(aServiceProviderCatalog), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - OSLC4J adaptation
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ServiceProviderCatalog catalog = (ServiceProviderCatalog)request.getAttribute("catalog");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title>[containingAdaptorInterface(aServiceProviderCatalog).name /] OSLC Adapter: Service Provider Catalog</title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </head>
+ <body onload="">
+
+ <div id="header">
+ <div id="banner"></div>
+ <table border="0" cellspacing="0" cellpadding="0" id="titles">
+ <tr>
+ <td id="title">
+ <p>
+ [aServiceProviderCatalog.title /]: Service Provider Catalog
+ </p>
+ </td>
+ <td id="information">
+ <p class="header_addl_info">
+ version 0.1
+ </p>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="bugzilla-body">
+ <div id="page-index">
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff1')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ <h1>Service Provider Catalog</h1>
+
+ <p>[aServiceProviderCatalog.description /]</p>
+
+ <table>
+ <tr>
+ <td><b>This document</b>:</td>
+ <td><a href="<%= catalog.getAbout() %>">
+ <%= catalog.getAbout().toString() %>
+ </a></td>
+ </tr>
+ <tr>
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff2')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </tr>
+ <tr>
+ <td><b>Adapter Publisher</b>:</td>
+ <td>OSLC Tools Project</td>
+ </tr>
+ <tr>
+ <td><b>Adapter Identity</b>:</td>
+ <td>[containingAdaptorInterface(aServiceProviderCatalog).name /]</td>
+ </tr>
+ </table>
+
+ <h2>Service Providers</h2>
+
+ <% for (ServiceProvider s : catalog.getServiceProviders()) { %>
+ <h3>Service Provider: <%= s.getTitle() %></h3>
+ <p><a href="<%= s.getAbout() %>">
+ <%= s.getAbout() %></a></p>
+ <% } %>
+
+ </div>
+ </div>
+
+ <div id="footer">
+ <div class="intro"></div>
+ <div class="outro">
+ <div style="margin: 0 1em 1em 1em; line-height: 1.6em; text-align: left">
+ <b>OSLC Tools Adapter Server 0.1</b> brought to you by <a href="http://eclipse.org/lyo">Eclipse Lyo</a><br>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
+
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogService.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogService.mtl
new file mode 100644
index 0000000..7d46bab
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogService.mtl
@@ -0,0 +1,200 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateServiceProviderCatalogService('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateServiceProviderCatalogService(aServiceProviderCatalog : ServiceProviderCatalog)]
+[file (javaClassFullFileNameForService(aServiceProviderCatalog), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaClassPackageNameForService(aServiceProviderCatalog) /];
+
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.UriInfo;
+import javax.ws.rs.core.Response;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDialog;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcQueryCapability;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcService;
+import org.eclipse.lyo.oslc4j.core.model.Compact;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog;
+
+import [javaInterfaceFullNameForAdaptorConstants(containingAdaptorInterface(aServiceProviderCatalog)) /];
+import [javaClassFullNameForAdaptorManager(containingAdaptorInterface(aServiceProviderCatalog)) /];
+import [javaClassFullNameForSingleton(aServiceProviderCatalog) /];
+
+// [protected ('imports')]
+// [/protected]
+
+@OslcService(OslcConstants.OSLC_CORE_DOMAIN)
+@Path("catalog")
+public class [javaClassNameForService(aServiceProviderCatalog) /]
+{
+ @Context private HttpServletRequest httpServletRequest;
+ @Context private HttpServletResponse httpServletResponse;
+ @Context private UriInfo uriInfo;
+ @OslcDialog
+ (
+ title = "Service Provider Catalog Selection Dialog",
+ label = "Service Provider Catalog Selection Dialog",
+ uri = "/catalog",
+ hintWidth = "1000px",
+ hintHeight = "600px",
+ resourceTypes = {OslcConstants.TYPE_SERVICE_PROVIDER_CATALOG},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ @OslcQueryCapability
+ (
+ title = "Service Provider Catalog Query Capability",
+ label = "Service Provider Catalog Query",
+ resourceShape = OslcConstants.PATH_RESOURCE_SHAPES + "/" + OslcConstants.PATH_SERVICE_PROVIDER_CATALOG,
+ resourceTypes = {OslcConstants.TYPE_SERVICE_PROVIDER_CATALOG},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+
+ /**
+ * Redirect requests to /catalog to /catalog/singleton
+ *
+ * By default, OSLC4J returns an OSLC query response for /catalog. We really just
+ * want the catalog itself which lives at /catalog/{serviceProviderCatalogId}
+ *
+ * @return
+ * @throws IOException
+ * @throws URISyntaxException
+ */
+ @GET
+ public Response getServiceProviderCatalogs() throws IOException, URISyntaxException
+ {
+ String forwardUri = uriInfo.getAbsolutePath() + "/singleton";
+ httpServletResponse.sendRedirect(forwardUri);
+ return Response.seeOther(new URI(forwardUri)).build();
+ }
+
+
+ /**
+ * Return the OSLC service provider catalog as RDF/XML, XML or JSON
+ *
+ * @return
+ */
+
+
+
+ @GET
+ @Path("{serviceProviderCatalogId}") // Required to distinguish from array result. But, ignored.
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public ServiceProviderCatalog getServiceProviderCatalog()
+ {
+ ServiceProviderCatalog catalog = ServiceProviderCatalogSingleton.getServiceProviderCatalog(httpServletRequest);
+
+ if (catalog != null) {
+
+ httpServletResponse.addHeader([javaInterfaceNameForAdaptorConstants(containingAdaptorInterface(aServiceProviderCatalog)) /].HDR_OSLC_VERSION,"2.0");
+ return catalog;
+ }
+
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+
+
+ /**
+ * Return the catalog singleton as HTML
+ *
+ * Forwards to serviceprovidercatalog_html.jsp to build the html
+ *
+ * @param serviceProviderId
+ */
+
+
+ @GET
+ @Path("{serviceProviderId}")
+ @Produces(MediaType.TEXT_HTML)
+ public void getHtmlServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId)
+ {
+ ServiceProviderCatalog catalog = ServiceProviderCatalogSingleton.getServiceProviderCatalog(httpServletRequest);
+
+
+ if (catalog !=null )
+ {
+ httpServletRequest.setAttribute("catalog",catalog);
+ // [protected ('getHtmlServiceProvider_setAttributes')]
+ // [/protected]
+
+
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[serviceProviderCatalogJspRelativeFileName() /]");
+ try {
+ rd.forward(httpServletRequest, httpServletResponse);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WebApplicationException(e);
+ }
+ }
+ }
+
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogSingleton.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogSingleton.mtl
new file mode 100644
index 0000000..eecf6bf
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderCatalogSingleton.mtl
@@ -0,0 +1,336 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - adapted for Bugzilla service provider
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateServiceProviderCatalogSingleton('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateServiceProviderCatalogSingleton(aServiceProviderCatalog : ServiceProviderCatalog)]
+[file (javaClassFullFileNameForSingleton(aServiceProviderCatalog), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - adapted for Bugzilla service provider
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+
+package [javaClassPackageNameForSingleton(aServiceProviderCatalog) /];
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response.Status;
+
+import org.eclipse.lyo.oslc4j.client.ServiceProviderRegistryURIs;
+import org.eclipse.lyo.oslc4j.core.model.Publisher;
+import org.eclipse.lyo.oslc4j.core.model.Service;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProviderCatalog;
+
+import [javaClassFullNameForAdaptorManager(containingAdaptorInterface(aServiceProviderCatalog)) /];
+import [javaClassFullNameForServiceProviderInfo(containingAdaptorInterface(aServiceProviderCatalog)) /];
+
+// [protected ('imports')]
+// [/protected]
+
+/**
+ * This is the OSLC service provider catalog for the Bugzilla adapter. Service providers are
+ * not registered with the catalog until a request comes in to access either the catalog or a
+ * specific service provider. This request could be from an external consumer or an internal
+ * request triggered by a consumer accessing a change request.
+ *
+ * The service providers are created and registered in the initServiceProvidersFromProducts()
+ * method. A list of accessible products is retrieved from Bugzilla and a ServiceProvider is
+ * created and registered for each using the Bugzilla productId as the identifier.
+ *
+ * The registered service providers are refreshed on each catalog or service provider collection
+ * request.
+ */
+public class [javaClassNameForSingleton(aServiceProviderCatalog) /]
+{
+ private static final ServiceProviderCatalog serviceProviderCatalog;
+ [comment TODO: We here assume that 1 single serviceProvider type is specified in the SPCatalog.
+ In the metamodel, a SPCatalog can have 1+ serviceProvider types.
+ For example, one SP type maps to the products. Another SP type maps to "something-else".
+ In this case, each such SP type would need to define its name. (for example "ProductServiceProvider")
+ In this case, loop through the SP types, and create a variable for each. You will also need to loop through and create the functions below for each such SP type.
+ Alternatively, define serviceProviders as some Dictionary, where the key is the SP name, and the value is the SortedMap below/]
+ private static final SortedMap<String, ServiceProvider> serviceProviders = new TreeMap<String, ServiceProvider>();
+
+ static
+ {
+ try
+ {
+ serviceProviderCatalog = new ServiceProviderCatalog();
+
+ serviceProviderCatalog.setAbout(new URI(ServiceProviderRegistryURIs.getServiceProviderRegistryURI()));
+ serviceProviderCatalog.setTitle("[aServiceProviderCatalog.title /]");
+ serviceProviderCatalog.setDescription("[aServiceProviderCatalog.description /]");
+ serviceProviderCatalog.setPublisher(new Publisher("[aServiceProviderCatalog.publisher.title /]", "[aServiceProviderCatalog.publisher.identifier /]"));
+ serviceProviderCatalog.getPublisher().setIcon(new URI("[aServiceProviderCatalog.publisher.icon /]"));
+ }
+ catch (final URISyntaxException exception)
+ {
+ // We should never get here.
+ throw new ExceptionInInitializerError(exception);
+ }
+ }
+
+
+ private [javaClassNameForSingleton(aServiceProviderCatalog) /]()
+ {
+ super();
+ }
+
+
+ public static URI getUri()
+ {
+ return serviceProviderCatalog.getAbout();
+ }
+
+ public static ServiceProviderCatalog getServiceProviderCatalog(HttpServletRequest httpServletRequest)
+ {
+ initServiceProviders(httpServletRequest);
+ return serviceProviderCatalog;
+ }
+
+ public static ServiceProvider [ '[' ']' /] getServiceProviders(HttpServletRequest httpServletRequest)
+ {
+ synchronized(serviceProviders)
+ {
+ initServiceProviders(httpServletRequest);
+ return serviceProviders.values().toArray(new ServiceProvider[ '[' /] serviceProviders.size()[ ']' /]);
+ }
+ }
+
+ public static ServiceProvider getServiceProvider(HttpServletRequest httpServletRequest, final String serviceProviderId)
+ {
+ ServiceProvider serviceProvider;
+
+ synchronized(serviceProviders)
+ {
+ serviceProvider = serviceProviders.get(serviceProviderId);
+
+ //One retry refreshing the service providers
+ if (serviceProvider == null)
+ {
+ getServiceProviders(httpServletRequest);
+ serviceProvider = serviceProviders.get(serviceProviderId);
+ }
+ }
+
+ if (serviceProvider != null)
+ {
+ return serviceProvider;
+ }
+
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+
+[comment TODO: should be able to simply replace productId with serviceProviderId. In the method "getServiceProvider" above
+they simply use serviceProviderId, which seems to also be the key in the "serviceProviders" set. /]
+ public static ServiceProvider registerServiceProvider(final HttpServletRequest httpServletRequest,
+ final ServiceProvider serviceProvider,
+ final String productId) throws URISyntaxException
+ {
+ synchronized(serviceProviders)
+ {
+ final URI serviceProviderURI = new URI(httpServletRequest.getScheme(),
+ null,
+ httpServletRequest.getServerName(),
+ httpServletRequest.getServerPort(),
+ httpServletRequest.getContextPath() + "/serviceProviders/" + productId,
+ null,
+ null);
+
+ return registerServiceProviderNoSync(serviceProviderURI,
+ serviceProvider,
+ productId);
+ }
+ }
+
+
+[comment TODO: should be able to simply replace productId with serviceProviderId. In the method "getServiceProvider" above
+they simply use serviceProviderId, which seems to also be the key in the "serviceProviders" set. /]
+/**
+ * Register a service provider with the OSLC catalog
+ *
+ * @param serviceProviderURI
+ * @param serviceProvider
+ * @param productId
+ * @return
+ */
+ private static ServiceProvider registerServiceProviderNoSync(final URI serviceProviderURI,
+ final ServiceProvider serviceProvider,
+ final String productId)
+ {
+ final SortedSet<URI> serviceProviderDomains = getServiceProviderDomains(serviceProvider);
+
+ serviceProvider.setAbout(serviceProviderURI);
+ serviceProvider.setIdentifier(productId);
+ serviceProvider.setCreated(new Date());
+ serviceProvider.setDetails(new URI[ '[' ']' /] {serviceProviderURI});
+
+ serviceProviderCatalog.addServiceProvider(serviceProvider);
+ serviceProviderCatalog.addDomains(serviceProviderDomains);
+
+ serviceProviders.put(productId,
+ serviceProvider);
+
+
+ return serviceProvider;
+ }
+
+[comment TODO: should be able to simply replace productId with serviceProviderId. In the method "getServiceProvider" above
+they simply use serviceProviderId, which seems to also be the key in the "serviceProviders" set. /]
+ // This version is for self-registration and thus package-protected
+ static ServiceProvider registerServiceProvider(final String baseURI,
+ final ServiceProvider serviceProvider,
+ final String productId)
+ throws URISyntaxException
+ {
+ synchronized(serviceProviders)
+ {
+ final URI serviceProviderURI = new URI(baseURI + "/serviceProviders/" + productId);
+
+ return registerServiceProviderNoSync(serviceProviderURI,
+ serviceProvider,
+ productId);
+ }
+ }
+
+ public static void deregisterServiceProvider(final String serviceProviderId)
+ {
+ synchronized(serviceProviders)
+ {
+ final ServiceProvider deregisteredServiceProvider = serviceProviders.remove(serviceProviderId);
+
+ if (deregisteredServiceProvider != null)
+ {
+ final SortedSet<URI> remainingDomains = new TreeSet<URI>();
+
+ for (final ServiceProvider remainingServiceProvider : serviceProviders.values())
+ {
+ remainingDomains.addAll(getServiceProviderDomains(remainingServiceProvider));
+ }
+
+ final SortedSet<URI> removedServiceProviderDomains = getServiceProviderDomains(deregisteredServiceProvider);
+
+ removedServiceProviderDomains.removeAll(remainingDomains);
+ serviceProviderCatalog.removeDomains(removedServiceProviderDomains);
+ serviceProviderCatalog.removeServiceProvider(deregisteredServiceProvider);
+ }
+ else
+ {
+ throw new WebApplicationException(Status.NOT_FOUND);
+ }
+ }
+ }
+
+ private static SortedSet<URI> getServiceProviderDomains(final ServiceProvider serviceProvider)
+ {
+ final SortedSet<URI> domains = new TreeSet<URI>();
+
+ if (serviceProvider!=null) {
+ final Service [ '[' ']' /] services = serviceProvider.getServices();
+ for (final Service service : services)
+ {
+ final URI domain = service.getDomain();
+
+ domains.add(domain);
+ }
+ }
+ return domains;
+ }
+
+ /**
+ * Retrieve a list of products from Bugzilla and construct a service provider for each.
+ *
+ * Each product ID is added to the parameter map which will be used during service provider
+ * creation to create unique URI paths for each Bugzilla product. See @Path definition at
+ * the top of BugzillaChangeRequestService.
+ *
+ * @param httpServletRequest
+ */
+ protected static void initServiceProviders (HttpServletRequest httpServletRequest)
+ {
+ try {
+
+ // [protected ('(MUST_FILL_IN) initServiceProviders')]
+ // [/protected]
+
+ String basePath = [javaClassNameForAdaptorServletListener(containingAdaptorInterface(aServiceProviderCatalog)) /].getServicesBase();
+ [javaClassNameForServiceProviderInfo(containingAdaptorInterface(aServiceProviderCatalog)) /] [ '[' ']' /] serviceProviderInfos = [javaClassNameForAdaptorManager(containingAdaptorInterface(aServiceProviderCatalog)) /].getServiceProviderInfos(httpServletRequest);
+
+ //Register a service provider for each serviceProviderId
+ for ([javaClassNameForServiceProviderInfo(containingAdaptorInterface(aServiceProviderCatalog)) /] serviceProviderInfo : serviceProviderInfos) {
+ String serviceProviderId = serviceProviderInfo.serviceProviderId;
+ if (! serviceProviders.containsKey(serviceProviderId)) {
+ String serviceProviderName = serviceProviderInfo.name;
+ String title = "[aServiceProviderCatalog.serviceProviders.title.concat(': ') /]" + serviceProviderName + "(" + serviceProviderId + ")";
+ String description = "[aServiceProviderCatalog.serviceProviders.description.concat(': ') /]" + serviceProviderName + "(" + serviceProviderId + ")";
+ Publisher publisher = new Publisher("[aServiceProviderCatalog.serviceProviders.publisher.title /]", "[aServiceProviderCatalog.serviceProviders.publisher.identifier /]");
+ Map<String, Object> parameterMap = new HashMap<String, Object>();
+ parameterMap.put("serviceProviderId",serviceProviderId);
+ final ServiceProvider aServiceProvider = [javaClassNameForServiceProviderFactory(containingAdaptorInterface(aServiceProviderCatalog)) /].createServiceProvider(basePath, title, description, publisher, parameterMap);
+ registerServiceProvider(basePath,aServiceProvider,serviceProviderId);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WebApplicationException(e,Status.INTERNAL_SERVER_ERROR);
+ }
+ }
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderHTML.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderHTML.mtl
new file mode 100644
index 0000000..944ee45
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderHTML.mtl
@@ -0,0 +1,209 @@
+[comment encoding = UTF-8 /]
+[comment
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+--%>
+/]
+
+[module generateServiceProviderHTML('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+
+[template public generateServiceProviderHTML(aServiceProvider : ServiceProvider)]
+[file (serviceProviderJspFullFileName(aServiceProvider), false, 'UTF-8')]
+<!DOCTYPE html>
+<%--
+ Copyright (c) 2011, 2012 IBM Corporation and others.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+
+ The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ and the Eclipse Distribution License is available at
+ http://www.eclipse.org/org/documents/edl-v10.php.
+
+ Contributors:
+
+ Sam Padgett - initial API and implementation
+ Michael Fiedler - adapted for OSLC4J
+ Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+
+ This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+--%>
+
+<%@ page import="java.net.URI" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.Service" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.ServiceProvider" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.Dialog" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.CreationFactory" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.ResourceShape" %>
+<%@ page import="org.eclipse.lyo.oslc4j.core.model.QueryCapability" %>
+<%--
+[protected ('imports')]
+--%>
+<%--
+[/protected]
+--%>
+
+<%@ page contentType="text/html" language="java" pageEncoding="UTF-8" %>
+
+<%
+ServiceProvider serviceProvider = (ServiceProvider)request.getAttribute("serviceProvider");
+Service['[]'/] services = (Service['[]'/])request.getAttribute("services");
+%>
+<%--
+[protected ('getRequestAttributes')]
+--%>
+<%--
+[/protected]
+--%>
+
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+ <title><%= serviceProvider.getTitle() %></title>
+ <%--
+ [protected ('(RECOMMENDED) headStuff')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </head>
+ <body onload="">
+ <div id="header">
+ <div id="banner"></div>
+ <table border="0" cellspacing="0" cellpadding="0" id="titles">
+ <tr>
+ <td id="title">
+ <p>
+ <%= serviceProvider.getTitle() %></title>
+ </p>
+ </td>
+ <td id="information">
+ <p class="header_addl_info">
+ version 0.1
+ </p>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="bugzilla-body">
+ <div id="page-index">
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff1')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+
+ <h1><%= serviceProvider.getTitle() %></title></h1>
+
+ <p><%= serviceProvider.getDescription() %></p>
+
+ <table>
+ <tr>
+ <td><b>This document</b>:</td>
+ <td><a href="<%= serviceProvider.getAbout() %>">
+ <%= serviceProvider.getAbout() %></a></td>
+ </tr>
+ <tr>
+ <%--
+ [protected ('(RECOMMENDED) bodyStuff2')]
+ --%>
+ <%--
+ [/protected]
+ --%>
+ </tr>
+ [comment TODO: Adaptor Publisher & IDentify should not be hard-coded!. we already have them in the meta-model defined /]
+ <tr>
+ <td><b>Adapter Publisher</b>:</td>
+ <td>Eclipse Lyo</td>
+ </tr>
+ <tr>
+ <td><b>Adapter Identity</b>:</td>
+ <td>org.eclipse.lyo.oslc4j.bugzilla.test</td>
+ </tr>
+ </table>
+
+ <h2>Services</h2>
+ <%for (int serviceIndex = 0; serviceIndex < services.length; serviceIndex++) {%>
+
+ <h3>Service <%= serviceIndex %> </h3>
+ [comment TODO: instead of the generic title, Put the name of the resource(s) to which the service applies in the title. /]
+ <h4>Resource Selector Dialog(s)</h4>
+ <%
+ Dialog['[]'/] selectionDialogs = services['[serviceIndex]'/].getSelectionDialogs();
+ for (int selectionDialogIndex = 0; selectionDialogIndex < selectionDialogs.length; selectionDialogIndex++) {
+ String selectionDialog = selectionDialogs['[selectionDialogIndex]'/].getDialog().toString();
+ %>
+ <p><a href="<%= selectionDialog %>"><%= selectionDialog %></a></p>
+ <%}%>
+
+ <h4>Resource Creator Dialog(s)</h4>
+ <%
+ Dialog['[]'/] creationDialogs = services['[serviceIndex]'/].getCreationDialogs();
+ for (int creationDialogIndex = 0; creationDialogIndex < creationDialogs.length; creationDialogIndex++) {
+ String creationDialog = creationDialogs['[creationDialogIndex]'/].getDialog().toString();
+ %>
+ <p><a href="<%= creationDialog %>"><%= creationDialog %></a></p>
+ <%}%>
+
+ <h4>Resource Creation Factory(s) and Resource Shape(s)</h4>
+ <%
+ CreationFactory['[]'/] creationFactories = services['[serviceIndex]'/].getCreationFactories();
+ for (int creationFactoryIndex = 0; creationFactoryIndex < creationFactories.length; creationFactoryIndex++) {
+ String creationFactory = creationFactories['[creationFactoryIndex]'/].getCreation().toString();
+ URI['[]'/] creationShapes = creationFactories['[creationFactoryIndex]'/].getResourceShapes();
+ [comment TODO: I for now assume that there is a single shape. we should instead loop and present all shapes defined. /]
+ String creationShape = creationShapes['[0]'/].toString();
+ %>
+ <p><a href="<%= creationFactory %>"><%= creationFactory %></a></p>
+ <p><a href="<%= creationShape %>"><%= creationShape %></a></p>
+ <%}%>
+
+ <h4>Resource Query Capability(s) and Resource Shape(s)</h4>
+ <%
+ QueryCapability['[]'/] queryCapabilities= services['[serviceIndex]'/].getQueryCapabilities();
+ for (int queryCapabilityIndex = 0; queryCapabilityIndex < queryCapabilities.length; queryCapabilityIndex++) {
+ String queryCapability = queryCapabilities['[queryCapabilityIndex]'/].getQueryBase().toString();
+ String queryShape = queryCapabilities['[queryCapabilityIndex]'/].getResourceShape().toString();
+ %>
+
+ <p><a href="<%= queryCapability %>"><%= queryCapability %></a></p>
+ <p><a href="<%= queryShape %>"><%= queryShape %></a></p>
+ <%}%>
+ <%}%>
+
+ </div>
+ </div>
+
+ <div id="footer">
+ <div class="intro"></div>
+ <div class="outro">
+ <div style="margin: 0 1em 1em 1em; line-height: 1.6em; text-align: left">
+ <b>OSLC Tools Adapter Server 0.1</b> brought to you by <a href="http://eclipse.org/lyo">Eclipse Lyo</a><br>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderInfo.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderInfo.mtl
new file mode 100644
index 0000000..239a57c
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderInfo.mtl
@@ -0,0 +1,71 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateServiceProviderInfo('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[template public generateServiceProviderInfo(anAdaptorInterface : AdaptorInterface)]
+[file (javaClassFullFileNameForServiceProviderInfo(anAdaptorInterface), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaClassPackageNameForServiceProviderInfo(anAdaptorInterface) /];
+
+// [protected ('imports')]
+// [/protected]
+
+
+// [protected ('pre_class_code')]
+// [/protected]
+
+public class [javaClassNameForServiceProviderInfo(anAdaptorInterface) /] {
+
+ public String serviceProviderId;
+ public String name;
+
+ // [protected ('class_attributes')]
+ // [/protected]
+
+ // [protected ('class_methods')]
+ // [/protected]
+
+}
+
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderService.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderService.mtl
new file mode 100644
index 0000000..2b1d501
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateServiceProviderService.mtl
@@ -0,0 +1,181 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *******************************************************************************/
+/]
+
+[module generateServiceProviderService('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::jspServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
+
+[template public generateServiceProviderService(aServiceProvider : ServiceProvider)]
+[file (javaClassFullFileNameForService(aServiceProvider), false, 'UTF-8')]
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Russell Boykin - initial API and implementation
+ * Alberto Giammaria - initial API and implementation
+ * Chris Peters - initial API and implementation
+ * Gianluca Bernardini - initial API and implementation
+ * Michael Fiedler - implementation for Bugzilla adapter
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ * This file is generated by org.eclipse.lyo.oslc4j.codegenerator
+ *******************************************************************************/
+
+package [javaClassPackageNameForService(aServiceProvider) /];
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response.Status;
+
+import org.eclipse.lyo.oslc4j.core.annotation.OslcDialog;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcQueryCapability;
+import org.eclipse.lyo.oslc4j.core.annotation.OslcService;
+import org.eclipse.lyo.oslc4j.core.model.Compact;
+import org.eclipse.lyo.oslc4j.core.model.OslcConstants;
+import org.eclipse.lyo.oslc4j.core.model.OslcMediaType;
+import org.eclipse.lyo.oslc4j.core.model.Service;
+import org.eclipse.lyo.oslc4j.core.model.ServiceProvider;
+
+import [javaClassFullNameForAdaptorManager(containingAdaptorInterface(aServiceProvider)) /];
+import [javaClassFullNameForSingleton(containingServiceProviderCatalog(aServiceProvider)) /];
+
+// [protected ('imports')]
+// [/protected]
+
+
+@OslcService(OslcConstants.OSLC_CORE_DOMAIN)
+@Path("serviceProviders")
+public class [javaClassNameForService(aServiceProvider) /]
+{
+ @Context private HttpServletRequest httpServletRequest;
+ @Context private HttpServletResponse httpServletResponse;
+
+
+ /**
+ * RDF/XML, XML and JSON representations of an OSLC Service Provider collection
+ * @return
+ */
+
+
+ @OslcDialog
+ (
+ title = "Service Provider Selection Dialog",
+ label = "Service Provider Selection Dialog",
+ uri = "",
+ hintWidth = "1000px",
+ hintHeight = "600px",
+ resourceTypes = {OslcConstants.TYPE_SERVICE_PROVIDER},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ @OslcQueryCapability
+ (
+ title = "Service Provider Query Capability",
+ label = "Service Provider Query",
+ resourceShape = OslcConstants.PATH_RESOURCE_SHAPES + "/" + OslcConstants.PATH_SERVICE_PROVIDER,
+ resourceTypes = {OslcConstants.TYPE_SERVICE_PROVIDER},
+ usages = {OslcConstants.OSLC_USAGE_DEFAULT}
+ )
+ @GET
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public ServiceProvider[ '[' /][ ']' /] getServiceProviders()
+ {
+ httpServletResponse.addHeader("Oslc-Core-Version","2.0");
+ return [javaClassNameForSingleton(containingServiceProviderCatalog(aServiceProvider)) /].getServiceProviders(httpServletRequest);
+ }
+
+
+ /**
+ * RDF/XML, XML and JSON representations of a single OSLC Service Provider
+ *
+ * @param serviceProviderId
+ * @return
+ */
+
+
+ @GET
+ @Path("{serviceProviderId}")
+ @Produces({OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_XML, OslcMediaType.APPLICATION_JSON})
+ public ServiceProvider getServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId)
+ {
+ httpServletResponse.addHeader("Oslc-Core-Version","2.0");
+ return [javaClassNameForSingleton(containingServiceProviderCatalog(aServiceProvider)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ }
+
+
+
+ /**
+ * HTML representation of a single OSLC Service Provider
+ *
+ * Forwards to serviceprovider_html.jsp to create the html document
+ *
+ * @param serviceProviderId
+ */
+ @GET
+ @Path("{serviceProviderId}")
+ @Produces(MediaType.TEXT_HTML)
+ public void getHtmlServiceProvider(@PathParam("serviceProviderId") final String serviceProviderId)
+ {
+ ServiceProvider serviceProvider = [javaClassNameForSingleton(containingServiceProviderCatalog(aServiceProvider)) /].getServiceProvider(httpServletRequest, serviceProviderId);
+ Service [ '[' /][ ']' /] services = serviceProvider.getServices();
+
+ httpServletRequest.setAttribute("serviceProvider", serviceProvider);
+ httpServletRequest.setAttribute("services", services);
+ // [protected ('getHtmlServiceProvider_setAttributes')]
+ // [/protected]
+
+ RequestDispatcher rd = httpServletRequest.getRequestDispatcher("[serviceProviderJspRelativeFileName(aServiceProvider) /]");
+ try {
+ rd.forward(httpServletRequest, httpServletResponse);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new WebApplicationException(e);
+ }
+ }
+
+
+
+}
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/Generate.java b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/Generate.java
new file mode 100644
index 0000000..8cc4a0b
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/Generate.java
@@ -0,0 +1,406 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2012 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.lyo.oslc4j.codegenerator.main;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'Generate' generation module.
+ *
+ * @generated
+ */
+public class Generate extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "/org/eclipse/lyo/oslc4j/codegenerator/main/generate";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "generate" };
+
+ /**
+ * The list of properties files from the launch parameters (Launch configuration).
+ *
+ * @generated
+ */
+ private List<String> propertiesFiles = new ArrayList<String>();
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public Generate() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public Generate(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public Generate(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+
+ List<String> arguments = new ArrayList<String>();
+
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * Add in this list all the arguments used by the starting point of the generation
+ * If your main template is called on an element of your model and a String, you can
+ * add in "arguments" this "String" attribute.
+ */
+
+ Generate generator = new Generate(modelURI, folder, arguments);
+
+ /*
+ * Add the properties from the launch arguments.
+ * If you want to programmatically add new properties, add them in "propertiesFiles"
+ * You can add the absolute path of a properties files, or even a project relative path.
+ * If you want to add another "protocol" for your properties files, please override
+ * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
+ * The behavior of the properties loader service is explained in the Acceleo documentation
+ * (Help -> Help Contents).
+ */
+
+ for (int i = 2; i < args.length; i++) {
+ generator.addPropertiesFile(args[i]);
+ }
+
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this. The default behavior should
+ * be sufficient in most cases. If you want to change the content of this method, do NOT forget to
+ * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
+ * any compilation of the Acceleo module with the main template that has caused the creation of this
+ * class will revert your modifications. If you encounter a problem with an unresolved proxy during the
+ * generation, you can remove the comments in the following instructions to check for problems. Please
+ * note that those instructions may have a significant impact on the performances.
+ */
+
+ //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
+
+ /*
+ * If you want to check for potential errors in your models before the launch of the generation, you
+ * use the code below.
+ */
+
+ //if (model != null && model.eResource() != null) {
+ // List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
+ // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
+ // System.err.println(diagnostic.toString());
+ // }
+ //}
+
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ /*
+ * TODO if you need to listen to generation event, add listeners to the list here. If you want to change
+ * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
+ * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
+ * that has caused the creation of this class will revert your modifications.
+ */
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ @Override
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO if your generation module requires access to properties files, add their qualified path to the list here.
+ *
+ * Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
+ * plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
+ * files to the "propertiesFiles" list:
+ *
+ * final String prefix = "platform:/plugin/";
+ * final String pluginName = "org.eclipse.acceleo.module.sample";
+ * final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
+ * final String fileName = "default.properties";
+ * propertiesFiles.add(prefix + pluginName + packagePath + fileName);
+ *
+ * With this mechanism, you can load properties files from your plugin or from another plugin.
+ *
+ * You may want to load properties files from the file system, for that you need to add the absolute path of the file:
+ *
+ * propertiesFiles.add("C:\Users\MyName\MyFile.properties");
+ *
+ * If you want to let your users add properties files located in the same folder as the model:
+ *
+ * if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
+ * propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
+ * }
+ *
+ * To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * Adds a properties file in the list of properties files.
+ *
+ * @param propertiesFile
+ * The properties file to add.
+ * @generated
+ * @since 3.1
+ */
+ @Override
+ public void addPropertiesFile(String propertiesFile) {
+ this.propertiesFiles.add(propertiesFile);
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * If you need additional package registrations, you can register them here. The following line
+ * (in comment) is an example of the package registration for UML.
+ *
+ * You can use the method "isInWorkspace(Class c)" to check if the package that you are about to
+ * register is in the workspace.
+ *
+ * To register a package properly, please follow the following conventions:
+ *
+ * If the package is located in another plug-in, already installed in Eclipse. The following content should
+ * have been generated at the beginning of this method. Do not register the package using this mechanism if
+ * the metamodel is located in the workspace.
+ *
+ * if (!isInWorkspace(UMLPackage.class)) {
+ * // The normal package registration if your metamodel is in a plugin.
+ * resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ * }
+ *
+ * If the package is located in another project in your workspace, the plugin containing the package has not
+ * been register by EMF and Acceleo should register it automatically. If you want to use the generator in
+ * stand alone, the regular registration (seen a couple lines before) is needed.
+ *
+ * To learn more about Package Registration, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ /*
+ * If you want to change the content of this method, do NOT forget to change the "@generated"
+ * tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
+ * of the Acceleo module with the main template that has caused the creation of this class will
+ * revert your modifications.
+ */
+
+ /*
+ * TODO If you need additional resource factories registrations, you can register them here. the following line
+ * (in comment) is an example of the resource factory registration for UML.
+ *
+ * If you want to use the generator in stand alone, the resource factory registration will be required.
+ *
+ * To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents).
+ */
+
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl
new file mode 100644
index 0000000..4457020
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/main/generate.mtl
@@ -0,0 +1,79 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generate('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourcePropertyServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderCatalogService/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderCatalogSingleton/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorServiceProviderFactory/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorManager/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorServletListener/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateDelegatedUIJavaScripts/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorApplication/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorPackageInfo/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateAdaptorConstants/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderCatalogHTML/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderHTML/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderService/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateServiceProviderInfo/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateResource/]
+[import org::eclipse::lyo::oslc4j::codegenerator::files::generateService/]
+[import org::eclipse::lyo::oslc4j::codegenerator::staticFiles::generateLicenseFiles/]
+
+[template public generate(anAdaptorInterface : AdaptorInterface)]
+[comment @main/]
+
+[comment TODO: Produce "package-info.java" under the Resources package. See the original instructions on how to setup a OSLC4J project for details./]
+[anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogService() /]
+[anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogSingleton() /]
+
+[anAdaptorInterface.generateLicenseFiles() /]
+[anAdaptorInterface.generateAdaptorApplication() /]
+[anAdaptorInterface.generateAdaptorPackageInfo() /]
+[anAdaptorInterface.generateAdaptorServletListener() /]
+[anAdaptorInterface.generateAdaptorManager() /]
+[anAdaptorInterface.generateAdaptorConstants() /]
+[anAdaptorInterface.generateDelegatedUIJavaScripts() /]
+[anAdaptorInterface.generateAdaptorServiceProviderFactory() /]
+[anAdaptorInterface.generateServiceProviderInfo() /]
+
+[anAdaptorInterface.serviceProviderCatalog.generateServiceProviderCatalogHTML() /]
+
+[for (aResource: Resource | relevantResources(anAdaptorInterface))]
+ [aResource.generateResource() /]
+[/for]
+
+[for (aServiceProvider: ServiceProvider | anAdaptorInterface.serviceProviderCatalog.serviceProviders)]
+ [aServiceProvider.generateServiceProviderService()/]
+ [aServiceProvider.generateServiceProviderHTML() /]
+ [for (aService: Service | aServiceProvider.services)]
+ [aService.generateService()/]
+ [/for]
+
+[/for]
+
+
+
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl
new file mode 100644
index 0000000..d19df42
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/adaptorInterfaceServices.mtl
@@ -0,0 +1,173 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module adaptorInterfaceServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+
+[query public containingAdaptorInterface(obj : OclAny) : AdaptorInterface =
+obj.eContainer(AdaptorInterface)
+/]
+
+[query public relevantResources(anAdaptorInterface : AdaptorInterface) : Set(Resource) =
+relevantDomainSpecifications(anAdaptorInterface)->collectNested(aDomainSpecification : DomainSpecification | aDomainSpecification.resources)->flatten()->asSet()
+/]
+
+[query public relevantDomainSpecifications(anAdaptorInterface : AdaptorInterface) : Set(DomainSpecification) =
+anAdaptorInterface.specification.domainSpecifications
+/]
+
+[comment Services for AdaptorPackageInfo /]
+[query public javaClassPackageNameForAdaptorPackageInfo(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface).concat('.resources')
+/]
+
+[query public javaClassFullFileNameForAdaptorPackageInfo(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForAdaptorPackageInfo(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat('package-info').concat('.java')
+/]
+
+[comment Services for AdaptorApplication /]
+[query public javaClassPackageNameForAdaptorApplication(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface).concat('.servlet')
+/]
+
+[query public javaClassNameForAdaptorApplication(anAdaptorInterface : AdaptorInterface) : String =
+'Application'
+/]
+
+[query public javaClassFullNameForAdaptorApplication(anAdaptorInterface : AdaptorInterface) : String =
+javaClassPackageNameForAdaptorApplication(anAdaptorInterface).concat('.').concat(javaClassNameForAdaptorApplication(anAdaptorInterface))
+/]
+
+[query public javaClassFullFileNameForAdaptorApplication(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForAdaptorApplication(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForAdaptorApplication(anAdaptorInterface)).concat('.java')
+/]
+
+[comment Services for AdaptorServletListener /]
+[query public javaClassPackageNameForAdaptorServletListener(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface).concat('.servlet')
+/]
+
+[query public javaClassNameForAdaptorServletListener(anAdaptorInterface : AdaptorInterface) : String =
+'ServletListener'
+/]
+
+[query public javaClassFullNameForAdaptorServletListener(anAdaptorInterface : AdaptorInterface) : String =
+javaClassPackageNameForAdaptorServletListener(anAdaptorInterface).concat('.').concat(javaClassNameForAdaptorServletListener(anAdaptorInterface))
+/]
+
+[query public javaClassFullFileNameForAdaptorServletListener(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForAdaptorServletListener(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForAdaptorServletListener(anAdaptorInterface)).concat('.java')
+/]
+
+[comment Services for ServiceProviderInfo /]
+[query public javaClassPackageNameForServiceProviderInfo(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface)
+/]
+
+[query public javaClassNameForServiceProviderInfo(anAdaptorInterface : AdaptorInterface) : String =
+'ServiceProviderInfo'
+/]
+
+[query public javaClassFullNameForServiceProviderInfo(anAdaptorInterface : AdaptorInterface) : String =
+javaClassPackageNameForServiceProviderInfo(anAdaptorInterface).concat('.').concat(javaClassNameForServiceProviderInfo(anAdaptorInterface))
+/]
+
+[query public javaClassFullFileNameForServiceProviderInfo(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForServiceProviderInfo(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForServiceProviderInfo(anAdaptorInterface)).concat('.java')
+/]
+
+[comment Services for AdaptorManager /]
+[query public javaClassPackageNameForAdaptorManager(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface)
+/]
+
+[query public javaClassNameForAdaptorManager(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.name.toUpperFirst().concat('Manager')
+/]
+
+[query public javaClassFullNameForAdaptorManager(anAdaptorInterface : AdaptorInterface) : String =
+javaClassPackageNameForAdaptorManager(anAdaptorInterface).concat('.').concat(javaClassNameForAdaptorManager(anAdaptorInterface))
+/]
+
+[query public javaClassFullFileNameForAdaptorManager(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForAdaptorManager(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForAdaptorManager(anAdaptorInterface)).concat('.java')
+/]
+
+[comment Services for AdaptorConstants /]
+[query public javaInterfacePackageNameForAdaptorConstants(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface)
+/]
+
+[query public javaInterfaceNameForAdaptorConstants(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.name.toUpperFirst().concat('Constants')
+/]
+
+[query public javaInterfaceFullNameForAdaptorConstants(anAdaptorInterface : AdaptorInterface) : String =
+javaInterfacePackageNameForAdaptorConstants(anAdaptorInterface).concat('.').concat(javaInterfaceNameForAdaptorConstants(anAdaptorInterface))
+/]
+
+[query public javaInterfaceFullFileNameForAdaptorConstants(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaInterfacePackageNameForAdaptorConstants(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaInterfaceNameForAdaptorConstants(anAdaptorInterface)).concat('.java')
+/]
+
+
+[query public domainSpecificationConstantName(aDomainSpecification : DomainSpecification) : String =
+aDomainSpecification.name.toUpperCase().substituteAll(' ', '_').concat('_DOMAIN')
+/]
+
+[query public domainSpecificationNamespaceConstantName(aDomainSpecification : DomainSpecification) : String =
+aDomainSpecification.name.toUpperCase().substituteAll(' ', '_').concat('_NAMSPACE')
+/]
+
+[query public domainSpecificationNamespacePrefixConstantName(aDomainSpecification : DomainSpecification) : String =
+aDomainSpecification.name.toUpperCase().substituteAll(' ', '_').concat('_NAMSPACE_PREFIX')
+/]
+
+[query public resourceConstantName(aResource : Resource) : String =
+aResource.name.toUpperCase().substituteAll(' ', '_')
+/]
+
+[query public resourcePathConstantName(aResource : Resource) : String =
+'PATH_'.concat(aResource.name.toUpperCase().substituteAll(' ', '_'))
+/]
+
+[query public resourceTypeConstantName(aResource : Resource) : String =
+'TYPE_'.concat(aResource.name.toUpperCase().substituteAll(' ', '_'))
+/]
+
+[comment Services for AdaptorServiceProviderFactory /]
+[query public javaClassPackageNameForServiceProviderFactory(anAdaptorInterface : AdaptorInterface) : String =
+javaClassBaseNamespace(anAdaptorInterface).concat('.servlet')
+/]
+
+[query public javaClassNameForServiceProviderFactory(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.name.toUpperFirst().concat('ServiceProviderFactory')
+/]
+
+[query public javaClassFullNameForServiceProviderFactory(anAdaptorInterface : AdaptorInterface) : String =
+javaClassPackageNameForServiceProviderFactory(anAdaptorInterface).concat('.').concat(javaClassNameForServiceProviderFactory(anAdaptorInterface))
+/]
+
+[query public javaClassFullFileNameForServiceProviderFactory(anAdaptorInterface : AdaptorInterface) : String =
+javaFilesBasePath(anAdaptorInterface).concat(javaClassPackageNameForServiceProviderFactory(anAdaptorInterface).substituteAll('.', '/')).concat('/').concat(javaClassNameForServiceProviderFactory(anAdaptorInterface)).concat('.java')
+/]
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/jspServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/jspServices.mtl
new file mode 100644
index 0000000..4962b8b
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/jspServices.mtl
@@ -0,0 +1,83 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module jspServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[query public filteredResourceCollectionJspRelativeFileName(aResource: Resource) : String =
+jspFilesWebappPath(aResource.eContainer(AdaptorInterface)).concat('/').concat(aResource.name.toLower()).concat('filteredcollection_json').concat('.jsp')
+/]
+[query public filteredResourceCollectionJspFullFileName(aResource: Resource) : String =
+jspFilesBasePath(aResource.eContainer(AdaptorInterface)).concat(filteredResourceCollectionJspRelativeFileName(aResource))
+/]
+
+[query public resourceCollectionJspRelativeFileName(aResource: Resource) : String =
+jspFilesWebappPath(aResource.eContainer(AdaptorInterface)).concat('/').concat(aResource.name.toLower()).concat('collection_html').concat('.jsp')
+/]
+[query public resourceCollectionJspFullFileName(aResource: Resource) : String =
+jspFilesBasePath(aResource.eContainer(AdaptorInterface)).concat(resourceCollectionJspRelativeFileName(aResource))
+/]
+
+[query public getResourceJspRelativeFileName(aResource: Resource) : String =
+jspFilesWebappPath(aResource.eContainer(AdaptorInterface)).concat('/').concat(aResource.name.toLower()).concat('_html').concat('.jsp')
+/]
+[query public getResourceJspFullFileName(aResource: Resource) : String =
+jspFilesBasePath(aResource.eContainer(AdaptorInterface)).concat(getResourceJspRelativeFileName(aResource))
+/]
+
+[query public resourceCreatorJspRelativeFileName(aResource: Resource) : String =
+jspFilesWebappPath(aResource.eContainer(AdaptorInterface)).concat('/').concat(aResource.name.toLower()).concat('creator_html').concat('.jsp')
+/]
+[query public resourceCreatorJspFullFileName(aResource: Resource) : String =
+jspFilesBasePath(aResource.eContainer(AdaptorInterface)).concat(resourceCreatorJspRelativeFileName(aResource))
+/]
+
+[query public resourceSelectorJspRelativeFileName(aResource: Resource) : String =
+jspFilesWebappPath(aResource.eContainer(AdaptorInterface)).concat('/').concat(aResource.name.toLower()).concat('selector_html').concat('.jsp')
+/]
+[query public resourceSelectorJspFullFileName(aResource: Resource) : String =
+jspFilesBasePath(aResource.eContainer(AdaptorInterface)).concat(resourceSelectorJspRelativeFileName(aResource))
+/]
+
+[query public serviceProviderCatalogJspRelativeFileName(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+jspFilesWebappPath(containingAdaptorInterface(aServiceProviderCatalog)).concat('/').concat('serviceProviderCatalog_html').concat('.jsp')
+/]
+[query public serviceProviderCatalogJspFullFileName(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+jspFilesBasePath(containingAdaptorInterface(aServiceProviderCatalog)).concat(serviceProviderCatalogJspRelativeFileName(aServiceProviderCatalog))
+/]
+
+[query public serviceProviderJspRelativeFileName(aServiceProvider : ServiceProvider) : String =
+jspFilesWebappPath(aServiceProvider.eContainer(AdaptorInterface)).concat('/').concat('serviceProvider_html').concat('.jsp')
+/]
+[query public serviceProviderJspFullFileName(aServiceProvider : ServiceProvider) : String =
+jspFilesBasePath(aServiceProvider.eContainer(AdaptorInterface)).concat(serviceProviderJspRelativeFileName())
+/]
+
+[comment TODO: I need to work out how to properly set hte javascript path. This is hard-coded :-)/]
+[query public delegatedUIJavaScriptsRelativeFileName(anAdaptorInterface : AdaptorInterface) : String =
+'delegatedUI'.concat('.js')
+/]
+[query public delegatedUIJavaScriptsFullFileName(anAdaptorInterface : AdaptorInterface) : String =
+javascriptFilesBasePath(anAdaptorInterface).concat('/').concat(delegatedUIJavaScriptsRelativeFileName(anAdaptorInterface))
+/]
+
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl
new file mode 100644
index 0000000..b6a3ecd
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl
@@ -0,0 +1,231 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module resourcePropertyServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::resourceServices/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[query public definingDomainSpecification(aProperty: ResourceProperty) : DomainSpecification =
+aProperty.eContainer(DomainSpecification)
+/]
+
+[comment TODO: "URI" should actually not be a valueType since it is not OSLC-standard. However, this is one way to allow user to specify a URI as a type.
+Another approach would be to have a valueType as String, and the Range being set to "URI", hence creating a URI (local) resource?
+But I really want the user to be able to map to java.net.URI, just like they can map to String or Boolean - without having to create a resource for that. /]
+[query public hasOSLCSupportedValueType(aProperty: ResourceProperty) : Boolean =
+not (Sequence{'URI'}->includes(aProperty.valueType.toString()))
+/]
+
+[query public nameAnnotation(aProperty: ResourceProperty) : String =
+'@OslcName("'.concat(aProperty.name). concat('")')
+/]
+
+[query public propertyDefinitionAnnotation(aProperty: ResourceProperty, aResource: Resource) : String =
+'@OslcPropertyDefinition('.concat(javaInterfaceNameForAdaptorConstants(aResource.eContainer(AdaptorInterface))).concat('.').concat(domainSpecificationNamespaceConstantName(aProperty.definingDomainSpecification())) . concat(' + "').concat(aProperty.name).concat('")')
+/]
+
+[query public descriptionAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.description.oclIsUndefined()) then
+ '@OslcDescription("'.concat(aProperty.description).concat('")')
+else
+ ''
+endif)
+/]
+
+[query public occursAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.occurs.oclIsUndefined()) then
+ if (aProperty.occurs = ResourcePropertyOccurs::exactlyOne) then
+ '@OslcOccurs(Occurs.ExactlyOne)'
+ else
+ if (aProperty.occurs = ResourcePropertyOccurs::zeroOrOne) then
+ '@OslcOccurs(Occurs.ZeroOrOne)'
+ else
+ if (aProperty.occurs = ResourcePropertyOccurs::zeroOrMany) then
+ '@OslcOccurs(Occurs.ZeroOrMany)'
+ else
+ if (aProperty.occurs = ResourcePropertyOccurs::oneOrMany) then
+ '@OslcOccurs(Occurs.OneOrMany)'
+ else
+ ''
+ endif
+ endif
+ endif
+ endif
+else
+ ''
+endif)
+/]
+
+[query public valueTypeAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.valueType.oclIsUndefined()) then
+ if (hasOSLCSupportedValueType(aProperty)) then
+ '@OslcValueType(ValueType.'.concat(aProperty.valueType.toString()).concat(')')
+ else
+ ''
+ endif
+else
+ ''
+endif)
+/]
+
+[query public representationAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.representation.oclIsUndefined()) then
+ if (aProperty.representation.toString().equalsIgnoreCase('representation.n/a')) then
+ '@OslcRepresentation(Representation.'.concat(aProperty.representation.toString().toUpperFirst()).concat(')')
+ else
+ ''
+ endif
+else
+ ''
+endif)
+/]
+
+[query public rangeAnnotation(aProperty: ResourceProperty, aResource: Resource) : String =
+(if (not aProperty.range.oclIsUndefined()) then
+ '@OslcRange('.concat(javaInterfaceNameForAdaptorConstants(aResource.eContainer(AdaptorInterface))).concat('.').concat(resourceTypeConstantName(aProperty.range)).concat(')')
+else
+ ''
+endif)
+/]
+
+[query public readOnlyAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.readOnly.oclIsUndefined()) then
+ '@OslcReadOnly('.concat(aProperty.readOnly.toString()).concat(')')
+else
+ ''
+endif)
+/]
+
+[query public titleAnnotation(aProperty: ResourceProperty) : String =
+(if (not aProperty.title.oclIsUndefined()) then
+ '@OslcTitle("'.concat(aProperty.title).concat('")')
+else
+ ''
+endif)
+/]
+
+[query public prefixedName(aProperty: ResourceProperty) : String =
+aProperty.definingDomainSpecification().namespacePrefix.name.concat(':').concat(aProperty.name)
+/]
+
+[query public typeURI(aProperty: ResourceProperty) : String =
+aProperty.definingDomainSpecification().namespaceURI.concat('#').concat(aProperty.name)
+/]
+
+[query public javaAttributeTypeNeedsConstruction(aProperty: ResourceProperty) : Boolean =
+Sequence{'Resource', 'LocalResource'}->includes(aProperty.valueType.toString())._or(Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString()))
+/]
+
+[query public javaAttributeBaseTypeCastFromString(aProperty: ResourceProperty, variable: String) : String =
+ (if (aProperty.valueType.toString() = 'String') then
+ variable
+ else
+ if (aProperty.valueType.toString() = 'XMLLiteral') then
+ variable
+ else
+ if(aProperty.valueType.toString() = 'DateTime') then
+ 'new SimpleDateFormat().parse(' + variable + ')'
+ else
+ if(aProperty.valueType.toString() = 'URI') then
+ 'new URI(' + variable + ')'
+ else
+ if(aProperty.valueType.toString() = 'Boolean') then
+ 'new Boolean(' + variable + ')'
+ else
+ if(aProperty.valueType.toString() = 'Resource') then
+ 'new Link(new URI(' + variable + '))'
+ else
+ if(aProperty.valueType.toString() = 'LocalResource') then
+ if (not aProperty.range.oclIsUndefined()) then
+ 'new ' + javaClassName(aProperty.range) + '(new URI(' + variable + '))'
+ else
+ 'new Link(new URI(' + variable + '))'
+ endif
+ else
+ ''
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif)
+/]
+
+
+[comment TODO: If occurs = 'zeroOrMany', it is not 100% clear when to use Set and when to use ArrayList, or TreeSet./]
+[query public javaAttributeTypeDeclaration(aProperty: ResourceProperty) : String =
+ (if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString())) then
+ 'HashSet<'
+ else
+ ''
+ endif)
+ .concat(javaAttributeBaseType(aProperty))
+ .concat(
+ (if (Sequence{'zeroOrMany', 'oneOrMany'}->includes(aProperty.occurs.toString())) then
+ '>'
+ else
+ ''
+ endif))
+/]
+
+[comment For Resource properties, we always have a Link type. That is how OSLC4 wants it. /]
+[query public javaAttributeBaseType(aProperty: ResourceProperty) : String =
+ (if (aProperty.valueType.toString() = 'String') then
+ 'String'
+ else
+ if (aProperty.valueType.toString() = 'XMLLiteral') then
+ 'String'
+ else
+ if(aProperty.valueType.toString() = 'DateTime') then
+ 'Date'
+ else
+ if(aProperty.valueType.toString() = 'URI') then
+ 'URI'
+ else
+ if(aProperty.valueType.toString() = 'Boolean') then
+ 'Boolean'
+ else
+ if(aProperty.valueType.toString() = 'Resource') then
+ 'Link'
+ else
+ if(aProperty.valueType.toString() = 'LocalResource') then
+ if (not aProperty.range.oclIsUndefined()) then
+ javaClassName(aProperty.range)
+ else
+ 'Link'
+ endif
+ else
+ ''
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif
+ endif)
+/]
+
+[template public javaAttributeName(aProperty: ResourceProperty, aResource: Resource)]
+[if (allProperties(aResource).name->count(aProperty.name) = 1)][aProperty.name /][else][aProperty.definingDomainSpecification().namespacePrefix.name.concat(aProperty.name.toUpperFirst()) /][/if][if (aProperty.occurs.toString() = 'zeroOrMany')]s[/if]
+[/template]
+
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl
new file mode 100644
index 0000000..461614a
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourceServices.mtl
@@ -0,0 +1,74 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module resourceServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+
+[query public definingDomainSpecification(aResource: Resource) : DomainSpecification =
+aResource.eContainer(DomainSpecification)
+/]
+
+[query public adaptorInterface(aResource: Resource) : AdaptorInterface =
+aResource.eContainer(AdaptorInterface)
+/]
+
+[query public allProperties(aResource: Resource) : Set(ResourceProperty) =
+aResource.resourceProperties->union(inheritedProperties(aResource))
+/]
+
+[query public inheritedProperties(aResource: Resource) : Set(ResourceProperty) =
+ (if (not aResource.extends.oclIsUndefined()) then
+ aResource.extends.resourceProperties->union(inheritedProperties(aResource.extends))
+ else
+ Set{}
+ endif)
+/]
+
+[query public prefixedName(aResource: Resource) : String =
+aResource.definingDomainSpecification().namespacePrefix.name.concat(':').concat(aResource.name)
+/]
+
+[comment TODO: in the Constants file, I generate constants that SHOULD match the URI developed here. But this code is not related to the way I generated the constants.
+Make sure this query and the Constants generation are based on the same set of base functions. THat is, make sure both functions produce matching URI values in the end. /]
+[query public typeURI(aResource: Resource) : String =
+aResource.definingDomainSpecification().namespaceURI.concat('#').concat(aResource.name)
+/]
+
+[query public javaClassPackageName(aResource: Resource) : String =
+javaClassBaseNamespace(adaptorInterface(aResource)).concat('.resources')
+/]
+
+[query public javaClassName(aResource: Resource) : String =
+aResource.name.toUpperFirst()
+/]
+
+[query public javaClassFullName(aResource: Resource) : String =
+javaClassPackageName(aResource).concat('.').concat(javaClassName(aResource))
+/]
+
+[query public javaClassFullFileName(aResource: Resource) : String =
+javaFilesBasePath(adaptorInterface(aResource)).concat(javaClassPackageName(aResource).substituteAll('.', '/')).concat('/').concat(javaClassName(aResource)).concat('.java')
+/]
+
+[template public parentJavaClassName(aResource: Resource)]
+[if (aResource.extends.oclIsUndefined())]AbstractResource[else][javaClassName(aResource.extends) /][/if]
+
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderCatalogServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderCatalogServices.mtl
new file mode 100644
index 0000000..75783ba
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderCatalogServices.mtl
@@ -0,0 +1,62 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module serviceProviderCatalogServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[query public containingServiceProviderCatalog(obj : OclAny) : ServiceProviderCatalog =
+obj.eContainer(ServiceProviderCatalog)
+/]
+
+[comment Services for serviceProviderCatalogSingleton /]
+[query public javaClassPackageNameForSingleton(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaClassBaseNamespace(containingAdaptorInterface(aServiceProviderCatalog)).concat('.servlet')
+/]
+
+[query public javaClassNameForSingleton(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+'ServiceProviderCatalogSingleton'
+/]
+
+[query public javaClassFullNameForSingleton(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaClassPackageNameForSingleton(aServiceProviderCatalog).concat('.').concat(javaClassNameForSingleton(aServiceProviderCatalog))
+/]
+
+[query public javaClassFullFileNameForSingleton(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaFilesBasePath(containingAdaptorInterface(aServiceProviderCatalog)).concat(javaClassPackageNameForSingleton(aServiceProviderCatalog).substituteAll('.', '/')).concat('/').concat(javaClassNameForSingleton(aServiceProviderCatalog)).concat('.java')
+/]
+
+[comment Services for serviceProviderCatalogService /]
+[query public javaClassPackageNameForService(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaClassBaseNamespace(containingAdaptorInterface(aServiceProviderCatalog)).concat('.services')
+/]
+
+[query public javaClassNameForService(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+'ServiceProviderCatalogService'
+/]
+
+[query public javaClassFullNameForService(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaClassPackageNameForService(aServiceProviderCatalog).concat('.').concat(javaClassNameForService(aServiceProviderCatalog))
+/]
+
+[query public javaClassFullFileNameForService(aServiceProviderCatalog : ServiceProviderCatalog) : String =
+javaFilesBasePath(containingAdaptorInterface(aServiceProviderCatalog)).concat(javaClassPackageNameForService(aServiceProviderCatalog).substituteAll('.', '/')).concat('/').concat(javaClassNameForService(aServiceProviderCatalog)).concat('.java')
+/]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderServices.mtl
new file mode 100644
index 0000000..717ef13
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceProviderServices.mtl
@@ -0,0 +1,42 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module serviceProviderServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[comment Services for serviceProviderService /]
+[query public javaClassPackageNameForService(aServiceProvider : ServiceProvider) : String =
+javaClassBaseNamespace(containingAdaptorInterface(aServiceProvider)).concat('.services')
+/]
+
+[query public javaClassNameForService(aServiceProvider : ServiceProvider) : String =
+'ServiceProviderService'
+/]
+
+[query public javaClassFullNameForService(aServiceProvider : ServiceProvider) : String =
+javaClassPackageNameForService(aServiceProvider).concat('.').concat(javaClassNameForService(aServiceProvider))
+/]
+
+[query public javaClassFullFileNameForService(aServiceProvider : ServiceProvider) : String =
+javaFilesBasePath(containingAdaptorInterface(aServiceProvider)).concat(javaClassPackageNameForService(aServiceProvider).substituteAll('.', '/')).concat('/').concat(javaClassNameForService(aServiceProvider)).concat('.java')
+/]
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceServices.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceServices.mtl
new file mode 100644
index 0000000..ecd98c5
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/serviceServices.mtl
@@ -0,0 +1,57 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module serviceServices('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::services::adaptorInterfaceServices/]
+
+[comment Services for service /]
+
+
+[query public managedResources(aService: Service) : Set(Resource) =
+aService.creationFactories.resourceTypes->asSet()
+ ->union(aService.queryCapabilities.resourceTypes->asSet())
+ ->union(aService.creationDialogs.resourceTypes->asSet())
+ ->union(aService.selectionDialogs.resourceTypes->asSet())
+/]
+
+[comment TODO: this service code-generation assumes that all ResourceTypes of all factories/queries/dialogs in the same are the same, and there is a single resourceType.
+Change, so that a service class is generated for each resourceType value specified. Of course, Only factories/queries/dialogs that specify that particular resourceType get generated./]
+[query public coveredResource(aService: Service) : Resource =
+managedResources(aService)->any(true)
+/]
+
+[query public javaClassPackageName(aService : Service) : String =
+javaClassBaseNamespace(containingAdaptorInterface(aService)).concat('.services')
+/]
+
+[query public javaClassName(aService : Service) : String =
+coveredResource(aService).name.toUpperFirst().concat('Service')
+/]
+
+[query public javaClassFullName(aService : Service) : String =
+javaClassPackageName(aService).concat('.').concat(javaClassName(aService))
+/]
+
+[query public javaClassFullFileName(aService : Service) : String =
+javaFilesBasePath(containingAdaptorInterface(aService)).concat(javaClassPackageName(aService).substituteAll('.', '/')).concat('/').concat(javaClassName(aService)).concat('.java')
+/]
+
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl
new file mode 100644
index 0000000..e9a8489
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/services.mtl
@@ -0,0 +1,42 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module services('org.eclipse.lyo.oslc4j.adaptorInterface')/]
+
+[query public javaClassBaseNamespace(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.javaClassBaseNamespace
+/]
+
+[query public javaFilesBasePath(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.javaFilesBasePath
+/]
+
+[query public jspFilesBasePath(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.jspFilesBasePath
+/]
+
+[query public javascriptFilesBasePath(anAdaptorInterface : AdaptorInterface) : String =
+anAdaptorInterface.javascriptFilesBasePath
+/]
+
+
+[query public jspFilesWebappPath(anAdaptorInterface : AdaptorInterface) : String =
+'/'.concat(javaClassBaseNamespace(anAdaptorInterface)).substituteAll('.', '/')
+/]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEDLV10HTML.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEDLV10HTML.mtl
new file mode 100644
index 0000000..3839cc6
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEDLV10HTML.mtl
@@ -0,0 +1,87 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateEDLV10HTML('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+
+[template public generateEDLV10HTML(anAdaptorInterface : AdaptorInterface)]
+[file ('license/edl-v10.html', false, 'UTF-8')]
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Distribution License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<p><b>Eclipse Distribution License - v 1.0</b></p>
+
+<p>Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. </p>
+
+<p>All rights reserved.</p>
+<p>Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+<ul><li>Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer. </li>
+<li>Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution. </li>
+<li>Neither the name of the Eclipse Foundation, Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission. </li></ul>
+</p>
+<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.</p>
+
+</body>
+
+</html>
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEPLV10HTML.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEPLV10HTML.mtl
new file mode 100644
index 0000000..f8f36b3
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateEPLV10HTML.mtl
@@ -0,0 +1,287 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateEPLV10HTML('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+
+[template public generateEPLV10HTML(anAdaptorInterface : AdaptorInterface)]
+[file ('license/epl-v10.html', false, 'UTF-8')]
+<!--?xml version="1.0" encoding="ISO-8859-1" ?-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Eclipse Public License - Version 1.0</title>
+<style type="text/css">
+ body {
+ size: 8.5in 11.0in;
+ margin: 0.25in 0.5in 0.25in 0.5in;
+ tab-interval: 0.5in;
+ }
+ p {
+ margin-left: auto;
+ margin-top: 0.5em;
+ margin-bottom: 0.5em;
+ }
+ p.list {
+ margin-left: 0.5in;
+ margin-top: 0.05em;
+ margin-bottom: 0.05em;
+ }
+ </style>
+
+</head>
+
+<body lang="EN-US">
+
+<h2>Eclipse Public License - v 1.0</h2>
+
+<p>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.</p>
+
+<p><b>1. DEFINITIONS</b></p>
+
+<p>"Contribution" means:</p>
+
+<p class="list">a) in the case of the initial Contributor, the initial
+code and documentation distributed under this Agreement, and</p>
+<p class="list">b) in the case of each subsequent Contributor:</p>
+<p class="list">i) changes to the Program, and</p>
+<p class="list">ii) additions to the Program;</p>
+<p class="list">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.</p>
+
+<p>"Contributor" means any person or entity that distributes
+the Program.</p>
+
+<p>"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.</p>
+
+<p>"Program" means the Contributions distributed in accordance
+with this Agreement.</p>
+
+<p>"Recipient" means anyone who receives the Program under
+this Agreement, including all Contributors.</p>
+
+<p><b>2. GRANT OF RIGHTS</b></p>
+
+<p class="list">a) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+royalty-free copyright license to 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.</p>
+
+<p class="list">b) Subject to the terms of this Agreement, each
+Contributor hereby grants Recipient a non-exclusive, worldwide,
+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.</p>
+
+<p class="list">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.</p>
+
+<p class="list">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.</p>
+
+<p><b>3. REQUIREMENTS</b></p>
+
+<p>A Contributor may choose to distribute the Program in object code
+form under its own license agreement, provided that:</p>
+
+<p class="list">a) it complies with the terms and conditions of this
+Agreement; and</p>
+
+<p class="list">b) its license agreement:</p>
+
+<p class="list">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;</p>
+
+<p class="list">ii) effectively excludes on behalf of all Contributors
+all liability for damages, including direct, indirect, special,
+incidental and consequential damages, such as lost profits;</p>
+
+<p class="list">iii) states that any provisions which differ from this
+Agreement are offered by that Contributor alone and not by any other
+party; and</p>
+
+<p class="list">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.</p>
+
+<p>When the Program is made available in source code form:</p>
+
+<p class="list">a) it must be made available under this Agreement; and</p>
+
+<p class="list">b) a copy of this Agreement must be included with each
+copy of the Program.</p>
+
+<p>Contributors may not remove or alter any copyright notices contained
+within the Program.</p>
+
+<p>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.</p>
+
+<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p><b>5. NO WARRANTY</b></p>
+
+<p>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.</p>
+
+<p><b>6. DISCLAIMER OF LIABILITY</b></p>
+
+<p>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.</p>
+
+<p><b>7. GENERAL</b></p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+<p>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.</p>
+
+
+
+</body></html>
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateLicenseFiles.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateLicenseFiles.mtl
new file mode 100644
index 0000000..34cba5c
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateLicenseFiles.mtl
@@ -0,0 +1,32 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateLicenseFiles('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+[import org::eclipse::lyo::oslc4j::codegenerator::staticFiles::generateNoticeHTML/]
+[import org::eclipse::lyo::oslc4j::codegenerator::staticFiles::generateEDLV10HTML/]
+[import org::eclipse::lyo::oslc4j::codegenerator::staticFiles::generateEPLV10HTML/]
+
+[template public generateLicenseFiles(anAdaptorInterface : AdaptorInterface)]
+[anAdaptorInterface.generateNoticeHTML() /]
+[anAdaptorInterface.generateEDLV10HTML() /]
+[anAdaptorInterface.generateEPLV10HTML() /]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateNoticeHTML.mtl b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateNoticeHTML.mtl
new file mode 100644
index 0000000..f9143e6
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/staticFiles/generateNoticeHTML.mtl
@@ -0,0 +1,136 @@
+[comment encoding = UTF-8 /]
+[comment
+/*******************************************************************************
+ * Copyright (c) 2014 Jad El-khoury.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v. 1.0 which accompanies this distribution.
+ *
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ *
+ * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448)
+ *
+ *******************************************************************************/
+/]
+
+[module generateNoticeHTML('org.eclipse.lyo.oslc4j.adaptorInterface')]
+
+[import org::eclipse::lyo::oslc4j::codegenerator::services::services/]
+
+[template public generateNoticeHTML(anAdaptorInterface : AdaptorInterface)]
+[file ('license/notice.html', false, 'UTF-8')]
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>13 December, 2011</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also 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, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Eclipse Distribution License Version 1.0 (available at <a href="http://www.eclipse.org/licenses/edl-v10.html">http://www.eclipse.org/licenses/edl-v1.0.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
+[/file]
+[/template]
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/tasks/generate.xml b/org.eclipse.lyo.oslc4j.codegenerator/tasks/generate.xml
new file mode 100644
index 0000000..22a9829
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/tasks/generate.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project default="generate" name="org.eclipse.lyo.oslc4j.codegenerator">
+ <property name="ECLIPSE_HOME" value="../../../../../../Program Files/eclipse-kepler"/>
+ <property name="ECLIPSE_WORKSPACE" value="../../../../workspace"/>
+
+ <!-- The classpath with only the dependencies used by the project -->
+ <path id="org.eclipse.lyo.oslc4j.codegenerator.libraryclasspath">
+ <pathelement location="${ECLIPSE_WORKSPACE}/org.eclipse.lyo.oslc4j.codegenerator/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.9.0.v20130326-1255.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.9.1.v20130814-1242.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.300.v20130429-1813.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.200.v20130514-1256/runtime_registry_compatibility.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.301.v20130717-1549.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.5.100.v20130422-1538.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.200.v20130326-1255.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20130327-1442.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.9.1.v20130827-0309.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.9.1.v20130827-0309.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.9.1.v20130827-0309.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.3.0.v20130909-1552.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.common_1.1.0.v20130531-0544.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.3.0.v20130520-1222.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.4.1.201309031307.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.4.1.201309031307.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.profiler_3.4.1.201309031307.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.4.1.201309031307.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.9.1.v20130902-0605.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.9.0.v20130902-0605.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/com.google.guava_10.0.1.v201203051515.jar"/>
+ </path>
+
+ <path id="org.eclipse.lyo.oslc4j.codegenerator.classpath">
+ <path refid="org.eclipse.lyo.oslc4j.codegenerator.libraryclasspath"/>
+ </path>
+
+ <!-- The classpath with only the jars available in the plugin folder of Eclipse -->
+ <path id="org.eclipse.lyo.oslc4j.codegenerator.libraryclasspath.alljars">
+ <pathelement location="../org.eclipse.lyo.oslc4j.codegenerator/bin"/>
+ <fileset dir="${ECLIPSE_HOME}/plugins/" includes="*.jar"/>
+ </path>
+
+ <path id="org.eclipse.lyo.oslc4j.codegenerator.classpath.alljars">
+ <path refid="org.eclipse.lyo.oslc4j.codegenerator.libraryclasspath.alljars"/>
+ </path>
+
+ <!-- The default task with the jars used by this project -->
+ <target name="generate">
+ <java classname="org.eclipse.lyo.oslc4j.codegenerator.main.Generate" classpathref="org.eclipse.lyo.oslc4j.codegenerator.classpath">
+ <arg value="${model}"/>
+ <arg value="${target}"/>
+ </java>
+ </target>
+
+ <!--
+ In case of problem you can also try with all the jar available in your Eclipse
+ Keep in mind that having two versions of the same jar can create problems
+ -->
+ <target name="generate.alljars">
+ <java classname="org.eclipse.lyo.oslc4j.codegenerator.main.Generate" classpathref="org.eclipse.lyo.oslc4j.codegenerator.classpath">
+ <arg value="${model}"/>
+ <arg value="${target}"/>
+ </java>
+ </target>
+</project>
diff --git a/org.eclipse.lyo.oslc4j.codegenerator/tasks/generateTarget.xml b/org.eclipse.lyo.oslc4j.codegenerator/tasks/generateTarget.xml
new file mode 100644
index 0000000..a5502c5
--- /dev/null
+++ b/org.eclipse.lyo.oslc4j.codegenerator/tasks/generateTarget.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Place this file in the target project and call it with "External Tools > Run As > Ant Build" -->
+<!-- You have to change the MODEL and the TARGET values -->
+
+<project basedir="." default="generateSample" name="org.eclipse.lyo.oslc4j.codegeneratorSample">
+ <import file="../../org.eclipse.lyo.oslc4j.codegenerator/tasks/generate.xml"/>
+
+ <!-- Change the values of MODEL and TARGET to point to your model and output folder -->
+ <property name="MODEL" value="${basedir}/model/file.xmi"/>
+ <property name="TARGET" value="${basedir}/src-gen"/>
+
+ <target name="generateSample" description="Generate files in 'TARGET'">
+ <antcall target="generate" >
+ <param name="model" value="${MODEL}"/>
+ <param name="target" value="${TARGET}"/>
+ </antcall>
+ </target>
+</project>