Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
fixed docker file issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fulton committed Dec 18, 2019
1 parent 15319b6 commit 33dbd1c
Show file tree
Hide file tree
Showing 42 changed files with 12 additions and 104 deletions.
5 changes: 3 additions & 2 deletions .idea/artifacts/Ara_Server_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN ./gradlew build

FROM openjdk:11.0-jre
WORKDIR /app
COPY --from=build /app/bin/jar /app
COPY --from=build /app/build/libs /app
EXPOSE 80
ENTRYPOINT ["sh", "-c"]
CMD ["java -jar Ara-Server.jar"]
CMD ["java -jar Ara-Server-1.0-SNAPSHOT-all.jar"]
Binary file removed bin/jar/Ara-Server.jar
Binary file not shown.
Binary file removed bin/jar/FastInfoset-1.2.15.jar
Binary file not shown.
Binary file removed bin/jar/annotations-13.0.jar
Binary file not shown.
Binary file removed bin/jar/antlr-2.7.7.jar
Binary file not shown.
Binary file removed bin/jar/ara-server.Ara-Server.main.jar
Binary file not shown.
Binary file removed bin/jar/byte-buddy-1.10.2.jar
Binary file not shown.
Binary file removed bin/jar/classmate-1.5.1.jar
Binary file not shown.
Binary file removed bin/jar/dom4j-2.1.1.jar
Binary file not shown.
Binary file removed bin/jar/gson-2.8.6.jar
Binary file not shown.
Binary file removed bin/jar/hamcrest-core-1.3.jar
Binary file not shown.
Binary file not shown.
Binary file removed bin/jar/istack-commons-runtime-3.0.7.jar
Binary file not shown.
Binary file removed bin/jar/jandex-2.1.1.Final.jar
Binary file not shown.
Binary file removed bin/jar/javassist-3.24.0-GA.jar
Binary file not shown.
Binary file removed bin/jar/javax.activation-api-1.2.0.jar
Binary file not shown.
Binary file removed bin/jar/javax.persistence-api-2.2.jar
Binary file not shown.
Binary file removed bin/jar/jaxb-api-2.3.1.jar
Binary file not shown.
Binary file removed bin/jar/jaxb-runtime-2.3.1.jar
Binary file not shown.
Binary file removed bin/jar/jboss-logging-3.3.2.Final.jar
Binary file not shown.
Binary file not shown.
Binary file removed bin/jar/jdom2-2.0.6.jar
Binary file not shown.
Binary file removed bin/jar/junit-4.12.jar
Binary file not shown.
Binary file removed bin/jar/kotlin-stdlib-1.3.50.jar
Binary file not shown.
Binary file removed bin/jar/kotlin-stdlib-common-1.3.50.jar
Binary file not shown.
Binary file removed bin/jar/kotlin-stdlib-jdk7-1.3.50.jar
Binary file not shown.
Binary file removed bin/jar/kotlin-stdlib-jdk8-1.3.50.jar
Binary file not shown.
Binary file removed bin/jar/mssql-jdbc-7.4.1.jre11.jar
Binary file not shown.
Binary file removed bin/jar/nanohttpd-2.3.1.jar
Binary file not shown.
Binary file removed bin/jar/okio-2.2.2.jar
Binary file not shown.
Binary file removed bin/jar/opennlp-tools-1.9.1.jar
Binary file not shown.
Binary file removed bin/jar/postgresql-9.1-901-1.jdbc4.jar
Binary file not shown.
Binary file removed bin/jar/rome-1.12.1.jar
Binary file not shown.
Binary file removed bin/jar/rome-utils-1.12.1.jar
Binary file not shown.
Binary file removed bin/jar/slf4j-api-1.7.29.jar
Binary file not shown.
Binary file removed bin/jar/sparc-3.3.0-v3346.jar
Binary file not shown.
Binary file removed bin/jar/stax-ex-1.8.jar
Binary file not shown.
Binary file removed bin/jar/txw2-2.3.1.jar
Binary file not shown.
9 changes: 7 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'application'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'com.github.johnrengelman.shadow' version '5.0.0'
//id ("com.gradle.build-scan").version("2.4.2")

