Fix repository
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
# Add any directories, files, or patterns you don't want to be tracked by version control
|
||||
/build/
|
||||
/target/
|
||||
/.settings
|
||||
|
||||
4
NoahCrawler/.gitignore
vendored
4
NoahCrawler/.gitignore
vendored
@@ -1,4 +0,0 @@
|
||||
/build/
|
||||
/target/
|
||||
/Sviluppo/
|
||||
/properties.txt
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||
<attributes>
|
||||
<attribute name="hide" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||
<classpathentry kind="output" path=""/>
|
||||
</classpath>
|
||||
@@ -1,106 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
|
||||
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
|
||||
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
|
||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
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.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deadCode=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
|
||||
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
|
||||
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
|
||||
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
|
||||
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
|
||||
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
|
||||
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
@@ -1,4 +0,0 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="NoahCrawler-0.0.1-SNAPSHOT">
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
|
||||
<property name="context-root" value="NoahCrawler"/>
|
||||
<property name="java-output-path" value="/NoahCrawler/build/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<runtime name="Apache Tomcat v8.5"/>
|
||||
<fixed facet="java"/>
|
||||
<fixed facet="jst.web"/>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.web" version="3.1"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
</faceted-project>
|
||||
@@ -1 +0,0 @@
|
||||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
||||
@@ -1 +0,0 @@
|
||||
Window
|
||||
@@ -1,2 +0,0 @@
|
||||
disabled=06target
|
||||
eclipse.preferences.version=1
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.wst.ws.service.policy.projectEnabled=false
|
||||
@@ -1,36 +0,0 @@
|
||||
package it.noah.crawler.impl;
|
||||
|
||||
import it.noah.crawler.AbstractNoahCrawler;
|
||||
import it.noah.crawler.NoahCrawler;
|
||||
import it.noah.crawler.converter.impl.ComuneConverter;
|
||||
import it.noah.crawler.dom.tag.Table;
|
||||
import it.noah.crawler.enums.UrlEnum;
|
||||
import it.noah.crawler.exception.NoahCrawlerException;
|
||||
import it.noah.crawler.exception.ObjectNotFoundException;
|
||||
import it.noah.crawler.model.Comune;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class ComuneNoahCrawler extends AbstractNoahCrawler implements
|
||||
NoahCrawler {
|
||||
|
||||
public ComuneNoahCrawler() throws IOException {
|
||||
super(UrlEnum.COMUNI_URL.getUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() throws NoahCrawlerException {
|
||||
try {
|
||||
List<Comune> comuni = convertTable2Comuni(getTable("", true));
|
||||
// TODO una volta creata la lista va salvata sul db
|
||||
} catch (ObjectNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private List<Comune> convertTable2Comuni(Table table) {
|
||||
return new ComuneConverter().convertTable(table);
|
||||
}
|
||||
|
||||
}
|
||||
29
README.md
29
README.md
@@ -1,29 +0,0 @@
|
||||
# README #
|
||||
|
||||
This README would normally document whatever steps are necessary to get your application up and running.
|
||||
|
||||
### What is this repository for? ###
|
||||
|
||||
* Quick summary
|
||||
* Version
|
||||
* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo)
|
||||
|
||||
### How do I get set up? ###
|
||||
|
||||
* Summary of set up
|
||||
* Configuration
|
||||
* Dependencies
|
||||
* Database configuration
|
||||
* How to run tests
|
||||
* Deployment instructions
|
||||
|
||||
### Contribution guidelines ###
|
||||
|
||||
* Writing tests
|
||||
* Code review
|
||||
* Other guidelines
|
||||
|
||||
### Who do I talk to? ###
|
||||
|
||||
* Repo owner or admin
|
||||
* Other community or team contact
|
||||
@@ -45,5 +45,10 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.40</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.geonames</groupId>
|
||||
<artifactId>geonames</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,21 +1,27 @@
|
||||
package it.noah.crawler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import it.noah.crawler.dom.NoahDOMExplorer;
|
||||
import it.noah.crawler.dom.tag.Table;
|
||||
import it.noah.crawler.exception.NoahCrawlerException;
|
||||
import it.noah.crawler.exception.ObjectNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public abstract class AbstractNoahCrawler implements NoahCrawler {
|
||||
|
||||
private final static Logger log = LoggerFactory
|
||||
.getLogger(AbstractNoahCrawler.class);
|
||||
|
||||
private NoahDOMExplorer explorer;
|
||||
|
||||
public AbstractNoahCrawler(String url) {
|
||||
try {
|
||||
this.explorer = new NoahDOMExplorer(url);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package it.noah.crawler.converter;
|
||||
|
||||
import it.noah.crawler.dom.tag.Table;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import it.noah.crawler.dom.tag.Table;
|
||||
|
||||
public interface Converter<T> {
|
||||
|
||||
public <T> List<T> convertTable(Table table);
|
||||
public List<T> convertTable(Table table);
|
||||
|
||||
}
|
||||
@@ -1,18 +1,23 @@
|
||||
package it.noah.crawler.converter.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.geonames.PostalCode;
|
||||
|
||||
import it.noah.crawler.converter.Converter;
|
||||
import it.noah.crawler.dom.tag.Table;
|
||||
import it.noah.crawler.model.Comune;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ComuneConverter implements Converter<Comune> {
|
||||
|
||||
@Override
|
||||
public List<Comune> convertTable(Table table) {
|
||||
List<Comune> comuni = new ArrayList<Comune>();
|
||||
return comuni;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Comune> convertPostalCode(List<PostalCode> postalCodes) {
|
||||
// TODO da implementare
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,7 @@ package it.noah.crawler.enums;
|
||||
|
||||
public enum UrlEnum {
|
||||
PROVINCE_URL(
|
||||
"http://www.aci.it/i-servizi/normative/codice-della-strada/elenco-sigle-province-ditalia.html"),
|
||||
COMUNI_URL("https://it.wikipedia.org/wiki/Citt%C3%A0_d'Italia");
|
||||
"http://www.aci.it/i-servizi/normative/codice-della-strada/elenco-sigle-province-ditalia.html");
|
||||
|
||||
private String url;
|
||||
|
||||
40
src/it/noah/crawler/impl/ComuneNoahCrawler.java
Normal file
40
src/it/noah/crawler/impl/ComuneNoahCrawler.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package it.noah.crawler.impl;
|
||||
|
||||
import org.geonames.Toponym;
|
||||
import org.geonames.ToponymSearchCriteria;
|
||||
import org.geonames.ToponymSearchResult;
|
||||
import org.geonames.WebService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import it.noah.crawler.NoahCrawler;
|
||||
import it.noah.crawler.exception.NoahCrawlerException;
|
||||
|
||||
public class ComuneNoahCrawler implements NoahCrawler {
|
||||
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(ComuneNoahCrawler.class);
|
||||
|
||||
// http://api.geonames.org/postalCodeSearch?placename=IT&username=morgoth
|
||||
|
||||
@Override
|
||||
public void run() throws NoahCrawlerException {
|
||||
try {
|
||||
WebService.setUserName("morgoth");
|
||||
ToponymSearchCriteria criteria = new ToponymSearchCriteria();
|
||||
criteria.setLanguage("IT");
|
||||
criteria.setCountryCode("IT");
|
||||
criteria.setMaxRows(1000);
|
||||
ToponymSearchResult result = WebService.search(criteria);
|
||||
System.out.println(result.getTotalResultsCount());
|
||||
for (Toponym toponym : result.getToponyms()) {
|
||||
// TODO FINIRE IMPLEMENTAZIONE
|
||||
}
|
||||
// TODO salvare sul database
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class FileUtils {
|
||||
int spaces = 0;
|
||||
|
||||
try {
|
||||
for (int i = 0; (ch = in.read()) != -1; i++) {
|
||||
while ((ch = in.read()) != -1) {
|
||||
if (Character.isWhitespace((char) ch)) {
|
||||
spaces++;
|
||||
}
|
||||
Reference in New Issue
Block a user