Skip to content
Snippets Groups Projects
Commit 878edf04 authored by NTUMBA WA NTUMBA Patient's avatar NTUMBA WA NTUMBA Patient
Browse files

Update VSB Service Bundle and fixed bug on artifact generation

parent 7b08fd63
No related branches found
No related tags found
No related merge requests found
Showing
with 203 additions and 63 deletions
......@@ -91,7 +91,12 @@ public class JarGenerator{
}
private void addPackage() {
System.out.println(" Constants.generatedCodePath "+Constants.generatedCodePath);
System.out.println(Constants.target_namespace + ".BindingComponentMain" +Constants.target_namespace + ".BindingComponentMain");
PathResolver.setClassPath(Constants.generatedCodePath);
Class<?> bc = null;
......
......@@ -72,7 +72,7 @@
<module>gmdl-utils</module>
<module>bc-generators</module>
<module>bc-manager</module>
<module>playgrounds</module>
<!-- <module>playgrounds</module> -->
<module>tools</module>
<module>vsb-manager-api</module>
<module>vsb-manager-service-bundle</module>
......
#Californium CoAP Properties file
#Thu Sep 07 17:05:30 CEST 2017
HTTP_SERVER_SOCKET_BUFFER_SIZE=8192
UDP_CONNECTOR_OUT_CAPACITY=2147483647
CONGESTION_CONTROL_ALGORITHM=Cocoa
USE_CONGESTION_CONTROL=false
ACK_TIMEOUT=2000
NOTIFICATION_CHECK_INTERVAL_COUNT=100
MAX_MESSAGE_SIZE=1024
DEDUPLICATOR=DEDUPLICATOR_MARK_AND_SWEEP
COAP_PORT=5683
ACK_TIMEOUT_SCALE=2.0
PREFERRED_BLOCK_SIZE=512
NETWORK_STAGE_RECEIVER_THREAD_COUNT=1
PROTOCOL_STAGE_THREAD_COUNT=8
MAX_TRANSMIT_WAIT=93000
UDP_CONNECTOR_RECEIVE_BUFFER=0
EXCHANGE_LIFETIME=247000
HTTP_SERVER_SOCKET_TIMEOUT=100000
CROP_ROTATION_PERIOD=2000
UDP_CONNECTOR_DATAGRAM_SIZE=2048
MAX_RETRANSMIT=4
NOTIFICATION_CHECK_INTERVAL=86400000
LEISURE=5000
HTTP_CACHE_RESPONSE_MAX_AGE=86400
BLOCKWISE_STATUS_LIFETIME=600000
UDP_CONNECTOR_SEND_BUFFER=0
HEALTH_STATUS_PRINT_LEVEL=FINEST
NETWORK_STAGE_SENDER_THREAD_COUNT=1
NON_LIFETIME=145000
TOKEN_SIZE_LIMIT=8
HTTP_PORT=8080
MARK_AND_SWEEP_INTERVAL=10000
HEALTH_STATUS_INTERVAL=60
ACK_RANDOM_FACTOR=1.5
NSTART=1
USE_RANDOM_MID_START=true
HTTP_CACHE_SIZE=32
PROBING_RATE=1.0
NOTIFICATION_REREGISTRATION_BACKOFF=2000
COAP_SECURE_PORT=5684
......@@ -116,7 +116,9 @@
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<executions>
<execution>
<phase>package</phase>
......
......@@ -189,7 +189,7 @@ public class VsbManager {
PathResolver.extractDirectoryFromJar(webapp_src_artifact, bc_generators_copy);
} else {
PathResolver.copyFolder(new File(".." + File.separator + ".." + File.separator + "bc-generators").getAbsolutePath(),
PathResolver.copyFolder(new File(".." + File.separator + "bc-generators").getAbsolutePath(),
bc_generators_copy);
}
......@@ -245,17 +245,17 @@ public class VsbManager {
warGenerator.addPackage(eu.chorevolution.vsb.gm.protocols.Manageable.class.getPackage());
String vsb_manager_pomxml = new File(".").getAbsolutePath() + File.separator + "pom.xml";
String gm_soap_pomxml = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_soap_pomxml = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-soap" + File.separator + "pom-gm-soap.xml";
String gm_coap_pomxml = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_coap_pomxml = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-coap" + File.separator + "pom.xml";
String gm_dpws_pomxml = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_dpws_pomxml = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-dpws" + File.separator + "pom.xml";
String gm_websocket_pomxl = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_websocket_pomxl = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-websocket" + File.separator + "pom.xml";
String gm_mqtt_pomxl = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_mqtt_pomxl = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-mqtt" + File.separator + "pom.xml";
String gm_rest_pomxl = new File(".").getAbsolutePath() + File.separator + ".." + File.separator+".." + File.separator
String gm_rest_pomxl = new File(".").getAbsolutePath() + File.separator+".." + File.separator
+ "protocol-pool" + File.separator + "gm-rest" + File.separator + "pom.xml";
if (STARTING_FROM_JAR) {
......@@ -826,9 +826,10 @@ public class VsbManager {
JInvocation run = bindingComponentVar.invoke("run");
jmMainBlock.add(run);
try {
try{
jCodeModel.build(new File(Constants.generatedCodePath + File.separator));
} catch (IOException e) {
}catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
......@@ -860,8 +861,9 @@ public class VsbManager {
e.printStackTrace();
}
switch (protocol) {
switch (protocol){
case REST:
jsonObject.put("target_namespace", Constants.target_namespace);
......@@ -883,6 +885,7 @@ public class VsbManager {
jsonObject.put("invocation_address", "http://localhost");
break;
case MQTT:
jsonObject.put("target_namespace", Constants.target_namespace);
......@@ -930,7 +933,8 @@ public class VsbManager {
// temporarily disabled
try (FileWriter file = new FileWriter(filename)) {
file.write(jsonObject.toJSONString());
} catch (IOException e) {
} catch (IOException e){
e.printStackTrace();
}
}
......@@ -946,9 +950,12 @@ public class VsbManager {
JSONParser parser = new JSONParser();
JSONObject jsonObject = null;
try {
try{
configJsonObject = (JSONObject) configParser.parse(new FileReader(configPath));
} catch (IOException | ParseException e) {
} catch (IOException | ParseException e){
e.printStackTrace();
}
......@@ -960,7 +967,8 @@ public class VsbManager {
e.printStackTrace();
}
switch (protocol) {
case REST:
......
......@@ -2,61 +2,102 @@ package eu.chorevolution.vsb.manager;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import eu.chorevolution.vsb.bc.manager.BcManagerRestService;
import eu.chorevolution.vsb.bc.manager.VsbOutput;
import eu.chorevolution.vsb.gmdl.utils.PathResolver;
import eu.chorevolution.vsb.manager.api.client.VsbManagerClient;
public class VsbManagerRestServiceClient{
public class VsbManagerRestServiceClient {
public static void main(String[] args) {
public static void main(String[] args){
// TODO Auto-generated method stub
String file_path = PathResolver.myFilePath(BcManagerRestService.class,"bridge.gidl");
String file_path = PathResolver.myFilePath(BcManagerRestService.class, "coap.gidl");
byte[] byteArray = readBytesFromFile(file_path);
VsbManagerClient client = new VsbManagerClient("127.0.0.1", 8080);
VsbOutput vsbOutput = client.generateBindingComponent(byteArray, "MQTT", "ServiceTest");
if (vsbOutput.jar != null) {
bytesToFile(vsbOutput.jar, "ServiceTest", "jar");
}
if (vsbOutput.war != null) {
bytesToFile(vsbOutput.war, "ServiceTest", "war");
}
if (vsbOutput.wsdl != null) {
bytesToFile(vsbOutput.wsdl, "ServiceTest", "wsdl");
}
}
private static byte[] readBytesFromFile(String filePath) {
FileInputStream fileInputStream = null;
byte[] bytesArray = null;
try {
File file = new File(filePath);
bytesArray = new byte[(int) file.length()];
// read file into bytes[]
fileInputStream = new FileInputStream(file);
fileInputStream.read(bytesArray);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bytesArray;
}
private static void bytesToFile(byte[] in, String ouput, String outputType) {
VsbOutput vsbOutput = client.generateBindingComponent(byteArray, "SOAP", "ServiceTest");
System.out.println("vsbOutput.war.length "+vsbOutput.war.length);
System.out.println("vsbOutput.wsdl.length "+vsbOutput.wsdl.length);
System.out.println("vsbOutput.jar.length "+vsbOutput.jar.length);
String fileName = ouput + "." + outputType;
File out = new File(fileName);
FileOutputStream fos;
try {
fos = new FileOutputStream(out);
fos.write(in);
fos.flush();
fos.close();
System.out.println("Generate "+outputType+" file : "+out.getAbsolutePath().toString());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private static byte[] readBytesFromFile(String filePath){
FileInputStream fileInputStream = null;
byte[] bytesArray = null;
try{
File file = new File(filePath);
bytesArray = new byte[(int) file.length()];
//read file into bytes[]
fileInputStream = new FileInputStream(file);
fileInputStream.read(bytesArray);
}
catch (IOException e){
e.printStackTrace();
}finally{
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e){
e.printStackTrace();
}
}
}
return bytesArray;
}
}
......@@ -13,7 +13,7 @@ public class VsbManagerTest{
// String interfaceDescriptionPath = "/home/pntumba/inria_code/repositories/urban-traffic-coordination/bindingcomponents/bcDTS-WEATHER/model/dts-weather.gidl";
// String interfaceDescriptionPath = "/home/pntumba/inria_code/repositories/urban-traffic-coordination/bindingcomponents/bcDTS-BRIDGE/model/dts-bridge.gidl";
// String interfaceDescriptionPath = "/home/pntumba/inria_code/repositories/urban-traffic-coordination/bindingcomponents/bcDTS-CONGESTION/model/dts-congestion.gidl";
String interfaceDescriptionPath = "/home/pntumba/inria_code/repositories/evolution-service-bus/bc-manager/src/main/resources/service.gidl";
String interfaceDescriptionPath = "/home/pntumba/inria_code/repositories/evolution-service-bus/bc-manager/src/main/resources/coap.gidl";
VsbManager vsbm = new VsbManager();
vsbm.generateWar(interfaceDescriptionPath, ProtocolType.WEB_SOCKETS, "service");
}
......
File added
File added
File added
#Californium CoAP Properties file
#Wed Sep 06 17:11:47 CEST 2017
HTTP_SERVER_SOCKET_BUFFER_SIZE=8192
UDP_CONNECTOR_OUT_CAPACITY=2147483647
CONGESTION_CONTROL_ALGORITHM=Cocoa
USE_CONGESTION_CONTROL=false
ACK_TIMEOUT=2000
NOTIFICATION_CHECK_INTERVAL_COUNT=100
MAX_MESSAGE_SIZE=1024
DEDUPLICATOR=DEDUPLICATOR_MARK_AND_SWEEP
COAP_PORT=5683
ACK_TIMEOUT_SCALE=2.0
PREFERRED_BLOCK_SIZE=512
NETWORK_STAGE_RECEIVER_THREAD_COUNT=1
PROTOCOL_STAGE_THREAD_COUNT=8
MAX_TRANSMIT_WAIT=93000
UDP_CONNECTOR_RECEIVE_BUFFER=0
EXCHANGE_LIFETIME=247000
HTTP_SERVER_SOCKET_TIMEOUT=100000
CROP_ROTATION_PERIOD=2000
UDP_CONNECTOR_DATAGRAM_SIZE=2048
MAX_RETRANSMIT=4
NOTIFICATION_CHECK_INTERVAL=86400000
LEISURE=5000
HTTP_CACHE_RESPONSE_MAX_AGE=86400
BLOCKWISE_STATUS_LIFETIME=600000
UDP_CONNECTOR_SEND_BUFFER=0
HEALTH_STATUS_PRINT_LEVEL=FINEST
NETWORK_STAGE_SENDER_THREAD_COUNT=1
NON_LIFETIME=145000
TOKEN_SIZE_LIMIT=8
HTTP_PORT=8080
MARK_AND_SWEEP_INTERVAL=10000
HEALTH_STATUS_INTERVAL=60
ACK_RANDOM_FACTOR=1.5
NSTART=1
USE_RANDOM_MID_START=true
HTTP_CACHE_SIZE=32
PROBING_RATE=1.0
NOTIFICATION_REREGISTRATION_BACKOFF=2000
COAP_SECURE_PORT=5684
......@@ -54,7 +54,6 @@
<groupId>eu.chorevolution.vsb</groupId>
<artifactId>vsb-manager-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- <classifier>jar-with-dependencies</classifier> -->
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -45,6 +45,7 @@ public class VsbManagerResource extends ServerResource {
byte[] byteArray = stringToByteArray(interfaceService);
ProtocolType busProtocol = null;
switch(protocol.toUpperCase()){
case "REST":
......@@ -80,7 +81,9 @@ public class VsbManagerResource extends ServerResource {
break;
}
VsbManager vsbm = new VsbManager();
System.out.println("Bus Protocole : "+busProtocol);
VsbOutput vsbOutput = vsbm.generateWar(byteArray, busProtocol, service_name);
vsbm.deleteGeneratedFiles();
return new ObjectRepresentation<VsbOutput>(vsbOutput);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment