-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #96 - the geoservice can now be used by gedbrowser behaviors
* This makes the client a consumable object * The geoservice client application is more robust for testing * I am holding back the actual use of the client in the gebrowser
- Loading branch information
1 parent
fc79263
commit 628644e
Showing
8 changed files
with
153 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<eclipse-pmd xmlns="http://acanda.ch/eclipse-pmd/0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://acanda.ch/eclipse-pmd/0.8 http://acanda.ch/eclipse-pmd/eclipse-pmd-0.8.xsd"> | ||
<analysis enabled="true" /> | ||
<rulesets> | ||
<ruleset name="Basic" ref="gedbrowser-top/config/rulesets/java/basic.xml" refcontext="workspace" /> | ||
<ruleset name="Code Size" ref="gedbrowser-top/config/rulesets/java/codesize.xml" refcontext="workspace" /> | ||
<ruleset name="Comments" ref="gedbrowser-top/config/rulesets/java/comments.xml" refcontext="workspace" /> | ||
<ruleset name="Coupling" ref="gedbrowser-top/config/rulesets/java/coupling.xml" refcontext="workspace" /> | ||
<ruleset name="Design" ref="gedbrowser-top/config/rulesets/java/design.xml" refcontext="workspace" /> | ||
<ruleset name="Import Statements" ref="gedbrowser-top/config/rulesets/java/imports.xml" refcontext="workspace" /> | ||
<ruleset name="JUnit" ref="gedbrowser-top/config/rulesets/java/junit.xml" refcontext="workspace" /> | ||
<ruleset name="Optimization" ref="gedbrowser-top/config/rulesets/java/optimizations.xml" refcontext="workspace" /> | ||
<ruleset name="Security Code Guidelines" ref="gedbrowser-top/config/rulesets/java/sunsecure.xml" refcontext="workspace" /> | ||
<ruleset name="Unused Code" ref="gedbrowser-top/config/rulesets/java/unusedcode.xml" refcontext="workspace" /> | ||
</rulesets> | ||
</eclipse-pmd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
geoservice-client/src/main/java/org/schoellerfamily/geoservice/client/GeoServiceClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.schoellerfamily.geoservice.client; | ||
|
||
import org.schoellerfamily.geoservice.model.GeoServiceItem; | ||
|
||
/** | ||
* @author Dick Schoeller | ||
*/ | ||
public interface GeoServiceClient { | ||
/** | ||
* @param placeName the place name | ||
* @return the geocoding result | ||
*/ | ||
GeoServiceItem get(String placeName); | ||
} |
33 changes: 33 additions & 0 deletions
33
...vice-client/src/main/java/org/schoellerfamily/geoservice/client/GeoServiceClientImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.schoellerfamily.geoservice.client; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.schoellerfamily.geoservice.model.GeoServiceItem; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
/** | ||
* @author Dick Schoeller | ||
*/ | ||
@Component | ||
public class GeoServiceClientImpl implements GeoServiceClient { | ||
/** Logger. */ | ||
private final transient Log logger = LogFactory.getLog(getClass()); | ||
|
||
/** */ | ||
@Autowired | ||
private transient RestTemplate restTemplate; | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public GeoServiceItem get(final String placeName) { | ||
logger.info("Get: " + placeName); | ||
final GeoServiceItem item = restTemplate.getForObject( | ||
"http://localhost:8088/geocode?name=" + placeName, | ||
GeoServiceItem.class); | ||
return item; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
geoservice-client/src/main/java/org/schoellerfamily/geoservice/client/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Copyright 2017 Richard Schoeller | ||
* Main package for geoservice client. | ||
*/ | ||
package org.schoellerfamily.geoservice.client; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters