我正在研究一个项目,我的目标是扩展Spring Boot框架,使其能够处理Jolie语言。我的主要问题是如何增强/扩展Spring Boot以支持其他语言-需要创建什么?
我认为我应该达到Kotlin support for Spring Boot之类的东西,但是我仍然不确定要满足什么条件才能成功。
答案 0 :(得分:0)
我会尽力回答您的问题。让我们从Jolie解释器是用Java编码的事实开始。这应该可以将Jolie作为Spring Boot插入基于Java的框架中。
我想象您想创建Jolie微服务并从您的框架内部运行它们,在此注释中,有一篇很棒的Montesi Blog帖子解释了如何Run Jolie from Java。
在帖子中,您可以看到使用Interpreter在主机Java应用程序中午餐您的JOLIE代码,class Interpreter
可以在jolie.jar中找到
jolie2java
可以为您的项目提供帮助,这个工具可以为消息类型创建Java代码。
jolie2java --addSource [true] --format [java|gwt] --packageName package_namespace [--targetPort inputPort_to_be_encoded] file.ol
这是一个示例
type op1Request :void{
.name:string
.surname:string
}
type op1Response :void{
.registrationNumber:string
}
interface TestInterface {
RequestResponse:
op1(op1Request)(op1Response)
}
and this are the resulting java classes
package org.matiho.springboot;
import java.util.List;
import java.util.LinkedList;
import jolie.runtime.Value;
import jolie.runtime.ByteArray;
public class op1Request {
private String _surname;
private String _name;
public op1Request( Value v ){
if (v.hasChildren("surname")){
_surname= v.getFirstChild("surname").strValue();
}
if (v.hasChildren("name")){
_name= v.getFirstChild("name").strValue();
}
}
public op1Request(){
}
public String getSurname(){
return _surname;
}
public void setSurname( String value ){
_surname = value;
}
public String getName(){
return _name;
}
public void setName( String value ){
_name = value;
}
public Value getValue(){
Value vReturn = Value.create();
if((_surname!=null)){
vReturn.getNewChild("surname").setValue(_surname);
}
if((_name!=null)){
vReturn.getNewChild("name").setValue(_name);
}
return vReturn;
}
}
响应类
package org.matiho.springboot;
import java.util.List;
import java.util.LinkedList;
import jolie.runtime.Value;
import jolie.runtime.ByteArray;
public class op1Response {
private String _registrationNumber;
public op1Response( Value v ){
if (v.hasChildren("registrationNumber")){
_registrationNumber= v.getFirstChild("registrationNumber").strValue();
}
}
public op1Response(){
}
public String getRegistrationNumber(){
return _registrationNumber;
}
public void setRegistrationNumber( String value ){
_registrationNumber = value;
}
public Value getValue(){
Value vReturn = Value.create();
if((_registrationNumber!=null)){
vReturn.getNewChild("registrationNumber").setValue(_registrationNumber);
}
return vReturn;
}
}
我可以看到您在将Jolie导入框架时遇到库兼容性方面的一些问题
希望对您有帮助
PS:您可以添加标签Jolie