Author: lemovice
Date: Sat Oct 12 21:47:22 2013
New Revision: 4617
Log:
Add missing directory
Added:
trunk/AncestrisExtensions/place.geonames/ (props changed)
trunk/AncestrisExtensions/place.geonames/build.xml
trunk/AncestrisExtensions/place.geonames/manifest.mf
trunk/AncestrisExtensions/place.geonames/nbproject/
trunk/AncestrisExtensions/place.geonames/nbproject/build-impl.xml
trunk/AncestrisExtensions/place.geonames/nbproject/genfiles.properties
trunk/AncestrisExtensions/place.geonames/nbproject/project.properties
trunk/AncestrisExtensions/place.geonames/nbproject/project.xml
trunk/AncestrisExtensions/place.geonames/nbproject/suite.properties
trunk/AncestrisExtensions/place.geonames/src/
trunk/AncestrisExtensions/place.geonames/src/ancestris/
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/Bundle.properties
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlace.java
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
Added: trunk/AncestrisExtensions/place.geonames/build.xml
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/build.xml Sat Oct 12 21:47:22 2013
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See
harness/README in the NetBeans platform --><!-- for some information on what
you could do (e.g. targets to override). --><!-- If you delete this file and
reopen the project it will be recreated. --><project
name="ancestris.modules.place.geonames" default="netbeans" basedir=".">
+ <description>Builds, tests, and runs the project
ancestris.modules.place.geonames.</description>
+ <import file="nbproject/build-impl.xml"/>
+</project>
Added: trunk/AncestrisExtensions/place.geonames/manifest.mf
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/manifest.mf Sat Oct 12
21:47:22 2013
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+OpenIDE-Module: ancestris.modules.place.geonames
+OpenIDE-Module-Localizing-Bundle:
ancestris/modules/place/geonames/Bundle.properties
+OpenIDE-Module-Specification-Version: 0.8
+
Added: trunk/AncestrisExtensions/place.geonames/nbproject/build-impl.xml
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/nbproject/build-impl.xml Sat Oct
12 21:47:22 2013
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+--><project name="ancestris.modules.place.geonames-impl" basedir="..">
+ <fail message="Please build using Ant 1.7.1 or higher.">
+ <condition>
+ <not>
+ <antversion atleast="1.7.1"/>
+ </not>
+ </condition>
+ </fail>
+ <property file="nbproject/private/suite-private.properties"/>
+ <property file="nbproject/suite.properties"/>
+ <fail unless="suite.dir">You must set 'suite.dir' to point to your
containing module suite</fail>
+ <property
file="${suite.dir}/nbproject/private/platform-private.properties"/>
+ <property file="${suite.dir}/nbproject/platform.properties"/>
+ <macrodef name="property"
uri="http://www.netbeans.org/ns/nb-module-project/2">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${@{value}}"/>
+ </sequential>
+ </macrodef>
+ <macrodef name="evalprops"
uri="http://www.netbeans.org/ns/nb-module-project/2">
+ <attribute name="property"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{property}" value="@{value}"/>
+ </sequential>
+ </macrodef>
+ <property file="${user.properties.file}"/>
+ <nbmproject2:property name="harness.dir"
value="nbplatform.${nbplatform.active}.harness.dir"
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+ <nbmproject2:property name="nbplatform.active.dir"
value="nbplatform.${nbplatform.active}.netbeans.dest.dir"
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+ <nbmproject2:evalprops property="cluster.path.evaluated"
value="${cluster.path}"
xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+ <fail message="Path to 'platform' cluster missing in $${cluster.path}
property or using corrupt Netbeans Platform (missing harness).">
+ <condition>
+ <not>
+ <contains string="${cluster.path.evaluated}"
substring="platform"/>
+ </not>
+ </condition>
+ </fail>
+ <import file="${harness.dir}/build.xml"/>
+</project>
Added: trunk/AncestrisExtensions/place.geonames/nbproject/genfiles.properties
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/nbproject/genfiles.properties
Sat Oct 12 21:47:22 2013
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=afddeee8
+build.xml.script.CRC32=3be5f4b6
[email protected]
+# This file is used by a NetBeans-based IDE to track changes in generated
files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never
regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=afddeee8
+nbproject/build-impl.xml.script.CRC32=fdd0be08
+nbproject/[email protected]
Added: trunk/AncestrisExtensions/place.geonames/nbproject/project.properties
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/nbproject/project.properties
Sat Oct 12 21:47:22 2013
@@ -0,0 +1,2 @@
+javac.source=1.6
+javac.compilerargs=-Xlint -Xlint:-serial
Added: trunk/AncestrisExtensions/place.geonames/nbproject/project.xml
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/nbproject/project.xml Sat Oct
12 21:47:22 2013
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.apisupport.project</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+ <code-name-base>ancestris.modules.place.geonames</code-name-base>
+ <suite-component/>
+ <module-dependencies>
+ <dependency>
+ <code-name-base>ancestris.api.place</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>1.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>ancestris.core</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <specification-version>0.8.0</specification-version>
+ </run-dependency>
+ </dependency>
+ <dependency>
+ <code-name-base>ancestris.libs.geonames</code-name-base>
+ <build-prerequisite/>
+ <compile-dependency/>
+ <run-dependency>
+ <release-version>1</release-version>
+ <specification-version>1.1.9</specification-version>
+ </run-dependency>
+ </dependency>
+ </module-dependencies>
+ <public-packages>
+ <package>ancestris.modules.place.geonames</package>
+ </public-packages>
+ </data>
+ </configuration>
+</project>
Added: trunk/AncestrisExtensions/place.geonames/nbproject/suite.properties
==============================================================================
--- (empty file)
+++ trunk/AncestrisExtensions/place.geonames/nbproject/suite.properties Sat Oct
12 21:47:22 2013
@@ -0,0 +1 @@
+suite.dir=${basedir}/..
Added:
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/Bundle.properties
==============================================================================
--- (empty file)
+++
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/Bundle.properties
Sat Oct 12 21:47:22 2013
@@ -0,0 +1,2 @@
+OpenIDE-Module-Display-Category=Biblioth\u00e8ques
+OpenIDE-Module-Name=place.geonames
Added:
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlace.java
==============================================================================
--- (empty file)
+++
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlace.java
Sat Oct 12 21:47:22 2013
@@ -0,0 +1,95 @@
+package ancestris.modules.place.geonames;
+
+import ancestris.api.place.Place;
+import org.geonames.PostalCode;
+import org.geonames.Toponym;
+
+/**
+ *
+ * @author dominique
+ */
+public class GeonamesPlace implements Place {
+
+ private PostalCode postalCode= null;
+ private Toponym toponym= null;
+
+ public GeonamesPlace(Toponym toponym, PostalCode postalCode) {
+ this.postalCode = postalCode;
+ this.toponym = toponym;
+ }
+
+ @Override
+ public int compareTo(Place that) {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String getCity() {
+ return postalCode.getPlaceName();
+ }
+
+ @Override
+ public String getFirstAvailableJurisdiction() {
+ return postalCode.getAdminCode1();
+ }
+
+ @Override
+ public String[] getFormat() {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String getFormatAsString() {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String getJurisdiction(int hierarchyLevel) {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public String[] getJurisdictions() {
+ String[] jurisdictions = new String[10];
+ int index = 0;
+
+ jurisdictions[index++] = postalCode.getPlaceName();
+ jurisdictions[index++] = postalCode.getAdminName1();
+ jurisdictions[index++] = postalCode.getAdminCode1();
+ jurisdictions[index++] = postalCode.getAdminName2();
+ jurisdictions[index++] = postalCode.getAdminCode2();
+ jurisdictions[index++] = postalCode.getAdminName3();
+ jurisdictions[index++] = postalCode.getAdminCode3();
+ jurisdictions[index++] = postalCode.getPostalCode();
+ jurisdictions[index++] = postalCode.getCountryCode();
+
+ return jurisdictions;
+ }
+
+ @Override
+ public String getValueStartingWithCity() {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public void setFormatAsString(boolean global, String format) {
+ throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Double getLongitude() {
+ return postalCode.getLongitude();
+ }
+
+ @Override
+ public Double getLatitude() {
+ return postalCode.getLatitude();
+ }
+
+ @Override
+ public String toString() {
+ return postalCode.getPlaceName() + "," + postalCode.getAdminName1() +
","
+ + postalCode.getAdminName2() + "," +
postalCode.getAdminName3() + ","
+ + postalCode.getPostalCode() + "," +
postalCode.getCountryCode();
+ }
+}
Added:
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
==============================================================================
--- (empty file)
+++
trunk/AncestrisExtensions/place.geonames/src/ancestris/modules/place/geonames/GeonamesPlacesList.java
Sat Oct 12 21:47:22 2013
@@ -0,0 +1,67 @@
+package ancestris.modules.place.geonames;
+
+import ancestris.api.place.Place;
+import ancestris.api.place.PlacesList;
+import genj.gedcom.PropertyPlace;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.geonames.*;
+
+/**
+ *
+ * @author dominique
+ */
+public class GeonamesPlacesList implements PlacesList {
+
+ private ArrayList<Place> placesList = new ArrayList<Place>();
+ private final static Logger logger =
Logger.getLogger(GeonamesPlacesList.class.getName(), null);
+
+ @Override
+ public List<Place> findPlace(PropertyPlace place) {
+
+ ToponymSearchResult toponymSearchResult;
+ String[] jurisdictions = place.getJurisdictions();
+
+ try {
+ WebService.setUserName("lemovice");
+ int index = 0;
+
+ do {
+ // parse format
+ StringBuilder result = new StringBuilder();
+ for (int i = index; i < jurisdictions.length; i++) {
+ result.append(jurisdictions[i].trim());
+ if (i < jurisdictions.length) {
+ result.append(" ");
+ }
+ }
+ index += 1;
+ ToponymSearchCriteria toponymSearchCriteria = new
ToponymSearchCriteria();
+ toponymSearchCriteria.setQ(result.toString());
+ toponymSearchResult = WebService.search(toponymSearchCriteria);
+
+ } while (index < jurisdictions.length &&
toponymSearchResult.getToponyms().isEmpty());
+
+ for (Toponym toponym : toponymSearchResult.getToponyms()) {
+ PostalCodeSearchCriteria postalCodeSearchCriteria = new
PostalCodeSearchCriteria();
+ postalCodeSearchCriteria.setStyle(Style.FULL);
+ List<PostalCode> postalCodeSearchResult;
+
+ postalCodeSearchCriteria.setPlaceName(toponym.getName());
+
postalCodeSearchCriteria.setCountryCode(toponym.getCountryCode());
+ postalCodeSearchResult =
WebService.postalCodeSearch(postalCodeSearchCriteria);
+
+ for (PostalCode postalCode : postalCodeSearchResult) {
+ placesList.add(new GeonamesPlace(toponym, postalCode));
+ }
+ }
+
+ return placesList;
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, e.getLocalizedMessage(), e);
+ return null;
+ }
+ }
+}
---------------------------------------------------------------------
Site Web Ancestris : http://www.ancestris.org
<*> Pour vous desinscrire de cette liste, envoyez un mail a :
[email protected]
<*> Pour obtenir de l'aide sur les commandes de la liste :
[email protected]
Pour obtenir tous les messages lies a ce fil de discussion, cliquez sur le
lien ci-dessous, cela ouvrira votre logiciel de messagerie. Il vous suffira
d'envoyer le message :
[email protected]