Java KieServicesConfiguration类的典型用法和代码示例

本文整理汇总了Java中org.kie.server.client.KieServicesConfiguration的典型用法代码示例。如果您正苦于以下问题:Java KieServicesConfiguration类的具体用法?Java KieServicesConfiguration怎么用?Java KieServicesConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

KieServicesConfiguration类属于org.kie.server.client包,在下文中一共展示了KieServicesConfiguration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processRules

点赞 3

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
public Measure processRules(@Body Measure measure) {
	
	KieServicesConfiguration config = KieServicesFactory.newRestConfiguration(
			kieHost, kieUser,
			kiePassword);
	
	Set<Class<?>> jaxBClasses = new HashSet<Class<?>>();
	jaxBClasses.add(Measure.class);
	
	config.addJaxbClasses(jaxBClasses);
	config.setMarshallingFormat(MarshallingFormat.JAXB);
	RuleServicesClient client = KieServicesFactory.newKieServicesClient(config)
			.getServicesClient(RuleServicesClient.class);

       List<Command<?>> cmds = new ArrayList<Command<?>>();
	KieCommands commands = KieServices.Factory.get().getCommands();
	cmds.add(commands.newInsert(measure));
	
    GetObjectsCommand getObjectsCommand = new GetObjectsCommand();
    getObjectsCommand.setOutIdentifier("objects");

	
	cmds.add(commands.newFireAllRules());
	cmds.add(getObjectsCommand);
	BatchExecutionCommand myCommands = CommandFactory.newBatchExecution(cmds,
			"DecisionTableKS");
	ServiceResponse<ExecutionResults> response = client.executeCommandsWithResults("iot-ocp-businessrules-service", myCommands);
			
	List responseList = (List) response.getResult().getValue("objects");
	
	Measure responseMeasure = (Measure) responseList.get(0);
	
	return responseMeasure;

}
 

开发者ID:sabre1041,
项目名称:iot-ocp,
代码行数:36,
代码来源:BusinessRulesBean.java

示例2: executeUsingREST

点赞 3

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
@POST
@Path("rest")
@Produces("application/json")
public List<KieContainerResource> executeUsingREST(){
	KieServicesConfiguration conf = KieServicesFactory.newRestConfiguration(URL, USER, PSW);
	conf.setMarshallingFormat(MarshallingFormat.JSON);
	KieServicesClient client = KieServicesFactory.newKieServicesClient(conf);
	return client.listContainers().getResult().getContainers();
}
 

开发者ID:jesuino,
项目名称:bpms6-examples,
代码行数:10,
代码来源:ListContainersResource.java

示例3: build

点赞 3

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
@Override
public Map<Class<?>, Object> build(KieServicesConfiguration configuration, ClassLoader classLoader) {
	Map<Class<?>, Object> services = new HashMap<Class<?>, Object>();
	Set<Class<?>> extraClasses = new HashSet<>();
	extraClasses.addAll(Arrays.asList(KieMLConstants.ADDITIONAL_MARSHALLER_CLASSES));
	configuration.addExtraClasses(extraClasses);
       services.put(KieServerMLClient.class, new KieServerMLClientImpl(configuration, classLoader));
       return services;
}
 

开发者ID:jesuino,
项目名称:kie-ml,
代码行数:10,
代码来源:KieMLClientBuilderImpl.java

示例4: main

点赞 2

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
		KieServicesConfiguration configuration = KieServicesFactory
				.newRestConfiguration(" http://localhost:8080/rest/server", "kieserver", "kieserver1!");
		configuration.setMarshallingFormat(MarshallingFormat.XSTREAM);
		HashSet<Class<?>> classes = new HashSet<>();
		classes.addAll(Arrays.asList(KieMLConstants.ADDITIONAL_MARSHALLER_CLASSES));
		configuration.addExtraClasses(classes);
		KieServicesClient client = KieServicesFactory.newKieServicesClient(configuration);
		
		client.listContainers().getResult().getContainers().stream()
			.filter(c -> c.getContainerId().equals(CONTAINER_ID))
			.findFirst().ifPresent(c -> client.disposeContainer(CONTAINER_ID));
		createContainer(client);
		Input input = new Input("file:/home/wsiqueir/MNIST/mnist_png/testing/2/174.png");
		KieServerMLClient mlClient = client.getServicesClient(KieServerMLClient.class);
		System.out.println(mlClient.getModelList(CONTAINER_ID).getResult());
		System.out.println(mlClient.getModel(CONTAINER_ID, "mnist").getResult());
		System.out.println(mlClient.predict(CONTAINER_ID, "mnist", input).getResult().getPredictions());
		
