Skip to content

Commit

Permalink
OpenGDS Mobile Application Server 1.2 update
Browse files Browse the repository at this point in the history
 - 속성 테이블 검색 최적화
 - GeoServer 연결 아이디 변경 (root -> admin)
 - Mybatis 설정 변경
   > postgresql datasource id 변경
   > e-govframework 충돌 방지
 - servlet 설정 변경
 - Util 객체 삭제 (JSON -> Map)
   > JSONObject 로 모두 처리하도록 변경
 - 추가 기능 : TopoJSON 로드 
   > resource/webmapping/에 TopoJSON 파일 추가
   > GeoJsonDAO, GeoJsonServiceImp, GeoJsonService, PageController에 로드
가능하도록 기능 추가
 - PageController 객체 추가 
   > demo.jsp 호출 가능 (통합 예제 웹 어플리케이션)
  • Loading branch information
engintruder committed Aug 6, 2015
1 parent 1ff33cf commit b7b49fb
Show file tree
Hide file tree
Showing 27 changed files with 585 additions and 139 deletions.
75 changes: 38 additions & 37 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,37 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.wst.jsdt.core.javascriptValidator"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
7 changes: 6 additions & 1 deletion .project
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.wst.jsdt.core.javascriptValidator.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
Expand Down
1 change: 1 addition & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/webapp/WEB-INF/jsp/webmapping/demo.jsp=UTF-8
encoding//src/test/java=UTF-8
1 change: 1 addition & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
OpenGDS Application Server 1.0
OpenGDS Mobile Application Server 1.2
=================
> + Public Data Request/Response and GeoServer Connect Java Module
> + Experimental Web Server System
Expand All @@ -11,4 +11,4 @@ How to Install?
Dependent libraries
================
> Read... pom.xml
> pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import java.util.LinkedHashMap;
import java.util.List;

import org.json.simple.JSONObject;

