/** * Create a new {@link RemoteRestRuntimeEngineBuilder} instance * to configure and buid a remote API client {@link RuntimeEngine} instance. * @return A {@link RemoteRestRuntimeEngineBuilder} instance */ public static RemoteRestRuntimeEngineBuilder newRestBuilder() { return org.kie.services.client.api.RemoteRuntimeEngineFactory.newRestBuilder(); }
/** * @see {@link RemoteRuntimeEngineFactory#newRestBuilder()} */ @Deprecated public static RemoteRestRuntimeEngineBuilder newBuilder() { return RemoteRuntimeEngineFactory.newRestBuilder(); }
private RemoteConfiguration buildRemoteConfiguration(RemoteModel remoteModel) { RuntimeEngine engine = null; if (remoteModel instanceof RemoteJmsModel) { RemoteJmsRuntimeEngineBuilder builder = RemoteRuntimeEngineFactory.newJmsBuilder(); InitialContext ctx = configRemoteJms(builder, (RemoteJmsModel)remoteModel); try { engine = builder.build(); } finally { if (ctx != null) { try { ctx.close(); } catch (Exception e) { e.getMessage(); // ignore but keep checkstyle happy } } } } else if (remoteModel instanceof RemoteRestModel) { RemoteRestRuntimeEngineBuilder builder = RemoteRuntimeEngineFactory.newRestBuilder(); configRemoteRest(builder, (RemoteRestModel)remoteModel); engine = builder.build(); } RemoteConfiguration config = null; if (engine instanceof RemoteRuntimeEngine) { Access<RemoteConfiguration> configAccess = new FieldAccess<RemoteConfiguration>(RemoteRuntimeEngine.class, "config"); config = configAccess.isReadable() ? configAccess.read(engine) : null; } return config; }
private RemoteConfiguration buildRemoteConfiguration(RemoteModel remoteModel) { RuntimeEngine engine = null; if (remoteModel instanceof RemoteJmsModel) { RemoteJmsRuntimeEngineBuilder builder = RemoteRuntimeEngineFactory.newJmsBuilder(); InitialContext ctx = configRemoteJms(builder, (RemoteJmsModel)remoteModel); try { engine = builder.build(); } finally { if (ctx != null) { try { ctx.close(); } catch (Exception e) { e.getMessage(); // ignore but keep checkstyle happy } } } } else if (remoteModel instanceof RemoteRestModel) { RemoteRestRuntimeEngineBuilder builder = RemoteRuntimeEngineFactory.newRestBuilder(); configRemoteRest(builder, (RemoteRestModel)remoteModel); engine = builder.build(); } RemoteConfiguration config = null; if (engine instanceof RemoteRuntimeEngine) { Access<RemoteConfiguration> configAccess = new FieldAccess<RemoteConfiguration>(RemoteRuntimeEngine.class, "config"); config = configAccess.isReadable() ? configAccess.read(engine) : null; } return config; }
protected KieSession initKieSession() throws CoreException { RuntimeEngine restSessionFactory; try { restSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId(bpmConfig.getDeploymentId()) .addUrl(new URL(bpmConfig.getBpmInstanceUrl())) .addUserName(bpmConfig.getUsername()) .addPassword(bpmConfig.getPassword()) .addTimeout(AUTHENTICATION_TIMEOUT_S) .build(); } catch (Exception e) { throw new CoreException("Could not initialize connection to BPM server at '" + bpmConfig.getBpmInstanceUrl() + "' check that the URL is correct.", e); } return restSessionFactory.getKieSession(); }
@Test public void notAceptedMethodTest() throws Exception { URL deploymentUrl = new URL( "http://localhost:8080/kie-wb/" ); RemoteRestRuntimeEngineFactory restSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId("deployment") .addUrl(deploymentUrl) .addUserName("mary") .addPassword("pass") .buildFactory(); WorkItemHandler wih = new DoNothingWorkItemHandler(); try { restSessionFactory.newRuntimeEngine().getKieSession().getWorkItemManager().registerWorkItemHandler("test", wih); fail( "The above call should have failed."); } catch( UnsupportedOperationException uoe ) { assertTrue("Incorrect error message: " + uoe.getMessage(), uoe.getMessage().contains("not supported on the Remote Client instance.")); } }
String taskUserId = userId; RuntimeEngine engine = RemoteRuntimeEngineFactory.newRestBuilder() .addDeploymentId(deploymentId) .addUrl(deploymentUrl)