Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
timspannairisdata committed Dec 30, 2016
1 parent de94c10 commit 1d3d241
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 38 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
/target/
/target/*.*
/.settings/
.DS_Store
.springBeans
.project
/src/main/resources/application.yml
/src/main/resources/application.properties
application.*
# Mobile Tools for Java (J2ME)
.mtj.tmp/
deploy.sh
*.pem

# Package Files #
*.jar
*.war
*.ear
*.nar
*.zip
*.tar
*.gz
*.cz
*.class

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
2 changes: 0 additions & 2 deletions all2.sh

This file was deleted.

13 changes: 0 additions & 13 deletions derby.log

This file was deleted.

1 change: 0 additions & 1 deletion scp.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/com/dataflowdeveloper/DataController.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static HttpServletRequest getCurrentRequest() {
HttpServletRequest servletRequest = ((ServletRequestAttributes) requestAttributes).getRequest();
Assert.state(servletRequest != null, "Could not find current HttpServletRequest");
return servletRequest;
}
}

Logger logger = LoggerFactory.getLogger(DataController.class);

Expand Down
14 changes: 9 additions & 5 deletions src/main/java/com/dataflowdeveloper/DataSourceService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import java.util.ArrayList;
import java.util.List;

import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -40,23 +38,29 @@ public PhillyCrime defaultValue() {
public List<PhillyCrime> search(String query) {

List<PhillyCrime> crimes = new ArrayList<>();
String sql = "";
try {
logger.error("Query: " + query);
logger.error("Limit:" + querylimit);
if ( connection == null ) {
logger.error("Null connection");
return crimes;
}
if ( query == null || query.trim().length() <= 0 ) {
query = "";
sql = "select * from phillycrime";
}
else {
query = "%" + query.toUpperCase() + "%";
sql = "select * from phillycrime WHERE upper(text_general_code) like ? LIMIT ?";
}

PreparedStatement ps = connection
.prepareStatement("select * from phillycrime WHERE upper(text_general_code) like ? LIMIT ?");
ps.setString(1, query);
ps.setInt(2, Integer.parseInt(querylimit));
.prepareStatement(sql);
if ( query.length() > 1 ) {
ps.setString(1, query);
ps.setInt(2, Integer.parseInt(querylimit));
}
ResultSet res = ps.executeQuery();
PhillyCrime crime = null;
while (res.next()) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/dataflowdeveloper/HBaseApplication.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
Expand Down Expand Up @@ -68,6 +66,7 @@ public Connection connection() {
try {
con = DriverManager.getConnection(databaseUri);
} catch (SQLException e) {
e.printStackTrace();
logger.error("Connection fail: ", e);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/dataflowdeveloper/PhillyCrime.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
text_general_code varchar,ucr_general varchar);
* @author tspann
*
*/
*/
public class PhillyCrime implements Serializable {

private static final long serialVersionUID = -2549969191580450272L;
Expand Down
Empty file modified src/main/java/com/dataflowdeveloper/Twitter2.java
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/java/com/dataflowdeveloper/TwitterService.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public TwitterProfile getUserProfile(String twitterUser) {
TwitterProfile userProfile = userOperations.getUserProfile(twitterUser);
return userProfile;
}
}
}
16 changes: 8 additions & 8 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
consumerkey=ql09tgU1MhvwJAsmI9vIYPxTB
consumersecret=4k7QphoGGlKBAsyhW9T9yKPYmlZ80djmAxRBPTithBSBNNN7F1
accesstoken=1006391-Yf9r2kVrblGnJeuZFdaj1vaATOB3wb707RUNqZlhOG
accesstokensecret=RZRsh4F1Td9gVX4W2KFnJk1JLTzkKWsjxGVEbNwuHxg26
consumerkey=q
consumersecret=4
accesstoken=100
accesstokensecret=R
server.port = 9999
querylimit=25
hiveuri=jdbc:hive2://localhost:10000/default
querylimit=250
hiveuri=jdbc:hive2://hiveserver:10000/default
hiveusername=root
hivepassword=
purl=jdbc:phoenix:localhost:2181:/hbase-unsecure
pdriver=org.apache.phoenix.jdbc.PhoenixDriver
purl=jdbc:phoenix:pserver:2181:/hbase-unsecure
pdriver=org.apache.phoenix.jdbc.PhoenixDriver
7 changes: 3 additions & 4 deletions src/main/resources/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
<body ng-app="myApp">
<b>Philly Crime Watch</b>
<br><br>
<div style="align: center; overflow:auto; height:300px; width:800px" class="white-frame" id="searchText">
To Query different crimes: http://localhost:9999/?query=Firearm
<br><br
<div class="white-frame" id="searchText">
<form method="get" action="">
<form method="get" action="/index.html">
Query: <input type="text" id="query" name="query" value=""> <input type="submit" name="Go">
</form>
</div>
<br>
<br><br>
<div class="white-frame" id="crime2" ng-app ng-controller="MyCtrl" style="align: center;overflow:auto;height:300px;width:800px">
<b>Recent Philadelphia Police Reports:</b><br><p>
<div ng-repeat="crime in crimelist">
Expand Down

0 comments on commit 1d3d241

Please sign in to comment.