Skip to content

Commit c7829c9

Browse files
committed
First commit.
0 parents  commit c7829c9

28 files changed

+2329
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/winfoom.iml
2+
/.idea/
3+
/target/

config/img/icon.png

821 Bytes
Loading

config/system.properties

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
###############################################################################
2+
# Copyright (c) 2018 Eugen Covaci.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS,
8+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
# See the License for the specific language governing permissions and limitations under the License.
10+
#
11+
# Contributors:
12+
# Eugen Covaci - initial design and implementation
13+
###############################################################################
14+
15+
### System settings. Modify them only if you really know what are you doing!
16+
17+
max.connections=600
18+
19+
max.connections.per.route=20
20+
21+
# If a connection has no activity during this period, then mark it as idle (seconds)
22+
max.connection.idle=30
23+
24+
# Connection eviction job interval (seconds)
25+
eviction.period=15
26+
27+
# Enable eviction job (boolean)
28+
eviction.enabled=true
29+
30+
server.socket.buffer.size=131072
31+
32+
socket.buffer.size=131072
33+
34+
# The maximum number of repeats when the request through remote proxy fails.
35+
repeats.on.failure=3
36+
37+
38+

config/user.properties

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
###############################################################################
2+
# Copyright (c) 2018 Eugen Covaci.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
# Unless required by applicable law or agreed to in writing, software
7+
# distributed under the License is distributed on an "AS IS" BASIS,
8+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9+
# See the License for the specific language governing permissions and limitations under the License.
10+
#
11+
# Contributors:
12+
# Eugen Covaci - initial design and implementation
13+
###############################################################################
14+
### Local Proxy Settings
15+
16+
# Local port the proxy listens on (default 3129)
17+
local.port=3129
18+
19+
# Host name of remote proxy (mandatory)
20+
proxy.host=localhost
21+
22+
# Port number of remote proxy (mandatory)
23+
proxy.port=80
24+
25+
# Proxy domain (mandatory)
26+
proxy.domain=DESKTOPQ
27+
28+
# Username (mandatory)
29+
proxy.username=Quasimodo
30+
31+
proxy.test.url=http://example.com
32+
33+
font.size=15

pom.xml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>2.2.1.RELEASE</version>
10+
<relativePath/>
11+
</parent>
12+
<groupId>org.kpax</groupId>
13+
<artifactId>winfoom</artifactId>
14+
<version>1.0-SNAPSHOT</version>
15+
16+
<name>winfoom</name>
17+
<!-- FIXME change it to the project's website -->
18+
<url>http://www.example.com</url>
19+
20+
<properties>
21+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
22+
<maven.compiler.source>11</maven.compiler.source>
23+
<maven.compiler.target>11</maven.compiler.target>
24+
<openjfx.version>11</openjfx.version>
25+
<httpclient.version>4.5.10</httpclient.version>
26+
</properties>
27+
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter</artifactId>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>org.openjfx</groupId>
36+
<artifactId>javafx-controls</artifactId>
37+
<version>${openjfx.version}</version>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.openjfx</groupId>
41+
<artifactId>javafx-fxml</artifactId>
42+
<version>${openjfx.version}</version>
43+
</dependency>
44+
<dependency>
45+
<groupId>org.openjfx</groupId>
46+
<artifactId>javafx-graphics</artifactId>
47+
<version>${openjfx.version}</version>
48+
</dependency>
49+
50+
<dependency>
51+
<groupId>org.apache.httpcomponents</groupId>
52+
<artifactId>httpclient</artifactId>
53+
<version>${httpclient.version}</version>
54+
</dependency>
55+
56+
<dependency>
57+
<groupId>org.apache.httpcomponents</groupId>
58+
<artifactId>httpclient-win</artifactId>
59+
<version>${httpclient.version}</version>
60+
</dependency>
61+
62+
<dependency>
63+
<groupId>org.apache.commons</groupId>
64+
<artifactId>commons-configuration2</artifactId>
65+
<version>2.2</version>
66+
</dependency>
67+
68+
<dependency>
69+
<groupId>commons-io</groupId>
70+
<artifactId>commons-io</artifactId>
71+
<version>2.5</version>
72+
</dependency>
73+
74+
<dependency>
75+
<groupId>commons-beanutils</groupId>
76+
<artifactId>commons-beanutils</artifactId>
77+
<version>1.9.3</version>
78+
</dependency>
79+
80+
<dependency>
81+
<groupId>org.springframework.boot</groupId>
82+
<artifactId>spring-boot-starter-test</artifactId>
83+
<scope>test</scope>
84+
</dependency>
85+
86+
</dependencies>
87+
88+
89+
</project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.kpax.winfoom;
2+
3+
import javafx.application.Application;
4+
import org.apache.commons.configuration2.PropertiesConfiguration;
5+
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
6+
import org.apache.commons.configuration2.builder.fluent.Configurations;
7+
import org.kpax.winfoom.util.LocalIOUtils;
8+
import org.springframework.boot.autoconfigure.SpringBootApplication;
9+
import org.springframework.context.annotation.Bean;
10+
11+
@SpringBootApplication
12+
public class FoomApplication {
13+
14+
public static void main(String[] args) {
15+
Application.launch(JavafxApplication.class, args);
16+
}
17+
18+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package org.kpax.winfoom;
2+
3+
import javafx.application.Application;
4+
import javafx.application.Platform;
5+
import javafx.fxml.FXMLLoader;
6+
import javafx.scene.Parent;
7+
import javafx.scene.Scene;
8+
import javafx.scene.layout.BorderPane;
9+
import javafx.stage.Stage;
10+
import org.apache.commons.configuration2.PropertiesConfiguration;
11+
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
12+
import org.apache.commons.configuration2.builder.fluent.Configurations;
13+
import org.kpax.winfoom.util.LocalIOUtils;
14+
import org.springframework.boot.SpringApplication;
15+
import org.springframework.context.ApplicationContextInitializer;
16+
import org.springframework.context.ConfigurableApplicationContext;
17+
import org.springframework.context.annotation.Bean;
18+
import org.springframework.context.support.GenericApplicationContext;
19+
import org.springframework.core.io.Resource;
20+
21+
public class JavafxApplication extends Application {
22+
23+
private ConfigurableApplicationContext applicationContext;
24+
25+
private Stage primaryStage;
26+
27+
@Override
28+
public void init() throws Exception {
29+
30+
ApplicationContextInitializer<GenericApplicationContext> initializer = new ApplicationContextInitializer<GenericApplicationContext>() {
31+
@Override
32+
public void initialize(GenericApplicationContext genericApplicationContext) {
33+
genericApplicationContext.registerBean(JavafxApplication.class, () -> JavafxApplication.this);
34+
genericApplicationContext.registerBean(FileBasedConfigurationBuilder.class, () -> new Configurations()
35+
.propertiesBuilder(LocalIOUtils.toPath(System.getProperty("user.dir"), "config",
36+
"user.properties")));
37+
}
38+
};
39+
40+
SpringApplication springApplication = new SpringApplication(FoomApplication.class);
41+
springApplication.addInitializers(initializer);
42+
this.applicationContext = springApplication.run(getParameters().getRaw().toArray(new String[0]));
43+
44+
}
45+
46+
@Override
47+
public void start(Stage primaryStage) throws Exception {
48+
this.primaryStage = primaryStage;
49+
Resource fxml = this.applicationContext.getResource("classpath:/view/main.fxml");
50+
FXMLLoader fxmlLoader = new FXMLLoader(fxml.getURL());
51+
fxmlLoader.setControllerFactory(this.applicationContext::getBean);
52+
Parent root = fxmlLoader.load();
53+
Scene scene = new Scene(root);
54+
primaryStage.setScene(scene);
55+
primaryStage.setTitle("WinFoom");
56+
primaryStage.show();
57+
}
58+
59+
@Override
60+
public void stop() throws Exception {
61+
this.applicationContext.close();
62+
Platform.exit();
63+
}
64+
65+
66+
public Stage getPrimaryStage() {
67+
return primaryStage;
68+
}
69+
70+
public void sizeToScene() {
71+
primaryStage.sizeToScene();
72+
}
73+
74+
public BorderPane getMainContainer() {
75+
return (BorderPane) primaryStage.getScene().getRoot();
76+
}
77+
78+
79+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.kpax.winfoom.auth;
2+
3+
import org.apache.http.auth.AuthScope;
4+
import org.apache.http.auth.NTCredentials;
5+
import org.apache.http.client.CredentialsProvider;
6+
import org.apache.http.impl.auth.win.WindowsCredentialsProvider;
7+
import org.apache.http.impl.client.BasicCredentialsProvider;
8+
import org.apache.http.impl.client.SystemDefaultCredentialsProvider;
9+
import org.kpax.winfoom.config.UserConfig;
10+
import org.springframework.beans.factory.annotation.Autowired;
11+
import org.springframework.stereotype.Component;
12+
13+
/**
14+
* @author Eugen Covaci {@literal [email protected]}
15+
* Created on 11/16/2019
16+
*/
17+
@Component
18+
public class Authentication {
19+
20+
private CredentialsProvider credentialsProvider;
21+
22+
public CredentialsProvider getCredentialsProvider() {
23+
if (credentialsProvider == null) {
24+
synchronized (this) {
25+
if (credentialsProvider == null) {
26+
credentialsProvider = new WindowsCredentialsProvider(new SystemDefaultCredentialsProvider());
27+
}
28+
}
29+
}
30+
return credentialsProvider;
31+
}
32+
}

0 commit comments

Comments
 (0)