Skip to content

Commit b6ecfad

Browse files
author
NoteFox
committed
added .init to repo
1 parent 9b640ad commit b6ecfad

25 files changed

Lines changed: 329 additions & 263 deletions

Server/OHDMConverter.jar

1.55 MB
Binary file not shown.

Server/convert-osm2map.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#! /bin/bash
2+
if [ "$#" -ne 2 ]; then
3+
echo -e "Illegal number of parameters! should be \n$0 src.osm dst.map"
4+
echo -e "but was $*"
5+
exit 1
6+
fi
7+
SOURCE=$1
8+
DEST=$2
9+
if [ ! -f "$SOURCE" ]; then
10+
echo "$SOURCE does not exist"
11+
exit 2
12+
fi
13+
if [ -f "$DEST" ]; then
14+
echo "$DEST already exists. not overwriting it"
15+
exit 3
16+
fi
17+
18+
/opt/osmosis/bin/osmosis --rx file=$SOURCE --mw file=$DEST

Server/demo.jar

22.1 MB
Binary file not shown.

db_render.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
servername:141.45.146.200
2+
portnumber:5432
3+
username:ohdm
4+
pwd:SoSe+2020
5+
dbname:postgis_db
6+
schema:rendering
7+
maxThreads:5
8+
renderoutput:generic

init.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// '[init]' says this is an init file,
2+
// just so it doesn't read an random file out of nothing
3+
//
4+
// Standart config
5+
// 'variable' 'name' = 'value'
6+
// '//' Comment
7+
8+
[init]
9+
doesFTPServiceLog = true
10+
doesWebServiceLog = true
11+
12+
logDefaultDir = ./log
13+
mapsDefaultDir = ./maps
14+
ftpDefaultDir = ./ftp
15+
16+
webPort = 5001
17+
ftpPort = 5000
18+
19+
standardUserName = ohdmOffViewer
20+
standardUserPassword = H!3r0glyph Sat3llite Era$er

out/META-INF/MANIFEST.MF

Lines changed: 0 additions & 3 deletions
This file was deleted.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<description>Demo project for Spring Boot</description>
1616

1717
<properties>
18-
<java.version>14</java.version>
18+
<java.version>11</java.version>
1919
</properties>
2020

2121
<dependencies>

requirements.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package FTPClient;
2-
31
import org.apache.commons.net.ftp.FTPFile;
42

