From feb2776a621ebb9449caf4a469ca1ceaffceb0cf Mon Sep 17 00:00:00 2001 From: Victor Verbitsky Date: Fri, 11 Jul 2014 12:46:38 +0400 Subject: [PATCH] SWITCHYARD-1935: Upgrade KIE/Drools/jBPM from 6.0.0.Final to 6.0.1.Final --- .../SwitchYardCdiIntegrationProcessor.java | 52 +++++++++++++++++-- jboss-as7/kiedroolsjbpm/pom.xml | 16 ++++++ .../soa/org/jbpm/main/assembly-component.xml | 1 + .../layers/soa/org/jbpm/main/module.xml | 1 + .../components/bpm/resources/module.xml | 9 +++- 5 files changed, 75 insertions(+), 4 deletions(-) diff --git a/jboss-as7/extension/src/main/java/org/switchyard/as7/extension/deployment/SwitchYardCdiIntegrationProcessor.java b/jboss-as7/extension/src/main/java/org/switchyard/as7/extension/deployment/SwitchYardCdiIntegrationProcessor.java index 2a210466..c9b42ef1 100644 --- a/jboss-as7/extension/src/main/java/org/switchyard/as7/extension/deployment/SwitchYardCdiIntegrationProcessor.java +++ b/jboss-as7/extension/src/main/java/org/switchyard/as7/extension/deployment/SwitchYardCdiIntegrationProcessor.java @@ -15,6 +15,9 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.List; + +import javax.enterprise.inject.spi.Extension; import org.apache.log4j.Logger; import org.jboss.as.server.deployment.Attachments; @@ -23,7 +26,9 @@ import org.jboss.as.server.deployment.DeploymentUnitProcessingException; import org.jboss.as.server.deployment.DeploymentUnitProcessor; import org.jboss.as.weld.WeldDeploymentMarker; +import org.jboss.as.weld.deployment.WeldAttachments; import org.jboss.modules.Module; +import org.jboss.weld.bootstrap.spi.Metadata; import org.switchyard.as7.extension.ExtensionMessages; import org.switchyard.as7.extension.SwitchYardDeploymentMarker; @@ -73,14 +78,55 @@ private void checkExtension(final String extensionName, DeploymentUnit deploymen Method registerMethod = weldPortableExtensionsClass.getDeclaredMethod(TRY_REGISTER_EXTENSION, Class.class, DeploymentUnit.class); Object extensions = getExtensionMethod.invoke(null, deploymentUnit); Class extensionClass = null; - extensionClass = module.getClassLoader().loadClass(extensionName); + try { + extensionClass = module.getClassLoader().loadClass(extensionName); + } catch (ClassNotFoundException cnfe) { + throw new DeploymentUnitProcessingException(cnfe); + } if (extensionClass != null) { registerMethod.invoke(extensions, extensionClass, deploymentUnit); } else { throw ExtensionMessages.MESSAGES.extensionNotfound(extensionName); } - } catch (ClassNotFoundException cnfe) { - throw new DeploymentUnitProcessingException(cnfe); + } catch (ClassNotFoundException wcnfe) { + final List> extensions = parent.getAttachmentList(WeldAttachments.PORTABLE_EXTENSIONS); + + boolean found = false; + for (Metadata extension : extensions) { + if (extension.getLocation().equals(extensionName)) { + found = true; + break; + } + } + + if (!found) { + _logger.debug("SwitchYard Application for deployment unit '" + deploymentUnit.getName() + "' contains CDI Beans. " + + "Attaching SwitchYard CDI Discovery (" + extensionName + ") to deployment."); + + try { + Class extensionClass = module.getClassLoader().loadClass(extensionName); + final Extension extensionInstance = (Extension) extensionClass.newInstance(); + + Metadata metadata = new Metadata() { + @Override + public Extension getValue() { + return extensionInstance; + } + + @Override + public String getLocation() { + return extensionName; + } + }; + parent.addToAttachmentList(WeldAttachments.PORTABLE_EXTENSIONS, metadata); + } catch (InstantiationException ie) { + throw new DeploymentUnitProcessingException(ie); + } catch (IllegalAccessException iae) { + throw new DeploymentUnitProcessingException(iae); + } catch (ClassNotFoundException cnfe) { + throw new DeploymentUnitProcessingException(cnfe); + } + } } catch (IllegalAccessException iae) { throw new DeploymentUnitProcessingException(iae); } catch (NoSuchMethodException nsme) { diff --git a/jboss-as7/kiedroolsjbpm/pom.xml b/jboss-as7/kiedroolsjbpm/pom.xml index 27208783..8e29908e 100644 --- a/jboss-as7/kiedroolsjbpm/pom.xml +++ b/jboss-as7/kiedroolsjbpm/pom.xml @@ -66,6 +66,18 @@ ${version.jbpm} jar + + org.jbpm + jbpm-human-task-audit + ${version.jbpm} + jar + + + org.jbpm + jbpm-kie-services + ${version.jbpm} + jar + META-INF/*.xsd,META-INF/*orm.xml ${project.build.directory}/jbpm-meta-inf @@ -185,6 +197,10 @@ org.jbpm jbpm-flow-builder + + org.jbpm + jbpm-human-task-audit + org.jbpm jbpm-human-task-core diff --git a/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/assembly-component.xml b/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/assembly-component.xml index 3033a140..c80827ab 100644 --- a/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/assembly-component.xml +++ b/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/assembly-component.xml @@ -34,6 +34,7 @@ org.jbpm:jbpm-bpmn2 org.jbpm:jbpm-flow org.jbpm:jbpm-flow-builder + org.jbpm:jbpm-human-task-audit org.jbpm:jbpm-human-task-core org.jbpm:jbpm-human-task-workitems org.jbpm:jbpm-kie-services diff --git a/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/module.xml b/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/module.xml index a7c15043..e4512dbf 100644 --- a/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/module.xml +++ b/jboss-as7/kiedroolsjbpm/src/main/resources/modules/system/layers/soa/org/jbpm/main/module.xml @@ -18,6 +18,7 @@ + diff --git a/jboss-as7/modules/src/main/resources/switchyard/components/bpm/resources/module.xml b/jboss-as7/modules/src/main/resources/switchyard/components/bpm/resources/module.xml index 894577c3..afad915b 100644 --- a/jboss-as7/modules/src/main/resources/switchyard/components/bpm/resources/module.xml +++ b/jboss-as7/modules/src/main/resources/switchyard/components/bpm/resources/module.xml @@ -20,7 +20,14 @@ - + + + + + + + +