Skip to content

Instantly share code, notes, and snippets.

Stephen Masters gratiartis

Block or report user

Report or block gratiartis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gratiartis
gratiartis / kie-workbench-rest-api-create-org.sh
Last active Feb 9, 2019
Example script to create an organisation, repository and project in KIE Workbench, via the REST API.
View kie-workbench-rest-api-create-org.sh
#!/bin/bash
# --------------------------------------------------------------------------------
#
# Script to demonstrate using the KIE (Drools) Workbench REST API to:
#
# create an organistion.
# create a repository associated with the organisation.
# create a project in the repository.
#
View MultiDsBarDbConfig.java
package com.sctrcd.multidsdemo;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
View application.yml
spring:
datasource:
url: jdbc:mysql://localhost/foo_schema
username: root
password: d4t4b4s3sForLif3
driverClassName: com.mysql.jdbc.Driver
test-on-borrow: true
test-while-idle: true
validation-query: select 1;
maxActive: 1
View FooDbConfig.java
package com.sctrcd.multidsdemo;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.context.annotation.Bean;
View BusPassController.java
@RestController
public class BusPassController {
private static Logger log = LoggerFactory.getLogger(BusPassController.class);
private final BusPassService busPassService;
@Autowired
public BusPassController(BusPassService busPassService) {
this.busPassService = busPassService;
View BusPassService.java
@Service
public class BusPassService {
private final KieContainer kieContainer;
@Autowired
public BusPassService(KieContainer kieContainer) {
log.info("Initialising a new bus pass session.");
this.kieContainer = kieContainer;
}
View BusPassApp.java
@SpringBootApplication
public class BusPassApp {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(BusPassApp.class, args);
}
@Bean
public KieContainer kieContainer() {
return KieServices.Factory.get().getKieClasspathContainer();
@gratiartis
gratiartis / gist:e246df0650984490e7be
Created Feb 6, 2015
Get a KieContainer and create a KieSession
View gist:e246df0650984490e7be
KieContainer kieContainer = KieServices.Factory.get().getKieClasspathContainer();
KieSession kieSession = kieContainer.newKieSession("BusPassSession");
@gratiartis
gratiartis / kmodule.xml
Created Feb 6, 2015
Example kmodule.xml
View kmodule.xml
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<kbase name="BusPassKbase" packages="com.sctrcd.buspassws.rules">
<ksession name="BusPassSession" />
</kbase>
</kmodule>
@gratiartis
gratiartis / spring-platform-bom.xml
Last active Aug 29, 2015
Spring IO Platform BOM
View spring-platform-bom.xml
<!-- Transitively bring in the Spring IO Platform Bill-of-Materials `pom.xml` -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>1.1.1.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
You can’t perform that action at this time.