Ajout Thortil kieserver

This commit is contained in:
Nicolas Héron 2018-11-06 14:46:51 +01:00
commit f7babd8a19
21 changed files with 289 additions and 117 deletions

View file

@ -0,0 +1,58 @@
# ignore .svn metadata files
.svn
# ignore Maven generated target folders
~
target
# ignore eclipse files
.project
.classpath
.settings
.metadata
# ignore m2e annotation processing files
.factorypath
# ignore IDEA files
*.iml
*.ipr
*.iws
.idea
# ignore NetBeans files
nbactions.xml
nb-configuration.xml
catalog.xml
#
maven-ant-tasks.jar
test-output
transaction.log
# vim files
*.swp
/.gitk-tmp.*
atlassian-ide-plugin.xml
# temp files
*~
# maven versions plugin
pom.xml.versionsBackup
# hprof dumps
/*.hprof
# ignore 'randomly' strewn around logs
server.log
# ignore java crashes
hs_err_pid*.log
# H2 databases produced by tests
*.h2.db
*.trace.db
*.lock.db
# JBoss transaction generated files
PutObjectStoreDirHere
# ignore mvn-rpmbuild repo
/.m2
# ignore eap repo
local-repo-eap
# Dependency reduced pom
*/dependency-reduced-pom.xml
#OS X index files
.DS_Store
testsuite-core/standalone/cli_output
tmp
log
*.log
embedded-cassandra.log*

View file

@ -0,0 +1,8 @@
*org.wildfly.swarm.bootstrap
org.wildfly.swarm.container
org.wildfly.swarm.jaxrs
org.wildfly.swarm.security
org.wildfly.swarm.configuration
io.undertow.servlet
io.undertow.core
org.jboss.resteasy.resteasy-jackson-provider

View file

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2015 Red Hat, Inc. and/or its affiliates.
~
~ Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>drools-framework-thorntail-fraction</artifactId>
<name>Drools Server thorntail fraction</name>
<description>Drools Server thorntail fraction</description>
<packaging>jar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom</artifactId>
<version>${version.thorntail}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-fraction-plugin</artifactId>
<version>90</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>container</artifactId>
<version>${version.thorntail}</version>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>spi</artifactId>
<version>${version.thorntail}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs</artifactId>
<version>${version.thorntail}</version>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>jaxrs-cdi</artifactId>
<version>${version.thorntail}</version>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>ejb</artifactId>
<version>${version.thorntail}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<!-- drools kie server dependencies -->
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-services-drools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-rest-drools</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
<version>2.1.0.Final</version>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<version>2.1.0.Final</version>
<!-- This is a compile-time dependency of this project, but is not needed at compile or runtime by other
projects that depend on this project.-->
<scope>provided</scope>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,47 @@
package org.chtijbug.swarm.drools.server.runtime;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.wildfly.swarm.bootstrap.util.TempFileManager;
import org.wildfly.swarm.jaxrs.JAXRSArchive;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
/**
* @author Ken Finnigan
*/
@ApplicationScoped
public class DroolsDeploymentProducer {
private static String configFolder = System.getProperty("org.drools.server.swarm.web.conf");
@Produces
public Archive droolsWar() throws Exception {
if (System.getProperty("org.drools.server.swarm.web.conf") == null) {
//Path dir = Files.createTempDirectory("swarm-keycloak-config");
File dir = TempFileManager.INSTANCE.newTempDirectory("swarm-drools-web-config", ".d");
System.setProperty("org.drools.server.swarm.conf", dir.getAbsolutePath());
Files.copy(getClass().getClassLoader().getResourceAsStream("config/web/web.xml"),
dir.toPath().resolve("web.xml"),
StandardCopyOption.REPLACE_EXISTING);
Files.copy(getClass().getClassLoader().getResourceAsStream("config/web/jboss-web.xml"),
dir.toPath().resolve("jboss-web.xml"),
StandardCopyOption.REPLACE_EXISTING);
configFolder = dir.toPath().toString();
}
DroolsMessages.MESSAGES.configurationDirectory(configFolder);
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "drools-server.war");
deployment.addAllDependencies();
deployment.addAsWebInfResource(new File(configFolder + "/web.xml"), "web.xml");
deployment.addAsWebInfResource(new File(configFolder + "/jboss-web.xml"), "jboss-web.xml");
return deployment;
}
}

View file

@ -0,0 +1,63 @@
package org.chtijbug.swarm.drools.server.runtime;
import org.wildfly.swarm.bootstrap.util.TempFileManager;
import org.wildfly.swarm.config.security.Flag;
import org.wildfly.swarm.config.security.SecurityDomain;
import org.wildfly.swarm.config.security.security_domain.ClassicAuthentication;
import org.wildfly.swarm.config.security.security_domain.authentication.LoginModule;
import org.wildfly.swarm.security.SecurityFraction;
import org.wildfly.swarm.spi.api.Customizer;
import org.wildfly.swarm.spi.api.Fraction;
import org.wildfly.swarm.spi.runtime.annotations.Post;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Any;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
/**
* @author Ken Finnigan
*/
@Post
@ApplicationScoped
public class DroolsFrameworkFraction implements Customizer, Fraction {
private static String configFolder = System.getProperty("org.drools.server.swarm.security.conf");
@Inject
@Any
Instance<SecurityFraction> security;
@Override
public void customize() throws Exception {
//Path dir = Files.createTempDirectory("swarm-keycloak-config");
File dir = TempFileManager.INSTANCE.newTempDirectory("swarm-drools-security-config", ".d");
System.setProperty("org.drools.server.swarm.conf", dir.getAbsolutePath());
Files.copy(getClass().getClassLoader().getResourceAsStream("config/security/application-users.properties"),
dir.toPath().resolve("application-users.properties"),
StandardCopyOption.REPLACE_EXISTING);
Files.copy(getClass().getClassLoader().getResourceAsStream("config/security/application-roles.properties"),
dir.toPath().resolve("application-roles.properties"),
StandardCopyOption.REPLACE_EXISTING);
configFolder = dir.toPath().toString();
LoginModule<?> loginModule = new LoginModule<>("UsersRoles");
loginModule.flag(Flag.REQUIRED)
.code("UsersRoles")
.moduleOption("usersProperties", configFolder + "/application-users.properties")
.moduleOption("rolesProperties", configFolder + "/application-roles.properties");
if (!this.security.isUnsatisfied()) {
SecurityDomain<?> security = new SecurityDomain<>("other-drools")
.classicAuthentication(new ClassicAuthentication<>()
.loginModule(loginModule));
this.security.get().securityDomain(security);
}
}
}

View file

@ -0,0 +1,40 @@
/*
* JBoss, Home of Professional Open Source.
*
* Copyright 2016 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.swarm.drools.server.runtime;
import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
/**
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@MessageLogger(projectCode = "TTDROOLS", length = 4)
public interface DroolsMessages extends BasicLogger {
DroolsMessages MESSAGES = Logger.getMessageLogger(DroolsMessages.class, "org.wildfly.swarm.drools");
@LogMessage(level = Logger.Level.DEBUG)
@Message(id = 1, value = "Configuration directory: %s")
void configurationDirectory(String dir);
}

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Thorntail :: Examples :: Camel CDI
%%
Copyright (C) 2016 RedHat
%%
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#L%
-->
<!-- Marker file indicating CDI should be enabled -->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all">
</beans>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/kie-server</context-root>
<security-domain>other-drools</security-domain>
</jboss-web>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
version="3.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<security-constraint>
<web-resource-collection>
<web-resource-name>REST web resources</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>kie-server</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>KIE Server</realm-name>
</login-config>
<security-role>
<role-name>kie-server</role-name>
</security-role>
</web-app>

View file

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>drools-framework-kie-server-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-thorntail-jar</artifactId>
<packaging>jar</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>bom</artifactId>
<version>${version.thorntail}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-thorntail-fraction</artifactId>
<version>${project.version}</version>
</dependency>
<!-- kie drools server dependencies -->
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-common</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.spec.javax.security.jacc</groupId>
<artifactId>jboss-jacc-api_1.4_spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<artifactId>jaxrs-api</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
<exclusion>
<artifactId>resteasy-jaxrs</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
<exclusion>
<artifactId>resteasy-jaxb-provider</artifactId>
<groupId>org.jboss.resteasy</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-rest-common</artifactId>
</dependency>
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.thorntail</groupId>
<artifactId>thorntail-maven-plugin</artifactId>
<executions>
<execution>
<id>package</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<!--plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin-->
</plugins>
</build>
</project>

View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
Thorntail :: Examples :: Camel CDI
%%
Copyright (C) 2016 RedHat
%%
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#L%
-->
<!-- Marker file indicating CDI should be enabled -->
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd" bean-discovery-mode="all">
</beans>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>pymma-jbpm-platform-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-thorntail-kie-server-parent</artifactId>
<packaging>pom</packaging>
<modules>
<module>drools-framework-thorntail-fraction</module>
<module>drools-framework-thorntail-jar</module>
</modules>
</project>