// ./gradlew :refreshVersions
Expand All @@ -11,12 +12,16 @@ plugins {
application {
mainClassName('com.andromeda.araserver.Run')
}
jar {
mainClassName = 'com.andromeda.araserver.Run'
jar {
manifest {
attributes(
'Main-Class': 'com.andromeda.araserver.Run'
'Main-Class': mainClassName
)

}
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
}

group 'ara-server'
Expand Down
Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
98 changes: 0 additions & 98 deletions src/main/java/com/andromeda/araserver/pages/ApiStart.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,104 +35,6 @@ public String apiMain(String mainUri, KeyWord keyWord, Parser parse) {
return new MsSql().getSkills(term, searchterm, keyWord, parse);//ParseApi(searchterm);
}

private String ParseApi(String search) {
//text to be outputted
String out;
String term;
//parse for search term
ArrayList<String> pairs = new ArrayList<>(Arrays.asList(search.split("&")));
term = pairs.get(0);
System.out.println(term);
//connect to DB
try {
//get DB driver
Class.forName("org.postgresql.Driver");
//get connection
Connection c = getConnection();
Statement stmt = c.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM skills;");
// I dont know how this works but it does 😀
while (rs.next()) {
// get values from the data base
String start = rs.getString("start");
String endtxt = rs.getString("endtxt");
String link = rs.getString("link");
//Print to logs for debugging
System.out.println("start = " + start);
System.out.println("endtxt = " + endtxt);
System.out.println("link = " + link);
//to avoid a null pointer
SqlModel temsqlmodel = new SqlModel(start, endtxt, link);
sqlmodel.add(temsqlmodel);
System.out.println();
}


} catch (Exception e) {
//print errors
e.printStackTrace();
System.err.println(e.getClass().getName() + ": " + e.getMessage());
return new Gson().toJson(outputModels);
}
System.out.println("Opened database successfully");
System.out.println(search);
//figure out what links to go to
for (SqlModel sqlModel : sqlmodel) {
System.out.println(sqlModel.description);
System.out.println(search.startsWith(sqlModel.description));

assert term != null;
if (search.startsWith(sqlModel.description) || search.equals(sqlModel.description)) {
System.out.println("Hiiiiiiii");
linkval = sqlModel.link + "/" + search.replace(sqlModel.description, "");
System.out.println(linkval);
break;
}
if (!"".equals(sqlModel.title) && term.endsWith(sqlModel.title)) {
linkval = sqlModel.link + "/" + search.replace(sqlModel.title, "");

break;
}
}
// parse to avoid errors
if (linkval == null) linkval = "https://araserver.herokuapp.com/searcht/" + search;
linkval = linkval.replace(" ", "");
System.out.println(linkval);
String url = linkval;
URL obj;
String result;
try {
//get data from correct link
obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
System.out.println("\nSending 'GET' request to URL : " + url);
System.out.println("Response Code : " + responseCode);
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();

while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
Scanner s = new Scanner(in).useDelimiter("\\A");
result = s.hasNext() ? s.next() : "";
System.out.println(result + "hi");
in.close();
//print result
out = response.toString();
System.out.println(out);
} catch (Exception e) {
//get the problems
e.printStackTrace();
//print error msg
out = new Gson().toJson(outputModels);
}
//return the output
return out;
}
private static Connection getConnection() throws SQLException {
//get a SQL connection (Note these creds are for test DB)
String dbUrl = "jdbc:postgresql://" + "ec2-54-221-214-3.compute-1.amazonaws.com" + ':' + "5432" + "/d40qc3ivndkhlh" + "?ssl=true" + "&sslfactory=org.postgresql.ssl.NonValidatingFactory";
Expand Down

0 comments on commit 33dbd1c

Please sign in to comment.