Refactored using IntelliJ
This commit is contained in:
95
README.MD
95
README.MD
@@ -7,20 +7,31 @@ Feel free to join our Discord.
|
||||
|
||||
## License Notice
|
||||
|
||||
This project (OAC) is licensed under the [Open Autonomous Public License (OAPL)](https://repo.open-autonomous-connection.org/open-autonomous-connection/OAPL/).
|
||||
This project (OAC) is licensed under
|
||||
the [Open Autonomous Public License (OAPL)](https://repo.open-autonomous-connection.org/open-autonomous-connection/OAPL/).
|
||||
|
||||
**Third-party components:**
|
||||
|
||||
- *UnlegitLibrary* is authored by the same copyright holder and is used here under a special agreement:
|
||||
While [UnlegitLibrary](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/) is generally distributed under the [GNU GPLv3](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/src/branch/master/LICENSE),
|
||||
While [UnlegitLibrary](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/) is generally distributed under
|
||||
the [GNU GPLv3](https://repo.unlegitdqrk.dev/UnlegitDqrk/unlegitlibrary/src/branch/master/LICENSE),
|
||||
it is additionally licensed under OAPL **exclusively for the OAC project**.
|
||||
Therefore, within OAC, the OAPL terms apply to UnlegitLibrary as well.
|
||||
|
||||
# Bugs/Problems
|
||||
- Project not tested yet
|
||||
# In progress
|
||||
- WebServer
|
||||
# TODO
|
||||
|
||||
- Finishing WebServer
|
||||
- Writing INS Backend and Frontend
|
||||
- Writing WebClient
|
||||
- Writing WebServer
|
||||
- Documentation / Wiki
|
||||
# Maven
|
||||
|
||||
### pom.xml
|
||||
|
||||
```
|
||||
<dependency>
|
||||
<groupId>org.openautonomousconnection</groupId>
|
||||
@@ -30,6 +41,7 @@ This project (OAC) is licensed under the [Open Autonomous Public License (OAPL)]
|
||||
```
|
||||
|
||||
### Repository:
|
||||
|
||||
```
|
||||
<repository>
|
||||
<id>oac</id>
|
||||
@@ -38,79 +50,4 @@ This project (OAC) is licensed under the [Open Autonomous Public License (OAPL)]
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
```
|
||||
|
||||
# Examples
|
||||
#### Note: These examples are very basic
|
||||
### Server
|
||||
|
||||
```java
|
||||
import dev.unlegitdqrk.unlegitlibrary.network.system.server.ConnectionHandler;
|
||||
import me.openautonomousconnection.protocol.ProtocolBridge;
|
||||
import me.openautonomousconnection.protocol.ProtocolSettings;
|
||||
import me.openautonomousconnection.protocol.ProtocolVersion;
|
||||
import me.openautonomousconnection.protocol.side.ProtocolServer;
|
||||
|
||||
public class Server extends ProtocolServer {
|
||||
|
||||
public Server() throws IOException, InterruptedException {
|
||||
super(10);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ProtocolBridge protocolBridge = new ProtocolBridge(ProtocolVersion.PV_1_0_0, new ProtocolSettings(), new Server());
|
||||
protocolBridge.getProtocolServer().setProtocolBridge(protocolBridge);
|
||||
protocolBridge.getProtocolServer().startServer();
|
||||
} catch (IOException | InterruptedException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException | NoSuchMethodException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Domain> getDomains() throws SQLException {
|
||||
return List.of(); // Your method here to get all registered domains
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(ConnectionHandler connectionHandler, String message) {
|
||||
System.out.println("Received message: " + message + " from client: " + connectionHandler.getClientID());
|
||||
}
|
||||
}
|
||||
```
|
||||
### Client
|
||||
|
||||
```java
|
||||
import me.openautonomousconnection.protocol.ProtocolBridge;
|
||||
import me.openautonomousconnection.protocol.ProtocolSettings;
|
||||
import me.openautonomousconnection.protocol.ProtocolVersion;
|
||||
import me.openautonomousconnection.protocol.infoName.Domain;
|
||||
import me.openautonomousconnection.protocol.side.ProtocolClient;
|
||||
import me.openautonomousconnection.protocol.utils.SiteType;
|
||||
|
||||
public class Client extends ProtocolClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
ProtocolBridge protocolBridge = new ProtocolBridge(ProtocolVersion.PV_1_0_0, new ProtocolSettings(), new Client());
|
||||
protocolBridge.getProtocolClient().setProtocolBridge(protocolBridge);
|
||||
protocolBridge.getProtocolServer().startClient();
|
||||
} catch (IOException | InterruptedException | InvocationTargetException | InstantiationException |
|
||||
IllegalAccessException | NoSuchMethodException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleHTMLContent(SiteType siteType, Domain infoName, String htmlContent) {
|
||||
System.out.println("Website html content received. This site is " + siteType.name);
|
||||
System.out.println(htmlContent); // Render content in a webview for example
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(String message) {
|
||||
System.out.println("Received message: " + message);
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
Reference in New Issue
Block a user