Commit 1ddebfec authored by Munilla Christophe's avatar Munilla Christophe

No commit message

No commit message
parent 789a9cf9
......@@ -27,7 +27,6 @@
package org.ow2.frascati.implementation.bpel.easybpel;
import java.net.URI;
import com.ebmwebsourcing.easybpel.model.bpel.api.BPELException;
import com.ebmwebsourcing.easybpel.model.bpel.api.BPELFactory;
import com.ebmwebsourcing.easybpel.model.bpel.api.inout.BPELReader;
......@@ -46,6 +45,7 @@ import org.osoa.sca.annotations.Property;
import org.ow2.frascati.implementation.bpel.api.BPELEngine;
import org.ow2.frascati.implementation.bpel.api.BPELProcess;
import org.ow2.frascati.jaxb.JAXB;
import org.ow2.frascati.util.AbstractLoggeable;
import org.ow2.frascati.util.FrascatiException;
......@@ -110,11 +110,14 @@ public class EasyBpelEngine
conf.setExplorer(withExplorer || easyBpelExplorer);
// create an EasyBPEL message converter.
DefaultBPELMessageConverter converter =
new DefaultBPELMessageConverter(BPELExternalMessageImpl.class, BPELInternalMessageImpl.class);
DefaultBPELMessageConverter converter =
new DefaultBPELMessageConverter(BPELExternalMessageImpl.class, BPELInternalMessageImpl.class);
JAXB.registerObjectFactoryFromClassLoder(
Thread.currentThread().getContextClassLoader());
// create the EasyBPEL core.
// TODO: why 10 ? or another value ?
// TODO: why 10 ? or another value ?
this.core = bpelFactory.newBPELEngine(conf, converter, 10,
EasyBpelReceiverImpl.class, 10, EasyBpelSenderImpl.class, log);
}
......
#Generated by Maven
#Fri Jan 20 09:09:27 CET 2012
version=1.5-SNAPSHOT
groupId=org.ow2.frascati
artifactId=frascati-implementation-osgi-jboss
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
......@@ -27,7 +27,10 @@
package org.ow2.frascati.jaxb;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
......@@ -216,4 +219,66 @@ public abstract class JAXB
return result;
}
/**
* Look for ObjectFactory classes in the ClassLoader passed on on as
* parameter. If an ObjectFactory class is found a new JAXBContext is
* created by using the package name of the class and the ClassLoader. Then
* it is stored in the jaxbContexts map
*
* @param classLoader
* The used ClassLoader to look for ObjectFactory classes
*/
public static void registerObjectFactoryFromClassLoder(
ClassLoader classLoader) {
Enumeration<URL> factoriesURL = null;
try {
factoriesURL = classLoader.getResources("ObjectFactory.class");
} catch (IOException e) {
// e.printStackTrace();
}
if (factoriesURL != null && factoriesURL.hasMoreElements()) {
while (factoriesURL.hasMoreElements()) {
// extract the package name from the URL
URL factoryURL = factoriesURL.nextElement();
// get the file part only
String factoryURLFilePart = factoryURL.getFile();
// if in a jar : cut after the jar delimiter
// if not : cut after the first '/' character
String factoryPackageName = factoryURLFilePart
.substring(factoryURLFilePart.lastIndexOf("!/") + 2);
// replace file separator with package separator
factoryPackageName = factoryPackageName.replace('/', '.');
// then remove the class name
String factoryClassName = factoryPackageName.substring(0,
factoryPackageName.lastIndexOf('.'));
factoryPackageName = factoryClassName.substring(0,
factoryClassName.lastIndexOf('.'));
// Try to find an existing JAXBContext for the package name
JAXBContext jc = jaxbContexts.get(factoryPackageName);
if (jc == null) {
// if it doesn't exist, it is created...
try {
jc = JAXBContext.newInstance(factoryPackageName,
classLoader);
// ...and stored in the map
jaxbContexts.put(factoryPackageName, jc);
} catch (javax.xml.bind.JAXBException jaxbe) {
System.out.println(
"WARNING : No JAXBContext created for '"
+ factoryPackageName + "' package");
}
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment