forked from apache/incubator-kie-kogito-runtimes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[incubator-kie-issues-1278] Support for codegen in project class load…
…ing handler descriptors. (error event) (apache#3537)
- Loading branch information
1 parent
bd66a1f
commit ec8e2de
Showing
9 changed files
with
152 additions
and
17 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
jbpm/jbpm-tests/src/main/java/org/jbpm/bpmn2/services/AlwaysThrowingComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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.jbpm.bpmn2.services; | ||
|
||
import org.kie.kogito.process.workitem.WorkItemExecutionException; | ||
|
||
public class AlwaysThrowingComponent { | ||
|
||
public void throwException() { | ||
throw new WorkItemExecutionException("MY_ERROR"); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
jbpm/jbpm-tests/src/main/java/org/jbpm/bpmn2/services/LoggingComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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.jbpm.bpmn2.services; | ||
|
||
public class LoggingComponent { | ||
|
||
public void logException(Throwable exception) { | ||
System.out.println(exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...m-tools/jbpm-tools-maven-plugin/src/main/java/org/jbpm/tools/maven/ClassLoaderHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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.jbpm.tools.maven; | ||
|
||
import java.io.File; | ||
import java.net.URL; | ||
import java.net.URLClassLoader; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import org.apache.maven.project.MavenProject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ClassLoaderHelper { | ||
private static Logger LOGGER = LoggerFactory.getLogger(ClassLoaderHelper.class); | ||
|
||
public static ClassLoader getClassLoader(MavenProject project) { | ||
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
try { | ||
|
||
Set<URL> classPathUrls = new HashSet<>(); | ||
|
||
// adding the projects classes itself | ||
List<String> classpathElements = project.getCompileClasspathElements(); | ||
classpathElements.add(project.getBuild().getOutputDirectory()); | ||
classpathElements.add(project.getBuild().getTestOutputDirectory()); | ||
for (final String classpathElement : classpathElements) { | ||
LOGGER.info("adding classpath element {} to classloader", classpathElement); | ||
classPathUrls.add(new File(classpathElement).toURI().toURL()); | ||
} | ||
|
||
return new URLClassLoader(classPathUrls.stream().toArray(URL[]::new), contextClassLoader); | ||
} catch (final Exception e) { | ||
return contextClassLoader; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters