Migrate to apache KIe 10.0 Remove all non existing features (like Business Central)

This commit is contained in:
nheron 2025-02-15 17:50:02 +01:00
commit 87390f9dd1
247 changed files with 406 additions and 21084 deletions

View file

@ -5,7 +5,7 @@
<parent>
<artifactId>drools-framework-base-tools-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -29,29 +29,8 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>${javax.activation.version}</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.api.version}</version>
</dependency>
</dependencies>
<build>
<plugins>

View file

@ -1,36 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* 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.drools.common.jaxb;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.StringWriter;
public final class JAXBContextUtils {
public static <T> String marshallObjectAsString(Class<T> clazz, T object) throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
// output pretty printed
jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
StringWriter writer = new StringWriter();
jaxbMarshaller.marshal(object, writer);
return writer.toString();
}
}

View file

@ -1,41 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* 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.drools.common.jaxb;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class JAXBContextUtilsTest {
@Test
public void testMarshallObjectAsString() throws Exception {
ToTestClass toTestClass = new ToTestClass();
toTestClass.setAttr1("attr1");
toTestClass.setAttr2("attr2");
String toEvaluate = JAXBContextUtils.marshallObjectAsString(ToTestClass.class, toTestClass);
assertThat(toEvaluate).isNotNull();
assertThat(toEvaluate).isEqualTo("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
"<toTestClass>\n" +
" <attr1>attr1</attr1>\n" +
" <attr2>attr2</attr2>\n" +
"</toTestClass>\n");
}
}

View file

@ -1,49 +0,0 @@
/*
* Copyright 2014 Pymma Software
*
* 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.drools.common.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = {"attr1", "attr2"})
public class ToTestClass {
private String attr1;
private String attr2;
public ToTestClass() {
}
public String getAttr1() {
return attr1;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr2() {
return attr2;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
}

View file

@ -4,7 +4,7 @@
<parent>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-examples</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View file

@ -4,7 +4,7 @@
<parent>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-examples</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<artifactId>drools-framework-swimmingpool-web-ui</artifactId>
@ -48,17 +48,7 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-client-connector</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>

View file

@ -16,8 +16,7 @@
package org.chtijbug.swimmingpool.web;
import org.chtijbug.drools.generic.restclient.GenericConnexionConfiguration;
import org.chtijbug.drools.generic.restclient.rest.UsedRestAPI;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -45,11 +44,5 @@ public class SwimmingPoolApplication {
SpringApplication.run(SwimmingPoolApplication.class, args);
}
@Bean
public UsedRestAPI serviceCalculate() {
GenericConnexionConfiguration swimmingPoolConnexionConfiguration = new GenericConnexionConfiguration(url, username, password);
return swimmingPoolConnexionConfiguration.getGenericRestAPI();
}
}

View file

@ -17,7 +17,6 @@ package org.chtijbug.swimmingpool.web.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.chtijbug.drools.common.rest.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -90,8 +89,8 @@ public class QuoteController {
"transactionId", updatedInstance.getSessionLogging());
}
clientHttpRequest.getHeaders().add(
Constants.AUTHORISATION_HEADER, token);
// clientHttpRequest.getHeaders().add(
// Constants.AUTHORISATION_HEADER, token);
clientHttpRequest.getHeaders().add(
HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
clientHttpRequest.getHeaders().add(

View file

@ -4,7 +4,7 @@
<parent>
<artifactId>drools-framework-base-tools-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View file

@ -18,18 +18,7 @@
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-services-drools</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
</dependency>
<!--dependency>
<groupId>com.pymmasoftware.jbpm</groupId>

View file

@ -26,45 +26,16 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workbench-models-guided-template</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-services-common</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>

View file

@ -1,278 +0,0 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.kieserver.services.drools;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.kie.api.remote.Remotable;
import org.kie.scanner.KieModuleMetaData;
import org.kie.server.api.KieServerConstants;
import org.kie.server.services.api.*;
import org.kie.server.services.impl.KieContainerInstanceImpl;
import org.kie.server.services.impl.KieServerImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import java.lang.annotation.Annotation;
import java.util.*;
public class DroolsChtijbugKieServerExtension implements KieServerExtension {
public static final String EXTENSION_NAME = "DroolsFramework";
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugKieServerExtension.class);
private static final Boolean DISABLED = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_SERVER_EXT_DISABLED, "false"));
private static final Boolean FILTER_REMOTEABLE = Boolean.parseBoolean(System.getProperty(KieServerConstants.KIE_DROOLS_FILTER_REMOTEABLE_CLASSES, "false"));
private DroolsChtijbugRulesExecutionService rulesExecutionService;
private KieServerRegistry registry;
private List<Object> services = new ArrayList<>();
private KieServerAddOnElement kieServerAddOnElement = null;
private boolean initialized = false;
@Override
public boolean isInitialized() {
return initialized;
}
@Override
public boolean isActive() {
return !DISABLED;
}
@Override
public void init(KieServerImpl kieServer, KieServerRegistry registry) {
initExtensionsList();
this.rulesExecutionService = new DroolsChtijbugRulesExecutionService(registry, this.kieServerAddOnElement);
this.registry = registry;
services.add(rulesExecutionService);
initialized = true;
}
private void initExtensionsList() {
List<KieServerGlobalVariableDefinition> kieServerGlobalVariableDefinitions = new ArrayList<>();
ServiceLoader<KieServerGlobalVariableDefinition> serverExtensions1 = ServiceLoader.load(KieServerGlobalVariableDefinition.class);
for (KieServerGlobalVariableDefinition loadedImpl : serverExtensions1) {
kieServerGlobalVariableDefinitions.add(loadedImpl);
}
List<KieServerLoggingDefinition> kieServerLoggingDefinitions = new ArrayList<>();
ServiceLoader<KieServerLoggingDefinition> serverExtensions2 = ServiceLoader.load(KieServerLoggingDefinition.class);
for (KieServerLoggingDefinition loadedImpl : serverExtensions2) {
kieServerLoggingDefinitions.add(loadedImpl);
}
List<KieServerListenerDefinition> kieServerListenerDefinitions = new ArrayList<>();
ServiceLoader<KieServerListenerDefinition> serverExtensions3 = ServiceLoader.load(KieServerListenerDefinition.class);
for (KieServerListenerDefinition loadedImpl : serverExtensions3) {
kieServerListenerDefinitions.add(loadedImpl);
}
this.kieServerAddOnElement = new KieServerAddOnElement(kieServerGlobalVariableDefinitions, kieServerLoggingDefinitions, kieServerListenerDefinitions);
}
@Override
public void destroy(KieServerImpl kieServer, KieServerRegistry registry) {
// no-op?
}
@Override
public void createContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
// do any other bootstrapping rule service requires
Set<Class<?>> extraClasses = new HashSet<>();
// create kbases so declared types can be created
Collection<String> kbases = kieContainerInstance.getKieContainer().getKieBaseNames();
for (String kbase : kbases) {
kieContainerInstance.getKieContainer().getKieBase(kbase);
}
KieModuleMetaData metaData = (KieModuleMetaData) parameters.get(KieServerConstants.KIE_SERVER_PARAM_MODULE_METADATA);
Collection<String> packages = metaData.getPackages();
for (String p : packages) {
Collection<String> classes = metaData.getClasses(p);
for (String c : classes) {
String type = p + "." + c;
try {
logger.debug("Adding {} type into extra jaxb classes set", type);
Class<?> clazz = Class.forName(type, true, kieContainerInstance.getKieContainer().getClassLoader());
addExtraClass(extraClasses, clazz, FILTER_REMOTEABLE);
logger.debug("Added {} type into extra jaxb classes set", type);
} catch (ClassNotFoundException e) {
logger.warn("Unable to create instance of type {} due to {}", type, e.getMessage());
logger.debug("Complete stack trace for exception while creating type {}", type, e);
} catch (Exception e) {
logger.warn("Unexpected error while create instance of type {} due to {}", type, e.getMessage());
logger.debug("Complete stack trace for unknown error while creating type {}", type, e);
}
}
}
kieContainerInstance.addExtraClasses(extraClasses);
this.rulesExecutionService.createRuleBasePackage(id, kieContainerInstance);
}
@Override
public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
//Nop
}
@Override
public boolean isUpdateContainerAllowed(String s, KieContainerInstance kieContainerInstance, Map<String, Object> map) {
logger.info("Container {} isUpdateContainerAllowed",s);
return true;
}
@Override
public void disposeContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) {
logger.info("Container {} dispose",id);
if (kieServerAddOnElement != null) {
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
kieServerGlobalVariableDefinition.OnDisposeKieBase();
}
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnDisposeKieBase();
}
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnDisposeKieBase();
}
}
kieContainerInstance.clearExtraClasses();
rulesExecutionService.removeRuleBasePackage(id);
if (kieContainerInstance instanceof KieContainerInstanceImpl) {
KieContainerInstanceImpl internalContainer = (KieContainerInstanceImpl) kieContainerInstance;
if (internalContainer.getKieContainer().getMainKieModule() instanceof InternalKieModule) {
InternalKieModule kie = (InternalKieModule) internalContainer.getKieContainer().getMainKieModule();
kie.getFile().delete();
}
}
}
@Override
public List<Object> getAppComponents(SupportedTransports type) {
ServiceLoader<KieServerApplicationComponentsService> appComponentsServices
= ServiceLoader.load(KieServerApplicationComponentsService.class);
List<Object> appComponentsList = new ArrayList<>();
Object[] serviceList = {
rulesExecutionService,
registry
};
for (KieServerApplicationComponentsService appComponentsService : appComponentsServices) {
appComponentsList.addAll(appComponentsService.getAppComponents(EXTENSION_NAME, type, serviceList));
}
return appComponentsList;
}
@Override
public <T> T getAppComponents(Class<T> serviceType) {
if (serviceType.isAssignableFrom(rulesExecutionService.getClass())) {
return (T) rulesExecutionService;
}
return null;
}
@Override
public String getImplementedCapability() {
return "BRules";
}
@Override
public List<Object> getServices() {
return services;
}
@Override
public String getExtensionName() {
return EXTENSION_NAME;
}
@Override
public Integer getStartOrder() {
return 0;
}
@Override
public String toString() {
return EXTENSION_NAME + " KIE Server extension";
}
public DroolsChtijbugRulesExecutionService getRulesExecutionService() {
return rulesExecutionService;
}
protected void addExtraClass(Set<Class<?>> extraClasses, Class classToAdd, boolean filtered) {
if (classToAdd.isInterface()
|| classToAdd.isAnnotation()
|| classToAdd.isLocalClass()
|| classToAdd.isMemberClass()) {
return;
}
if (filtered) {
boolean jaxbClass = false;
boolean remoteableClass = false;
// @XmlRootElement and @XmlType may be used with inheritance
for (Annotation anno : classToAdd.getAnnotations()) {
if (XmlRootElement.class.equals(anno.annotationType())) {
jaxbClass = true;
break;
}
if (XmlType.class.equals(anno.annotationType())) {
jaxbClass = true;
break;
}
}
// @Remotable is not inheritable, and may not be used as such
for (Annotation anno : classToAdd.getDeclaredAnnotations()) {
if (Remotable.class.equals(anno.annotationType())) {
remoteableClass = true;
break;
}
}
if (jaxbClass || remoteableClass) {
extraClasses.add(classToAdd);
}
} else {
extraClasses.add(classToAdd);
}
}
}

View file

@ -1,184 +0,0 @@
/*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* 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.kieserver.services.drools;
import org.chtijbug.drools.ChtijbugObjectRequest;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.kieserver.extension.KieServerGlobalVariableDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerListenerDefinition;
import org.chtijbug.drools.kieserver.extension.KieServerLoggingDefinition;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBasePackage;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.impl.RuleBaseSingleton;
import org.chtijbug.drools.runtimeevent.MessageHandlerResolver;
import org.kie.api.runtime.KieContainer;
import org.kie.server.services.api.KieContainerInstance;
import org.kie.server.services.api.KieServerRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
/**
* Direct rules execution service that allow use of typed objects instead of string only
*/
public class DroolsChtijbugRulesExecutionService {
private static final Logger logger = LoggerFactory.getLogger(DroolsChtijbugRulesExecutionService.class);
private KieServerRegistry context;
private Map<String, RuleBasePackage> ruleBasePackages = new HashMap<>();
private Map<String, RuleBasePackage> ruleBasePackagesClass = new HashMap<>();
private MessageHandlerResolver messageHandlerResolver;
private int MaxNumberRulesToExecute = 20000;
private KieServerAddOnElement kieServerAddOnElement = null;
public DroolsChtijbugRulesExecutionService(KieServerRegistry context, KieServerAddOnElement kieServerAddOnElement) {
this.context = context;
this.messageHandlerResolver = new MessageHandlerResolver();
this.kieServerAddOnElement = kieServerAddOnElement;
}
public KieServerRegistry getContext() {
return context;
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, int sessionMaxNumberRulesToExecute) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, null, sessionMaxNumberRulesToExecute);
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, null);
}
public KieServerAddOnElement getKieServerAddOnElement() {
return kieServerAddOnElement;
}
public void removeRuleBasePackage(String id) {
if (this.ruleBasePackages.containsKey(id) == true) {
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(id);
ruleBasePackage.dispose();
this.ruleBasePackages.remove(id);
}
if (this.ruleBasePackagesClass.containsKey(id) == true) {
this.ruleBasePackagesClass.remove(id);
}
}
public void createRuleBasePackage(String id, KieContainerInstance kci) {
if (kci != null
&& kci.getKieContainer() != null) {
if (this.ruleBasePackages.containsKey(id) == false) {
KieContainer kieContainer = kci.getKieContainer();
RuleBasePackage ruleBasePackage = new RuleBaseSingleton(kieContainer, this.MaxNumberRulesToExecute, kieServerAddOnElement);
if (kieServerAddOnElement != null) {
for (KieServerGlobalVariableDefinition kieServerGlobalVariableDefinition : kieServerAddOnElement.getKieServerGlobalVariableDefinitions()) {
kieServerGlobalVariableDefinition.OnCreateKieBase(kieServerAddOnElement.getGlobals());
}
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnCreateKieBase();
}
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
kieServerLoggingDefinition.OnCreateKieBase();
}
}
this.ruleBasePackages.put(id, ruleBasePackage);
}
}
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, String sessionName, int sessionMaxNumberRulesToExecute) {
Object result = null;
try {
if (messageHandlerResolver==null){
logger.error("DroolsChtijbugRulesExecutionService.FireAllRulesAndStartProcess.messageHandlerResolver is null");
}
if (chtijbugObjectRequest==null){
logger.error("DroolsChtijbugRulesExecutionService.FireAllRulesAndStartProcess.chtijbugObjectRequest is null");
}else if( chtijbugObjectRequest.getObjectRequest()==null){
logger.error("DroolsChtijbugRulesExecutionService.FireAllRulesAndStartProcess.chtijbugObjectRequest.getObjectRequest is null");
}
if (chtijbugObjectRequest.getObjectRequest().getClass()!= null
&& chtijbugObjectRequest.getObjectRequest().getClass().getClassLoader() != null) {
messageHandlerResolver.setClassLoader(chtijbugObjectRequest.getObjectRequest().getClass().getClassLoader());
}
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(kci.getResource().getContainerId());
if (ruleBasePackage != null) {
Date startTime = new Date();
ChtijbugHistoryListener chtijbugHistoryListener=null;
if (!chtijbugObjectRequest.isDisableLogging()) {
chtijbugHistoryListener = new ChtijbugHistoryListener();
}
RuleBaseSession session = ruleBasePackage.createRuleBaseSession(sessionMaxNumberRulesToExecute, chtijbugHistoryListener, sessionName);
if (kieServerAddOnElement != null) {
for (KieServerListenerDefinition kieServerListenerDefinition : kieServerAddOnElement.getKieServerListenerDefinitions()) {
kieServerListenerDefinition.OnCreateKieSession(session.getKnowledgeSession());
}
for (String globalVariableName : kieServerAddOnElement.getGlobals().keySet()) {
session.setGlobal(globalVariableName, kieServerAddOnElement.getGlobals().get(globalVariableName));
}
}
result = session.fireAllRulesAndStartProcess(chtijbugObjectRequest.getObjectRequest(), processID);
session.dispose();
Date stopTime = new Date();
List<HistoryEvent> events=new ArrayList<>();
if (chtijbugHistoryListener!= null){
events = chtijbugHistoryListener.getHistoryEventLinkedList();
}
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(events);
sessionContext.setGroupID(kci.getResource().getReleaseId().getGroupId());
sessionContext.setArtefactID(kci.getResource().getReleaseId().getArtifactId());
sessionContext.setVersion(kci.getResource().getReleaseId().getVersion());
sessionContext.setContainerId(kci.getContainerId());
String serverName = System.getProperty("org.kie.server.id");
if (serverName!= null){
sessionContext.setServerName(serverName);
}
sessionContext.setStartTime(startTime);
sessionContext.setStopTime(stopTime);
chtijbugObjectRequest.setSessionLogging(sessionContext);
chtijbugObjectRequest.setObjectRequest(result);
logger.debug("Returning OK response with content '{}'", chtijbugObjectRequest.getObjectRequest());
}
return chtijbugObjectRequest;
} catch (DroolsChtijbugException e) {
logger.error("FireAllRulesAndStartProcess",e);
}
throw new IllegalStateException("Unable to execute command " + chtijbugObjectRequest.getObjectRequest());
}
public ChtijbugObjectRequest FireAllRulesAndStartProcess(KieContainerInstance kci, ChtijbugObjectRequest chtijbugObjectRequest, String processID, String sessionName) {
return this.FireAllRulesAndStartProcess(kci, chtijbugObjectRequest, processID, sessionName, this.MaxNumberRulesToExecute);
}
}

View file

@ -1,30 +0,0 @@
package org.chtijbug.kieserver.services.drools.sftp;
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
import org.apache.sshd.server.session.ServerSession;
/**
* Very basic PasswordAuthenticator used for unit tests.
*/
public class MyPasswordAuthenticator implements PasswordAuthenticator {
private String login;
private String password;
public MyPasswordAuthenticator(String login, String password) {
this.login = login;
this.password = password;
}
public boolean authenticate(String username, String password, ServerSession session) {
boolean retour = false;
if (this.login != null
&& this.password != null
&& this.login.equals(username)
&& this.password.equals(password)) {
retour = true;
}
return retour;
}
}

View file

@ -1,13 +0,0 @@
package org.chtijbug.kieserver.services.drools.sftp;
import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
import org.apache.sshd.server.session.ServerSession;
import java.security.PublicKey;
public class MyPublickeyAuthenticator implements PublickeyAuthenticator {
public boolean authenticate(String s, PublicKey publicKey, ServerSession serverSession) {
return true;
}
}

View file

@ -11,9 +11,9 @@
<artifactId>drools-framework-kie-server-parent</artifactId>
<modules>
<module>drools-framework-kie-server-services-drools</module>
<module>drools-framework-kie-server-client-connector</module>
<module>drools-framework-kie-server-extension-interface</module>
<module>drools-framework-kie-server-rest-drools</module>
<!--module>drools-framework-kie-server-client-connector</module>-->
<!--module>drools-framework-kie-server-extension-interface</module-->
<!--module>drools-framework-kie-server-rest-drools</module-->
</modules>

View file

@ -1,124 +0,0 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>drools-framework-kie-wb-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<artifactId>drools-framework-kie-wb-rest-pojo</artifactId>
<packaging>jar</packaging>
<name>kie drools Framework - REST pojo</name>
<description>kie drools Framework - REST Client classes</description>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-rest-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-common</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>guava</artifactId>
<groupId>com.google.guava</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>3.6.2.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>3.6.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<version>3.6.2.Final</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>mail</artifactId>
<groupId>javax.mail</groupId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!--build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>wrap-dependency</id>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<instructions>
<Embed-Dependency>*</Embed-Dependency>
<Export-Package>org.drools.guvnor.server.jaxrs.*</Export-Package>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.plugin.version}</version>
<configuration>
<source>${pymma.java.version}</source>
<target>${pymma.java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,62 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.api;
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;
@XmlRootElement(name = "user")
@XmlAccessorType(XmlAccessType.FIELD)
public class UserLoginInformation {
private List<PlatformProjectData> projects = new ArrayList<>();
private String username;
private List<String> roles = new ArrayList<>();
public List<PlatformProjectData> getProjects() {
return projects;
}
public void setProjects(List<PlatformProjectData> projects) {
this.projects = projects;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "archived")
@XmlAccessorType(XmlAccessType.FIELD)
public class Archived {
@XmlElement
private boolean value;
public boolean getValue() {
return value;
}
public void setValue(boolean archived) {
value = archived;
}
}

View file

@ -1,145 +0,0 @@
/*
* Copyright 2011 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Date;
@XmlRootElement()
public class Asset {
private String title;
private String binaryContentAttachmentFileName;
private String description;
private String author;
private Date published;
private URI binaryLink, sourceLink, refLink;
private String content;
private AssetMetadata metadata;
private String directory;
private String comment;
@XmlElement
public URI getBinaryLink() {
return binaryLink;
}
public void setBinaryLink(URI binaryLink) {
this.binaryLink = binaryLink;
}
@XmlElement
public URI getSourceLink() {
return sourceLink;
}
public void setSourceLink(URI sourceLink) {
this.sourceLink = sourceLink;
}
@XmlElement
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@XmlElement
public String getBinaryContentAttachmentFileName() {
return binaryContentAttachmentFileName;
}
public void setBinaryContentAttachmentFileName(String binaryContentAttachmentFileName) {
this.binaryContentAttachmentFileName = binaryContentAttachmentFileName;
}
@XmlElement()
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlElement
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@XmlElement
public Date getPublished() {
return published;
}
public void setPublished(Date published) {
this.published = published;
}
@XmlElement
public URI getRefLink() {
return refLink;
}
public void setRefLink(URI refLink) {
this.refLink = refLink;
}
@XmlElement
public AssetMetadata getMetadata() {
return metadata;
}
public void setMetadata(AssetMetadata metadata) {
this.metadata = metadata;
}
@XmlElement
public String getDirectory() {
return directory;
}
public void setDirectory(String directory) {
this.directory = directory;
}
@XmlElement
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@XmlElement
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}

View file

@ -1,117 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
@XmlRootElement(name = "metadata")
public class AssetMetadata {
private String uuid;
private String[] categories;
private String note;
private Date created;
private String format;
private boolean disabled;
private String state;
private long versionNumber;
private String checkInComment;
@XmlElement
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@XmlElement
public String[] getCategories() {
return categories;
}
public void setCategories(String[] categories) {
this.categories = categories;
}
@XmlElement
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
@XmlElement
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@XmlElement
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
@XmlElement
public boolean isDisabled() {
return disabled;
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
@XmlElement
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@XmlElement
public long getVersionNumber() {
return versionNumber;
}
public void setVersionNumber(long versionNumber) {
this.versionNumber = versionNumber;
}
@XmlElement
public String getCheckInComment() {
return checkInComment;
}
public void setCheckInComment(String checkInComment) {
this.checkInComment = checkInComment;
}
}

View file

@ -1,52 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import org.jboss.resteasy.annotations.providers.multipart.PartType;
import javax.ws.rs.FormParam;
import javax.ws.rs.core.MediaType;
import java.io.InputStream;
public class AssetMultipartForm {
@FormParam("asset")
@PartType(MediaType.APPLICATION_JSON)
private Asset asset;
@FormParam("binary")
@PartType(MediaType.APPLICATION_OCTET_STREAM)
private InputStream binary;
public Asset getAsset() {
return asset;
}
public void setAsset(Asset asset) {
this.asset = asset;
}
public InputStream getBinary() {
return binary;
}
public void setBinary(InputStream binary) {
this.binary = binary;
}
}

View file

@ -1,175 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.*;
import java.util.Date;
@XmlRootElement(name = "metadata")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({Categories.class})
public class AtomAssetMetadata {
@XmlElement
private Uuid uuid;
@XmlElement
private Categories categories;
@XmlElement
private Note note;
@XmlElement
private Created created;
@XmlElement
private Format format;
@XmlElement
private Disabled disabled;
@XmlElement
private State state;
@XmlElement
private VersionNumber versionNumber;
@XmlElement
private CheckinComment checkinComment;
@XmlElement
private Archived archived;
public String getUuid() {
return uuid != null ? uuid.getValue() : null;
}
public void setUuid(String uuid) {
if (this.uuid == null) {
this.uuid = new Uuid();
}
this.uuid.setValue(uuid);
}
public String[] getCategories() {
return categories != null ? categories.getValues() : null;
}
public void setCategories(String[] categories) {
if (this.categories == null) {
this.categories = new Categories();
}
this.categories.setValue(categories);
}
public String getNote() {
return note != null ? note.getValue() : null;
}
public void setNote(String note) {
if (this.note == null) {
this.note = new Note();
}
this.note.setValue(note);
}
public Date getCreated() {
return created != null ? created.getValue() : null;
}
public void setCreated(Date created) {
if (this.created == null) {
this.created = new Created();
}
this.created.setValue(created);
}
public String getFormat() {
return format != null ? format.getValue() : null;
}
public void setFormat(String format) {
if (this.format == null) {
this.format = new Format();
}
this.format.setValue(format);
}
public boolean getDisabled() {
return disabled != null ? disabled.getValue() : false;
}
public void setDisabled(boolean disabled) {
if (this.disabled == null) {
this.disabled = new Disabled();
}
this.disabled.setValue(disabled);
}
public String getState() {
return state != null ? state.getValue() : null;
}
public void setState(String state) {
if (this.state == null) {
this.state = new State();
}
this.state.setValue(state);
}
public long getVersionNumber() {
return versionNumber != null ? versionNumber.getValue() : -1L;
}
public void setVersionNumber(long versionNumber) {
if (this.versionNumber == null) {
this.versionNumber = new VersionNumber();
}
this.versionNumber.setValue(versionNumber);
}
public String getCheckinComment() {
return checkinComment != null ? checkinComment.getValue() : null;
}
public void setCheckinComment(String checkinComment) {
if (this.checkinComment == null) {
this.checkinComment = new CheckinComment();
}
this.checkinComment.setValue(checkinComment);
}
public boolean isArchived() {
return archived != null ? archived.getValue() : false;
}
public void setArchived(boolean archived) {
if (this.archived == null) {
this.archived = new Archived();
}
this.archived.setValue(archived);
}
@Override
public String toString() {
return "AtomAssetMetadata{" +
"uuid=" + uuid +
", categories=" + categories +
", note=" + note +
", created=" + created +
", format=" + format +
", disabled=" + disabled +
", state=" + state +
", versionNumber=" + versionNumber +
", checkinComment=" + checkinComment +
", archived=" + archived +
'}';
}
}

View file

@ -1,123 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
@XmlRootElement(name = "metadata")
@XmlAccessorType(XmlAccessType.FIELD)
public class AtomPackageMetadata {
@XmlElement
private Uuid uuid;
@XmlElement
private Created created;
@XmlElement
private Format format;
@XmlElement
private State state;
@XmlElement
private Archived archived;
@XmlElement
private VersionNumber versionNumber;
@XmlElement
private CheckinComment checkinComment;
public String getUuid() {
return uuid != null ? uuid.getValue() : "";
}
public void setUuid(String uuid) {
if (this.uuid == null) {
this.uuid = new Uuid();
}
this.uuid.setValue(uuid);
}
public Date getCreated() {
return created != null ? created.getValue() : null;
}
public void setCreated(Date created) {
if (this.created == null) {
this.created = new Created();
}
this.created.setValue(created);
}
public String getFormat() {
return format != null ? format.getValue() : "";
}
public void setFormat(String format) {
if (this.format == null) {
this.format = new Format();
}
this.format.setValue(format);
}
public String getState() {
return state != null ? state.getValue() : "";
}
public void setState(String state) {
if (this.state == null) {
this.state = new State();
}
this.state.setValue(state);
}
public boolean isArchived() {
return archived != null ? archived.getValue() : false;
}
public void setArchived(boolean archived) {
if (this.archived == null) {
this.archived = new Archived();
}
this.archived.setValue(archived);
}
public long getVersionNumber() {
return versionNumber != null ? versionNumber.getValue() : -1L;
}
public void setVersionNumber(long versionNumber) {
if (this.versionNumber == null) {
this.versionNumber = new VersionNumber();
}
this.versionNumber.setValue(versionNumber);
}
public String getCheckinComment() {
return checkinComment != null ? checkinComment.getValue() : "";
}
public void setCheckinComment(String checkinComment) {
if (this.checkinComment == null) {
this.checkinComment = new CheckinComment();
}
this.checkinComment.setValue(checkinComment);
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "categories")
@XmlAccessorType(XmlAccessType.FIELD)
public class Categories {
@XmlElement(name = "value")
private String[] values;
public String[] getValues() {
return values;
}
public void setValue(String[] categories) {
values = categories;
}
}

View file

@ -1,48 +0,0 @@
/*
* Copyright 2011 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
@XmlRootElement()
public class Category {
private String path;
private URI refLink;
@XmlElement()
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@XmlElement
public URI getRefLink() {
return refLink;
}
public void setRefLink(URI refLink) {
this.refLink = refLink;
}
}

View file

@ -1,40 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "checkinComment")
@XmlAccessorType(XmlAccessType.FIELD)
public class CheckinComment {
@XmlElement
private String value;
public String getValue() {
return value; //To change body of created methods use File | Settings | File Templates.
}
public void setValue(String checkin) {
value = checkin;
}
}

View file

@ -1,41 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
@XmlRootElement(name = "created")
@XmlAccessorType(XmlAccessType.FIELD)
public class Created {
@XmlElement
private Date value;
public Date getValue() {
return value;
}
public void setValue(Date created) {
value = created;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "disabled")
@XmlAccessorType(XmlAccessType.FIELD)
public class Disabled {
@XmlElement
private boolean value;
public boolean getValue() {
return value;
}
public void setValue(boolean disabled) {
value = disabled;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "format")
@XmlAccessorType(XmlAccessType.FIELD)
public class Format {
@XmlElement
private String value;
public String getValue() {
return value;
}
public void setValue(String format) {
value = format;
}
}

View file

@ -1,29 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.jaxb;
import org.chtijbug.guvnor.server.jaxrs.providers.atom.Entry;
import org.jboss.resteasy.spi.interception.DecoratorProcessor;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import java.lang.annotation.Annotation;
/**
* 10 19 2012
*
* @author <a href="mailto:l.weinan@gmail.com">Weinan Li</a>
*/
public class GuvnorAtomProcessor implements DecoratorProcessor<Marshaller, GuvnorDecorators> {
@Override
public Marshaller decorate(Marshaller target, GuvnorDecorators annotation, Class type, Annotation[] annotations, MediaType mediaType) {
Class[] classes = new Class[]{AtomAssetMetadata.class, AtomPackageMetadata.class, Entry.class};
try {
JAXBContext jaxbContext = JAXBContext.newInstance(classes);
return jaxbContext.createMarshaller();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View file

@ -1,20 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.jaxb;
import org.jboss.resteasy.annotations.Decorator;
import javax.xml.bind.Marshaller;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 10 19 2012
*
* @author <a href="mailto:l.weinan@gmail.com">Weinan Li</a>
*/
@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Decorator(processor = GuvnorAtomProcessor.class, target = Marshaller.class)
public @interface GuvnorDecorators {
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "note")
@XmlAccessorType(XmlAccessType.FIELD)
public class Note {
@XmlElement
private String value;
public String getValue() {
return value;
}
public void setValue(String note) {
value = note;
}
}

View file

@ -1,122 +0,0 @@
/*
* Copyright 2011 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collection;
import java.util.Date;
import java.util.LinkedList;
@XmlRootElement()
public class Package {
private String title;
private String description;
private String author;
private Date published;
private Collection<String> modules = new LinkedList<>();
private PackageMetadata metadata;
private String groupID;
private String artifactID;
private String version;
@XmlElement
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@XmlElement
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@XmlElement
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@XmlElement
public Date getPublished() {
return published;
}
public void setPublished(Date published) {
this.published = published;
}
@XmlElement
public PackageMetadata getMetadata() {
return metadata;
}
public void setMetadata(PackageMetadata metadata) {
this.metadata = metadata;
}
@XmlElement
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@XmlElement
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
@XmlElement
public String getArtifactID() {
return artifactID;
}
public void setArtifactID(String artifactID) {
this.artifactID = artifactID;
}
@XmlElement
public Collection<String> getModules() {
return modules;
}
public void setModules(Collection<String> modules) {
this.modules = modules;
}
}

View file

@ -1,111 +0,0 @@
/*
* Copyright 2011 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Date;
@XmlRootElement(name = "metadata")
public class PackageMetadata {
private String uuid;
private Date created;
private String format;
private String state;
private boolean archived;
private long versionNumber;
private String checkinComment;
@XmlElement
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@XmlElement
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@XmlElement
public String getFormat() {
return format;
}
public void setFormat(String format) {
this.format = format;
}
@XmlElement
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@XmlElement
public boolean isArchived() {
return archived;
}
public void setArchived(boolean archived) {
this.archived = archived;
}
@XmlElement
public long getVersionNumber() {
return versionNumber;
}
public void setVersionNumber(long versionNumber) {
this.versionNumber = versionNumber;
}
@XmlElement
public String getCheckinComment() {
return checkinComment;
}
public void setCheckinComment(String checkinComment) {
this.checkinComment = checkinComment;
}
@Override
public String toString() {
return "PackageMetadata{" +
"uuid='" + uuid + '\'' +
", created=" + created +
", format='" + format + '\'' +
", state='" + state + '\'' +
", archived=" + archived +
", versionNumber=" + versionNumber +
", checkinComment='" + checkinComment + '\'' +
'}';
}
}

View file

@ -1,109 +0,0 @@
/*
* Copyright 2013 JBoss by Red Hat.
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.*;
/**
* @author nheron
*/
@XmlRootElement(namespace = "http://www.w3.org/2005/Atom", name = "SnapshotCreationData")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = {"buildMode", "statusOperator", "statusDescriptionValue", "enableStatusSelector", "categoryOperator",
"categoryValue", "enableCategorySelector", "customSelectorConfigName"})
public class SnapshotCreationData {
private String buildMode;
private String statusOperator;
private String statusDescriptionValue;
private boolean enableStatusSelector = false;
private String categoryOperator;
private String categoryValue;
private boolean enableCategorySelector = false;
private String customSelectorConfigName;
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getBuildMode() {
return buildMode;
}
public void setBuildMode(String buildMode) {
this.buildMode = buildMode;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getStatusOperator() {
return statusOperator;
}
public void setStatusOperator(String statusOperator) {
this.statusOperator = statusOperator;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getStatusDescriptionValue() {
return statusDescriptionValue;
}
public void setStatusDescriptionValue(String statusDescriptionValue) {
this.statusDescriptionValue = statusDescriptionValue;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public boolean getEnableStatusSelector() {
return enableStatusSelector;
}
public void setEnableStatusSelector(boolean enableStatusSelector) {
this.enableStatusSelector = enableStatusSelector;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getCategoryOperator() {
return categoryOperator;
}
public void setCategoryOperator(String categoryOperator) {
this.categoryOperator = categoryOperator;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getCategoryValue() {
return categoryValue;
}
public void setCategoryValue(String categoryValue) {
this.categoryValue = categoryValue;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public boolean getEnableCategorySelector() {
return enableCategorySelector;
}
public void setEnableCategorySelector(boolean enableCategorySelector) {
this.enableCategorySelector = enableCategorySelector;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getCustomSelectorConfigName() {
return customSelectorConfigName;
}
public void setCustomSelectorConfigName(String customSelectorConfigName) {
this.customSelectorConfigName = customSelectorConfigName;
}
}

View file

@ -1,50 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "snapshots")
@XmlAccessorType(XmlAccessType.FIELD)
public class Snapshots {
@XmlElement(name = "packageName")
private String packageName;
@XmlElement(name = "name")
private String[] listNames;
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String[] getListNames() {
return listNames;
}
public void setListNames(String[] names) {
listNames = names;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "state")
@XmlAccessorType(XmlAccessType.FIELD)
public class State {
@XmlElement
private String value;
public String getValue() {
return value;
}
public void setValue(String state) {
value = state;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "uuid")
@XmlAccessorType(XmlAccessType.FIELD)
public class Uuid {
@XmlElement
private String value;
public String getValue() {
return value;
}
public void setValue(String uuid) {
value = uuid;
}
}

View file

@ -1,39 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "versionNumber")
@XmlAccessorType(XmlAccessType.FIELD)
public class VersionNumber {
@XmlElement
private long value;
public long getValue() {
return value;
}
public void setValue(long uuid) {
value = uuid;
}
}

View file

@ -1,43 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.model;
public class DependencyData {
private String groupId;
private String artifactId;
private String version;
public DependencyData() {
}
public DependencyData(String groupId, String artifactId, String version) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
}
public String getGroupId() {
return groupId;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public String getArtifactId() {
return artifactId;
}
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
}

View file

@ -1,27 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.model;
public class KModuleData {
private String kbaseToInclude;
private String kbase;
public KModuleData() {
}
public String getKbaseToInclude() {
return kbaseToInclude;
}
public void setKbaseToInclude(String kbaseToInclude) {
this.kbaseToInclude = kbaseToInclude;
}
public String getKbase() {
return kbase;
}
public void setKbase(String kbase) {
this.kbase = kbase;
}
}

View file

@ -1,74 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.model;
import org.guvnor.rest.client.ProjectResponse;
import java.util.ArrayList;
import java.util.List;
public class PlatformProjectData extends ProjectResponse {
private String artifactId;
private String wbName;
private String branch;
private List<String> javaClasses = new ArrayList<>();
private List<DependencyData> dependencies = new ArrayList<>();
private KModuleData kModule;
public PlatformProjectData() {
super();
}
public String getWbName() {
return wbName;
}
public void setWbName(String wbName) {
this.wbName = wbName;
}
public List<String> getJavaClasses() {
return javaClasses;
}
public void setJavaClasses(List<String> javaClasses) {
this.javaClasses = javaClasses;
}
public String getArtifactId() {
return artifactId;
}
public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public List<DependencyData> getDependencies() {
return dependencies;
}
public void setDependencies(List<DependencyData> dependencies) {
this.dependencies = dependencies;
}
public KModuleData getkModule() {
return kModule;
}
public void setkModule(KModuleData kModule) {
this.kModule = kModule;
}
}

View file

@ -1,13 +0,0 @@
package org.chtijbug.guvnor.server.jaxrs.model;
public class WorkspaceAuthData {
private String status;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

View file

@ -1,119 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBContextFinder;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBMarshalException;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.*;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashSet;
/**
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@Provider
@Produces("application/atom+*")
@Consumes("application/atom+*")
public class AtomEntryProvider implements MessageBodyReader<Entry>, MessageBodyWriter<Entry> {
@Context
protected Providers providers;
protected JAXBContextFinder getFinder(MediaType type) {
ContextResolver<JAXBContextFinder> resolver = providers.getContextResolver(JAXBContextFinder.class, type);
if (resolver == null) return null;
return resolver.getContext(null);
}
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return Entry.class.isAssignableFrom(type);
}
public Entry readFrom(Class<Entry> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
JAXBContextFinder finder = getFinder(mediaType);
if (finder == null) {
throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
}
try {
JAXBContext ctx = finder.findCachedContext(Entry.class, mediaType, annotations);
Entry entry = (Entry) ctx.createUnmarshaller().unmarshal(entityStream);
if (entry.getContent() != null) entry.getContent().setFinder(finder);
entry.setFinder(finder);
return entry;
} catch (JAXBException e) {
throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
}
}
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return Entry.class.isAssignableFrom(type);
}
public long getSize(Entry entry, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return -1;
}
public void writeTo(Entry entry, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
JAXBContextFinder finder = getFinder(mediaType);
if (finder == null) {
throw new JAXBMarshalException("Unable to find JAXBContext for media type: " + mediaType);
}
HashSet<Class> set = new HashSet<Class>();
set.add(Entry.class);
if (entry.getAnyOtherJAXBObject() != null) {
set.add(entry.getAnyOtherJAXBObject().getClass());
}
if (entry.getContent() != null && entry.getContent().getJAXBObject() != null) {
set.add(entry.getContent().getJAXBObject().getClass());
}
try {
JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
Marshaller marshaller = ctx.createMarshaller();
/* NamespacePrefixMapper mapper = new NamespacePrefixMapper()
{
public String getPreferredPrefix(String namespace, String s1, boolean b)
{
if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
else return s1;
}
};
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper);
*/
marshaller.marshal(entry, entityStream);
} catch (JAXBException e) {
throw new JAXBMarshalException("Unable to marshal: " + mediaType, e);
}
}
}

View file

@ -1,118 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBContextFinder;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBMarshalException;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBUnmarshalException;
import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.*;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.HashSet;
/**
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@Provider
@Produces("application/atom+*")
@Consumes("application/atom+*")
public class AtomFeedProvider implements MessageBodyReader<Feed>, MessageBodyWriter<Feed> {
@Context
protected Providers providers;
protected JAXBContextFinder getFinder(MediaType type) {
ContextResolver<JAXBContextFinder> resolver = providers.getContextResolver(JAXBContextFinder.class, type);
if (resolver == null) return null;
return resolver.getContext(null);
}
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return Feed.class.isAssignableFrom(type);
}
public Feed readFrom(Class<Feed> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
JAXBContextFinder finder = getFinder(mediaType);
if (finder == null) {
throw new JAXBUnmarshalException("Unable to find JAXBContext for media type: " + mediaType);
}
try {
JAXBContext ctx = finder.findCachedContext(Feed.class, mediaType, annotations);
Feed feed = (Feed) ctx.createUnmarshaller().unmarshal(entityStream);
for (Entry entry : feed.getEntries()) {
if (entry.getContent() != null) entry.getContent().setFinder(finder);
}
return feed;
} catch (JAXBException e) {
throw new JAXBUnmarshalException("Unable to unmarshal: " + mediaType, e);
}
}
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return Feed.class.isAssignableFrom(type);
}
public long getSize(Feed feed, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
return -1;
}
public void writeTo(Feed feed, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
JAXBContextFinder finder = getFinder(mediaType);
if (finder == null) {
throw new JAXBMarshalException("Unable to find JAXBContext for media type: " + mediaType);
}
HashSet<Class> set = new HashSet<Class>();
set.add(Feed.class);
for (Entry entry : feed.getEntries()) {
if (entry.getContent() != null && entry.getContent().getJAXBObject() != null) {
set.add(entry.getContent().getJAXBObject().getClass());
}
}
try {
JAXBContext ctx = finder.findCacheContext(mediaType, annotations, set.toArray(new Class[set.size()]));
Marshaller marshaller = ctx.createMarshaller();
/* NamespacePrefixMapper mapper = new NamespacePrefixMapper()
{
public String getPreferredPrefix(String namespace, String s1, boolean b)
{
if (namespace.equals("http://www.w3.org/2005/Atom")) return "atom";
else return s1;
}
};
marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper);
*/
marshaller.marshal(feed, entityStream);
} catch (JAXBException e) {
throw new JAXBMarshalException("Unable to marshal: " + mediaType, e);
}
}
}

View file

@ -1,58 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
/**
* If invoked within the context of a JAX-RS call, it will automatically build a
* URI based the base URI of the JAX-RS application. Same URI as UriInfo.getBaseUri().
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "link")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class BaseLink extends Link {
public BaseLink() {
}
public BaseLink(String rel, String relativeLink) {
UriInfo uriInfo = ResteasyProviderFactory.getContextData(UriInfo.class);
if (uriInfo == null)
throw new IllegalStateException("This constructor must be called in the context of a JAX-RS request");
URI uri = uriInfo.getBaseUriBuilder().path(relativeLink).build();
setHref(uri);
setRel(rel);
}
public BaseLink(String rel, String relativeLink, MediaType mediaType) {
this(rel, relativeLink);
this.setType(mediaType);
}
public BaseLink(String rel, String relativeLink, String mediaType) {
this(rel, relativeLink);
this.setType(MediaType.valueOf(mediaType));
}
}

View file

@ -1,80 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
/**
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* The "atom:category" element conveys information about a category
* associated with an entry or feed. This specification assigns no
* meaning to the content (if any) of this element.
*
* atomCategory =
* element atom:category {
* atomCommonAttributes,
* attribute term { text },
* attribute scheme { atomUri }?,
* attribute label { text }?,
* undefinedContent
* }
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "category")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Category extends CommonAttributes {
private String term;
private URI scheme;
private String label;
@XmlAttribute
public String getTerm() {
return term;
}
public void setTerm(String term) {
this.term = term;
}
@XmlAttribute
public URI getScheme() {
return scheme;
}
public void setScheme(URI scheme) {
this.scheme = scheme;
}
@XmlAttribute
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View file

@ -1,62 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
/**
* Attributes common across all atom types
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
public class CommonAttributes {
private String language;
private URI base;
private Map extensionAttributes = new HashMap();
@XmlAttribute(name = "lang", namespace = "http://www.w3.org/XML/1998/namespace")
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
@XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
public URI getBase() {
return base;
}
public void setBase(URI base) {
this.base = base;
}
@XmlAnyAttribute
public Map getExtensionAttributes() {
return extensionAttributes;
}
}

View file

@ -1,268 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBContextFinder;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider;
import org.w3c.dom.Element;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Represents an atom:content element.</p>
* <p/>
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* The "atom:content" element either contains or links to the content of
* the entry. The content of atom:content is Language-Sensitive.
*
* atomInlineTextContent =
* element atom:content {
* atomCommonAttributes,
* attribute type { "text" | "html" }?,
* (text)*
* }
*
* atomInlineXHTMLContent =
* element atom:content {
* atomCommonAttributes,
* attribute type { "xhtml" },
* xhtmlDiv
* }
* atomInlineOtherContent =
* element atom:content {
* atomCommonAttributes,
* attribute type { atomMediaType }?,
* (text|anyElement)*
* }
*
* atomOutOfLineContent =
* element atom:content {
* atomCommonAttributes,
* attribute type { atomMediaType }?,
* attribute src { atomUri },
* empty
* }
*
* atomContent = atomInlineTextContent
* | atomInlineXHTMLContent
* | atomInlineOtherContent
* | atomOutOfLineContent
*
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "content")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Content extends CommonAttributes {
protected JAXBContextFinder finder;
private String type;
private MediaType mediaType;
private String text;
private Element element;
private URI src;
private List<Object> value;
private Object jaxbObject;
protected void setFinder(JAXBContextFinder finder) {
this.finder = finder;
}
@XmlAnyElement
@XmlMixed
public List<Object> getValue() {
return value;
}
public void setValue(List<Object> value) {
this.value = value;
}
@XmlAttribute
public URI getSrc() {
return src;
}
public void setSrc(URI src) {
this.src = src;
}
/**
* Mime type of the content
*
* @return
*/
@XmlTransient
public MediaType getType() {
if (mediaType == null) {
if (type.equals("html")) mediaType = MediaType.TEXT_HTML_TYPE;
else if (type.equals("text")) mediaType = MediaType.TEXT_PLAIN_TYPE;
else if (type.equals("xhtml")) mediaType = MediaType.APPLICATION_XHTML_XML_TYPE;
else mediaType = MediaType.valueOf(type);
}
return mediaType;
}
public void setType(MediaType type) {
mediaType = type;
if (type.equals(MediaType.TEXT_PLAIN_TYPE)) this.type = "text";
else if (type.equals(MediaType.TEXT_HTML_TYPE)) this.type = "html";
else if (type.equals(MediaType.APPLICATION_XHTML_XML_TYPE)) this.type = "xhtml";
else this.type = type.toString();
}
@XmlAttribute(name = "type")
public String getRawType() {
return type;
}
public void setRawType(String type) {
this.type = type;
}
/**
* If content is text, return it as a String. Otherwise, if content is not text this will return null.
*
* @return
*/
@XmlTransient
public String getText() {
if (value == null) return null;
if (value.size() == 0) return null;
if (text != null) return text;
StringBuffer buf = new StringBuffer();
for (Object obj : value) {
if (obj instanceof String) buf.append(obj.toString());
}
text = buf.toString();
return text;
}
/**
* Set content as text
*
* @param text
*/
public void setText(String text) {
if (value == null) value = new ArrayList<>();
if (this.text != null && value != null) value.clear();
this.text = text;
value.add(text);
}
/**
* Get content as an XML Element if the content is XML. Otherwise, this will just return null.
*
* @return
*/
@XmlTransient
public Element getElement() {
if (value == null) return null;
if (element != null) return element;
for (Object obj : value) {
if (obj instanceof Element) {
element = (Element) obj;
return element;
}
}
return null;
}
/**
* Set the content to an XML Element
*
* @param element
*/
public void setElement(Element element) {
if (value == null) value = new ArrayList();
if (this.element != null && value != null) value.clear();
this.element = element;
value.add(element);
}
/**
* Extract the content as the provided JAXB annotated type.
* <p/>
* This method will use a cached JAXBContext used by the Resteasy JAXB providers
* or, if those are not existent, it will create a new JAXBContext from scratch
* using the class.
*
* @param clazz class type you are expecting
* @param otherPossibleClasses Other classe you want to create the JAXBContext with
* @return null if there is no XML content
* @throws JAXBException
*/
public <T> T getJAXBObject(Class<T> clazz, Class... otherPossibleClasses) throws JAXBException {
JAXBContext ctx = null;
Class[] classes = {clazz};
if (otherPossibleClasses != null && otherPossibleClasses.length > 0) {
classes = new Class[1 + otherPossibleClasses.length];
classes[0] = clazz;
for (int i = 0; i < otherPossibleClasses.length; i++) classes[i + 1] = otherPossibleClasses[i];
}
if (finder != null) {
ctx = finder.findCacheContext(MediaType.APPLICATION_XML_TYPE, null, classes);
} else {
ctx = JAXBContext.newInstance(classes);
}
if (getElement() == null) return null;
Object obj = ctx.createUnmarshaller().unmarshal(getElement());
if (obj instanceof JAXBElement) {
jaxbObject = ((JAXBElement) obj).getValue();
return (T) jaxbObject;
} else {
jaxbObject = obj;
return (T) obj;
}
}
/**
* Returns previous extracted jaxbobject from a call to getJAXBObject(Class<T> clazz)
* or value passed in through a previous setJAXBObject().
*
* @return
*/
@XmlTransient
public Object getJAXBObject() {
return jaxbObject;
}
public void setJAXBObject(Object obj) {
if (value == null) value = new ArrayList();
if (jaxbObject != null && value != null) value.clear();
if (!obj.getClass().isAnnotationPresent(XmlRootElement.class) && obj.getClass().isAnnotationPresent(XmlType.class)) {
value.add(JAXBXmlTypeProvider.wrapInJAXBElement(obj, obj.getClass()));
} else {
value.add(obj);
}
jaxbObject = obj;
}
}

View file

@ -1,353 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBContextFinder;
import org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider;
import org.w3c.dom.Element;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>Per RFC4287:</p>
* <pre>
* The "atom:entry" element represents an individual entry, acting as a
* container for metadata and data associated with the entry. This
* element can appear as a child of the atom:feed element, or it can
* appear as the document (i.e., top-level) element of a stand-alone
* Atom Entry Document.
*
* atomEntry =
* element atom:entry {
* atomCommonAttributes,
* (atomAuthor*
* &amp; atomCategory*
* &amp; atomContent?
* &amp; atomContributor*
* &amp; atomId
* &amp; atomLink*
* &amp; atomPublished?
* &amp; atomRights?
* &amp; atomSource?
* &amp; atomSummary?
* &amp; atomTitle
* &amp; atomUpdated
* &amp; extensionElement*)
* }
*
* This specification assigns no significance to the order of appearance
* of the child elements of atom:entry.
*
* The following child elements are defined by this specification (note
* that it requires the presence of some of these elements):
*
* o atom:entry elements MUST contain one or more atom:author elements,
* unless the atom:entry contains an atom:source element that
* contains an atom:author element or, in an Atom Feed Document, the
* atom:feed element contains an atom:author element itself.
* o atom:entry elements MAY contain any number of atom:category
* elements.
* o atom:entry elements MUST NOT contain more than one atom:content
* element.
* o atom:entry elements MAY contain any number of atom:contributor
* elements.
* o atom:entry elements MUST contain exactly one atom:id element.
* o atom:entry elements that contain no child atom:content element
* MUST contain at least one atom:link element with a rel attribute
* value of "alternate".
* o atom:entry elements MUST NOT contain more than one atom:link
* element with a rel attribute value of "alternate" that has the
* same combination of type and hreflang attribute values.
* o atom:entry elements MAY contain additional atom:link elements
* beyond those described above.
* o atom:entry elements MUST NOT contain more than one atom:published
* element.
* o atom:entry elements MUST NOT contain more than one atom:rights
* element.
* o atom:entry elements MUST NOT contain more than one atom:source
* element.
* o atom:entry elements MUST contain an atom:summary element in either
* of the following cases:
* * the atom:entry contains an atom:content that has a "src"
* attribute (and is thus empty).
* * the atom:entry contains content that is encoded in Base64;
* i.e., the "type" attribute of atom:content is a MIME media type
* [MIMEREG], but is not an XML media type [RFC3023], does not
* begin with "text/", and does not end with "/xml" or "+xml".
* o atom:entry elements MUST NOT contain more than one atom:summary
* element.
* o atom:entry elements MUST contain exactly one atom:title element.
* o atom:entry elements MUST contain exactly one atom:updated element.
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(namespace = "http://www.w3.org/2005/Atom", name = "entry")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = {"title", "links", "categories", "updated", "id", "published", "authors", "contributors", "source",
"rights", "content", "summary", "anyOther"})
public class Entry extends CommonAttributes {
protected JAXBContextFinder finder;
private List<Person> authors = new ArrayList<Person>();
private List<Category> categories = new ArrayList<Category>();
private Content content;
private List<Person> contributors = new ArrayList<Person>();
private URI id;
private List<Link> links = new ArrayList<Link>();
private Date published;
private String title;
private Date updated;
private String rights;
private Source source;
private String summary;
private Element anyOtherElement;
private List<Object> anyOther;
private Object anyOtherJaxbObject;
protected void setFinder(JAXBContextFinder finder) {
this.finder = finder;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public URI getId() {
return id;
}
public void setId(URI id) {
this.id = id;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Link getLinkByRel(String name) {
for (Link link : links) if (link.getRel().equals(name)) return link;
return null;
}
@XmlElementRef(namespace = "http://www.w3.org/2005/Atom")
public List<Link> getLinks() {
return links;
}
@XmlElementRef(namespace = "http://www.w3.org/2005/Atom")
public Content getContent() {
return content;
}
public void setContent(Content content) {
this.content = content;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom", name = "author")
public List<Person> getAuthors() {
return authors;
}
@XmlElementRef(namespace = "http://www.w3.org/2005/Atom")
public List<Category> getCategories() {
return categories;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom", name = "contributor")
public List<Person> getContributors() {
return contributors;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public Date getPublished() {
return published;
}
public void setPublished(Date published) {
this.published = published;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getRights() {
return rights;
}
public void setRights(String rights) {
this.rights = rights;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public Source getSource() {
return source;
}
public void setSource(Source source) {
this.source = source;
}
@XmlElement(namespace = "http://www.w3.org/2005/Atom")
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
@Override
public String toString() {
return "Entry{" +
"authors=" + authors +
", categories=" + categories +
", content=" + content +
", contributors=" + contributors +
", id=" + id +
", links=" + links +
", published=" + published +
", title='" + title + '\'' +
", updated=" + updated +
", rights='" + rights + '\'' +
", source=" + source +
", summary='" + summary + '\'' +
", anyOtherElement=" + anyOtherElement +
", anyOther=" + anyOther +
", anyOtherJaxbObject=" + anyOtherJaxbObject +
'}';
}
/**
* Get content as an XML Element if the content is XML. Otherwise, this will just return null.
*
* @return
*/
@XmlTransient
public Element getAnyOtherElement() {
if (anyOther == null) return null;
if (anyOtherElement != null) return anyOtherElement;
for (Object obj : anyOther) {
if (obj instanceof Element) {
anyOtherElement = (Element) obj;
return anyOtherElement;
}
}
return null;
}
@XmlMixed
@XmlAnyElement(lax = true)
public List<Object> getAnyOther() {
if (anyOther == null) {
anyOther = new ArrayList<Object>();
}
return this.anyOther;
}
/**
* Extract the content as the provided JAXB annotated type.
* <p/>
* This method will use a cached JAXBContext used by the Resteasy JAXB providers
* or, if those are not existent, it will create a new JAXBContext from scratch
* using the class.
*
* @param clazz class type you are expecting
* @param otherPossibleClasses Other classe you want to create the JAXBContext with
* @return null if there is no XML content
* @throws JAXBException
*/
public <T> T getAnyOtherJAXBObject(Class<T> clazz, Class... otherPossibleClasses) throws JAXBException {
JAXBContext ctx = null;
Class[] classes = {clazz};
if (otherPossibleClasses != null && otherPossibleClasses.length > 0) {
classes = new Class[1 + otherPossibleClasses.length];
classes[0] = clazz;
for (int i = 0; i < otherPossibleClasses.length; i++) classes[i + 1] = otherPossibleClasses[i];
}
if (finder != null) {
ctx = finder.findCacheContext(MediaType.APPLICATION_XML_TYPE, null, classes);
} else {
ctx = JAXBContext.newInstance(classes);
}
Object obj = null;
if (getAnyOtherElement() != null) {
obj = ctx.createUnmarshaller().unmarshal(getAnyOtherElement());
} else {
if (getAnyOther().size() == 0) return null;
for (Object _obj : getAnyOther()) {
for (Class _clazz : classes) {
if (_obj.getClass().equals(_clazz)) {
obj = _obj;
break;
}
}
}
if (obj == null)
return null;
}
if (obj instanceof JAXBElement) {
anyOtherJaxbObject = ((JAXBElement) obj).getValue();
return (T) anyOtherJaxbObject;
} else {
anyOtherJaxbObject = obj;
return (T) obj;
}
}
/**
* Returns previous extracted jaxbobject from a call to getJAXBObject(Class<T> clazz)
* or value passed in through a previous setJAXBObject().
*
* @return
*/
@XmlTransient
public Object getAnyOtherJAXBObject() {
return anyOtherJaxbObject;
}
public void setAnyOtherJAXBObject(Object obj) {
if (anyOther == null) anyOther = new ArrayList();
if (anyOtherJaxbObject != null && anyOther != null) anyOther.clear();
if (!obj.getClass().isAnnotationPresent(XmlRootElement.class) && obj.getClass().isAnnotationPresent(XmlType.class)) {
anyOther.add(JAXBXmlTypeProvider.wrapInJAXBElement(obj, obj.getClass()));
} else {
anyOther.add(obj);
}
anyOtherJaxbObject = obj;
}
}

View file

@ -1,111 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.chtijbug.guvnor.server.jaxrs.jaxb.AtomAssetMetadata;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* The "atom:feed" element is the document (i.e., top-level) element of
* an Atom Feed Document, acting as a container for metadata and data
* associated with the feed. Its element children consist of metadata
* elements followed by zero or more atom:entry child elements.
*
* atomFeed =
* element atom:feed {
* atomCommonAttributes,
* (atomAuthor*
* &amp; atomCategory*
* &amp; atomContributor*
* &amp; atomGenerator?
* &amp; atomIcon?
* &amp; atomId
* &amp; atomLink*
* &amp; atomLogo?
* &amp; atomRights?
* &amp; atomSubtitle?
* &amp; atomTitle
* &amp; atomUpdated
* &amp; extensionElement*),
* atomEntry*
* }
*
* This specification assigns no significance to the order of atom:entry
* elements within the feed.
*
* The following child elements are defined by this specification (note
* that the presence of some of these elements is required):
*
* o atom:feed elements MUST contain one or more atom:author elements,
* unless all of the atom:feed element's child atom:entry elements
* contain at least one atom:author element.
* o atom:feed elements MAY contain any number of atom:category
* elements.
* o atom:feed elements MAY contain any number of atom:contributor
* elements.
* o atom:feed elements MUST NOT contain more than one atom:generator
* element.
* o atom:feed elements MUST NOT contain more than one atom:icon
* element.
* o atom:feed elements MUST NOT contain more than one atom:logo
* element.
* o atom:feed elements MUST contain exactly one atom:id element.
* o atom:feed elements SHOULD contain one atom:link element with a rel
* attribute value of "self". This is the preferred URI for
* retrieving Atom Feed Documents representing this Atom feed.
* o atom:feed elements MUST NOT contain more than one atom:link
* element with a rel attribute value of "alternate" that has the
* same combination of type and hreflang attribute values.
* o atom:feed elements MAY contain additional atom:link elements
* beyond those described above.
* o atom:feed elements MUST NOT contain more than one atom:rights
* element.
* o atom:feed elements MUST NOT contain more than one atom:subtitle
* element.
* o atom:feed elements MUST contain exactly one atom:title element.
* o atom:feed elements MUST contain exactly one atom:updated element.
*
* If multiple atom:entry elements with the same atom:id value appear in
* an Atom Feed Document, they represent the same entry. Their
* atom:updated timestamps SHOULD be different. If an Atom Feed
* Document contains multiple entries with the same atom:id, Atom
* Processors MAY choose to display all of them or some subset of them.
* One typical behavior would be to display only the entry with the
* latest atom:updated timestamp.
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(namespace = "http://www.w3.org/2005/Atom", name = "feed")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlSeeAlso({AtomAssetMetadata.class})
public class Feed extends Source {
private List<Entry> entries = new ArrayList<Entry>();
@XmlElementRef(namespace = "http://www.w3.org/2005/Atom")
public List<Entry> getEntries() {
return entries;
}
}

View file

@ -1,93 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.*;
import java.net.URI;
/**
* <p>Per RFC4287</p>
* <p/>
* <pre>
* atomGenerator = element atom:generator {
* atomCommonAttributes,
* attribute uri { atomUri }?,
* attribute version { text }?,
* text
* }
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "generator")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Generator {
private URI uri;
private String version;
private String text;
private String language;
private URI base;
@XmlAttribute(name = "lang")
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
@XmlAttribute
public URI getBase() {
return base;
}
public void setBase(URI base) {
this.base = base;
}
@XmlAttribute
public URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}
@XmlAttribute
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@XmlValue
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View file

@ -1,147 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
/**
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* The "atom:link" element defines a reference from an entry or feed to
* a Web resource. This specification assigns no meaning to the content
* (if any) of this element.
*
* atomLink =
* element atom:link {
* atomCommonAttributes,
* attribute href { atomUri },
* attribute rel { atomNCName | atomUri }?,
* attribute type { atomMediaType }?,
* attribute hreflang { atomLanguageTag }?,
* attribute title { text }?,
* attribute length { text }?,
* undefinedContent
* }
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "link")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Link extends CommonAttributes {
protected URI href;
protected String rel;
protected MediaType type;
protected String hreflang;
protected String title;
protected String length;
public Link() {
}
public Link(String rel, URI href) {
this.rel = rel;
this.href = href;
}
public Link(String rel, URI href, MediaType type) {
this.rel = rel;
this.href = href;
this.type = type;
}
public Link(String rel, String href) {
this.rel = rel;
this.href = URI.create(href);
}
public Link(String rel, String href, MediaType type) {
this.rel = rel;
this.href = URI.create(href);
this.type = type;
}
public Link(String rel, String href, String type) {
this.rel = rel;
this.href = URI.create(href);
this.type = MediaType.valueOf(type);
}
@XmlAttribute(required = true)
public URI getHref() {
return href;
}
public void setHref(URI href) {
this.href = href;
}
@XmlAttribute
public String getRel() {
return rel;
}
public void setRel(String rel) {
this.rel = rel;
}
public MediaType getType() {
return type;
}
public void setType(MediaType type) {
this.type = type;
}
@XmlAttribute
public String getHreflang() {
return hreflang;
}
public void setHreflang(String hreflang) {
this.hreflang = hreflang;
}
@XmlAttribute
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@XmlAttribute
public String getLength() {
return length;
}
public void setLength(String length) {
this.length = length;
}
}

View file

@ -1,35 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.adapters.XmlAdapter;
/**
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
public class MediaTypeAdapter extends XmlAdapter<String, MediaType> {
public MediaType unmarshal(String s) throws Exception {
if (s == null) return null;
return MediaType.valueOf(s);
}
public String marshal(MediaType mediaType) throws Exception {
if (mediaType == null) return null;
return mediaType.toString();
}
}

View file

@ -1,83 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.net.URI;
/**
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* A Person construct is an element that describes a person,
* corporation, or similar entity (hereafter, 'person').
*
* atomPersonConstruct =
* atomCommonAttributes,
* (element atom:name { text }
* &amp; element atom:uri { atomUri }?
* &amp; element atom:email { atomEmailAddress }?
* &amp; extensionElement*)
*
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
public class Person extends CommonAttributes {
private String name;
private URI uri;
private String email;
public Person() {
}
public Person(String name) {
this.name = name;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElement
public URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}
@XmlElement
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}

View file

@ -1,58 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
/**
* If invoked within the context of a JAX-RS call, it will automatically build a
* URI based the base URI of the JAX-RS application. Same URI as UriInfo.getRequestUri().
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlRootElement(name = "link")
@XmlAccessorType(XmlAccessType.PROPERTY)
public class RelativeLink extends Link {
public RelativeLink() {
}
public RelativeLink(String rel, String relativeLink) {
UriInfo uriInfo = ResteasyProviderFactory.getContextData(UriInfo.class);
if (uriInfo == null)
throw new IllegalStateException("This constructor must be called in the context of a JAX-RS request");
URI uri = uriInfo.getAbsolutePathBuilder().path(relativeLink).build();
setHref(uri);
setRel(rel);
}
public RelativeLink(String rel, String relativeLink, MediaType mediaType) {
this(rel, relativeLink);
this.setType(mediaType);
}
public RelativeLink(String rel, String relativeLink, String mediaType) {
this(rel, relativeLink);
this.setType(MediaType.valueOf(mediaType));
}
}

View file

@ -1,181 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.*;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>Per RFC4287:</p>
* <p/>
* <pre>
* If an atom:entry is copied from one feed into another feed, then the
* source atom:feed's metadata (all child elements of atom:feed other
* than the atom:entry elements) MAY be preserved within the copied
* entry by adding an atom:source child element, if it is not already
* present in the entry, and including some or all of the source feed's
* Metadata elements as the atom:source element's children. Such
* metadata SHOULD be preserved if the source atom:feed contains any of
* the child elements atom:author, atom:contributor, atom:rights, or
* atom:category and those child elements are not present in the source
* atom:entry.
*
* atomSource =
* element atom:source {
* atomCommonAttributes,
* (atomAuthor*
* &amp; atomCategory*
* &amp; atomContributor*
* &amp; atomGenerator?
* &amp; atomIcon?
* &amp; atomId?
* &amp; atomLink*
* &amp; atomLogo?
* &amp; atomRights?
* &amp; atomSubtitle?
* &amp; atomTitle?
* &amp; atomUpdated?
* &amp; extensionElement*)
* }
*
* The atom:source element is designed to allow the aggregation of
* entries from different feeds while retaining information about an
* entry's source feed. For this reason, Atom Processors that are
* performing such aggregation SHOULD include at least the required
* feed-level Metadata elements (atom:id, atom:title, and atom:updated)
* in the atom:source element.
* </pre>
* <p/>
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(propOrder = {"title", "subtitle", "categories", "updated", "id", "links", "authors", "contributors", "rights",
"icon", "logo", "generator"})
public class Source extends CommonAttributes {
private List<Person> authors = new ArrayList<Person>();
private List<Category> categories = new ArrayList<Category>();
private List<Person> contributors = new ArrayList<Person>();
private Generator generator;
private URI id;
private String title;
private Date updated;
private List<Link> links = new ArrayList<Link>();
private URI icon;
private URI logo;
private String rights;
private String subtitle;
@XmlElement(name = "author")
public List<Person> getAuthors() {
return authors;
}
@XmlElement(name = "contributor")
public List<Person> getContributors() {
return contributors;
}
@XmlElement
public URI getId() {
return id;
}
public void setId(URI id) {
this.id = id;
}
@XmlElement
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@XmlElement
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Link getLinkByRel(String name) {
for (Link link : links) if (link.getRel().equals(name)) return link;
return null;
}
@XmlElementRef
public List<Link> getLinks() {
return links;
}
@XmlElementRef
public List<Category> getCategories() {
return categories;
}
@XmlElementRef
public Generator getGenerator() {
return generator;
}
public void setGenerator(Generator generator) {
this.generator = generator;
}
@XmlElement
public URI getIcon() {
return icon;
}
public void setIcon(URI icon) {
this.icon = icon;
}
@XmlElement
public URI getLogo() {
return logo;
}
public void setLogo(URI logo) {
this.logo = logo;
}
@XmlElement
public String getRights() {
return rights;
}
public void setRights(String rights) {
this.rights = rights;
}
@XmlElement
public String getSubtitle() {
return subtitle;
}
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
}

View file

@ -1,35 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.guvnor.server.jaxrs.providers.atom;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.net.URI;
/**
* TODO remove this file when JBoss AS includes RESTEasy 2.3.4.Final or higher
*/
public class UriAdapter extends XmlAdapter<String, URI> {
public URI unmarshal(String s) throws Exception {
if (s == null) return null;
return new URI(s);
}
public String marshal(URI uri) throws Exception {
if (uri == null) return null;
return uri.toString();
}
}

View file

@ -1,34 +0,0 @@
/*
* Copyright 2012 JBoss Inc
*
* 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.
*/
@XmlSchema(namespace = "http://www.w3.org/2005/Atom",
// attributeFormDefault = XmlNsForm.QUALIFIED,
xmlns = {@javax.xml.bind.annotation.XmlNs(prefix = "atom", namespaceURI = "http://www.w3.org/2005/Atom")},
elementFormDefault = XmlNsForm.QUALIFIED
)
@XmlJavaTypeAdapters(
{
@XmlJavaTypeAdapter(type = URI.class, value = UriAdapter.class),
@XmlJavaTypeAdapter(type = MediaType.class, value = MediaTypeAdapter.class)
})
package org.chtijbug.guvnor.server.jaxrs.providers.atom;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
import java.net.URI;

View file

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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-wb-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-uberfire-security-service</artifactId>
<dependencies>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-commons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-security-management-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-security-management-backend</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-javax-enterprise</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-security-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-bus</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
<version>1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<scope>provided</scope>
<version>${version.mongodb.driver}</version>
</dependency>
</dependencies>
</project>

View file

@ -1,186 +0,0 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.guvnor.uberfire.security;
import com.mongodb.BasicDBObject;
import com.mongodb.Block;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.jboss.errai.security.shared.api.Group;
import org.jboss.errai.security.shared.api.GroupImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uberfire.commons.config.ConfigProperties;
import org.uberfire.ext.security.management.api.*;
import org.uberfire.ext.security.management.api.exception.SecurityManagementException;
import org.uberfire.ext.security.management.impl.GroupManagerSettingsImpl;
import org.uberfire.ext.security.management.impl.SearchResponseImpl;
import org.uberfire.ext.security.management.search.GroupsIdentifierRuntimeSearchEngine;
import org.uberfire.ext.security.management.search.IdentifierRuntimeSearchEngine;
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
import java.util.*;
import static com.mongodb.client.model.Filters.eq;
/**
* <p>Groups manager service provider implementation for Apache tomcat, when using default realm based on properties files.</p>
* @since 0.8.0
*/
public class KiePlatformGroupManager implements GroupManager, ContextualManager {
private static final Logger LOG = LoggerFactory.getLogger(KiePlatformGroupManager.class);
IdentifierRuntimeSearchEngine<Group> groupsSearchEngine;
private MongoClient mongoClient;
private CodecRegistry pojoCodecRegistry;
private MongoDatabase database;
public KiePlatformGroupManager() {
this(new ConfigProperties(System.getProperties()));
}
public KiePlatformGroupManager(final Map<String, String> gitPrefs) {
this(new ConfigProperties(gitPrefs));
}
public KiePlatformGroupManager(final ConfigProperties gitPrefs) {
// loadConfig(gitPrefs);
}
public void setMongo (MongoClient mongoClient,CodecRegistry pojoCodecRegistry,MongoDatabase database){
this.mongoClient=mongoClient;
this.pojoCodecRegistry = pojoCodecRegistry;
this.database=database;
}
@Override
public void initialize(UserSystemManager userSystemManager) throws Exception {
groupsSearchEngine = new GroupsIdentifierRuntimeSearchEngine();
}
@Override
public void destroy() throws Exception {
}
@Override
public SearchResponse<Group> search(SearchRequest request) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("userGroups");
BasicDBObject regexQuery = new BasicDBObject();
regexQuery.put("name", new BasicDBObject("$regex", request.getSearchPattern() + ".*").append("$options", "i"));
List<Group> groups = new ArrayList<>();
long totalNumber = userCollection.countDocuments(regexQuery);
FindIterable<Document> documents = userCollection.find(regexQuery).skip(request.getPageSize() * (request.getPage() - 1)).limit(request.getPageSize());
documents.forEach((Block<? super Document>) document -> {
String groupName = document.getString("name");
Group group = new GroupImpl(groupName);
groups.add(group);
});
boolean hasNextPage = true;
if ((request.getPageSize() * (request.getPage()) > totalNumber)) {
hasNextPage = false;
}
SearchResponse<Group> response = new SearchResponseImpl(groups, request.getPage(), request.getPageSize(), Long.valueOf(totalNumber).intValue(), hasNextPage);
return response;
}
@Override
public Group get(String identifier) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("userGroups");
List<Group> groups = new ArrayList<>();
userCollection.find(eq("name", identifier)).forEach((Block<? super Document>) document -> {
String groupName = document.getString("name");
Group group = new GroupImpl(groupName);
groups.add(group);
});
if (groups.size() == 1) {
return groups.get(0);
} else {
return null;
}
}
@Override
public List<Group> getAll() throws SecurityManagementException {
List<Group> groups = new ArrayList<>();
MongoCollection<Document> userGroupsCollection = database.getCollection("userGroups");
userGroupsCollection.find().forEach((Block<? super Document>) document -> {
String groupName = document.getString("name");
Group group = new GroupImpl(groupName);
groups.add(group);
});
return groups;
}
@Override
public Group create(Group entity) throws SecurityManagementException {
return entity;
}
@Override
public Group update(Group entity) throws SecurityManagementException {
return entity;
}
@Override
public void delete(String... identifiers) throws SecurityManagementException {
}
@Override
public GroupManagerSettings getSettings() {
final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<Capability, CapabilityStatus>(8);
for (final Capability capability : SecurityManagementUtils.GROUPS_CAPABILITIES) {
capabilityStatusMap.put(capability,
getCapabilityStatus(capability));
}
return new GroupManagerSettingsImpl(capabilityStatusMap,
true);
}
protected CapabilityStatus getCapabilityStatus(Capability capability) {
if (capability != null) {
switch (capability) {
case CAN_SEARCH_GROUPS:
case CAN_ADD_GROUP:
case CAN_UPDATE_GROUP:
case CAN_READ_GROUP:
case CAN_DELETE_GROUP:
return CapabilityStatus.ENABLED;
}
}
return CapabilityStatus.UNSUPPORTED;
}
@Override
public void assignUsers(String name,
Collection<String> users) throws SecurityManagementException {
}
}

View file

@ -1,185 +0,0 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.guvnor.uberfire.security;
import com.mongodb.BasicDBObject;
import com.mongodb.Block;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.jboss.errai.security.shared.api.Role;
import org.jboss.errai.security.shared.api.RoleImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uberfire.commons.config.ConfigProperties;
import org.uberfire.ext.security.management.api.*;
import org.uberfire.ext.security.management.api.exception.SecurityManagementException;
import org.uberfire.ext.security.management.impl.RoleManagerSettingsImpl;
import org.uberfire.ext.security.management.impl.SearchResponseImpl;
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.mongodb.client.model.Filters.eq;
/**
* <p>Groups manager service provider implementation for Apache tomcat, when using default realm based on properties files.</p>
*
* @since 0.8.0
*/
public class KiePlatformRoleManager implements RoleManager, ContextualManager {
private static final Logger LOG = LoggerFactory.getLogger(KiePlatformRoleManager.class);
private MongoClient mongoClient;
private CodecRegistry pojoCodecRegistry;
private MongoDatabase database;
public KiePlatformRoleManager() {
this(new ConfigProperties(System.getProperties()));
}
public KiePlatformRoleManager(final Map<String, String> gitPrefs) {
this(new ConfigProperties(gitPrefs));
}
public KiePlatformRoleManager(final ConfigProperties gitPrefs) {
// loadConfig(gitPrefs);
}
public void setMongo(MongoClient mongoClient, CodecRegistry pojoCodecRegistry, MongoDatabase database) {
this.mongoClient = mongoClient;
this.pojoCodecRegistry = pojoCodecRegistry;
this.database = database;
}
@Override
public void initialize(UserSystemManager userSystemManager) throws Exception {
}
@Override
public void destroy() throws Exception {
}
@Override
public SearchResponse<Role> search(SearchRequest request) throws SecurityManagementException {
MongoCollection<Document> roleCollection = database.getCollection("userRoles");
BasicDBObject regexQuery = new BasicDBObject();
regexQuery.put("name", new BasicDBObject("$regex", request.getSearchPattern() + ".*").append("$options", "i"));
List<Role> roles = new ArrayList<>();
long totalNumber = roleCollection.countDocuments(regexQuery);
FindIterable<Document> documents = roleCollection.find(regexQuery).skip(request.getPageSize() * (request.getPage() - 1)).limit(request.getPageSize());
documents.forEach((Block<? super Document>) document -> {
String roleName = document.getString("name");
Role role = new RoleImpl(roleName);
roles.add(role);
});
boolean hasNextPage = true;
if ((request.getPageSize() * (request.getPage()) > totalNumber)) {
hasNextPage = false;
}
SearchResponse<Role> response = new SearchResponseImpl(roles, request.getPage(), request.getPageSize(), Long.valueOf(totalNumber).intValue(), hasNextPage);
return response;
}
@Override
public Role get(String identifier) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("userRoles");
List<Role> roles = new ArrayList<>();
userCollection.find(eq("name", identifier)).forEach((Block<? super Document>) document -> {
String roleName = document.getString("name");
Role role = new RoleImpl(roleName);
roles.add(role);
});
if (roles.size() == 1) {
return roles.get(0);
} else {
return null;
}
}
@Override
public List<Role> getAll() throws SecurityManagementException {
MongoCollection<Document> userRolesCollection = database.getCollection("userRoles");
List<Role> roles = new ArrayList<>();
userRolesCollection.find().forEach((Block<? super Document>) document -> {
String roleName = document.getString("name");
RoleImpl role = new RoleImpl(roleName);
roles.add(role);
});
return roles;
}
@Override
public Role create(Role entity) throws SecurityManagementException {
return entity;
}
@Override
public Role update(Role entity) throws SecurityManagementException {
return entity;
}
@Override
public void delete(String... identifiers) throws SecurityManagementException {
}
@Override
public RoleManagerSettings getSettings() {
final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<>(8);
for (final Capability capability : SecurityManagementUtils.ROLES_CAPABILITIES) {
capabilityStatusMap.put(capability,
getCapabilityStatus(capability));
}
return new RoleManagerSettingsImpl(capabilityStatusMap);
}
protected CapabilityStatus getCapabilityStatus(Capability capability) {
if (capability != null) {
switch (capability) {
case CAN_SEARCH_ROLES:
case CAN_READ_ROLE:
return CapabilityStatus.ENABLED;
case CAN_ADD_ROLE:
case CAN_UPDATE_ROLE:
case CAN_DELETE_ROLE:
return CapabilityStatus.UNSUPPORTED;
}
}
return CapabilityStatus.UNSUPPORTED;
}
}

View file

@ -1,76 +0,0 @@
package org.chtijbug.guvnor.uberfire.security;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
import org.uberfire.ext.security.management.api.GroupManager;
import org.uberfire.ext.security.management.api.RoleManager;
import org.uberfire.ext.security.management.api.UserManagementService;
import org.uberfire.ext.security.management.api.UserManager;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;
import javax.inject.Named;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
@Dependent
@Named(value = "PymmaKieSecurityService")
public class KiePlatformSecurityService implements UserManagementService {
KiePlatformUserManager userManager;
KiePlatformGroupManager groupManager;
KiePlatformRoleManager roleManager;
private String connectionString;
private String databaseName;
private MongoClient mongoClient;
private CodecRegistry pojoCodecRegistry;
private MongoDatabase database;
@Inject
public KiePlatformSecurityService(KiePlatformUserManager userManager,
KiePlatformGroupManager groupManager,
KiePlatformRoleManager roleManager) {
//-DconnectionString=localhost:28017 -Ddatabase=businessProxyDB
this.connectionString = System.getProperty("connectionString");
this.databaseName=System.getProperty("name");
System.out.println("KiePlatformSecurityService initialized with databaseName = " + connectionString );
this.mongoClient = MongoClients.create(connectionString);
this.pojoCodecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().automatic(true).build()));
this.database = mongoClient.getDatabase(databaseName).withCodecRegistry(pojoCodecRegistry);
System.out.println("All setup");
this.userManager = userManager;
this.groupManager = groupManager;
this.roleManager = roleManager;
this.userManager.setMongo(mongoClient,pojoCodecRegistry,database);
this.groupManager.setMongo(mongoClient,pojoCodecRegistry,database);
this.roleManager.setMongo(mongoClient,pojoCodecRegistry,database);
}
@Override
public UserManager users() {
return userManager;
}
@Override
public GroupManager groups() {
return groupManager;
}
@Override
public RoleManager roles() {
return roleManager;
}
}

View file

@ -1,300 +0,0 @@
/*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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.guvnor.uberfire.security;
import com.mongodb.BasicDBObject;
import com.mongodb.Block;
import com.mongodb.DBRef;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.jboss.errai.security.shared.api.Group;
import org.jboss.errai.security.shared.api.GroupImpl;
import org.jboss.errai.security.shared.api.Role;
import org.jboss.errai.security.shared.api.RoleImpl;
import org.jboss.errai.security.shared.api.identity.User;
import org.jboss.errai.security.shared.api.identity.UserImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.uberfire.commons.config.ConfigProperties;
import org.uberfire.ext.security.management.api.*;
import org.uberfire.ext.security.management.api.exception.SecurityManagementException;
import org.uberfire.ext.security.management.impl.SearchResponseImpl;
import org.uberfire.ext.security.management.impl.UserManagerSettingsImpl;
import org.uberfire.ext.security.management.util.SecurityManagementUtils;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import static com.mongodb.client.model.Filters.eq;
/**
* <p>Users manager service provider implementation for Apache tomcat, when using default realm based on properties files.</p>
*
* @since 0.8.0
*/
public class KiePlatformUserManager implements UserManager, ContextualManager {
private static final Logger LOG = LoggerFactory.getLogger(KiePlatformUserManager.class);
private MongoClient mongoClient;
private CodecRegistry pojoCodecRegistry;
private MongoDatabase database;
public KiePlatformUserManager() {
this(new ConfigProperties(System.getProperties()));
}
public KiePlatformUserManager(final Map<String, String> gitPrefs) {
this(new ConfigProperties(gitPrefs));
}
public KiePlatformUserManager(final ConfigProperties gitPrefs) {
//loadConfig(gitPrefs);
}
public void setMongo(MongoClient mongoClient, CodecRegistry pojoCodecRegistry, MongoDatabase database) {
this.mongoClient = mongoClient;
this.pojoCodecRegistry = pojoCodecRegistry;
this.database = database;
}
@Override
public void initialize(final UserSystemManager userSystemManager) throws Exception {
System.out.println("All setup");
}
@Override
public void destroy() throws Exception {
}
@Override
public SearchResponse<User> search(SearchRequest request) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("user");
BasicDBObject regexQuery = new BasicDBObject();
regexQuery.put("login", new BasicDBObject("$regex", request.getSearchPattern() + ".*").append("$options", "i"));
List<User> users = new ArrayList<>();
long totalNumber = userCollection.countDocuments(regexQuery);
FindIterable<Document> documents = userCollection.find(regexQuery).skip(request.getPageSize() * (request.getPage() - 1)).limit(request.getPageSize());
documents.forEach((Block<? super Document>) document -> {
String userName = document.getString("login");
User user = fillUser(userName, document);
users.add(user);
});
boolean hasNextPage = true;
if ((request.getPageSize() * (request.getPage()) > totalNumber)) {
hasNextPage = false;
}
SearchResponse<User> response = new SearchResponseImpl(users, request.getPage(), request.getPageSize(), Long.valueOf(totalNumber).intValue(), hasNextPage);
return response;
}
@Override
public User get(String identifier) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("user");
List<User> users = new ArrayList<>();
userCollection.find(eq("login", identifier)).forEach((Block<? super Document>) document -> {
String userName = document.getString("login");
User user = fillUser(userName, document);
users.add(user);
});
if (users.size() == 1) {
return users.get(0);
} else {
return new UserImpl(identifier);
}
}
@Override
public List<User> getAll() throws SecurityManagementException {
List<User> users = new ArrayList<>();
MongoCollection<Document> userCollection = database.getCollection("user");
userCollection.find().forEach((Block<? super Document>) document -> {
String userName = document.getString("login");
User user = fillUser(userName, document);
users.add(user);
});
return users;
}
private User fillUser(String userName, Document document) {
AtomicReference<ArrayList<DBRef>> roles = new AtomicReference<ArrayList<DBRef>>(new ArrayList());
AtomicReference<ArrayList<DBRef>> groups = new AtomicReference<ArrayList<DBRef>>(new ArrayList());
roles.set((ArrayList) document.get("userRoles"));
groups.set((ArrayList) document.get("userGroups"));
List<Role> roleList = new ArrayList<>();
for (DBRef dbRef : roles.get()) {
Document roleDocument = Utils.getDocumentFromRef(dbRef, database);
Role role = new RoleImpl(roleDocument.getString("name"));
roleList.add(role);
}
List<Group> groupList = new ArrayList<>();
for (DBRef dbRef : groups.get()) {
Document groupDocument = Utils.getDocumentFromRef(dbRef, database);
Group group = new GroupImpl(groupDocument.getString("name"));
groupList.add(group);
}
User user = new UserImpl(userName, roleList, groupList);
return user;
}
@Override
public User create(User entity) throws SecurityManagementException {
save(entity, true);
return entity;
}
@Override
public User update(User entity) throws SecurityManagementException {
save(entity, false);
return entity;
}
private void save(User entity, boolean isCreated) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("user");
MongoCollection<Document> userGroupsCollection = database.getCollection("userGroups");
MongoCollection<Document> userRolesCollection = database.getCollection("userRoles");
AtomicReference<ArrayList<DBRef>> roles = new AtomicReference<>(new ArrayList<>());
AtomicReference<ArrayList<DBRef>> groups = new AtomicReference<>(new ArrayList<>());
ArrayList<Document> users = new ArrayList<>();
if (isCreated) {
userCollection.find(eq("login", entity.getIdentifier())).forEach((Block<? super Document>) document -> {
throw new SecurityManagementException("Existing identifier " + entity.getIdentifier());
});
} else {
userCollection.find(eq("login", entity.getIdentifier())).forEach((Block<? super Document>) document -> {
users.add(document);
});
if (users.size() == 0) {
throw new SecurityManagementException("unknown identifier " + entity.getIdentifier());
}
if (users.size() > 1) {
throw new SecurityManagementException("existing multiple times with identifier " + entity.getIdentifier());
}
}
for (Group group : entity.getGroups()) {
userGroupsCollection.find(eq("name", group.getName())).forEach((Block<? super Document>) document -> {
DBRef dbRef = new DBRef("userGroups", document.get("_id"));
groups.get().add(dbRef);
});
}
for (Role role : entity.getRoles()) {
userRolesCollection.find(eq("name", role.getName())).forEach((Block<? super Document>) document -> {
DBRef dbRef = new DBRef("userRoles", document.get("_id"));
roles.get().add(dbRef);
});
}
if (isCreated) {
Document userDocument = new Document();
userDocument.append("login", entity.getIdentifier());
userDocument.append("password", entity.getIdentifier());
userDocument.append("userRoles", roles);
userDocument.append("userGroups", groups);
userCollection.insertOne(userDocument);
} else {
userCollection.find(eq("login", entity.getIdentifier())).forEach((Block<? super Document>) document -> {
document.append("userRoles", roles);
document.append("userGroups", groups);
userCollection.replaceOne(eq("login", entity.getIdentifier()), document);
});
}
}
@Override
public void delete(String... identifiers) throws SecurityManagementException {
}
@Override
public UserManagerSettings getSettings() {
final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<Capability, CapabilityStatus>(8);
for (final Capability capability : SecurityManagementUtils.USERS_CAPABILITIES) {
capabilityStatusMap.put(capability,
getCapabilityStatus(capability));
}
return new UserManagerSettingsImpl(capabilityStatusMap,
null);
}
@Override
public void assignGroups(String username,
Collection<String> groups) throws SecurityManagementException {
}
@Override
public void assignRoles(String username,
Collection<String> roles) throws SecurityManagementException {
}
private void doAssignGroups(String username,
Collection<String> ids) throws SecurityManagementException {
}
@Override
public void changePassword(String username,
String newPassword) throws SecurityManagementException {
MongoCollection<Document> userCollection = database.getCollection("user");
userCollection.find(eq("login", username)).forEach((Block<? super Document>) document -> {
document.append("password", newPassword);
userCollection.replaceOne(eq("login", username), document);
});
}
protected CapabilityStatus getCapabilityStatus(Capability capability) {
if (capability != null) {
switch (capability) {
case CAN_SEARCH_USERS:
case CAN_ADD_USER:
case CAN_UPDATE_USER:
case CAN_DELETE_USER:
case CAN_READ_USER:
case CAN_MANAGE_ATTRIBUTES:
case CAN_ASSIGN_GROUPS:
case CAN_ASSIGN_ROLES:
case CAN_CHANGE_PASSWORD:
return CapabilityStatus.ENABLED;
}
}
return CapabilityStatus.UNSUPPORTED;
}
}

View file

@ -1,20 +0,0 @@
package org.chtijbug.guvnor.uberfire.security;
import com.mongodb.DBRef;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import static com.mongodb.client.model.Filters.eq;
public class Utils {
public static Document getDocumentFromRef(DBRef dbRef, MongoDatabase database){
if (dbRef!=null) {
MongoCollection<Document> userRolesCollection = database.getCollection(dbRef.getCollectionName());
Document document = userRolesCollection.find(eq("_id", dbRef.getId())).first();
return document;
}
return null;
}
}

View file

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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-wb-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>drools-framework-wildfly-login-module</artifactId>
<dependencies>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>${version.mongodb.driver}</version>
</dependency>
<dependency>
<groupId>org.picketbox</groupId>
<artifactId>picketbox</artifactId>
<version>5.0.3.Final</version>
</dependency>
</dependencies>
<build>
<finalName>pymma-kie-loginmodule</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>mongodb-driver.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>bson</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>bson.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-core</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>mongodb-driver-core.jar</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,108 +0,0 @@
package org.chtijbug.wildfly.loginmodule;
import com.mongodb.DBRef;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import org.bson.Document;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
import org.jboss.security.SimpleGroup;
import org.jboss.security.SimplePrincipal;
import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.login.LoginException;
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static com.mongodb.client.model.Filters.eq;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
public class KiePlatformLoginModule extends UsernamePasswordLoginModule {
private String connectionString;
private String databaseName;
private MongoClient mongoClient;
CodecRegistry pojoCodecRegistry;
MongoDatabase database;
@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
super.initialize(subject, callbackHandler, sharedState, options);
connectionString = (String)options.get("connectionString");
databaseName = (String)options.get("name");
System.out.println("Pymma Login Module initialized with databaseName = " + connectionString );
mongoClient = MongoClients.create(connectionString);
pojoCodecRegistry = fromRegistries(MongoClientSettings.getDefaultCodecRegistry(),
fromProviders(PojoCodecProvider.builder().automatic(true).build()));
database = mongoClient.getDatabase(databaseName).withCodecRegistry(pojoCodecRegistry);
System.out.println("All setup");
}
@Override
protected boolean validatePassword(String inputPassword, String expectedPassword) {
System.out.println( "Pymma KieLogin validate password");
return inputPassword.equals(expectedPassword);
//return super.validatePassword(inputPassword, expectedPassword);
}
@Override
protected String getUsersPassword() throws LoginException {
System.out.format("KiePlatformLoginModule: authenticating user '%s'\n",
getUsername());
AtomicReference<String> password= new AtomicReference<>("");
AtomicReference<String> userWorkbenchName= new AtomicReference<>("");
MongoCollection<Document> userCollection = database.getCollection("user");
userCollection.find(eq("login", getUsername())).forEach((Consumer<Document>) doc
-> password.set((String) doc.get("password")));
userCollection.find(eq("login", getUsername())).forEach((Consumer<Document>) doc
-> userWorkbenchName.set((String) doc.get("wbName")));
String wbName=System.getProperty("org.chtijbug.wbname");
if (wbName==null || wbName.length()==0)
wbName="demo";
if (userWorkbenchName.get()==null || wbName.equals(userWorkbenchName.get())){
return password.get();
}else{
return "";
}
}
@Override
protected Group[] getRoleSets() throws LoginException {
SimpleGroup group = new SimpleGroup("Roles");
AtomicReference<ArrayList<DBRef>> roles= new AtomicReference<ArrayList<DBRef>>(new ArrayList());
AtomicReference<ArrayList<DBRef>> groups= new AtomicReference<ArrayList<DBRef>>(new ArrayList());
MongoCollection<Document> userCollection = database.getCollection("user");
userCollection.find(eq("login", getUsername())).forEach((Consumer<Document>) doc
-> roles.set((ArrayList) doc.get("userRoles")));
userCollection.find(eq("login", getUsername())).forEach((Consumer<Document>) doc
-> groups.set((ArrayList) doc.get("userGroups")));
MongoCollection<Document> userRolesCollection = database.getCollection("userRoles");
for (DBRef dbRef : roles.get()){
Document role = userRolesCollection.find(eq("_id", dbRef.getId())).first();
group.addMember(new SimplePrincipal((String)role.get("name")));
}
MongoCollection<Document> userGroupsCollection = database.getCollection("userGroups");
for (DBRef dbRef : groups.get()){
Document userGroupdoc = userGroupsCollection.find(eq("_id", dbRef.getId())).first();
group.addMember(new SimplePrincipal((String)userGroupdoc.get("name")));
}
return new Group[] { group };
}
}

View file

@ -1,141 +0,0 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>drools-framework-kie-wb-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<artifactId>kie-drools-framework-rest-backend</artifactId>
<packaging>jar</packaging>
<name>kie drools Framework - REST Backend</name>
<description>kie drools Framework - REST Backend</description>
<dependencies>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-wb-rest-pojo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>2.0.30.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie.workbench.screens</groupId>
<artifactId>kie-wb-common-data-modeller-api</artifactId>
<version>${jbpm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-rest-backend</artifactId>
<version>${jbpm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
<version>1.0.0.Final</version>
<scope>provided</scope>
</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.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-nio2-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-nio2-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-io</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-project-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-commons</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-rest-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-structure-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.plugin.version}</version>
<configuration>
<source>${pymma.java.version}</source>
<target>${pymma.java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -1,20 +0,0 @@
package org.chtijbug.kie.rest.backend;
import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
@Provider
public class CORSFilter implements ContainerResponseFilter {
@Override
public void filter(final ContainerRequestContext requestContext,
final ContainerResponseContext cres) throws IOException {
cres.getHeaders().add("Allow", "GET, POST, PUT, DELETE, OPTIONS, HEAD");
}
}

View file

@ -1,624 +0,0 @@
package org.chtijbug.kie.rest.backend;
import org.chtijbug.guvnor.server.jaxrs.api.UserLoginInformation;
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
import org.chtijbug.guvnor.server.jaxrs.jaxb.Package;
import org.chtijbug.guvnor.server.jaxrs.model.DependencyData;
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
import org.chtijbug.guvnor.server.jaxrs.model.WorkspaceAuthData;
import org.chtijbug.kie.rest.backend.service.AssetService;
import org.guvnor.common.services.project.model.GAV;
import org.guvnor.common.services.project.model.POM;
import org.guvnor.common.services.project.model.WorkspaceProject;
import org.guvnor.common.services.project.service.WorkspaceProjectService;
import org.guvnor.rest.backend.UserManagementResourceHelper;
import org.guvnor.structure.organizationalunit.OrganizationalUnit;
import org.guvnor.structure.organizationalunit.OrganizationalUnitService;
import org.guvnor.structure.repositories.Branch;
import org.guvnor.structure.repositories.Repository;
import org.guvnor.structure.repositories.RepositoryService;
import org.jboss.errai.security.shared.api.Group;
import org.jboss.errai.security.shared.api.GroupImpl;
import org.kie.workbench.common.screens.datamodeller.service.DataModelerService;
import org.slf4j.LoggerFactory;
import org.uberfire.backend.authz.AuthorizationPolicyStorage;
import org.uberfire.backend.authz.AuthorizationService;
import org.uberfire.backend.events.AuthorizationPolicySavedEvent;
import org.uberfire.io.IOService;
import org.uberfire.java.nio.base.options.CommentedOption;
import org.uberfire.java.nio.file.DirectoryStream;
import org.uberfire.java.nio.file.Paths;
import org.uberfire.security.authz.AuthorizationPolicy;
import org.uberfire.security.authz.Permission;
import org.uberfire.security.authz.PermissionManager;
import org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileAlreadyExistsException;
import java.security.Principal;
import java.util.*;
@Path("/chtijbug")
@Named
@ApplicationScoped
public class PackageResource {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(PackageResource.class);
@Context
protected UriInfo uriInfo;
@Context
protected SecurityContext sc;
@Inject
@Named("ioStrategy")
private IOService ioService;
@Inject
private OrganizationalUnitService organizationalUnitService;
@Inject
private RepositoryService repositoryService;
@Inject
private WorkspaceProjectService projectService;
private RestTypeDefinition dotFileFilter = new RestTypeDefinition();
@Inject
private DataModelerService dataModelerService;
@Inject
private WorkspaceProjectService workspaceProjectService;
@Inject
private AssetService assetService;
@Inject
private PermissionManager permissionManager;
@Inject
private AuthorizationService authorizationService;
@Inject
private UserManagementResourceHelper userManagementResourceHelper;
@Inject
private AuthorizationPolicyStorage authorizationPolicyStorage;
@Inject
private Event<AuthorizationPolicySavedEvent> savedEvent;
public PackageResource() {
System.out.println("coucou");
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/login")
public UserLoginInformation login() {
UserLoginInformation userLoginInformation = new UserLoginInformation();
userLoginInformation.setUsername(sc.getUserPrincipal().getName());
for (String role : PermissionConstants.tableauChaine) {
if (sc.isUserInRole(role) == true) {
userLoginInformation.getRoles().add(role);
}
}
return userLoginInformation;
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/content")
public UserLoginInformation getUserContent() {
UserLoginInformation userLoginInformation = new UserLoginInformation();
userLoginInformation.setUsername(sc.getUserPrincipal().getName());
for (String role : PermissionConstants.tableauChaine) {
if (sc.isUserInRole(role) == true) {
userLoginInformation.getRoles().add(role);
}
}
userLoginInformation.setProjects(assetService.getAllProjects());
return userLoginInformation;
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/detailedSpaces")
// @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})
public Collection<PlatformProjectData> getProjects() {
logger.debug("-----getSpaces--- ");
return assetService.getAllProjects();
}
@GET
@Path("{organizationalUnitName}/{repositoryName}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Collection<Package> getPackagesAsJAXB(@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("repositoryName") String repositoryName) {
OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(organizationalUnitName);
Collection<Repository> repositories = organizationalUnit.getRepositories();
for (Repository repository : repositories) {
if (repository.getAlias().equals(repositoryName)) {
Optional<Branch> branch = repository.getDefaultBranch();
Collection<WorkspaceProject> projects = projectService.getAllWorkspaceProjects(organizationalUnit);
Collection<Package> packages = new ArrayList<>();
for (WorkspaceProject project : projects) {
Package aPackage = new Package();
aPackage.setTitle(project.getName());
aPackage.setGroupID(project.getMainModule().getPom().getGav().getGroupId());
aPackage.setArtifactID(project.getMainModule().getPom().getGav().getArtifactId());
aPackage.setVersion(project.getMainModule().getPom().getGav().getVersion());
packages.add(aPackage);
}
return packages;
}
}
return null;
}
@GET
@Path("{organizationalUnitName}/{projectName}/assets")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Collection<Asset> getAssetsAsJAXB(
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName) {
try {
List<Asset> contentList = new LinkedList<>();
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(nioPath);
assetService.getContent(directoryStream, contentList);
}
return contentList;
} catch (RuntimeException e) {
throw new WebApplicationException(e);
}
}
@GET
@Path("{organizationalUnitName}/{projectName}/assets/{assetName}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Collection<Asset> getAssetAsJaxB(
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, @PathParam("assetName") String assetName) {
List<Asset> resultList = new LinkedList<>();
try {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
List<Asset> contentList = new LinkedList<>();
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(nioPath);
assetService.getContent(directoryStream, contentList);
for (Asset asset : contentList) {
if (asset.getTitle().equals(assetName)) {
resultList.add(asset);
}
}
}
return resultList;
} catch (RuntimeException e) {
throw new WebApplicationException(e);
}
}
@GET
@Path("{organizationalUnitName}/{projectName}/assets/{assetName}/source")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public String getAssetSource(
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, @PathParam("assetName") String assetName) {
List<Asset> resultList = new LinkedList<>();
String result = "";
try {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(nioPath);
result = assetService.getContentSource(directoryStream, assetName);
}
return result;
} catch (RuntimeException e) {
throw new WebApplicationException(e);
}
}
@PUT
@Path("{organizationalUnitName}/{projectName}/asset/{assetName}")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response updateAssetFromJAXB(@Context HttpHeaders headers,
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName,
@PathParam("assetName") String assetName, String asset) {
return updateAssetContent(headers, organizationalUnitName, projectName, assetName, asset, true);
}
@POST
@Path("{organizationalUnitName}/{projectName}/newAsset")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Asset createAssetFromSourceAndJAXB(
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, Asset asset) {
try {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPathDirectory = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = null;
try {
directoryStream = ioService.newDirectoryStream(nioPathDirectory);
org.uberfire.java.nio.file.Path directoryWhereCreateAsset = assetService.getDirectoryElementPath(directoryStream, asset.getTitle());
if (directoryWhereCreateAsset != null) {
final org.uberfire.java.nio.file.Path nioPath = Paths.get(directoryWhereCreateAsset.toUri());
if (ioService.exists(nioPath)) {
throw new FileAlreadyExistsException(nioPath.toString());
}
CommentedOption commentedOption = new CommentedOption(asset.getComment());
ioService.write(nioPath, asset.getContent().getBytes(), commentedOption);
}
} catch (Exception e) {
} finally {
if (directoryStream != null) {
directoryStream.close();
}
}
}
} catch (Exception e) {
throw new WebApplicationException(e);
}
return null;
}
@POST
@Path("{organizationalUnitName}/{projectName}/asset/{assetName}/source")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN})
public Response createAssetSource(@Context HttpHeaders headers,
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, @PathParam("assetName") String assetName, String content) {
return updateAssetContent(headers, organizationalUnitName, projectName, assetName, content, true);
}
@PUT
@Path("{organizationalUnitName}/{projectName}/asset/{assetName}/source")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN})
public Response updateAssetSource(@Context HttpHeaders headers,
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, @PathParam("assetName") String assetName, String content) {
return updateAssetContent(headers, organizationalUnitName, projectName, assetName, content, false);
}
@DELETE
@Path("{organizationalUnitName}/{projectName}/asset/{assetName}/source")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN})
public Response deleteAssetSource(@Context HttpHeaders headers,
@PathParam("organizationalUnitName") String organizationalUnitName, @PathParam("projectName") String projectName, @PathParam("assetName") String assetName, String content) {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
// Optional<Branch> rr = project.getRepository().getBranch("ee");
// org.uberfire.backend.vfs.Path tata = rr.get().getPath();
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(nioPath);
org.uberfire.java.nio.file.Path elementToDelete = assetService.getFileElementPath(directoryStream, assetName);
if (elementToDelete == null) {
return Response.status(Response.Status.NOT_FOUND).build();
} else {
File fileToUpdate = elementToDelete.toFile();
if (fileToUpdate.isFile()) {
content = content.replace("\"", "");
ioService.delete(elementToDelete);
logger.debug("Returning OK response with content '{}'", content);
return Response.status(Response.Status.NO_CONTENT).build();
} else {
return Response.status(Response.Status.NOT_MODIFIED).entity("Asset is not a file").build();
}
}
} else {
logger.info("Project {} or Organization {} not found ", projectName, organizationalUnitName);
return Response.status(Response.Status.NOT_FOUND).entity("Project or Organization not found").build();
}
}
private Response updateAssetContent(HttpHeaders headers, String organizationalUnitName, String projectName, String assetName, String content, boolean isCreate) {
try {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
if (project != null) {
// Optional<Branch> rr = project.getRepository().getBranch("ee");
// org.uberfire.backend.vfs.Path tata = rr.get().getPath();
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream = ioService.newDirectoryStream(nioPath);
org.uberfire.java.nio.file.Path elementToUpdate = assetService.getFileElementPath(directoryStream, assetName);
if (elementToUpdate != null && isCreate) {
return Response.status(Response.Status.CONFLICT).build();
} else if (elementToUpdate != null && !isCreate) {
File fileToUpdate = elementToUpdate.toFile();
if (fileToUpdate.isFile()) {
content = content.replace("\"", "");
ioService.write(elementToUpdate, content);
logger.debug("Returning OK response with content '{}'", content);
return Response.status(Response.Status.ACCEPTED).build();
} else {
return Response.status(Response.Status.NOT_MODIFIED).entity("Asset is not a file").build();
}
} else {//
if (isCreate) {
String targetName = projectName.replace("-", "_").replace(" ", "_");
org.uberfire.java.nio.file.Path ressourcesPath = nioPath.resolve("src/main/resources");
if (assetName.contains(".java")){
ressourcesPath = nioPath.resolve("src/main/java");
content=content.replace("\""," ").replace("\\n"," ").replace("\\t"," ");
}
DirectoryStream<org.uberfire.java.nio.file.Path> directoryStreamBase = ioService.newDirectoryStream(ressourcesPath);
org.uberfire.java.nio.file.Path directoryWhereCreateAsset = assetService.getRuleDirectoryByName(directoryStreamBase, targetName);
if (directoryWhereCreateAsset != null) {
URI parentURI = directoryWhereCreateAsset.toUri();
URI uri = new URI(parentURI.getScheme(), parentURI.getUserInfo(), parentURI.getHost(), parentURI.getPort(), parentURI.getPath() + "/" + assetName, parentURI.getQuery(), parentURI.getFragment());
final org.uberfire.java.nio.file.Path nioPathWhere = Paths.get(uri);
CommentedOption commentedOption = new CommentedOption("Created from rest");
ioService.write(nioPathWhere, content.getBytes(), commentedOption);
return Response.status(Response.Status.CREATED).build();
} else {
return Response.status(Response.Status.NOT_FOUND).entity("no Rule package").build();
}
} else {
return Response.status(Response.Status.NOT_FOUND).entity("Asset not found").build();
}
}
} else {
logger.info("Project {} or Organization {} not found ", projectName, organizationalUnitName);
return Response.status(Response.Status.NOT_FOUND).entity("Project or Organization not found").build();
}
} catch (RuntimeException | URISyntaxException e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e).build();
}
}
@PUT
@Path("{organizationalUnitName}/{projectName}/dependency")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN})
public Response updateProjectDependencies(@Context HttpHeaders headers,
@PathParam("organizationalUnitName") String organizationalUnitName,
@PathParam("projectName") String projectName, PlatformProjectData request) {
try {
WorkspaceProject project = assetService.getProject(organizationalUnitName, projectName);
List<DependencyData> toAdd = new ArrayList<>();
if (project != null) {
POM pom = project.getMainModule().getPom();
for (DependencyData dependencyData : request.getDependencies()) {
for (GAV element : pom.getDependencies().getGavs()) {
if (element.getGroupId().equals(dependencyData.getGroupId())
&& element.getArtifactId().equals(dependencyData.getArtifactId())
&& element.getVersion().equals(dependencyData.getVersion())) {
toAdd.add(dependencyData);
break;
}
}
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("\n");
for (DependencyData dependencyData : toAdd) {
stringBuilder.append("<dependency>").append("\n");
stringBuilder.append("\t").append("<groupId>").append(dependencyData.getGroupId()).append("</groupId>").append("\n");
stringBuilder.append("\t").append("<artifactId>").append(dependencyData.getArtifactId()).append("</artifactId>").append("\n");
stringBuilder.append("\t").append("<version>").append(dependencyData.getVersion()).append("</version>").append("\n");
stringBuilder.append("</dependency>").append("\n").append("\n");
}
stringBuilder.append("\n");
org.uberfire.backend.vfs.Path pomPath = project.getMainModule().getPomXMLPath();
org.uberfire.java.nio.file.Path nioPath = Paths.get(pomPath.toURI());
String pomContent = ioService.readAllString(nioPath);
int dependInt = pomContent.indexOf("/dependencies");
String newPomContent = pomContent.substring(0, dependInt - 1) + stringBuilder.toString() + pomContent.substring(dependInt - 1, pomContent.length());
CommentedOption commentedOption = new CommentedOption("Added from rest");
ioService.write(nioPath, newPomContent.getBytes(), commentedOption);
if (request.getkModule() != null) {
String kbase = "kbase";
if (request.getkModule().getKbase() != null
&& !request.getkModule().getKbase().isEmpty()) {
kbase = request.getkModule().getKbase();
}
String basePackage = pom.getGav().getGroupId() + "." + projectName.replace("-", "_");
org.uberfire.backend.vfs.Path rootPath = project.getRootPath();
org.uberfire.java.nio.file.Path nioRootPath = Paths.get(rootPath.toURI());
DirectoryStream<org.uberfire.java.nio.file.Path> directoryRootStream = ioService.newDirectoryStream(nioRootPath);
org.uberfire.java.nio.file.Path kmodulePath = assetService.findFileByName(directoryRootStream, "kmodule.xml");
String kmoduleContent = ioService.readAllString(kmodulePath);
/**
* <?xml version="1.0" encoding="UTF-8"?>
* <kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
* <kbase name="kbase-extension" packages="com.adeo.lys.rules" includes="kbase-base">
* <ksession name="session-extension" type="stateful" default="false" clockType="realtime"/>
* </kbase>
* </kmodule>
*/
StringBuilder kModuleBuilder = new StringBuilder();
kModuleBuilder.append("<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">").append("\n");
kModuleBuilder.append("\t").append("<kbase name=\"").append(kbase).append("\" default=\"true\" eventProcessingMode=\"stream\" equalsBehavior=\"identity\" packages=\"").append(basePackage).append("\" includes=\"").append(request.getkModule().getKbaseToInclude()).append("\">").append("\n");
kModuleBuilder.append("\t").append("\t").append(" <ksession name=\"session-extension\" type=\"stateful\" default=\"false\" clockType=\"realtime\"/>").append("\n");
kModuleBuilder.append("\t").append("</kbase>").append("\n");
kModuleBuilder.append("</kmodule>").append("\n");
kmoduleContent = kModuleBuilder.toString();
CommentedOption commentedOption2 = new CommentedOption("Added from rest");
ioService.write(kmodulePath, kmoduleContent.getBytes(), commentedOption2);
logger.info("Kmodule updated");
}
return Response.status(Response.Status.CREATED).entity(request).build();
} else {
logger.info("Project {} or Organization {} not found ", projectName, organizationalUnitName);
return Response.status(Response.Status.NOT_FOUND).entity(request).build();
}
} catch (RuntimeException e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(e).build();
}
}
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/auth")
public AuthorizationPolicy getAuth() {
Principal Principam = sc.getUserPrincipal();
AuthorizationPolicy authorizationPolicy = this.permissionManager.getAuthorizationPolicy();
return authorizationPolicy;
}
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/auth/{groupName}/{organisationUnit}")
public Response createGroupAuthorization(@Context HttpHeaders headers,
@PathParam("groupName") String groupName,
@PathParam("organisationUnit") String organisationUnit) {
Group targetGroup = null;
AuthorizationPolicy storedPolicies = this.authorizationPolicyStorage.loadPolicy();
for (Group group : storedPolicies.getGroups()) {
if (group.getName().equals(groupName)) {
targetGroup = group;
}
}
if (targetGroup == null) {
targetGroup = new GroupImpl(groupName);
AuthorizationPolicyBuilder groupPermissionBuilder = permissionManager.newAuthorizationPolicy().group(groupName);
groupPermissionBuilder = groupPermissionBuilder.permission("editor.read", true);
// groupPermissionBuilder = groupPermissionBuilder.permission("dataobject.edit", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.BPMNDiagramEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.CaseManagementDiagramEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.GuidedDecisionTreeEditorPresenter", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.GuidedScoreCardEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.ScoreCardXLSEditor", true);
groupPermissionBuilder = groupPermissionBuilder.permission("globalExperimentalFeatures.edit", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "globalpreferences.edit", false);
groupPermissionBuilder = groupPermissionBuilder.permission("guideddecisiontable.edit.columns", true);
groupPermissionBuilder = groupPermissionBuilder.permission("jar.download", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.create", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.delete", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.read", false);
groupPermissionBuilder = groupPermissionBuilder.permission("orgunit.read." + organisationUnit, true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.update", false);
groupPermissionBuilder = groupPermissionBuilder.permission("orgunit.update." + organisationUnit, true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.create", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.delete", false);
groupPermissionBuilder = groupPermissionBuilder.permission("perspective.read", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.update", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "planner.available", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "profilepreferences.edit", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.build", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.create", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.delete", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.read", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.release", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.update", false);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.build", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.configure", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.create", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.delete", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.read", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.update", true);
//groupPermissionBuilder = groupPermissionBuilder.priority(-10);
for (Permission p : groupPermissionBuilder.build().getPermissions(targetGroup).collection()) {
storedPolicies.addPermission(targetGroup, p);
}
storedPolicies.setHomePerspective(targetGroup,"AuthoringPerspective");
storedPolicies.setPriority(targetGroup,-10);
this.authorizationPolicyStorage.savePolicy(storedPolicies);
permissionManager.setAuthorizationPolicy(storedPolicies);
savedEvent.fire(new AuthorizationPolicySavedEvent(storedPolicies));
} else {
targetGroup = new GroupImpl(groupName);
AuthorizationPolicyBuilder groupPermissionBuilder = permissionManager.newAuthorizationPolicy().group(groupName);
groupPermissionBuilder = groupPermissionBuilder.permission("editor.read", true);
// groupPermissionBuilder = groupPermissionBuilder.permission("dataobject.edit", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.BPMNDiagramEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.CaseManagementDiagramEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.GuidedDecisionTreeEditorPresenter", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.GuidedScoreCardEditor", true);
//groupPermissionBuilder = groupPermissionBuilder.permission("editor.read.ScoreCardXLSEditor", true);
groupPermissionBuilder = groupPermissionBuilder.permission("globalExperimentalFeatures.edit", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "globalpreferences.edit", false);
groupPermissionBuilder = groupPermissionBuilder.permission("guideddecisiontable.edit.columns", true);
groupPermissionBuilder = groupPermissionBuilder.permission("jar.download", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.create", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.delete", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.read", false);
groupPermissionBuilder = groupPermissionBuilder.permission("orgunit.read." + organisationUnit, true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "orgunit.update", false);
groupPermissionBuilder = groupPermissionBuilder.permission("orgunit.update." + organisationUnit, true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.create", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.delete", false);
groupPermissionBuilder = groupPermissionBuilder.permission("perspective.read", true);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "perspective.update", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "planner.available", false);
// groupPermissionBuilder = groupPermissionBuilder.permission(groupPermissionbase + "profilepreferences.edit", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.build", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.create", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.delete", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.read", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.release", false);
groupPermissionBuilder = groupPermissionBuilder.permission("project.update", false);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.build", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.configure", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.create", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.delete", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.read", true);
groupPermissionBuilder = groupPermissionBuilder.permission("repository.update", true);
//groupPermissionBuilder = groupPermissionBuilder.priority(-10);
for (Permission p : groupPermissionBuilder.build().getPermissions(targetGroup).collection()) {
storedPolicies.addPermission(targetGroup, p);
}
storedPolicies.setHomePerspective(targetGroup,"AuthoringPerspective");
storedPolicies.setPriority(targetGroup,-10);
this.authorizationPolicyStorage.savePolicy(storedPolicies);
permissionManager.setAuthorizationPolicy(storedPolicies);
savedEvent.fire(new AuthorizationPolicySavedEvent(storedPolicies));
}
WorkspaceAuthData result=new WorkspaceAuthData();
return Response.status(Response.Status.OK).entity(result).build();
}
}

View file

@ -1,22 +0,0 @@
package org.chtijbug.kie.rest.backend;
public interface PermissionConstants {
public static final String REST_ROLE = "rest-all";
public static final String REST_PROJECT_ROLE = "rest-project";
public static final String REST_DEPLOYMENT_ROLE = "rest-deployment";
public static final String REST_PROCESS_ROLE = "rest-process";
public static final String REST_PROCESS_RO_ROLE = "rest-process-read-only";
public static final String REST_TASK_ROLE = "rest-task";
public static final String REST_TASK_RO_ROLE = "rest-task-read-only";
public static final String REST_QUERY_ROLE = "rest-query";
public static final String REST_CLIENT_ROLE = "rest-client";
public static final String ADMIN_ROLE = "admin";
public static final String ANALYST_ROLE = "analyst";
public static final String KIEMGMT_ROLE = "kiemgmt";
public static final String ADMIN_GROUP_ROLE = "admingroup";
public static String tableauChaine[] = {ADMIN_GROUP_ROLE, KIEMGMT_ROLE, ANALYST_ROLE, ADMIN_ROLE, REST_CLIENT_ROLE, REST_QUERY_ROLE, REST_TASK_RO_ROLE, REST_TASK_ROLE, REST_PROCESS_RO_ROLE, REST_ROLE, REST_PROJECT_ROLE, REST_DEPLOYMENT_ROLE, REST_PROCESS_ROLE};
}

View file

@ -1,93 +0,0 @@
package org.chtijbug.kie.rest.backend;
import org.kie.api.io.ResourceType;
/**
* Created by nheron on 23/01/15.
*/
public class RestTypeDefinition {
public boolean accept(String fileName) {
boolean result = false;
if (fileName.startsWith(".") == false) {
if (fileName.endsWith("." + ResourceType.DRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.GDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.RDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.XDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DSL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DSLR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.RDSLR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DRF.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BPMN2.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.CMMN.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DTABLE.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.XSD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.PMML.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DESCR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.JAVA.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.PROPERTIES.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SCARD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.TDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BAYES.getDefaultExtension())
// ||fileName.endsWith("." + ResourceType.JAVA.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.TEMPLATE.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DRT.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.GDST.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SCGD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SOLVER.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DMN.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.FEEL.getDefaultExtension())
) {
result = true;
}
}
return result;
}
public boolean acceptDroolsFile(String fileName) {
boolean result = false;
if (fileName.startsWith(".") == false) {
if (fileName.endsWith("." + ResourceType.DRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.GDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.RDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.XDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DSL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DSLR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.RDSLR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DRF.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BPMN2.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.CMMN.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DTABLE.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.XSD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.PMML.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DESCR.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SCARD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.TDRL.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.BAYES.getDefaultExtension())
// ||fileName.endsWith("." + ResourceType.JAVA.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.TEMPLATE.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DRT.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.GDST.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SCGD.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.SOLVER.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.DMN.getDefaultExtension())
|| fileName.endsWith("." + ResourceType.FEEL.getDefaultExtension())
) {
result = true;
}
}
return result;
}
}

View file

@ -1,310 +0,0 @@
package org.chtijbug.kie.rest.backend.service;
import io.undertow.Undertow;
import io.undertow.UndertowOptions;
import org.chtijbug.guvnor.server.jaxrs.jaxb.Asset;
import org.chtijbug.guvnor.server.jaxrs.model.PlatformProjectData;
import org.chtijbug.kie.rest.backend.RestTypeDefinition;
import org.guvnor.common.services.project.model.Module;
import org.guvnor.common.services.project.model.WorkspaceProject;
import org.guvnor.common.services.project.service.WorkspaceProjectService;
import org.guvnor.structure.organizationalunit.OrganizationalUnit;
import org.guvnor.structure.organizationalunit.OrganizationalUnitService;
import org.guvnor.structure.repositories.Branch;
import org.guvnor.structure.repositories.PublicURI;
import org.guvnor.structure.repositories.RepositoryService;
import org.jboss.errai.bus.server.annotations.Service;
import org.kie.workbench.common.screens.datamodeller.model.EditorModelContent;
import org.kie.workbench.common.screens.datamodeller.service.DataModelerService;
import org.kie.workbench.common.services.datamodeller.core.DataObject;
import org.kie.workbench.common.services.datamodeller.core.impl.DataModelImpl;
import org.slf4j.LoggerFactory;
import org.uberfire.backend.vfs.PathFactory;
import org.uberfire.io.IOService;
import org.uberfire.java.nio.file.DirectoryStream;
import org.uberfire.java.nio.file.Path;
import javax.inject.Inject;
import javax.inject.Named;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.core.UriInfo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@Service
public class AssetService {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(AssetService.class);
@Context
protected UriInfo uriInfo;
@Context
protected SecurityContext sc;
@Inject
@Named("ioStrategy")
private IOService ioService;
@Inject
private OrganizationalUnitService organizationalUnitService;
@Inject
private RepositoryService repositoryService;
@Inject
private WorkspaceProjectService projectService;
private RestTypeDefinition dotFileFilter = new RestTypeDefinition();
@Inject
private DataModelerService dataModelerService;
@Inject
private WorkspaceProjectService workspaceProjectService;
public List<PlatformProjectData> getAllProjects() {
final List<PlatformProjectData> spaces = new ArrayList<>();
for (OrganizationalUnit ou : organizationalUnitService.getOrganizationalUnits()) {
spaces.addAll(getSpace(ou));
}
return spaces;
}
private List<PlatformProjectData> getSpace(OrganizationalUnit ou) {
final List<PlatformProjectData> repoNames = new ArrayList<>();
try {
for (WorkspaceProject workspaceProject : workspaceProjectService.getAllWorkspaceProjects(ou)) {
for (Branch branch : workspaceProject.getRepository().getBranches()) {
repoNames.add(getProjectResponse(workspaceProject, branch));
}
}
}catch (Exception e){
logger.info("getSpace error "+ou.getName(),e);
}
return repoNames;
}
public void todo(){
// workspaceProjectService.
}
private PlatformProjectData getProjectResponse(WorkspaceProject workspaceProject, Branch branch) {
final PlatformProjectData projectResponse = new PlatformProjectData();
projectResponse.setName(workspaceProject.getName());
projectResponse.setSpaceName(workspaceProject.getOrganizationalUnit().getName());
String wbName=System.getProperty("org.chtijbug.wbname");
if (wbName==null || wbName.length()==0)
wbName="demo";
projectResponse.setWbName(wbName);
if (workspaceProject.getMainModule() != null) {
Module kmodule = workspaceProject.getMainModule();
org.uberfire.backend.vfs.Path importVFPath = PathFactory.newPath("project.imports", branch.getPath().toURI() + "project.imports");
EditorModelContent econtent = dataModelerService.loadContent(importVFPath);
//EditorModelContent econtent = dataModelerService.loadContent(((KieModule) kmodule).getImportsPath());
DataModelImpl econtentDataModel = (DataModelImpl) econtent.getDataModel();
List<DataObject> dataObjects = econtentDataModel.getExternalClasses();
for (DataObject dataObject : dataObjects) {
System.out.println(dataObject.toString());
String className = "class=" + dataObject.getPackageName() + "." + dataObject.getName();
projectResponse.getJavaClasses().add(className);
}
projectResponse.setArtifactId(workspaceProject.getMainModule().getPom().getGav().getArtifactId());
projectResponse.setGroupId(workspaceProject.getMainModule().getPom().getGav().getGroupId());
projectResponse.setVersion(workspaceProject.getMainModule().getPom().getGav().getVersion());
projectResponse.setDescription(workspaceProject.getMainModule().getPom().getDescription());
projectResponse.setBranch(branch.getName());
}
final ArrayList<org.guvnor.rest.client.PublicURI> publicURIs = new ArrayList<>();
for (PublicURI publicURI : workspaceProject.getRepository().getPublicURIs()) {
final org.guvnor.rest.client.PublicURI responseURI = new org.guvnor.rest.client.PublicURI();
responseURI.setProtocol(publicURI.getProtocol());
responseURI.setUri(publicURI.getURI());
publicURIs.add(responseURI);
}
projectResponse.setPublicURIs(publicURIs);
return projectResponse;
}
public WorkspaceProject getProject(String organizationalUnitName, String projectName) {
OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(organizationalUnitName);
if (organizationalUnit==null){
return null;
}
Collection<WorkspaceProject> workspaceProjects = projectService.getAllWorkspaceProjects(organizationalUnit);
if (workspaceProjects==null){
return null;
}
for (WorkspaceProject project : workspaceProjects) {
if (project.getName().equals(projectName)) {
return project;
}
}
// }
//}
return null;
}
private void getContentSource(DirectoryStream<Path> directoryStream, Asset asset, List<org.uberfire.java.nio.file.Path> pathLinkedList) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
getContentSource(adirectoryStream, asset, pathLinkedList);
} else {
if (dotFileFilter.accept(elementPath.getFileName().toString())) {
Map<String, Object> listAttributes = ioService.readAttributes(elementPath);
if (asset.getTitle().equals(elementPath.getFileName().toString())) {
pathLinkedList.add(elementPath);
}
}
}
}
}
public void getContent(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, Collection<Asset> contentList) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
getContent(adirectoryStream, contentList);
} else {
if (dotFileFilter.accept(elementPath.getFileName().toString())) {
Map<String, Object> listAttributes = ioService.readAttributes(elementPath);
Asset asset = new Asset();
asset.setTitle(elementPath.getFileName().toString());
asset.setDirectory(elementPath.getParent().toString());
asset.setRefLink(elementPath.getFileName().toUri());
contentList.add(asset);
}
}
}
}
public String getContentSource(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
String result = getContentSource(adirectoryStream, assetName);
if (result != null && result.length() > 0) {
return result;
}
} else {
if (elementPath.getFileName().toString().startsWith(".") == false) {
if (elementPath.getFileName().toString().equals(assetName)) {
return ioService.readAllString(elementPath);
}
}
}
}
return null;
}
public org.uberfire.java.nio.file.Path getFileElementPath(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
org.uberfire.java.nio.file.Path foundElementPath = getFileElementPath(adirectoryStream, assetName);
if (foundElementPath != null) {
return foundElementPath;
}
} else {
if (dotFileFilter.accept(elementPath.getFileName().toString())
&& elementPath.getFileName().toString().contains(assetName)) {
return elementPath;
}
}
}
return null;
}
public org.uberfire.java.nio.file.Path findFileByName(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
org.uberfire.java.nio.file.Path foundElementPath = findFileByName(adirectoryStream, assetName);
if (foundElementPath != null) {
return foundElementPath;
}
} else {
if (elementPath.getFileName().toString().contains(assetName)) {
return elementPath;
}
}
}
return null;
}
public org.uberfire.java.nio.file.Path getRuleDirectory(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
org.uberfire.java.nio.file.Path foundElementPath = getRuleDirectory(adirectoryStream, assetName);
if (foundElementPath != null) {
return foundElementPath;
}
} else {
if (dotFileFilter.acceptDroolsFile(elementPath.getFileName().toString())) {
return elementPath;
}
}
}
return null;
}
public org.uberfire.java.nio.file.Path getRuleDirectoryByName(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (elementPath.getFileName().toString().equals(assetName)) {
return elementPath;
}
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = ioService.newDirectoryStream(elementPath);
org.uberfire.java.nio.file.Path foundElementPath = getRuleDirectoryByName(adirectoryStream, assetName);
if (foundElementPath != null) {
return foundElementPath;
}
} else {
if (elementPath.getFileName().toString().equals(assetName)) {
return elementPath;
}
}
}
return null;
}
public org.uberfire.java.nio.file.Path getDirectoryElementPath(DirectoryStream<org.uberfire.java.nio.file.Path> directoryStream, String assetName) {
for (org.uberfire.java.nio.file.Path elementPath : directoryStream) {
if (org.uberfire.java.nio.file.Files.isDirectory(elementPath)) {
DirectoryStream<org.uberfire.java.nio.file.Path> adirectoryStream = null;
try {
adirectoryStream = ioService.newDirectoryStream(elementPath);
if (elementPath.getFileName().toString().equals(assetName)) {
return elementPath;
}
org.uberfire.java.nio.file.Path foundElementPath = getDirectoryElementPath(adirectoryStream, assetName);
if (foundElementPath != null) {
return foundElementPath;
}
} catch (Exception e) {
} finally {
if (adirectoryStream != null) {
adirectoryStream.close();
}
}
}
}
return null;
}
}

View file

@ -1,29 +0,0 @@
#
# Copyright 2012 JBoss Inc
#
# 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.
#
# ErraiApp.properties
#
# Do not remove, even if empty!
#
# This is a marker file. When it is detected inside a JAR or at the
# top of any classpath, the subdirectories are scanned for deployable
# components. As such, all Errai application modules in a project
# should contain an ErraiApp.properties at the root of all classpaths
# that you wish to be scanned.
#
# There are also some configuration options that can be set in this
# file, although it is rarely necessary. See the documentation at
# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties
# for details.

View file

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="" />
<datasource-mapping>
<factory-entry name="org.jbpm.domain" />
</datasource-mapping>
<deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/src/main/resources/persistence.xml" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.kie:jbpm-wb-showcase:war:7.7.0-SNAPSHOT" level="project" />
</component>
</module>

View file

@ -1,534 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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-wb-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<artifactId>kie-wb</artifactId>
<packaging>war</packaging>
<name>Pymma platform workbench</name>
<description>Pymma Plarform Kie-wb</description>
<dependencies>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>kie-drools-framework-rest-backend</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>business-central</artifactId>
<classifier>wildfly23</classifier>
<version>${jbpm.version}</version>
<type>war</type>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-wildfly-login-module</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-security-management-wildfly</artifactId>
<version>${jbpm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-uberfire-security-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>${version.mongodb.driver}</version>
</dependency>
</dependencies>
<build>
<finalName>kie-wb</finalName>
<plugins>
<!-- unpack step -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.kie</groupId>
<artifactId>business-central</artifactId>
<classifier>wildfly23</classifier>
<version>${jbpm.version}</version>
<type>war</type>
<outputDirectory>${project.build.directory}/unpack-tmp</outputDirectory>
<!--includes>**/*.class,**/*.xml</includes-->
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/unpack-tmp/WEB-INF/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>drools-framework-wildfly-login-module,jackson-module-jaxb-annotations:2.9.10</excludeArtifactIds>
<includeGroupIds>com.pymmasoftware.jbpm</includeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/unpack-tmp/</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<finalName>kie-wb</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly-kie-wb-wildfly-11.xml</descriptor>
</descriptors>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-wildfly-login-module</artifactId>
<version>${project.version}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>pymma-kie-login-module.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>mongodb-driver.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>bson</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>bson.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-core</artifactId>
<version>${version.mongodb.driver}</version>
<type>jar</type>
<overWrite>yes</overWrite>
<outputDirectory>${project.build.directory}/</outputDirectory>
<destFileName>mongodb-driver-core.jar</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>docker-build</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${fabri8.plugin.version}</version>
<configuration>
<!--registry>192.168.1.184:12500</registry-->
<dockerHost>unix:///var/run/docker.sock</dockerHost>
<!-- this is for Mac and Amazon Linux -->
<!--dockerHost>unix:///var/run/docker.sock</dockerHost-->
<verbose>true</verbose>
<images>
<image>
<name>kie-wb:${version.number}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
<!--copies Jar to the maven directory (uses Assembly system)-->
<!--copies Jar to the maven directory (uses Assembly system)-->
<assembly>
<mode>dir</mode>
<name>maven/</name>
<inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>middleware-rest</id>
<files>
<file>
<source>${project.build.directory}/kie-wb.war</source>
<outputDirectory>./</outputDirectory>
<destName>kie-wb.war</destName>
</file>
<file>
<source>${project.build.directory}/pymma-kie-login-module.jar</source>
<outputDirectory>./</outputDirectory>
<destName>pymma-kie-login-module.jar</destName>
</file>
<file>
<source>${project.build.directory}/bson.jar</source>
<outputDirectory>./</outputDirectory>
<destName>bson.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver-core.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver-core.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver.jar</destName>
</file>
</files>
</inline>
</assembly>
<tags>
<tag>latest</tag>
</tags>
</build>
<run>
<extraHosts>
<host>mongodb:172.17.0.1</host>
<host>kie-wb:172.17.0.1</host>
</extraHosts>
<ports>
<port>10080:8080</port>
<port>10001:8001</port>
<port>50505:50505</port>
</ports>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docker-deploy</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${fabri8.plugin.version}</version>
<configuration>
<registry>${registry.host}</registry>
<dockerHost>${docker.Host}</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>kie-wb:${version.number}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
<!--copies Jar to the maven directory (uses Assembly system)-->
<assembly>
<mode>dir</mode>
<name>maven/</name>
<inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>middleware-rest</id>
<files>
<file>
<source>${project.build.directory}/kie-wb.war</source>
<outputDirectory>./</outputDirectory>
<destName>kie-wb.war</destName>
</file>
<file>
<source>${project.build.directory}/pymma-kie-login-module.jar</source>
<outputDirectory>./</outputDirectory>
<destName>pymma-kie-login-module.jar</destName>
</file>
<file>
<source>${project.build.directory}/bson.jar</source>
<outputDirectory>./</outputDirectory>
<destName>bson.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver-core.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver-core.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver.jar</destName>
</file>
</files>
</inline>
</assembly>
</build>
<run>
<extraHosts>
<host>mongodb:192.168.1.102</host>
<host>declasin:192.168.1.184</host>
</extraHosts>
<ports>
<port>8080:8080</port>
</ports>
</run>
</image>
</images>
<authConfig>
<username>nheron</username>
<password>pymmalomme</password>
</authConfig>
<retries>5</retries>
</configuration>
<executions>
<execution>
<id>mydeploy</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>docker-hub</id>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${fabri8.plugin.version}</version>
<configuration>
<verbose>true</verbose>
<images>
<image>
<name>pymmasoftware/kie-wb:${project.version}</name>
<build>
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
<!--copies Jar to the maven directory (uses Assembly system)-->
<assembly>
<mode>dir</mode>
<name>maven/</name>
<inline xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>middleware-rest</id>
<files>
<file>
<source>${project.build.directory}/kie-wb.war</source>
<outputDirectory>./</outputDirectory>
<destName>kie-wb.war</destName>
</file>
<file>
<source>${project.build.directory}/pymma-kie-login-module.jar</source>
<outputDirectory>./</outputDirectory>
<destName>pymma-kie-login-module.jar</destName>
</file>
<file>
<source>${project.build.directory}/bson.jar</source>
<outputDirectory>./</outputDirectory>
<destName>bson.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver-core.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver-core.jar</destName>
</file>
<file>
<source>${project.build.directory}/mongodb-driver.jar</source>
<outputDirectory>./</outputDirectory>
<destName>mongodb-driver.jar</destName>
</file>
</files>
</inline>
</assembly>
<tags>
<tag>${version.number}</tag>
<tag>latest</tag>
<tag>${project.version}</tag>
</tags>
</build>
<run>
<extraHosts>
<host>mongodb:192.168.1.102</host>
<host>declasin:192.168.1.184</host>
</extraHosts>
<ports>
<port>8080:8080</port>
</ports>
</run>
</image>
</images>
<authConfig>
<username>${dockerhub.username}</username>
<password>${dockerhub.password}</password>
</authConfig>
<retries>5</retries>
</configuration>
<executions>
<execution>
<id>mydeploy</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2012 Red Hat, Inc. and/or its affiliates.
~
~ 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.
-->
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<!-- including a . in the id will modify the *classifier* of the artifact, instead of the name/id of the artifact -->
<id>wildfly11</id>
<formats>
<format>war</format>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}/unpack-tmp</directory>
<outputDirectory>.</outputDirectory>
</fileSet>
</fileSets>
<!--componentDescriptors>
<componentDescriptor>src/main/assembly/component-kie-wb-wildfly-11-eap-7-common.xml</componentDescriptor>
</componentDescriptors-->
</assembly>

View file

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ~ Copyright 2012 Red Hat, Inc. and/or its affiliates. ~ ~ 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. -->
<persistence version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/persistence"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/jbpmds</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<mapping-file>META-INF/TaskAuditorm.xml</mapping-file>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<class>org.jbpm.process.audit.ProcessInstanceLog</class>
<class>org.jbpm.process.audit.NodeInstanceLog</class>
<class>org.jbpm.process.audit.VariableInstanceLog</class>
<class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>
<class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>
<!-- manager -->
<class>org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo</class>
<class>org.jbpm.services.task.impl.model.AttachmentImpl</class>
<class>org.jbpm.services.task.impl.model.ContentImpl</class>
<class>org.jbpm.services.task.impl.model.BooleanExpressionImpl</class>
<class>org.jbpm.services.task.impl.model.CommentImpl</class>
<class>org.jbpm.services.task.impl.model.DeadlineImpl</class>
<class>org.jbpm.services.task.impl.model.DelegationImpl</class>
<class>org.jbpm.services.task.impl.model.EscalationImpl</class>
<class>org.jbpm.services.task.impl.model.GroupImpl</class>
<class>org.jbpm.services.task.impl.model.I18NTextImpl</class>
<class>org.jbpm.services.task.impl.model.NotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationImpl</class>
<class>org.jbpm.services.task.impl.model.EmailNotificationHeaderImpl</class>
<class>org.jbpm.services.task.impl.model.PeopleAssignmentsImpl</class>
<class>org.jbpm.services.task.impl.model.ReassignmentImpl</class>
<class>org.jbpm.services.task.impl.model.TaskImpl</class>
<class>org.jbpm.services.task.impl.model.TaskDataImpl</class>
<class>org.jbpm.services.task.impl.model.UserImpl</class>
<!--BAM for task service -->
<class>org.jbpm.services.task.audit.impl.model.BAMTaskSummaryImpl</class>
<!-- Event Classes -->
<class>org.jbpm.services.task.audit.impl.model.TaskEventImpl</class>
<!-- Task Audit Classes -->
<class>org.jbpm.services.task.audit.impl.model.AuditTaskImpl</class>
<class>org.jbpm.services.task.audit.impl.model.TaskVariableImpl</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.show_sql" value="false" />
<!-- BZ 841786: AS7/EAP 6/Hib 4 uses new (sequence) generators which seem to cause problems -->
<property name="hibernate.id.new_generator_mappings" value="false" />
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform" />
</properties>
</persistence-unit>
</persistence>

View file

@ -1,106 +0,0 @@
##########################################################################
# Dockerfile that provides the image for JBoss Drools Workbench 6.5.0.Final
###########################################################################
####### BASE ############
FROM jboss/wildfly:23.0.2.Final
####### MAINTAINER ############
MAINTAINER "Nicolas Héron" "nicolas.heron@pymma-software.com"
####### ENVIRONMENT ############
ENV JBOSS_BIND_ADDRESS 0.0.0.0
ENV KIE_REPOSITORY https://repository.jboss.org/nexus/content/groups/public-jboss
ENV CHTIJBUG_REPOSITORY https://oss.sonatype.org/content/repositories/releases
ENV KIE_VERSION 7.17.0.Final
ENV KIE_CONTEXT_PATH kie-wb
ENV CHTIJBUG_VERSION 2.0.10
# Do NOT use demo neither examples by default in this image (no internet connection required).
ENV KIE_DEMO false
ENV JAVA_OPTS -Xms256m -Xmx4512m
####### Pymma Kie Realm #########
##com.pymmasoftware.kie-realm
RUN mkdir /opt/jboss/wildfly/modules/com
RUN mkdir /opt/jboss/wildfly/modules/com/pymmasoftware
RUN mkdir /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule
RUN mkdir /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main
ADD maven/pymma-kie-login-module.jar /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main/pymma-kie-loginmodule.jar
ADD maven/mongodb-driver.jar /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main/mongodb-driver.jar
ADD maven/mongodb-driver-core.jar /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main/mongodb-driver-core.jar
ADD maven/bson.jar /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main/bson.jar
ADD etc/module-loginmodule.xml /opt/jboss/wildfly/modules/com/pymmasoftware/pymma-kie-loginmodule/main/module.xml
####### DROOLS-WB ############
ADD maven/kie-wb.war /opt/jboss/wildfly/standalone/deployments/$KIE_CONTEXT_PATH.war
#RUN curl $CHTIJBUG_REPOSITORY/org/chtijbug/drools/drools-framework-kie-wb-wars/$CHTIJBUG_VERSION/drools-framework-kie-wb-wars-$CHTIJBUG_VERSION.war -o /opt/jboss/wildfly/standalone/deployments/$KIE_CONTEXT_PATH.war
#RUN curl -o $HOME/$KIE_CONTEXT_PATH.war $KIE_REPOSITORY/org/kie/kie-drools-wb-distribution-wars/$KIE_VERSION/kie-drools-wb-distribution-wars-$KIE_VERSION-$KIE_CLASSIFIER.war && \
#unzip -q $HOME/$KIE_CONTEXT_PATH.war -d $JBOSS_HOME/standalone/deployments/$KIE_CONTEXT_PATH.war && \
#touch $JBOSS_HOME/standalone/deployments/$KIE_CONTEXT_PATH.war.dodeploy && \
# rm -rf $HOME/$KIE_CONTEXT_PATH.war
####### SCRIPTS ############
USER root
ADD etc/start_drools-wb.sh $JBOSS_HOME/bin/start_drools-wb.sh
RUN chown jboss:jboss $JBOSS_HOME/bin/start_drools-wb.sh
RUN chown -R jboss:jboss /opt/jboss/wildfly/modules/com/pymmasoftware
####### ENVIRONMENT ############
# Use demo and examples by default in this showcase image (internet connection required).
ENV KIE_DEMO false
ENV KIE_SERVER_PROFILE standalone-full-drools
####### EXPOSE INTERNAL JBPM GIT PORT ############
EXPOSE 8001
####### Drools Workbench CUSTOM CONFIGURATION ############
ADD etc/standalone-full-drools.xml $JBOSS_HOME/standalone/configuration/standalone-full-drools.xml
#ADD etc/application-users.properties $JBOSS_HOME/standalone/configuration/application-users.properties
#ADD etc/application-roles.properties $JBOSS_HOME/standalone/configuration/application-roles.properties
# Added files are chowned to root user, change it to the jboss one.
USER root
RUN chown jboss:jboss $JBOSS_HOME/standalone/configuration/standalone-full-drools.xml
# Switchback to jboss user
USER root
#RUN yum install -y git
RUN mkdir /home/lucene
RUN mkdir /home/niodir
RUN mkdir /home/kie-example
RUN mkdir /m2_kiewb
ADD settings.xml /m2_kiewb/settings.xml
RUN mkdir /m2_kiewb/repository
####### MVN REPO ############
# https://bugzilla.redhat.com/show_bug.cgi?id=1263738
#RUN mkdir -p /m2_kiewb/repository/org/guvnor/guvnor-asset-mgmt-project/$KIE_VERSION && \
#curl -o /m2_kiewb/repository/org/guvnor/guvnor-asset-mgmt-project/$KIE_VERSION/guvnor-asset-mgmt-project-$KIE_VERSION.jar $KIE_REPOSITORY/org/guvnor/guvnor-asset-mgmt-project/$KIE_VERSION/guvnor-asset-mgmt-project-$KIE_VERSION.jar
RUN chown jboss:jboss /home/lucene
RUN chown jboss:jboss /home/niodir
RUN chown jboss:jboss /home/kie-example
RUN chown jboss:jboss /m2_kiewb
RUN chown -R jboss:jboss /m2_kiewb/repository
#RUN cd /home/kie-example && git clone https://github.com/chtiJBUG/onboarding-nautic-project.git
#RUN cd /home/kie-example && git clone https://github.com/chtiJBUG/onboa rding-carinsurance-project.git
#RUN cd /home/kie-example && git clone https://github.com/chtiJBUG/onboarding-loyalty-project.git
####### EXPOSE INTERNAL JBPM GIT PORT ############
EXPOSE 8001
EXPOSE 8080
EXPOSE 50505
####### RUNNING DROOLS-WB ############
VOLUME /home/lucene
VOLUME /home/niodir
WORKDIR $JBOSS_HOME/bin/
CMD ["./start_drools-wb.sh"]

View file

@ -1,16 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="com.pymmasoftware.pymma-kie-loginmodule">
<resources>
<resource-root path="pymma-kie-loginmodule.jar"/>
<resource-root path="bson.jar"/>
<resource-root path="mongodb-driver-core.jar"/>
<resource-root path="mongodb-driver.jar"/>
</resources>
<dependencies>
<module name="org.picketbox"/>
<module name="javax.api"/>
</dependencies>
</module>

View file

@ -1,673 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:16.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
<extension module="org.jboss.as.clustering.jgroups"/>
<extension module="org.jboss.as.connector"/>
<extension module="org.jboss.as.deployment-scanner"/>
<extension module="org.jboss.as.ee"/>
<extension module="org.jboss.as.ejb3"/>
<extension module="org.jboss.as.jaxrs"/>
<extension module="org.jboss.as.jdr"/>
<extension module="org.jboss.as.jmx"/>
<extension module="org.jboss.as.jpa"/>
<extension module="org.jboss.as.jsf"/>
<extension module="org.jboss.as.jsr77"/>
<extension module="org.jboss.as.logging"/>
<extension module="org.jboss.as.mail"/>
<extension module="org.jboss.as.modcluster"/>
<extension module="org.jboss.as.naming"/>
<extension module="org.jboss.as.pojo"/>
<extension module="org.jboss.as.remoting"/>
<extension module="org.jboss.as.sar"/>
<extension module="org.jboss.as.security"/>
<extension module="org.jboss.as.transactions"/>
<extension module="org.jboss.as.webservices"/>
<extension module="org.jboss.as.weld"/>
<extension module="org.wildfly.extension.batch.jberet"/>
<extension module="org.wildfly.extension.bean-validation"/>
<extension module="org.wildfly.extension.clustering.singleton"/>
<extension module="org.wildfly.extension.clustering.web"/>
<extension module="org.wildfly.extension.core-management"/>
<extension module="org.wildfly.extension.discovery"/>
<extension module="org.wildfly.extension.ee-security"/>
<extension module="org.wildfly.extension.elytron"/>
<extension module="org.wildfly.extension.health"/>
<extension module="org.wildfly.extension.io"/>
<extension module="org.wildfly.extension.messaging-activemq"/>
<extension module="org.wildfly.extension.metrics"/>
<extension module="org.wildfly.extension.microprofile.config-smallrye"/>
<extension module="org.wildfly.extension.microprofile.jwt-smallrye"/>
<extension module="org.wildfly.extension.microprofile.opentracing-smallrye"/>
<extension module="org.wildfly.extension.request-controller"/>
<extension module="org.wildfly.extension.security.manager"/>
<extension module="org.wildfly.extension.undertow"/>
<extension module="org.wildfly.iiop-openjdk"/>
</extensions>
<management>
<security-realms>
<security-realm name="ManagementRealm">
<authentication>
<local default-user="$local" skip-group-loading="true"/>
<properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization map-groups-to-roles="false">
<properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
<security-realm name="ApplicationRealm">
<server-identities>
<ssl>
<keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>
</ssl>
</server-identities>
<authentication>
<local default-user="$local" allowed-users="*" skip-group-loading="true"/>
<properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
</authentication>
<authorization>
<properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</authorization>
</security-realm>
</security-realms>
<audit-log>
<formatters>
<json-formatter name="json-formatter"/>
</formatters>
<handlers>
<file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
</handlers>
<logger log-boot="true" log-read-only="false" enabled="false">
<handlers>
<handler name="file"/>
</handlers>
</logger>
</audit-log>
<management-interfaces>
<http-interface security-realm="ManagementRealm">
<http-upgrade enabled="true"/>
<socket-binding http="management-http"/>
</http-interface>
</management-interfaces>
<access-control provider="simple">
<role-mapping>
<role name="SuperUser">
<include>
<user name="$local"/>
</include>
</role>
</role-mapping>
</access-control>
</management>
<profile>
<subsystem xmlns="urn:jboss:domain:logging:8.0">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="server.log"/>
<suffix value=".yyyy-MM-dd"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.arjuna">
<level name="WARN"/>
</logger>
<logger category="io.jaegertracing.Configuration">
<level name="WARN"/>
</logger>
<logger category="org.jboss.as.config">
<level name="DEBUG"/>
</logger>
<logger category="sun.rmi">
<level name="WARN"/>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
<handler name="FILE"/>
</handlers>
</root-logger>
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>
</formatter>
</subsystem>
<subsystem xmlns="urn:jboss:domain:batch-jberet:2.0">
<default-job-repository name="in-memory"/>
<default-thread-pool name="batch"/>
<job-repository name="in-memory">
<in-memory/>
</job-repository>
<thread-pool name="batch">
<max-threads count="10"/>
<keepalive-time time="30" unit="seconds"/>
</thread-pool>
</subsystem>
<subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>
<subsystem xmlns="urn:jboss:domain:core-management:1.0"/>
<subsystem xmlns="urn:jboss:domain:datasources:6.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:discovery:1.0"/>
<subsystem xmlns="urn:jboss:domain:distributable-web:2.0" default-session-management="default" default-single-sign-on-management="default">
<infinispan-session-management name="default" cache-container="web" granularity="SESSION">
<primary-owner-affinity/>
</infinispan-session-management>
<infinispan-single-sign-on-management name="default" cache-container="web" cache="sso"/>
<infinispan-routing cache-container="web" cache="routing"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee:6.0">
<spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
<concurrent>
<context-services>
<context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
</context-services>
<managed-thread-factories>
<managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
</managed-thread-factories>
<managed-executor-services>
<managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="5000"/>
</managed-executor-services>
<managed-scheduled-executor-services>
<managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-termination-period="0" hung-task-threshold="60000" keepalive-time="3000"/>
</managed-scheduled-executor-services>
</concurrent>
<default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:ee-security:1.0"/>
<subsystem xmlns="urn:jboss:domain:ejb3:9.0">
<session-bean>
<stateless>
<bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
</stateless>
<stateful default-access-timeout="5000" cache-ref="distributable" passivation-disabled-cache-ref="simple"/>
<singleton default-access-timeout="5000"/>
</session-bean>
<mdb>
<resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>
<bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
<bean-instance-pools>
<strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
<strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
</bean-instance-pools>
</pools>
<caches>
<cache name="simple"/>
<cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
</caches>
<passivation-stores>
<passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
</passivation-stores>
<async thread-pool-name="default"/>
<timer-service thread-pool-name="default" default-data-store="default-file-store">
<data-stores>
<file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
</data-stores>
</timer-service>
<remote cluster="ejb" connectors="http-remoting-connector" thread-pool-name="default">
<channel-creation-options>
<option name="MAX_OUTBOUND_MESSAGES" value="1234" type="remoting"/>
</channel-creation-options>
</remote>
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="60" unit="seconds"/>
</thread-pool>
</thread-pools>
<iiop enable-by-default="false" use-qualified-name="false"/>
<default-security-domain value="other"/>
<default-missing-method-permissions-deny-access value="true"/>
<statistics enabled="${wildfly.ejb3.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<log-system-exceptions value="true"/>
</subsystem>
<subsystem xmlns="urn:wildfly:elytron:13.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
<providers>
<aggregate-providers name="combined-providers">
<providers name="elytron"/>
<providers name="openssl"/>
</aggregate-providers>
<provider-loader name="elytron" module="org.wildfly.security.elytron"/>
<provider-loader name="openssl" module="org.wildfly.openssl"/>
</providers>
<audit-logging>
<file-audit-log name="local-audit" path="audit.log" relative-to="jboss.server.log.dir" format="JSON"/>
</audit-logging>
<security-domains>
<security-domain name="ApplicationDomain" default-realm="ApplicationRealm" permission-mapper="default-permission-mapper">
<realm name="ApplicationRealm" role-decoder="groups-to-roles"/>
<realm name="local"/>
</security-domain>
<security-domain name="ManagementDomain" default-realm="ManagementRealm" permission-mapper="default-permission-mapper">
<realm name="ManagementRealm" role-decoder="groups-to-roles"/>
<realm name="local" role-mapper="super-user-mapper"/>
</security-domain>
</security-domains>
<security-realms>
<identity-realm name="local" identity="$local"/>
<properties-realm name="ApplicationRealm">
<users-properties path="application-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ApplicationRealm"/>
<groups-properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
</properties-realm>
<properties-realm name="ManagementRealm">
<users-properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" digest-realm-name="ManagementRealm"/>
<groups-properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
</properties-realm>
</security-realms>
<mappers>
<simple-permission-mapper name="default-permission-mapper" mapping-mode="first">
<permission-mapping>
<principal name="anonymous"/>
<permission-set name="default-permissions"/>
</permission-mapping>
<permission-mapping match-all="true">
<permission-set name="login-permission"/>
<permission-set name="default-permissions"/>
</permission-mapping>
</simple-permission-mapper>
<constant-realm-mapper name="local" realm-name="local"/>
<simple-role-decoder name="groups-to-roles" attribute="groups"/>
<constant-role-mapper name="super-user-mapper">
<role name="SuperUser"/>
</constant-role-mapper>
</mappers>
<permission-sets>
<permission-set name="login-permission">
<permission class-name="org.wildfly.security.auth.permission.LoginPermission"/>
</permission-set>
<permission-set name="default-permissions">
<permission class-name="org.wildfly.extension.batch.jberet.deployment.BatchPermission" module="org.wildfly.extension.batch.jberet" target-name="*"/>
<permission class-name="org.wildfly.transaction.client.RemoteTransactionPermission" module="org.wildfly.transaction.client"/>
<permission class-name="org.jboss.ejb.client.RemoteEJBPermission" module="org.jboss.ejb-client"/>
</permission-set>
</permission-sets>
<http>
<http-authentication-factory name="management-http-authentication" security-domain="ManagementDomain" http-server-mechanism-factory="global">
<mechanism-configuration>
<mechanism mechanism-name="DIGEST">
<mechanism-realm realm-name="ManagementRealm"/>
</mechanism>
</mechanism-configuration>
</http-authentication-factory>
<provider-http-server-mechanism-factory name="global"/>
</http>
<sasl>
<sasl-authentication-factory name="application-sasl-authentication" sasl-server-factory="configured" security-domain="ApplicationDomain">
<mechanism-configuration>
<mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
<mechanism mechanism-name="DIGEST-MD5">
<mechanism-realm realm-name="ApplicationRealm"/>
</mechanism>
</mechanism-configuration>
</sasl-authentication-factory>
<sasl-authentication-factory name="management-sasl-authentication" sasl-server-factory="configured" security-domain="ManagementDomain">
<mechanism-configuration>
<mechanism mechanism-name="JBOSS-LOCAL-USER" realm-mapper="local"/>
<mechanism mechanism-name="DIGEST-MD5">
<mechanism-realm realm-name="ManagementRealm"/>
</mechanism>
</mechanism-configuration>
</sasl-authentication-factory>
<configurable-sasl-server-factory name="configured" sasl-server-factory="elytron">
<properties>
<property name="wildfly.sasl.local-user.default-user" value="$local"/>
</properties>
</configurable-sasl-server-factory>
<mechanism-provider-filtering-sasl-server-factory name="elytron" sasl-server-factory="global">
<filters>
<filter provider-name="WildFlyElytron"/>
</filters>
</mechanism-provider-filtering-sasl-server-factory>
<provider-sasl-server-factory name="global"/>
</sasl>
<tls>
<key-stores>
<key-store name="applicationKS">
<credential-reference clear-text="password"/>
<implementation type="JKS"/>
<file path="application.keystore" relative-to="jboss.server.config.dir"/>
</key-store>
</key-stores>
<key-managers>
<key-manager name="applicationKM" key-store="applicationKS" generate-self-signed-certificate-host="localhost">
<credential-reference clear-text="password"/>
</key-manager>
</key-managers>
<server-ssl-contexts>
<server-ssl-context name="applicationSSC" key-manager="applicationKM"/>
</server-ssl-contexts>
</tls>
</subsystem>
<subsystem xmlns="urn:wildfly:health:1.0" security-enabled="false"/>
<subsystem xmlns="urn:jboss:domain:iiop-openjdk:2.1">
<orb socket-binding="iiop"/>
<initializers security="identity" transactions="spec"/>
<security server-requires-ssl="false" client-requires-ssl="false"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:12.0">
<cache-container name="ejb" default-cache="dist" aliases="sfsb" modules="org.wildfly.clustering.ejb.infinispan">
<transport lock-timeout="60000"/>
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store/>
</distributed-cache>
</cache-container>
<cache-container name="server" default-cache="default" aliases="singleton cluster" modules="org.wildfly.clustering.server">
<transport lock-timeout="60000"/>
<replicated-cache name="default">
<transaction mode="BATCH"/>
</replicated-cache>
</cache-container>
<cache-container name="web" default-cache="dist" modules="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="sso">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
</replicated-cache>
<replicated-cache name="routing"/>
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store/>
</distributed-cache>
</cache-container>
<cache-container name="hibernate" modules="org.infinispan.hibernate-cache">
<transport lock-timeout="60000"/>
<local-cache name="local-query">
<heap-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="pending-puts">
<expiration max-idle="60000"/>
</local-cache>
<invalidation-cache name="entity">
<heap-memory size="10000"/>
<expiration max-idle="100000"/>
</invalidation-cache>
<replicated-cache name="timestamps"/>
</cache-container>
</subsystem>
<subsystem xmlns="urn:jboss:domain:io:3.0">
<worker name="default"/>
<buffer-pool name="default"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jaxrs:2.0"/>
<subsystem xmlns="urn:jboss:domain:jca:5.0">
<archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
<bean-validation enabled="true"/>
<default-workmanager>
<short-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</short-running-threads>
<long-running-threads>
<core-threads count="50"/>
<queue-length count="50"/>
<max-threads count="50"/>
<keepalive-time time="10" unit="seconds"/>
</long-running-threads>
</default-workmanager>
<cached-connection-manager/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
<subsystem xmlns="urn:jboss:domain:jgroups:8.0">
<channels default="ee">
<channel name="ee" stack="udp" cluster="ejb"/>
</channels>
<stacks>
<stack name="udp">
<transport type="UDP" socket-binding="jgroups-udp"/>
<protocol type="PING"/>
<protocol type="MERGE3"/>
<socket-protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="UFC"/>
<protocol type="MFC"/>
<protocol type="FRAG3"/>
</stack>
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<socket-protocol type="MPING" socket-binding="jgroups-mping"/>
<protocol type="MERGE3"/>
<socket-protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG3"/>
</stack>
</stacks>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jmx:1.3">
<expose-resolved-model/>
<expose-expression-model/>
<remoting-connector/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jpa:1.1">
<jpa default-extended-persistence-inheritance="DEEP"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:jsf:1.1"/>
<subsystem xmlns="urn:jboss:domain:jsr77:1.0"/>
<subsystem xmlns="urn:jboss:domain:mail:4.0">
<mail-session name="default" jndi-name="java:jboss/mail/Default">
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
</subsystem>
<subsystem xmlns="urn:jboss:domain:messaging-activemq:13.0">
<server name="default">
<cluster password="${jboss.messaging.cluster.password:CHANGE ME!!}"/>
<statistics enabled="${wildfly.messaging-activemq.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<security-setting name="#">
<role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>
</security-setting>
<address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10" redistribution-delay="1000"/>
<http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>
<http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">
<param name="batch-delay" value="50"/>
</http-connector>
<in-vm-connector name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-connector>
<http-acceptor name="http-acceptor" http-listener="default"/>
<http-acceptor name="http-acceptor-throughput" http-listener="default">
<param name="batch-delay" value="50"/>
<param name="direct-deliver" value="false"/>
</http-acceptor>
<in-vm-acceptor name="in-vm" server-id="0">
<param name="buffer-pooling" value="false"/>
</in-vm-acceptor>
<jgroups-broadcast-group name="bg-group1" jgroups-cluster="activemq-cluster" connectors="http-connector"/>
<jgroups-discovery-group name="dg-group1" jgroups-cluster="activemq-cluster"/>
<cluster-connection name="my-cluster" address="jms" connector-name="http-connector" discovery-group="dg-group1"/>
<jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>
<jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>
<connection-factory name="InVmConnectionFactory" entries="java:/ConnectionFactory" connectors="in-vm"/>
<connection-factory name="RemoteConnectionFactory" entries="java:jboss/exported/jms/RemoteConnectionFactory" connectors="http-connector" ha="true" block-on-acknowledge="true" reconnect-attempts="-1"/>
<pooled-connection-factory name="activemq-ra" entries="java:/JmsXA java:jboss/DefaultJMSConnectionFactory" connectors="in-vm" transaction="xa"/>
</server>
</subsystem>
<subsystem xmlns="urn:wildfly:metrics:1.0" security-enabled="false" exposed-subsystems="*" prefix="${wildfly.metrics.prefix:wildfly}"/>
<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"/>
<subsystem xmlns="urn:wildfly:microprofile-jwt-smallrye:1.0"/>
<subsystem xmlns="urn:wildfly:microprofile-opentracing-smallrye:3.0" default-tracer="jaeger">
<jaeger-tracer name="jaeger">
<sampler-configuration sampler-type="const" sampler-param="1.0"/>
</jaeger-tracer>
</subsystem>
<subsystem xmlns="urn:jboss:domain:modcluster:5.0">
<proxy name="default" advertise-socket="modcluster" listener="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</proxy>
</subsystem>
<subsystem xmlns="urn:jboss:domain:naming:2.0">
<remote-naming/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
<subsystem xmlns="urn:jboss:domain:remoting:4.0">
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0"/>
<subsystem xmlns="urn:jboss:domain:sar:1.0"/>
<subsystem xmlns="urn:jboss:domain:security:2.0">
<security-domains>
<security-domain name="other" cache-type="default">
<authentication>
<login-module code="org.chtijbug.wildfly.loginmodule.KiePlatformLoginModule" flag="required" module="com.pymmasoftware.pymma-kie-loginmodule">
<module-option name="connectionString" value="${connectionString}"/>
<module-option name="name" value="${name}"/>
</login-module>
</authentication>
</security-domain>
<security-domain name="jboss-web-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
<security-domain name="jaspitest" cache-type="default">
<authentication-jaspi>
<login-module-stack name="dummy">
<login-module code="Dummy" flag="optional"/>
</login-module-stack>
<auth-module code="Dummy"/>
</authentication-jaspi>
</security-domain>
<security-domain name="jboss-ejb-policy" cache-type="default">
<authorization>
<policy-module code="Delegating" flag="required"/>
</authorization>
</security-domain>
</security-domains>
</subsystem>
<subsystem xmlns="urn:jboss:domain:security-manager:1.0">
<deployment-permissions>
<maximum-set>
<permission class="java.security.AllPermission"/>
</maximum-set>
</deployment-permissions>
</subsystem>
<subsystem xmlns="urn:jboss:domain:singleton:1.0">
<singleton-policies default="default">
<singleton-policy name="default" cache-container="server">
<simple-election-policy/>
</singleton-policy>
</singleton-policies>
</subsystem>
<subsystem xmlns="urn:jboss:domain:transactions:6.0">
<core-environment node-identifier="${jboss.tx.node.id:1}">
<process-id>
<uuid/>
</process-id>
</core-environment>
<recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
<coordinator-environment statistics-enabled="${wildfly.transactions.statistics-enabled:${wildfly.statistics-enabled:false}}"/>
<object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:undertow:12.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
<buffer-cache name="default"/>
<server name="default-server">
<ajp-listener name="ajp" socket-binding="ajp"/>
<http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<http-invoker security-realm="ApplicationRealm"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
</subsystem>
<subsystem xmlns="urn:jboss:domain:webservices:2.0" statistics-enabled="${wildfly.webservices.statistics-enabled:${wildfly.statistics-enabled:false}}">
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
<client-config name="Standard-Client-Config"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:weld:4.0"/>
</profile>
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="private">
<inet-address value="${jboss.bind.address.private:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface name="unsecure">
<inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="iiop" interface="unsecure" port="3528"/>
<socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>
<socket-binding name="jgroups-mping" interface="private" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
<socket-binding name="jgroups-tcp" interface="private" port="7600"/>
<socket-binding name="jgroups-tcp-fd" interface="private" port="57600"/>
<socket-binding name="jgroups-udp" interface="private" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="jgroups-udp-fd" interface="private" port="54200"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="modcluster" multicast-address="${jboss.modcluster.multicast.address:224.0.1.105}" multicast-port="23364"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="${jboss.mail.server.host:localhost}" port="${jboss.mail.server.port:25}"/>
</outbound-socket-binding>
</socket-binding-group>
</server>

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
# Start Wildfly with the given arguments.
echo "Running Drools Workbench on JBoss Wildfly..."
#export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=50505,suspend=y,server=y"
export JAVA_OPTS=" -Dorg.kie.workbench.profile=PLANNER_AND_RULES -Djava.net.preferIPv4Stack=true -Dorg.uberfire.metadata.index.dir=/home/lucene -Dorg.uberfire.nio.git.daemon.host=0.0.0.0 -Dorg.uberfire.nio.git.ssh.host=0.0.0.0 -Dorg.guvnor.m2repo.dir=/m2_kiewb/repository -DM2_HOME=/m2_kiewb/repository -Dorg.uberfire.nio.git.dir=/home/niodir -Dorg.uberfire.nio.git.dirname=gitBase -Dorg.appformer.m2repo.url=http://localhost:8080/kie-wb/maven2 -Dkie.maven.settings.custom=/m2_kiewb/settings.xml -Dfile.encoding=UTF-8 -Duser.language=fr -Duser.country=FR -Dorg.uberfire.ext.security.management.api.userManagementServices=PymmaKieSecurityService $PYMMA_OPTS"
exec ./standalone.sh -b $JBOSS_BIND_ADDRESS -c $KIE_SERVER_PROFILE.xml
exit $?

View file

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>/m2_kiewb/repository</localRepository>
<servers>
<server>
<id>pymma2-release</id>
<username>nheron</username>
<password>pymmalomme</password>
</server>
<server>
<id>pymma2-snapshot</id>
<username>nheron</username>
<password>pymmalomme</password>
</server>
</servers>
<mirrors>
</mirrors>
<profiles>
<profile>
<id>pymma-declasin</id>
<repositories>
<repository>
<id>pymma2-snapshot</id>
<name>pymma2 repo release</name>
<url>https://nexus.pymma-software.net/repository/pymma-snapshot/</url>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>pymma2-release</id>
<name>pymma2 repo release</name>
<url>https://nexus.pymma-software.net/repository/pymma-release/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>pymma-declasin</activeProfile>
</activeProfiles>
</settings>

View file

@ -1,59 +0,0 @@
#!/bin/sh
# *****************************************************
# Drools Workbench Showcase - Docker image start script
# *****************************************************
# Program arguments
#
# -c | --container-name: The name for the created container.
# If not specified, defaults to "drools-workbench-showcase"
# -h | --help; Show the script usage
#
CONTAINER_NAME="kie-wb"
IMAGE_NAME="chtijbug/kie-wb"
IMAGE_TAG="latest"
function usage
{
echo "usage: start.sh [ [-c <container_name> ] ] [-h]]"
}
while [ "$1" != "" ]; do
case $1 in
-c | --container-name ) shift
CONTAINER_NAME=$1
;;
-h | --help ) usage
exit
;;
* ) usage
exit 1
esac
shift
done
# Check if container is already started
if [ -f docker.pid ]; then
echo "Container is already started"
container_id=$(cat docker.pid)
echo "Stoping container $container_id..."
docker stop $container_id
rm -f docker.pid
fi
# Start the jboss docker container
echo "Starting $CONTAINER_NAME docker container using:"
echo "** Container name: $CONTAINER_NAME"
image_drools_workbench=$(docker run -P -d --name $CONTAINER_NAME $IMAGE_NAME:$IMAGE_TAG)
ip_drools_workbench=$(docker inspect $image_drools_workbench | grep \"IPAddress\" | awk '{print $2}' | tr -d '",')
echo $image_drools_workbench > docker.pid
# End
echo ""
echo "Server starting in $ip_drools_workbench"
echo "You can access the server root context in http://$ip_drools_workbench:8080"
echo "JBoss Drools Workbench is running at http://$ip_drools_workbench:8080/drools-wb"
exit 0

View file

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2017 Red Hat Inc. and/or its affiliates and other contributors
~ as indicated by the @author tags. All rights reserved.
~ See the copyright.txt in the distribution for a
~ full listing of individual contributors.
~
~ This copyrighted material is made available to anyone wishing to use,
~ modify, copy, or redistribute it subject to the terms and conditions
~ of the GNU Lesser General Public License, v. 2.1.
~ This program is distributed in the hope that it will be useful, but WITHOUT A
~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
~ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
~ You should have received a copy of the GNU Lesser General Public License,
~ v.2.1 along with this distribution; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
~ MA 02110-1301, USA.
-->
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<!-- IMPORTANT: when adding dependency (module) here, make sure it is a public one.
Do not add private modules as there is no guarantee they won't be changed or
removed in future. WildFly also generates warning(s) during the deployment if
the WAR depends on private modules. -->
<!-- Keep the alphabetical order! -->
<!-- JMS API required by kie-server-client as there is an runtime API dependency
(even though the JMS is not being used for the communication itself). -->
<module name="javax.jms.api"/>
<module name="com.pymmasoftware.pymma-kie-loginmodule"/>
</dependencies>
</deployment>
</jboss-deployment-structure>

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'
debug="true">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>

View file

@ -1,510 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<!--
<distributable/>
-->
<listener>
<listener-class>org.uberfire.backend.server.io.DisposableShutdownService</listener-class>
</listener>
<listener>
<listener-class>org.kie.workbench.screens.workbench.backend.SwaggerAPIScanner</listener-class>
</listener>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.role.based.security</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>request-capture</filter-name>
<filter-class>org.uberfire.ext.security.server.SecurityIntegrationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>request-capture</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<filter>
<filter-name>Cache Filter</filter-name>
<filter-class>org.uberfire.ext.security.server.CacheHeadersFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Cache Filter</filter-name>
<url-pattern>/kie-wb.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Cache Filter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter>
<filter-name>Host Page Patch</filter-name>
<filter-class>org.jboss.errai.security.server.servlet.UserHostPageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Host Page Patch</filter-name>
<url-pattern>/kie-wb.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>CSRF Token Filter</filter-name>
<filter-class>org.jboss.errai.bus.server.servlet.CSRFTokenFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CSRF Token Filter</filter-name>
<url-pattern>/kie-wb.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>GWT Locale Filter</filter-name>
<filter-class>org.uberfire.server.locale.GWTLocaleHeaderFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>GWT Locale Filter</filter-name>
<url-pattern>/kie-wb.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>UberFire Security Headers Filter</filter-name>
<filter-class>org.uberfire.ext.security.server.SecureHeadersFilter</filter-class>
<init-param>
<param-name>x-frame-options</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
<init-param>
<param-name>x-xss-protection-enable</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>x-xss-protection-block</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UberFire Security Headers Filter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>LoginRedirectServlet</servlet-name>
<servlet-class>org.uberfire.ext.security.server.LoginRedirectServlet</servlet-class>
<init-param>
<param-name>display-after-login</param-name>
<param-value>/kie-wb.jsp</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>LoginRedirectServlet</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!-- Basic Auth Filter for REST and Maven2 repo -->
<filter>
<filter-name>HTTP Basic Auth Filter</filter-name>
<filter-class>org.uberfire.ext.security.server.BasicAuthSecurityFilter</filter-class>
<init-param>
<param-name>realmName</param-name>
<param-value>Business Central Realm</param-value>
</init-param>
<init-param>
<param-name>excludedPaths</param-name>
<param-value>/rest/healthy,/rest/ready</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>HTTP Basic Auth Filter</filter-name>
<url-pattern>/git/*</url-pattern>
<url-pattern>/rest/*</url-pattern>
<url-pattern>/ws/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>GzipFilter</filter-name>
<filter-class>org.uberfire.backend.server.util.gzip.GzipFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>GzipFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<!-- drools-wb servlets -->
<servlet>
<servlet-name>DTableXLSFileServlet</servlet-name>
<servlet-class>org.drools.workbench.screens.dtablexls.backend.server.DecisionTableXLSFileServlet</servlet-class>
<init-param>
<param-name>includes-path</param-name>
<param-value>git://**,default://**</param-value>
</init-param>
<init-param>
<param-name>excludes-path</param-name>
<param-value>file://**</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>DTableXLSFileServlet</servlet-name>
<url-pattern>/org.kie.bc.KIEWebapp/dtablexls/file</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ArchiveServlet</servlet-name>
<servlet-class>org.guvnor.common.services.backend.archive.ArchiveServlet</servlet-class>
<init-param>
<param-name>includes-path</param-name>
<param-value>git://**,default://**</param-value>
</init-param>
<init-param>
<param-name>excludes-path</param-name>
<param-value>file://**</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ArchiveServlet</servlet-name>
<url-pattern>/org.kie.bc.KIEWebapp/archive</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ScoreCardFileServlet</servlet-name>
<servlet-class>org.drools.workbench.screens.scorecardxls.backend.server.ScoreCardXLSFileServlet</servlet-class>
<init-param>
<param-name>includes-path</param-name>
<param-value>git://**,default://**</param-value>
</init-param>
<init-param>
<param-name>excludes-path</param-name>
<param-value>file://**</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ScoreCardFileServlet</servlet-name>
<url-pattern>/org.kie.bc.KIEWebapp/scorecardxls/file</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>UberfireFileUploadServlet</servlet-name>
<servlet-class>org.uberfire.server.FileUploadServlet</servlet-class>
<init-param>
<param-name>includes-path</param-name>
<param-value>git://**,default://**</param-value>
</init-param>
<init-param>
<param-name>excludes-path</param-name>
<param-value>file://**</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>UberfireFileUploadServlet</servlet-name>
<url-pattern>/org.kie.bc.KIEWebapp/defaulteditor/upload/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>UberfireFileDownloadServlet</servlet-name>
<servlet-class>org.uberfire.server.FileDownloadServlet</servlet-class>
<init-param>
<param-name>includes-path</param-name>
<param-value>git://**,default://**</param-value>
</init-param>
<init-param>
<param-name>excludes-path</param-name>
<param-value>file://**</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>UberfireFileDownloadServlet</servlet-name>
<url-pattern>/org.kie.bc.KIEWebapp/defaulteditor/download/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>M2Servlet</servlet-name>
<servlet-class>org.guvnor.m2repo.backend.server.M2Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>M2Servlet</servlet-name>
<url-pattern>/maven2/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>VerifierWebWorkerServlet</servlet-name>
<servlet-class>org.kie.workbench.common.services.verifier.service.VerifierWebWorkerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VerifierWebWorkerServlet</servlet-name>
<url-pattern>/verifier/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>PluginMediaServlet</servlet-name>
<servlet-class>org.uberfire.ext.plugin.backend.PluginMediaServlet</servlet-class>
<init-param>
<param-name>url-pattern</param-name>
<param-value>/plugins/</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PluginMediaServlet</servlet-name>
<url-pattern>/plugins/*</url-pattern>
</servlet-mapping>
<!-- Errai servlets -->
<servlet>
<!-- NOTE: the integration-test profile uses this web.xml. Integration tests only work properly
with the DefaultBlockingServlet. If you change this setting, make a backup of this web.xml
(perhaps under src/integration-test-settings/web.xml and alter the integration-test
profile in pom.xml to use that. -->
<servlet-name>ErraiServlet</servlet-name>
<servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ErraiServlet</servlet-name>
<url-pattern>*.erraiBus</url-pattern>
</servlet-mapping>
<!-- Start jBPM Designer -->
<filter>
<filter-name>Redirect Filter</filter-name>
<filter-class>org.jbpm.designer.filter.DesignerResourcesRedirectFilter</filter-class>
<init-param>
<param-name>redirectTo</param-name>
<param-value>/org.kie.bc.KIEWebapp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Redirect Filter</filter-name>
<url-pattern>/org.jbpm.designer.jBPMDesigner/*</url-pattern>
</filter-mapping>
<!-- the number within the session-timout element must be expressed in
minutes. it is now 24 hours. -->
<session-config>
<session-timeout>1440</session-timeout>
<cookie-config>
<http-only>true</http-only>
</cookie-config>
</session-config>
<!-- jBoss' default mapping is to "image/svg", which causes the client
not to parse the SVG content as XML. However, the Oryx Editor client relies
on that behaviour. The mimetype as per W3C specification must be "image/svg+xml".
See http://www.w3.org/TR/SVG/intro.html#MIMEType. -->
<mime-mapping>
<extension>svg</extension>
<mime-type>image/svg+xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>json</extension>
<mime-type>application/json</mime-type>
</mime-mapping>
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<!-- Set Favourites Icon MIME-Type -->
<mime-mapping>
<extension>ico</extension>
<mime-type>image/x-icon</mime-type>
</mime-mapping>
<!-- End jBPM Designer -->
<!-- security settings -->
<security-constraint>
<web-resource-collection>
<web-resource-name>download</web-resource-name>
<url-pattern>/org.kie.bc.KIEWebapp/archive</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/defaulteditor/upload/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/defaulteditor/download/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/dtablexls/file</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/scorecardxls/file</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>analyst</role-name>
<role-name>developer</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>console</web-resource-name>
<url-pattern>/kie-wb.jsp</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/*</url-pattern>
<url-pattern>*.erraiBus</url-pattern>
<url-pattern>/resourceList</url-pattern>
<url-pattern>/editor</url-pattern>
<url-pattern>/editor/*</url-pattern>
<url-pattern>/menuconnector/*</url-pattern>
<url-pattern>/menu/*</url-pattern>
<url-pattern>/uuidRepository</url-pattern>
<url-pattern>/transformer</url-pattern>
<url-pattern>/assetservice</url-pattern>
<url-pattern>/filestore</url-pattern>
<url-pattern>/dictionary</url-pattern>
<url-pattern>/themes</url-pattern>
<url-pattern>/customeditors</url-pattern>
<url-pattern>/simulation</url-pattern>
<url-pattern>/formwidget</url-pattern>
<url-pattern>/calledelement</url-pattern>
<url-pattern>/stencilpatterns</url-pattern>
<url-pattern>/jbpmservicerepo</url-pattern>
<url-pattern>/processdiff</url-pattern>
<url-pattern>/taskforms</url-pattern>
<url-pattern>/taskformseditor</url-pattern>
<url-pattern>/processinfo</url-pattern>
<url-pattern>/syntaxcheck</url-pattern>
<url-pattern>/plugins</url-pattern>
<url-pattern>/plugin</url-pattern>
<url-pattern>/plugin/*</url-pattern>
<url-pattern>/stencilset/*</url-pattern>
<url-pattern>/plugins/*</url-pattern>
<url-pattern>/verifier/*</url-pattern>
<url-pattern>/docs/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
<role-name>analyst</role-name>
<role-name>developer</role-name>
<role-name>user</role-name>
<role-name>manager</role-name>
<role-name>process-admin</role-name>
</auth-constraint>
</security-constraint>
<!-- Basic auth for WebSocket endpoints -->
<security-constraint>
<web-resource-collection>
<web-resource-name>WebSocket basic auth resources</web-resource-name>
<url-pattern>/websocket/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>rest-all</role-name>
</auth-constraint>
</security-constraint>
<!-- public resources -->
<security-constraint>
<web-resource-collection>
<web-resource-name>public</web-resource-name>
<url-pattern>/org.kie.bc.KIEWebapp/ace/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/bootstrap-daterangepicker/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/bootstrap-select/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/css/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/deferredjs/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/fonts/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/img/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/images/*</url-pattern>
<url-pattern>/org.kie.bc.KIEWebapp/zeroclipboard/*</url-pattern>
<url-pattern>/rest/ready</url-pattern>
<url-pattern>/rest/healthy</url-pattern>
<url-pattern>/maven2/*</url-pattern>
</web-resource-collection>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>remote-services</web-resource-name>
<url-pattern>/rest/*</url-pattern>
<url-pattern>/ws/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>rest-all</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC?silent=true,FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login.jsp?message=Login failed: Invalid UserName or Password</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>Administrator - Administrates the BPMS system. Has full access
rights to make any changes necessary. Also has the
ability to add and remove users from the system.
</description>
<role-name>admin</role-name>
</security-role>
<security-role>
<description>Analyst - Responsible for creating and designing processes
into the system. Creates process flows and handles
process change requests. Needs to test processes that
they create. Also creates forms and dashboards.
</description>
<role-name>analyst</role-name>
</security-role>
<security-role>
<description>Developer - Implements code required for process to work. Mostly uses
the JBDS connection to view processes, but may use the
web tool occasionally.
</description>
<role-name>developer</role-name>
</security-role>
<security-role>
<description>Business user - Daily user of the system to take actions on business tasks
that are required for the processes to continue forward. Works
primarily with the task lists.
</description>
<role-name>user</role-name>
</security-role>
<security-role>
<description>Manager/Viewer-only User - Viewer of the system that is interested in statistics
around the business processes and their performance, business indicators, and other
reporting of the system and people who interact with the system.
</description>
<role-name>manager</role-name>
</security-role>
<security-role>
<description>Process Administrator - can access and manage the process related activities like process
definitions and process instances.
</description>
<role-name>process-admin</role-name>
</security-role>
<security-role>
<description>REST user - Users with the rest-all role can access Business Central REST capabilities.</description>
<role-name>rest-all</role-name>
</security-role>
<security-role>
<description>REST project - Users with the rest-project role can access Business Central REST capabilities.</description>
<role-name>rest-project</role-name>
</security-role>
<error-page>
<error-code>403</error-code>
<location>/not_authorized.jsp</location>
</error-page>
</web-app>

View file

@ -1,58 +0,0 @@
<?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-base-tools-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<artifactId>drools-framework-kie-wb-parent</artifactId>
<modules>
<module>kie-wb</module>
<module>kie-drools-framework-rest-backend</module>
<module>drools-framework-kie-wb-rest-pojo</module>
<module>drools-framework-uberfire-security-service</module>
<module>drools-framework-wildfly-login-module</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-bom</artifactId>
<!-- Using ${uberfire.version} instead of ${project.version} enables easier way to create hot fixes
(one-off patches). This pom is a parent for all uberfire modules, so when version is changed in
one of them, the ${project.version} property changes too and therefore also required version of
uberfire-bom. Usage of this property makes it possible to change version of the (sub)module
and still use the original version of uberfire-bom. -->
<version>${jbpm.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-bom</artifactId>
<version>${jbpm.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Errai -->
<dependency>
<groupId>org.jboss.errai.bom</groupId>
<artifactId>errai-internal-bom</artifactId>
<version>4.3.3.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View file

@ -5,7 +5,7 @@
<parent>
<artifactId>drools-framework-base-tools-parent</artifactId>
<groupId>com.pymmasoftware.jbpm</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</parent>
@ -48,41 +48,34 @@
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${jbpm.version}</version>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.21</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-client</artifactId>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-wiring-dynamic</artifactId>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
@ -96,21 +89,8 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-api</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.pymmasoftware.jbpm</groupId>
<artifactId>drools-framework-kie-server-extension-interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
@ -130,11 +110,7 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
@ -144,31 +120,17 @@
<artifactId>drools-core</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<groupId>org.drools</groupId>
<artifactId>drools-wiring-static</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<groupId>org.kie.kogito</groupId>
<artifactId>jbpm-flow</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<exclusions>
<exclusion>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</exclusion>
</exclusions>
<version>${jbpm.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
@ -179,10 +141,7 @@
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-workbench-models-guided-dtable</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>

View file

@ -71,12 +71,9 @@ public interface RuleBaseSession {
HistoryContainer getHistoryContainer();
String getHistoryContainerXML();
Collection<DroolsFactObject> listLastVersionObjects();
String listLastVersionObjectsXML();
Collection<DroolsRuleObject> listRules();
int getNumberRulesExecuted();

View file

@ -22,11 +22,11 @@ import org.chtijbug.drools.entity.history.fact.FactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedFactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.UpdatedFactHistoryEvent;
import org.chtijbug.drools.runtime.DroolsFactObjectFactory;
import org.drools.core.definitions.rule.impl.RuleImpl;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.drools.core.common.PropagationContext;
import org.drools.core.event.rule.impl.ObjectDeletedEventImpl;
import org.drools.core.event.rule.impl.ObjectInsertedEventImpl;
import org.drools.core.event.rule.impl.ObjectUpdatedEventImpl;
import org.drools.core.spi.PropagationContext;
import org.kie.api.event.rule.ObjectDeletedEvent;
import org.kie.api.event.rule.ObjectInsertedEvent;
import org.kie.api.event.rule.ObjectUpdatedEvent;

View file

@ -17,7 +17,6 @@ package org.chtijbug.drools.runtime.impl;
import org.chtijbug.drools.entity.history.EventCounter;
import org.chtijbug.drools.entity.history.knowledge.*;
import org.chtijbug.drools.kieserver.extension.KieServerAddOnElement;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.RuleBasePackage;
import org.chtijbug.drools.runtime.RuleBaseSession;
@ -81,10 +80,7 @@ public class RuleBaseSingleton implements RuleBasePackage {
* Global Maps
*/
Map<String, Object> globals = new HashMap<>();
/**
* extensions Points
*/
private KieServerAddOnElement kieServerAddOnElement = null;
/**
* @param kieContainer
@ -96,11 +92,7 @@ public class RuleBaseSingleton implements RuleBasePackage {
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
}
public RuleBaseSingleton(KieContainer kieContainer, int maxNumberRulesToExecute, KieServerAddOnElement kieServerAddOnElement) {
this.kieServerAddOnElement = kieServerAddOnElement;
this.kieContainer = kieContainer;
this.maxNumberRuleToExecute = maxNumberRulesToExecute;
}
public RuleBaseSingleton(KieContainer kieContainer, int maxNumberRulesToExecute, HistoryListener historyListener) {
this.kieContainer = kieContainer;

View file

@ -17,8 +17,6 @@ package org.chtijbug.drools.runtime.impl;
import com.rits.cloning.Cloner;
import com.rits.cloning.ObjenesisInstantiationStrategy;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import org.chtijbug.drools.common.reflection.ReflectionUtils;
import org.chtijbug.drools.entity.*;
import org.chtijbug.drools.entity.history.EventCounter;
@ -31,11 +29,11 @@ import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.DroolsFactObjectFactory;
import org.chtijbug.drools.runtime.RuleBaseSession;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.drools.core.definitions.rule.impl.RuleImpl;
import org.drools.base.definitions.rule.impl.RuleImpl;
import org.jbpm.workflow.core.node.RuleSetNode;
import org.jbpm.workflow.instance.node.*;
import org.kie.api.definition.rule.Rule;
import org.kie.api.event.rule.DefaultAgendaEventListener;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.ObjectFilter;
import org.kie.api.runtime.process.NodeInstance;
@ -82,7 +80,6 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
private ProcessHandlerListener processHandlerListener;
private int maxNumberRuleToExecute;
private XStream xstream = new XStream(new JettisonMappedXmlDriver());
private Long ruleBaseID;
private Long sessionId;
@ -127,7 +124,7 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
public DroolsProcessInstanceObject getDroolsProcessInstanceObject(ProcessInstance processInstance) {
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(Long.toString(processInstance.getId()));
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(processInstance.getId());
if (droolsProcessInstanceObject == null) {
DroolsProcessObject droolsProcessObject = processList.get(processInstance.getProcess().getId());
@ -153,7 +150,9 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
nodeType = DroolsNodeType.RuleNode;
RuleSetNode ruleSetNode = this.getRuleSetNode(nodeInstance);
if (ruleSetNode != null) {
ruleFlowGroupName = ruleSetNode.getRuleFlowGroup();
if (ruleSetNode.getRuleType().isRuleFlowGroup()) {
ruleFlowGroupName = ruleSetNode.getRuleType().getName();
}
}
} else if (nodeInstance instanceof SplitInstance) {
nodeType = DroolsNodeType.SplitNode;
@ -162,7 +161,7 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
} else if (nodeInstance instanceof EndNodeInstance) {
nodeType = DroolsNodeType.EndNode;
}
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(Long.toString(nodeInstance.getProcessInstance().getId()));
DroolsProcessInstanceObject droolsProcessInstanceObject = processInstanceList.get(nodeInstance.getProcessInstance().getId());
if (droolsProcessInstanceObject == null) {
droolsProcessInstanceObject = this.getDroolsProcessInstanceObject(nodeInstance.getProcessInstance());
}
@ -185,7 +184,7 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
RuleImpl ruleInstance = (RuleImpl) rule;
if (droolsRuleObject == null) {
droolsRuleObject = DroolsRuleObject.createDroolRuleObject(rule.getName(), rule.getPackageName());
droolsRuleObject.setRuleFlowGroup(ruleInstance.getRuleFlowGroup());
droolsRuleObject.setRuleFlowGroup(ruleInstance.getAgendaGroup());
addDroolsRuleObject(droolsRuleObject);
}
@ -236,16 +235,6 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
return historyContainer;
}
@Override
public String getHistoryContainerXML() {
String result = null;
if (historyContainer != null) {
xstream.setMode(XStream.NO_REFERENCES);
result = xstream.toXML(historyContainer);
}
return result;
}
@Override
public Collection<DroolsFactObject> listLastVersionObjects() {
Collection<DroolsFactObject> list = new ArrayList<>();
@ -257,16 +246,6 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
return list;
}
@Override
public String listLastVersionObjectsXML() {
String result = null;
Collection<DroolsFactObject> list = this.listLastVersionObjects();
if (list != null) {
xstream.setMode(XStream.NO_REFERENCES);
result = xstream.toXML(list);
}
return result;
}
public void setData(FactHandle f, Object o, DroolsFactObject fObject) {

Some files were not shown because too many files have changed in this diff Show more