我正在尝试使用在远程服务器中创建的 de .jar 文件来运行 Jbpm 项目。
在我的旧项目中,我使用 .bpmn 文件创建了我的 RuntimeEnvironment ...
@Produces
@Singleton
@PerProcessInstance
@PerRequest
public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) throws IOException {
RuntimeEnvironment environment = RuntimeEnvironmentBuilder.Factory.get()
.newDefaultBuilder()
.entityManagerFactory(emf)
.addAsset(
ResourceFactory
.newClassPathResource("rewards-basic.bpmn"),
ResourceType.BPMN2).get();
return environment;
}
它工作正常。
但现在我想使用远程存储库中的 .jar。例子:
@Produces
@Singleton
@PerProcessInstance
@PerRequest
public RuntimeEnvironment produceEnvironment(EntityManagerFactory emf) throws IOException {
String url = "http://server:8080/jbpm-console/maven2/group/testHtmlForms/1.0/testHtmlForms-1.0.jar";
KieServices ks = KieServices.Factory.get();
KieRepository kr = ks.getRepository();
UrlResource urlResource = (UrlResource) ks.getResources()
.newUrlResource(url);
urlResource.setUsername("admin");
urlResource.setPassword("admin");
urlResource.setBasicAuthentication("enabled");
InputStream is = urlResource.getInputStream();
KieModule kModule = kr.addKieModule(ks.getResources()
.newInputStreamResource(is));
KieContainer kContainer = ks.newKieContainer(kModule.getReleaseId());
RuntimeEnvironment environment = ????????
return environment;
}
那是可能的??我如何创建运行时环境?