First commit
This commit is contained in:
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
<option name="processCode" value="true" />
|
||||||
|
<option name="processLiterals" value="true" />
|
||||||
|
<option name="processComments" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
10
.idea/libraries/projectlombok_lombok.xml
generated
Normal file
10
.idea/libraries/projectlombok_lombok.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="projectlombok.lombok" type="repository">
|
||||||
|
<properties maven-id="org.projectlombok:lombok:1.18.34" />
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.34/lombok-1.18.34.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES />
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -19,5 +19,6 @@
|
|||||||
</orderEntry>
|
</orderEntry>
|
||||||
<orderEntry type="library" name="tinylog" level="project" />
|
<orderEntry type="library" name="tinylog" level="project" />
|
||||||
<orderEntry type="library" name="io.javalin" level="project" />
|
<orderEntry type="library" name="io.javalin" level="project" />
|
||||||
|
<orderEntry type="library" name="projectlombok.lombok" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import AASMini.AASMini;
|
import AASMini.AASMini;
|
||||||
import ProtegeGX.ProtegeGX;
|
import ProtegeGX.ProtegeGX;
|
||||||
import Web.WebServer;
|
import Web.WebServer;
|
||||||
|
import org.pmw.tinylog.Logger;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static AASMini aas;
|
private static AASMini aas;
|
||||||
@@ -21,12 +22,26 @@ public class Main {
|
|||||||
System.out.println("Protege to AAS Mini Connector");
|
System.out.println("Protege to AAS Mini Connector");
|
||||||
|
|
||||||
protegeGX = new ProtegeGX();
|
protegeGX = new ProtegeGX();
|
||||||
|
protegeGX.setOnCardRead(data -> {
|
||||||
|
Logger.info(data);
|
||||||
|
if (aas!=null && aas.IsConnected()){
|
||||||
|
// send something to AAS
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
aas = new AASMini(aasIP, aasPort);
|
aas = new AASMini(aasIP, aasPort);
|
||||||
aas.Connect();
|
aas.Connect();
|
||||||
|
|
||||||
web = new WebServer();
|
web = new WebServer();
|
||||||
web.Start(webPort);
|
web.Start(webPort);
|
||||||
|
web.setAasAPI(data -> {
|
||||||
|
Logger.info(data);
|
||||||
|
// Do something with AAS
|
||||||
|
});
|
||||||
|
web.setProtegeGXAPI(data -> {
|
||||||
|
Logger.info(data);
|
||||||
|
// Do something with ProtegeGX
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetArguments(String[] args){
|
private static void GetArguments(String[] args){
|
||||||
|
|||||||
12
src/ProtegeGX/ProtegeData.java
Normal file
12
src/ProtegeGX/ProtegeData.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package ProtegeGX;
|
||||||
|
|
||||||
|
public class ProtegeData {
|
||||||
|
public String ReaderID;
|
||||||
|
public String CardID;
|
||||||
|
public String Description;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return "ReaderID = " + ReaderID + ", CardID = " + CardID + ", Description = " + Description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
package ProtegeGX;
|
package ProtegeGX;
|
||||||
|
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ProtegeGX {
|
public class ProtegeGX {
|
||||||
|
@Setter private Consumer<ProtegeData> onCardRead;
|
||||||
|
|
||||||
|
private void updateCardRead(ProtegeData data){
|
||||||
|
if (onCardRead!=null) onCardRead.accept(data);
|
||||||
|
}
|
||||||
|
|
||||||
public ProtegeGX(){
|
public ProtegeGX(){
|
||||||
System.out.println("ProtegeGX Constructor");
|
System.out.println("ProtegeGX Constructor");
|
||||||
//TODO belum ada codingan, tunggu apache cxf jar nya
|
//TODO belum ada codingan, tunggu apache cxf jar nya
|
||||||
|
|||||||
@@ -1,10 +1,25 @@
|
|||||||
package Web;
|
package Web;
|
||||||
|
|
||||||
import io.javalin.Javalin;
|
import io.javalin.Javalin;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import static io.javalin.apibuilder.ApiBuilder.get;
|
||||||
import static io.javalin.apibuilder.ApiBuilder.path;
|
import static io.javalin.apibuilder.ApiBuilder.path;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class WebServer {
|
public class WebServer {
|
||||||
|
@Setter private Consumer<String> aasAPI;
|
||||||
|
@Setter private Consumer<String> protegeGXAPI;
|
||||||
|
|
||||||
|
private void updateAASAPI(String data){
|
||||||
|
if (aasAPI!=null) aasAPI.accept(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateProtegeGXAPI(String data){
|
||||||
|
if (protegeGXAPI!=null) protegeGXAPI.accept(data);
|
||||||
|
}
|
||||||
|
|
||||||
Javalin app;
|
Javalin app;
|
||||||
public WebServer(){
|
public WebServer(){
|
||||||
@@ -15,10 +30,12 @@ public class WebServer {
|
|||||||
// API for AAS Mini
|
// API for AAS Mini
|
||||||
path("aasmini", ()->{
|
path("aasmini", ()->{
|
||||||
//TODO implement API for AAS Mini
|
//TODO implement API for AAS Mini
|
||||||
|
get(ctx -> ctx.result("AAS Mini API"));
|
||||||
});
|
});
|
||||||
// API for ProtegeGX
|
// API for ProtegeGX
|
||||||
path("protegegx", ()->{
|
path("protegegx", ()->{
|
||||||
//TODO implement API for ProtegeGX
|
//TODO implement API for ProtegeGX
|
||||||
|
get(ctx -> ctx.result("ProtegeGX API"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user