//		InputStream is = KieServerMLClientTest.class.getResource("/data/iris2d_test_data.arff").openStream();
//		String arffContent = null;
//		try (BufferedReader buffer = new BufferedReader(new InputStreamReader(is))) {
//			arffContent =  buffer.lines().collect(Collectors.joining("\n"));
//        }
//		System.out.println("Sending data:" + arffContent);
//		System.out.println(mlClient.getModel(CONTAINER_ID, "iris2d").getResult());
//		Input input2 = new Input(null, arffContent, null);
//		System.out.println(mlClient.predict(CONTAINER_ID, "iris2d", input2).getResult().getPredictions());
		
		
		input = new Input(null, SENTENCE, null);
		System.out.println(mlClient.predict(CONTAINER_ID, "datePos", input).getResult().getText());
		System.out.println(mlClient.predict(CONTAINER_ID, "tagger", input).getResult().getText());
		
		client.disposeContainer(CONTAINER_ID);

	}
 

开发者ID:jesuino,
项目名称:kie-ml,
代码行数:38,
代码来源:KieServerMLClientTest.java

示例5: RemoteCommandExecutor

点赞 2

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
public RemoteCommandExecutor() {
	//Creating a client to the KieServer requires a url, and username/password for a user
	//with the 'kie-server' role.
	String url = "http://localhost:8080/kie-server/services/rest/server";
    String username = "kieserver";
    String password = "[email protected]";
    KieServicesConfiguration config = new KieServicesConfigurationImpl(url, username, password);
    kieServicesClient = new KieServicesClientImpl(config);
}
 

开发者ID:anurag-saran,
项目名称:drools-usage-patterns,
代码行数:10,
代码来源:RemoteCommandExecutor.java

示例6: executeUsingJMS

点赞 2

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
@POST
@Path("jms")
@Produces("application/json")
public List<KieContainerResource> executeUsingJMS() throws NamingException{
       // FIRST WAY: Using the initial context
       java.util.Properties env = new java.util.Properties();
       env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
                       "org.jboss.naming.remote.client.InitialContextFactory");
       env.put(javax.naming.Context.PROVIDER_URL, "remote://localhost:4547");
       // the same user used in kie server will be against the remote server -
       // make sure the user has the role "admin" or modify the roles for JMS
       // security in standalone.xml
       env.put(javax.naming.Context.SECURITY_PRINCIPAL, USER);
       env.put(javax.naming.Context.SECURITY_CREDENTIALS, PSW);
       InitialContext ctx = new InitialContext(env);

       // SECOND WAY: Lookup queues to build the configuration
       ConnectionFactory conn = (ConnectionFactory) ctx.lookup("jms/RemoteConnectionFactory");
       Queue reqQueue = (Queue) ctx.lookup("jms/queue/KIE.SERVER.REQUEST");
       Queue respQueue = (Queue) ctx.lookup("jms/queue/KIE.SERVER.RESPONSE");

       // Use the configuration you want
       KieServicesConfiguration conf = KieServicesFactory.newJMSConfiguration(conn, reqQueue, respQueue, USER, PSW);
       //conf = KieServicesFactory.newJMSConfiguration(ctx, USER, PASSWORD);
       conf.setMarshallingFormat(MarshallingFormat.JSON);
	
	KieServicesClient client = KieServicesFactory.newKieServicesClient(conf);
	return client.listContainers().getResult().getContainers();
}
 

开发者ID:jesuino,
项目名称:bpms6-examples,
代码行数:30,
代码来源:ListContainersResource.java

示例7: executeUsingJMS

点赞 2

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
@POST
@Path("jms")
@Produces("application/json")
public List<KieContainerResource> executeUsingJMS(){
	KieServicesConfiguration conf = KieServicesFactory.newJMSConfiguration(connectionFactory, reqQueue, respQueue, USER, PSW);
	conf.setMarshallingFormat(MarshallingFormat.JSON);
	KieServicesClient client = KieServicesFactory.newKieServicesClient(conf);
	return client.listContainers().getResult().getContainers();
}
 

开发者ID:jesuino,
项目名称:bpms6-examples,
代码行数:10,
代码来源:ListContainersResource.java

示例8: KieServerMLClientImpl

点赞 2

import org.kie.server.client.KieServicesConfiguration; //导入依赖的package包/类
public KieServerMLClientImpl(KieServicesConfiguration config, ClassLoader cl) {
	super(config, cl);
	baseUrl = config.getServerUrl();
}
 

开发者ID:jesuino,
项目名称:kie-ml,
代码行数:5,
代码来源:KieServerMLClientImpl.java