Add config for dClent

This commit is contained in:
James Quinley 2022-01-23 16:53:12 -08:00
parent 1b3635d011
commit df3971294c
7 changed files with 128 additions and 10 deletions

2
.idea/discord.xml generated
View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

View File

@ -6,6 +6,11 @@
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jcenter" />
<option name="name" value="jcenter-bintray" />
<option name="url" value="https://jcenter.bintray.com" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
@ -16,5 +21,10 @@
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="bintray" />
<option name="url" value="https://jcenter.bintray.com" />
</remote-repository>
</component>
</project>

68
pom.xml
View File

@ -12,20 +12,74 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
<repository>
<id>central</id>
<name>bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>8.0.10</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.3.2</version>
</dependency>
<dependency>
<!-- jsoup HTML parser library @ https://jsoup.org/ -->
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.0</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>

View File

@ -0,0 +1,30 @@
package com.jamesquinley.DelegationServices;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import static java.util.concurrent.TimeUnit.SECONDS;
public class delegationServices {
static ConnectionString scReadconnectionString = new ConnectionString("mongodb+srv://serverClient:ej2ookJGgpV6JyFS@accountdelegation.n06hb.mongodb.net/myFirstDatabase?retryWrites=true&w=majoritymongodb+srv://client:dPMtaqHXJSpPaX3d@socialcreditdatabase.rqsyf.mongodb.net/socialCreditDatabase?retryWrites=true&w=majority");
static MongoClientSettings scReadsettings = MongoClientSettings.builder()
.applyConnectionString(scReadconnectionString)
.applyToSocketSettings(builder ->
builder.connectTimeout(5, SECONDS)
.readTimeout(6, SECONDS))
.build();
static MongoClient dClient = MongoClients.create(scReadsettings);
static MongoDatabase dClientDatabase = dClient.getDatabase("DelegationRequest");
static MongoCollection<Document> dCollection = dClientDatabase.getCollection("accountRequest");
//still need to config
public static void delegationProcesser () {
System.out.println("delegation Trigger Set");
delegationTimer.trigger();
}
}

View File

@ -0,0 +1,24 @@
package com.jamesquinley.DelegationServices;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
public class delegationTimer {
public static void trigger ()
{
final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
final Runnable runnable = new Runnable() {
int countdownStarter = 5;
public void run() {
countdownStarter--;
if (countdownStarter <= 0) {
countdownStarter = 5;
delegationServices.delegationProcesser();
scheduler.shutdown();
}
}
};
scheduler.scheduleAtFixedRate(runnable, 0, 1, TimeUnit.SECONDS);
}
}

View File

@ -1,7 +1,7 @@
package com.jamesquinley;
/**
* Hello world!
Hey there! This is the source code for AOTSK-Delegation Server, for login
*
*/
public class startup
@ -9,6 +9,6 @@ public class startup
public static void main( String[] args )
{
System.out.println( "We're starting the login delegation server, please wait one moment while we check a few things.");
com.jamesquinley.DelegationServices.delegationTimer.trigger();
}
}