Skip to content

Commit 0abbf11

Browse files
author
Jonathan
committed
Finished REST.
REST Wrapper for the Generator Java Client to make REST request to the generator Javascript client to make REST requests to the generator
1 parent 9e80bfd commit 0abbf11

10 files changed

+262
-44
lines changed

src/ca/concordia/cse/gipsy/ws/rest/RestJSClient.html renamed to WebContent/RestJSClient.html

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
requester.onreadystatechange = function() {
1818
if (this.readyState == 4 && this.status == 200) {
1919
toCallOnSuccess();
20-
} else if (this.status == 404) {
20+
} else if (this.readyState == 4 && this.status == 404) {
2121
document.getElementById("error").innerHTML = "The file you have requested hasn't been generated yet. Please generate them first.";
22-
} else {
22+
} else if (this.readyState == 4) {
2323
document.getElementById("error").innerHTML = "An error happened during the request. HTTP Code: " + this.status;
2424
}
2525
};
@@ -34,9 +34,10 @@
3434
}
3535

3636
function generateFiles() {
37-
if (document.getElementById("solutionListDepths").innerHTML) {
38-
const depths = document.getElementById("solutionListDepths").innerHTML.split(',');
39-
let solutionsListParsed = [];
37+
let solutionsListParsed = [];
38+
39+
if (document.getElementById("solutionListDepths").value) {
40+
const depths = document.getElementById("solutionListDepths").value.split(',');
4041

4142
for (let i = 0; i < depths.length; i++) {
4243
if (!isNaN(parseInt(depths[i]))) {
@@ -48,9 +49,9 @@
4849
}
4950

5051
const parameters = {
51-
numberOfConcepts: document.getElementById("numberOfConcepts").innerHTML || 10000,
52-
numberOfServices: document.getElementById("numberOfServices").innerHTML || 4000,
53-
solvableProblem: document.getElementById("isSolvable").innerHTML == 'true' ? true : false,
52+
numberOfConcepts: document.getElementById("numberOfConcepts").value || 10000,
53+
numberOfServices: document.getElementById("numberOfServices").value || 4000,
54+
solvableProblem: document.getElementById("isSolvable").value == 'true' ? true : false,
5455
solutionsList: solutionsListParsed
5556
};
5657

@@ -61,34 +62,34 @@
6162
}
6263

6364
function getWSDL() {
64-
makeRequest('GET', restAPIURL + 'gen/wsdl', undefined, function() {
65-
window.open(restAPIURL + 'gen/wsdl', '_blank');
65+
makeRequest('GET', restAPIURL + '/gen/wsdl', undefined, function() {
66+
window.open(restAPIURL + '/gen/wsdl', '_blank');
6667
});
6768
}
6869

6970
function getWSLA() {
70-
makeRequest('GET', restAPIURL + 'gen/wsla', undefined, function() {
71-
window.open(restAPIURL + 'gen/wsla', '_blank');
71+
makeRequest('GET', restAPIURL + '/gen/wsla', undefined, function() {
72+
window.open(restAPIURL + '/gen/wsla', '_blank');
7273
});
7374
}
7475

7576
function getOWL() {
76-
makeRequest('GET', restAPIURL + 'gen/owl', undefined, function() {
77-
window.open(restAPIURL + 'gen/owl', '_blank');
77+
makeRequest('GET', restAPIURL + '/gen/owl', undefined, function() {
78+
window.open(restAPIURL + '/gen/owl', '_blank');
7879
});
7980
}
8081

8182
function getBPEL() {
82-
makeRequest('GET', restAPIURL + 'gen/bpel', undefined, function() {
83-
window.open(restAPIURL + 'gen/bpel', '_blank');
83+
makeRequest('GET', restAPIURL + '/gen/bpel', undefined, function() {
84+
window.open(restAPIURL + '/gen/bpel', '_blank');
8485
});
8586
}
8687

8788
function changedValue() {
8889
if (document.getElementById("isSolvable").value == 'true') {
89-
document.getElementById("solutionListDepths").style.display = 'block';
90+
document.getElementById("labelSolutionDepths").style.display = 'block';
9091
} else {
91-
document.getElementById("solutionListDepths").style.display = 'none';
92+
document.getElementById("labelSolutionDepths").style.display = 'none';
9293
document.getElementById("solutionListDepths").value = '';
9394
}
9495
}
@@ -101,10 +102,22 @@ <h1>Javascript REST Client for WS-Gen</h1>
101102
<h3>Parameters for the Generator</h3>
102103
<p id="error" style="color: red;"></p>
103104
<p id="status"></p>
104-
<input id="numberOfConcepts" type="number"/>
105-
<input id="numberOfServices" type="number"/>
106-
<input id="isSolvable" type="text" onkeyup="changedValue"/>
107-
<input id="solutionListDepths" style="display: none;" type="text"/>
105+
<label>
106+
Number of concepts (integer):
107+
<input id="numberOfConcepts" type="number"/>
108+
</label>
109+
<label>
110+
Number of services (integer):
111+
<input id="numberOfServices" type="number"/>
112+
</label>
113+
<label>
114+
Is solvable (true or false)
115+
<input id="isSolvable" type="text" onkeyup="changedValue()"/>
116+
</label>
117+
<label id="labelSolutionDepths" style="display: none;">
118+
Solution list depths (integer separated by ,):
119+
<input id="solutionListDepths" type="text"/>
120+
</label>
108121
<button type="button" onclick="generateFiles()">Generate Files</button>
109122
<div id="divGetFiles" style="display: none;">
110123
<button type="button" onclick="getWSDL()">Download WSDL</button>

nbproject/ant-deploy.xml

Lines changed: 145 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,150 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4+
5+
Copyright (c) 2008, 2016 Oracle and/or its affiliates. All rights reserved.
6+
7+
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8+
Other names may be trademarks of their respective owners.
9+
10+
The contents of this file are subject to the terms of either the GNU
11+
General Public License Version 2 only ("GPL") or the Common
12+
Development and Distribution License("CDDL") (collectively, the
13+
"License"). You may not use this file except in compliance with the
14+
License. You can obtain a copy of the License at
15+
http://www.netbeans.org/cddl-gplv2.html
16+
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17+
specific language governing permissions and limitations under the
18+
License. When distributing the software, include this License Header
19+
Notice in each file and include the License file at
20+
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
21+
particular file as subject to the "Classpath" exception as provided
22+
by Oracle in the GPL Version 2 section of the License file that
23+
accompanied this code. If applicable, add the following below the
24+
License Header, with the fields enclosed by brackets [] replaced by
25+
your own identifying information:
26+
"Portions Copyrighted [year] [name of copyright owner]"
27+
28+
If you wish your version of this file to be governed by only the CDDL
29+
or only the GPL Version 2, indicate your decision by adding
30+
"[Contributor] elects to include this software in this distribution
31+
under the [CDDL or GPL Version 2] license." If you do not indicate a
32+
single choice of license, a recipient has the option to distribute
33+
your version of this file under either the CDDL, the GPL Version 2 or
34+
to extend the choice of license to its licensees as provided above.
35+
However, if you add GPL Version 2 code and therefore, elected the GPL
36+
Version 2 license, then the option applies only if the new code is
37+
made subject to such option by the copyright holder.
38+
39+
Contributor(s):
40+
-->
241
<project default="-deploy-ant" basedir=".">
3-
<target name="-deploy-ant" if="deploy.ant.enabled">
4-
<fail message="Deploy is not supported for the current target server"/>
42+
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
43+
<property file="${deploy.ant.properties.file}" />
44+
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
45+
<available file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" property="glassfish.web.present"/>
46+
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
47+
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
48+
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
549
</target>
6-
<target name="-undeploy-ant" if="deploy.ant.enabled">
7-
<fail message="Undeploy is not supported for the current target server"/>
50+
51+
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
52+
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
53+
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
54+
<!-- The doctype triggers resolution which can fail -->
55+
<replace file="${temp.sun.web}">
56+
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
57+
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
58+
</replace>
59+
<replace file="${temp.sun.web}">
60+
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
61+
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
62+
</replace>
63+
<xmlproperty file="${temp.sun.web}" validate="false">
64+
</xmlproperty>
65+
<delete file="${temp.sun.web}"/>
66+
<condition property="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
67+
<isset property="sun-web-app.context-root"/>
68+
</condition>
69+
<condition property="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}" else="/${ant.project.name}">
70+
<isset property="sun-web-app.context-root"/>
71+
</condition>
72+
</target>
73+
<target name="-parse-glassfish-web" depends="-init-cl-deployment-env" if="glassfish.web.present">
74+
<tempfile prefix="gfv3" property="temp.gf.web" destdir="${java.io.tmpdir}"/>
75+
<copy file="${deploy.ant.docbase.dir}/WEB-INF/glassfish-web.xml" tofile="${temp.gf.web}"/>
76+
<!-- The doctype triggers resolution which can fail -->
77+
<replace file="${temp.gf.web}">
78+
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
79+
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
80+
</replace>
81+
<replace file="${temp.gf.web}">
82+
<replacetoken><![CDATA[<glassfish-web-app]]></replacetoken>
83+
<replacevalue><![CDATA[--> <glassfish-web-app]]></replacevalue>
84+
</replace>
85+
<xmlproperty file="${temp.gf.web}" validate="false">
86+
</xmlproperty>
87+
<delete file="${temp.gf.web}"/>
88+
<condition property="deploy.ant.client.url" value="${gfv3.url}${glassfish-web-app.context-root}" else="${gfv3.url}/${ant.project.name}">
89+
<isset property="glassfish-web-app.context-root"/>
90+
</condition>
91+
<condition property="deploy.context.root.argument" value="&amp;contextroot=${glassfish-web-app.context-root}" else="/${ant.project.name}">
92+
<isset property="glassfish-web-app.context-root"/>
93+
</condition>
94+
</target>
95+
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
96+
<property name="deploy.context.root.argument" value=""/>
97+
</target>
98+
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
99+
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
100+
<mkdir dir="${gfv3.resources.dir}"/>
101+
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
102+
<copy todir="${gfv3.resources.dir}/META-INF">
103+
<fileset dir="${deploy.ant.resource.dir}"/>
104+
</copy>
105+
<jar destfile="${deploy.ant.archive}" update="true">
106+
<fileset dir="${gfv3.resources.dir}"/>
107+
</jar>
108+
<delete dir="${gfv3.resources.dir}"/>
109+
</target>
110+
<target name="-deploy-ant" depends="-parse-glassfish-web, -parse-sun-web, -no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
111+
<antcall target="-deploy-without-pw"/>
112+
<antcall target="-deploy-with-pw"/>
113+
</target>
114+
115+
<target name="-deploy-without-pw" unless="gfv3.password">
116+
<echo message="Deploying ${deploy.ant.archive}"/>
117+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
118+
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
119+
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
120+
dest="${gfv3.results.file}"/>
121+
<delete file="${gfv3.results.file}"/>
122+
</target>
123+
<target name="-deploy-with-pw" if="gfv3.password">
124+
<echo message="Deploying ${deploy.ant.archive}"/>
125+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
126+
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
127+
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
128+
dest="${gfv3.results.file}"/>
129+
<delete file="${gfv3.results.file}"/>
130+
</target>
131+
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
132+
<antcall target="-undeploy-without-pw"/>
133+
<antcall target="-undeploy-with-pw"/>
134+
</target>
135+
136+
<target name="-undeploy-without-pw" unless="gfv3.password">
137+
<echo message="Undeploying ${deploy.ant.archive}"/>
138+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
139+
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
140+
dest="${gfv3.results.file}"/>
141+
<delete file="${gfv3.results.file}"/>
142+
</target>
143+
<target name="-undeploy-with-pw" if="gfv3.password">
144+
<echo message="Undeploying ${deploy.ant.archive}"/>
145+
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
146+
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
147+
dest="${gfv3.results.file}"/>
148+
<delete file="${gfv3.results.file}"/>
8149
</target>
9150
</project>

nbproject/build-impl.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
1919
-->
2020
<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="WSC09Platform-impl">
21+
<import file="jaxws-build.xml"/>
22+
<import file="rest-build.xml"/>
2123
<import file="ant-deploy.xml"/>
2224
<fail message="Please build using Ant 1.7.1 or higher.">
2325
<condition>
@@ -997,6 +999,9 @@ exists or setup the property manually. For example like this:
997999
<copyfiles files="${file.reference.xalan-2.7.0.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
9981000
<copyfiles files="${file.reference.xercesImpl-2.8.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
9991001
<copyfiles files="${file.reference.dom4j-1.6.1.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
1002+
<copyfiles files="${file.reference.jackson-annotations-2.9.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
1003+
<copyfiles files="${file.reference.jackson-core-2.9.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
1004+
<copyfiles files="${file.reference.jackson-databind-2.9.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
10001005
<mkdir dir="${build.web.dir}/META-INF"/>
10011006
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
10021007
</target>
@@ -1014,6 +1019,9 @@ exists or setup the property manually. For example like this:
10141019
<copyfiles files="${file.reference.xalan-2.7.0.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
10151020
<copyfiles files="${file.reference.xercesImpl-2.8.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
10161021
<copyfiles files="${file.reference.dom4j-1.6.1.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
1022+
<copyfiles files="${file.reference.jackson-annotations-2.9.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
1023+
<copyfiles files="${file.reference.jackson-core-2.9.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
1024+
<copyfiles files="${file.reference.jackson-databind-2.9.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
10171025
</target>
10181026
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
10191027
<delete dir="${build.web.dir}/WEB-INF/lib"/>

nbproject/genfiles.properties

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
build.xml.data.CRC32=0f6fb47b
1+
build.xml.data.CRC32=7b1a7c2c
22
build.xml.script.CRC32=bcdf5eca
3-
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
3+
build.xml.stylesheet.CRC32=651128d4@1.77.1.1
44
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
55
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6-
nbproject/build-impl.xml.data.CRC32=0f6fb47b
7-
nbproject/build-impl.xml.script.CRC32=a447f045
8-
nbproject/build-impl.xml.stylesheet.CRC32=[email protected]
6+
nbproject/build-impl.xml.data.CRC32=7b1a7c2c
7+
nbproject/build-impl.xml.script.CRC32=7965e830
8+
nbproject/build-impl.xml.stylesheet.CRC32=[email protected]
9+
nbproject/rest-build.xml.data.CRC32=0ab29f81
10+
nbproject/rest-build.xml.script.CRC32=c9ad12d8
11+
nbproject/rest-build.xml.stylesheet.CRC32=[email protected]
12+
nbproject/jaxws-build.xml.stylesheet.CRC32=6608c2cf

0 commit comments

Comments
 (0)