public interface AttributeTableService {

List<LinkedHashMap<String, Object>> createAttr(HashMap<String, Object> tableName);
// List<LinkedHashMap<String, Object>> createAttr(HashMap<String, Object> tableName);
List<LinkedHashMap<String, Object>> createAttr(JSONObject tableName);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.openGDSMobileApplicationServer.service;

import org.json.simple.JSONObject;

public interface GeoJsonService {

JSONObject getLocation(JSONObject obj);

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import java.util.LinkedHashMap;
import java.util.List;

import org.json.simple.JSONObject;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
Expand All @@ -16,18 +18,17 @@
public class AttributeTableDAO extends EgovAbstractMapper {

@Autowired
@Qualifier("sqlSession-postgresql")
SqlSessionTemplate sess;


public List<LinkedHashMap<String, Object>> selectAttr(HashMap<String, Object> tableName) {
public List<LinkedHashMap<String, Object>> selectAttr(JSONObject tableName) {
List<LinkedHashMap<String, Object>> tableContentList = new ArrayList<LinkedHashMap<String,Object>>();
try{
tableContentList = sess.selectList("spatialMapper.attrTable", tableName);
}catch(Exception e){
tableContentList = null;
}
//System.out.println(tableContentList);

}
return tableContentList;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.openGDSMobileApplicationServer.service.impl;

import java.util.HashMap;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
Expand All @@ -21,17 +24,17 @@ public class AttributeTableServiceImp extends EgovAbstractServiceImpl implements
@Autowired
@Qualifier("attrDAO")
AttributeTableDAO at;
Logger log = LogManager.getLogger("org.springframework");

@Override
public List<LinkedHashMap<String, Object>> createAttr(HashMap<String, Object> tableName) {
public List<LinkedHashMap<String, Object>> createAttr(JSONObject tableName) {
List<LinkedHashMap<String, Object>> resultData = at.selectAttr(tableName);
ListIterator<LinkedHashMap<String, Object>> listItr = resultData.listIterator();
while(listItr.hasNext()){
LinkedHashMap<String, Object> tmp = listItr.next();
tmp.remove("geom");
}

System.out.println(resultData);
log.info(resultData);
return resultData;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.openGDSMobileApplicationServer.service.impl;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;

import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.springframework.stereotype.Repository;

@Repository("geojsondao")
public class GeoJsonDAO {


public JSONObject getGeoJSON(String location){
URL xmlLocation = this.getClass().getResource("/webmapping/geoBasedData/" + location + ".json");
JSONParser parser = new JSONParser();
Object obj = null;
try {
obj = parser.parse(new FileReader(xmlLocation.getPath()));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return (JSONObject) obj;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.openGDSMobileApplicationServer.service.impl;

import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.openGDSMobileApplicationServer.service.GeoJsonService;

@Service
public class GeoJsonServiceImp implements GeoJsonService {
@Autowired
@Qualifier("geojsondao")
GeoJsonDAO geojson;

@Override
public JSONObject getLocation(JSONObject obj) {
// TODO Auto-generated method stub
String location = (String) obj.get("jsonName");
JSONObject geojsonObj = geojson.getGeoJSON(location);
return geojsonObj;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
import it.geosolutions.geoserver.rest.GeoServerRESTReader;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Repository;


Expand All @@ -18,12 +20,12 @@ public class GeoServerManagerDAO{

GeoServerRESTPublisher publisher;
GeoServerRESTReader reader ;
Logger log = LogManager.getLogger("org.springframework");

GeoServerManagerDAO() throws MalformedURLException{
super();
publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
reader= new GeoServerRESTReader(RESTURL, RESTUSER, RESTPW);
System.out.println(reader.existGeoserver());
reader= new GeoServerRESTReader(RESTURL, RESTUSER, RESTPW);
}

public boolean geoserverCreateWorkspace(String name) {
Expand Down
37 changes: 0 additions & 37 deletions src/main/java/com/openGDSMobileApplicationServer/util/Util.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.openGDSMobileApplicationServer.web;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
Expand All @@ -12,7 +12,6 @@
import org.springframework.web.bind.annotation.ResponseBody;

import com.openGDSMobileApplicationServer.service.AttributeTableService;
import com.openGDSMobileApplicationServer.util.Util;


@Controller
Expand All @@ -22,15 +21,14 @@ public class AttributeTableController {
AttributeTableService ats;

@RequestMapping(headers="Content-Type=application/json", value="/attrTable.do", method=RequestMethod.POST)
public @ResponseBody Map<String, Object> attrTable(@RequestBody String JSONData){
public @ResponseBody Map<String, Object> attrSearchTable(@RequestBody JSONObject JSONData){
Map<String, Object> message = new HashMap<String, Object>();

try {
HashMap<String,Object> data = Util.convertJsonToObject(JSONData);
message.put("result", "OK");
message.put("message", null);
message.put("data", ats.createAttr(data));
} catch (IOException e) {
message.put("data", ats.createAttr(JSONData));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.web.bind.annotation.ResponseBody;

import com.openGDSMobileApplicationServer.service.GeoServerManagerService;
import com.openGDSMobileApplicationServer.util.Util;

@Controller
public class GeoServerManagerController {
Expand All @@ -37,10 +36,10 @@ public class GeoServerManagerController {
public @ResponseBody Map<String, Object> getLayerNames(@RequestBody String data){
Map<String, Object> message = new HashMap<String, Object>();
try {
Map<String,Object> Mapdata = Util.convertJsonToObject(data);
// Map<String,Object> Mapdata = Util.convertJsonToObject(data);
message.put("result", "OK");
message.put("message", null);
message.put("data", geoServerManagerObj.getLayerNames(Mapdata.get("wsName").toString()));
// message.put("data", geoServerManagerObj.getLayerNames(Mapdata.get("wsName").toString()));
return message;
} catch (Exception e) {
// TODO Auto-generated catch block
Expand Down
Loading

0 comments on commit b7b49fb

Please sign in to comment.