53
import java.io.IOException;
@@ -29,11 +27,21 @@ public interface FTPInterface {
2927
boolean isConnected();
3028

3129
/**
32-
* gives back the File list, given in current working dir
33-
* @return FTPFiles in current dir
34-
* @throws IOException couldn't read from current dir
30+
* gives back the File list, given in given path
31+
* @param path path where it lists everything
32+
* @return FTPFiles in path
33+
* @throws IOException couldn't read from path
34+
*/
35+
FTPFile[] getFileList(String path) throws IOException;
36+
37+
38+
/**
39+
* gives bcak the Dir list, in given path
40+
* @param path path where it lists everything
41+
* @return Dirs in path
42+
* @throws IOException couldn't read from path
3543
*/
36-
FTPFile[] getFileList() throws IOException;
44+
FTPFile[] getDirList(String path) throws IOException;
3745

3846
/**
3947
* call to download a File from current dir

src/main/java/FTPClient/FtpClientImpl.java renamed to src/java/FtpClient.java

Lines changed: 65 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
package FTPClient;
2-
31
import org.apache.commons.net.ftp.FTPClient;
42
import org.apache.commons.net.ftp.FTPFile;
53
import org.apache.commons.net.ftp.FTPReply;
64

75
import java.io.*;
86
import java.net.SocketException;
97
import java.text.SimpleDateFormat;
8+
import java.util.ArrayList;
109
import java.util.Date;
1110

12-
public class FtpClientImpl extends Thread implements FTPInterface{
11+
public class FtpClient extends Thread implements FTPInterface{
1312

14-
public FtpClientImpl(OutputStream os) {
13+
public FtpClient(OutputStream os) {
1514
logStream = new PrintStream(os);
1615
}
1716

18-
public FtpClientImpl() {
17+
public FtpClient() {
1918
LOGGING_OVER_FILE = false;
2019
}
2120

@@ -27,42 +26,42 @@ public FtpClientImpl() {
2726

2827
@Override
2928
public int connect(String server, int port, String user, String pass) {
30-
if( client == null ) {
31-
log("Getting passive FTP client");
32-
client = new FTPClient();
33-
34-
try {
35-
36-
client.connect(server, port);
37-
// After connection attempt, you should check the reply code to verify
38-
// success.
39-
int reply = client.getReplyCode();
40-
41-
if(!FTPReply.isPositiveCompletion(reply)) {
42-
client.disconnect();
43-
log(" ERROR : FTP server refused connection.");
44-
return 1;
45-
}
46-
47-
//after connecting to the server set the local passive mode
48-
client.enterLocalPassiveMode();
49-
50-
//send username and password to login to the server
51-
if( !client.login(user, pass) ) {
52-
log(" ERROR - Could not login to FTP Server");
53-
return 2;
54-
}
55-
} catch (SocketException e) {
56-
String message = "Socket exception thrown, Server not found";
57-
log("ERROR :" + message+"\n" + e);
58-
return 3;
59-
} catch (IOException e) {
60-
String message = "IO Exception";
61-
log("ERROR :" + message+"\n" + e);
62-
return 4;
29+
if( client == null ) {
30+
log("Getting passive FTP client");
31+
client = new FTPClient();
32+
33+
try {
34+
35+
client.connect(server, port);
36+
// After connection attempt, you should check the reply code to verify
37+
// success.
38+
int reply = client.getReplyCode();
39+
40+
if(!FTPReply.isPositiveCompletion(reply)) {
41+
client.disconnect();
42+
log(" ERROR : FTP server refused connection.");
43+
return 1;
6344
}
45+
46+
//after connecting to the server set the local passive mode
47+
client.enterLocalPassiveMode();
48+
49+
//send username and password to login to the server
50+
if( !client.login(user, pass) ) {
51+
log(" ERROR - Could not login to FTP Server");
52+
return 2;
53+
}
54+
} catch (SocketException e) {
55+
String message = "Socket exception thrown, Server not found";
56+
log("ERROR :" + message+"\n" + e);
57+
return 3;
58+
} catch (IOException e) {
59+
String message = "IO Exception";
60+
log("ERROR :" + message+"\n" + e);
61+
return 4;
6462
}
65-
return 0;
63+
}
64+
return 0;
6665
}
6766

6867
@Override
@@ -71,15 +70,39 @@ public boolean isConnected() {
7170
}
7271

7372
@Override
74-
public FTPFile[] getFileList() throws IOException {
73+
public FTPFile[] getDirList(String path) throws IOException {
74+
if(client == null) {
75+
System.out.println("INFO : First initialize the FTPClient by calling 'initFTPPassiveClient()'");
76+
return null;
77+
}
78+
79+
log("DEBUG : Getting file listing for current director");
80+
FTPFile[] files = client.listFiles(path);
81+
ArrayList<FTPFile> dirList = new ArrayList<>();
82+
for (FTPFile f :
83+
files) {
84+
if (f.isDirectory())
85+
dirList.add(f);
86+
}
87+
return dirList.toArray(new FTPFile[dirList.size()]);
88+
}
89+
90+
@Override
91+
public FTPFile[] getFileList(String path) throws IOException {
7592
if(client == null) {
7693
System.out.println("INFO : First initialize the FTPClient by calling 'initFTPPassiveClient()'");
7794
return null;
7895
}
7996

8097
log("DEBUG : Getting file listing for current director");
81-
FTPFile[] files = client.listFiles("");
82-
return files;
98+
FTPFile[] files = client.listFiles(path);
99+
ArrayList<FTPFile> actualFiles = new ArrayList<>();
100+
for (FTPFile f :
101+
files) {
102+
if (!f.isDirectory())
103+
actualFiles.add(f);
104+
}
105+
return actualFiles.toArray(new FTPFile[actualFiles.size()]);
83106
}
84107

85108
@Override

0 commit comments

Comments
 (0)