From: Mathieu Baudier Date: Mon, 16 Nov 2009 20:24:33 +0000 (+0000) Subject: Force usage of vanilla Xalan when in OSGi X-Git-Tag: argeo-slc-2.1.7~1522 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=1700d7107498d27348384ab6fd9d6c5d535d823b;p=gpl%2Fargeo-slc.git Force usage of vanilla Xalan when in OSGi git-svn-id: https://svn.argeo.org/slc/trunk@3093 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/modules/agent/org.argeo.slc.agent.ext.xalan/META-INF/MANIFEST.MF b/modules/agent/org.argeo.slc.agent.ext.xalan/META-INF/MANIFEST.MF index 5e06b35d2..ea4b7ef1c 100644 --- a/modules/agent/org.argeo.slc.agent.ext.xalan/META-INF/MANIFEST.MF +++ b/modules/agent/org.argeo.slc.agent.ext.xalan/META-INF/MANIFEST.MF @@ -3,4 +3,5 @@ Bundle-ManifestVersion: 2 Fragment-Host: com.springsource.org.apache.xalan Bundle-Version: 0.12.1.SNAPSHOT Bundle-SymbolicName: org.argeo.slc.agent.ext.xalan -Import-Package: org.w3c.dom.traversal;resolution:=optional +Import-Package: com.sun.org.apache.xml.internal.dtm;resolution:=optional, + org.w3c.dom.traversal;resolution:=optional diff --git a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml b/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml index 395db0502..a40763c43 100644 --- a/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml +++ b/modules/agent/org.argeo.slc.agent.jms/META-INF/spring/osgi.xml @@ -18,5 +18,6 @@ + interface="org.argeo.slc.execution.ExecutionModulesManager" + context-class-loader="service-provider" /> \ No newline at end of file diff --git a/modules/agent/org.argeo.slc.agent/META-INF/MANIFEST.MF b/modules/agent/org.argeo.slc.agent/META-INF/MANIFEST.MF index dd7dadd60..2c6d13b0a 100644 --- a/modules/agent/org.argeo.slc.agent/META-INF/MANIFEST.MF +++ b/modules/agent/org.argeo.slc.agent/META-INF/MANIFEST.MF @@ -4,3 +4,5 @@ Require-Bundle: org.argeo.slc.specs,org.argeo.slc.core,org.argeo.slc.s Bundle-Version: 0.12.1.SNAPSHOT Bundle-Name: Argeo SLC Agent Bundle-SymbolicName: org.argeo.slc.agent +Import-Package: org.apache.xalan.processor, + org.apache.xerces.jaxp diff --git a/runtime/org.argeo.slc.core/pom.xml b/runtime/org.argeo.slc.core/pom.xml index d9e1ae098..fbd77f409 100644 --- a/runtime/org.argeo.slc.core/pom.xml +++ b/runtime/org.argeo.slc.core/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.slc @@ -80,13 +81,6 @@ org.argeo.dep.osgi.commons.exec - org.slf4j com.springsource.slf4j.org.apache.commons.logging diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java index 1450ab98a..3c85055f8 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/ExecutionThread.java @@ -28,6 +28,13 @@ public class ExecutionThread extends Thread { } public void run() { + if (getContextClassLoader() != null) { + if (log.isTraceEnabled()) + log.debug("Context class loader set to " + + getContextClassLoader()); + } + + // Retrieve execution flow descriptor ExecutionFlowDescriptor executionFlowDescriptor = realizedFlow .getFlowDescriptor(); String flowName = executionFlowDescriptor.getName(); @@ -63,5 +70,4 @@ public class ExecutionThread extends Thread { it.next().addSteps(slcExecution, steps); } } - } diff --git a/runtime/org.argeo.slc.support.castor/pom.xml b/runtime/org.argeo.slc.support.castor/pom.xml index 47957b742..e486f68ea 100644 --- a/runtime/org.argeo.slc.support.castor/pom.xml +++ b/runtime/org.argeo.slc.support.castor/pom.xml @@ -53,7 +53,8 @@ org.argeo.slc.msg.event;resolution:=optional, org.argeo.slc.msg.test.tree;resolution:=optional, org.argeo.slc.detached;resolution:=optional, - org.apache.xml.serialize + org.apache.xml.serialize;resolution:=optional, + org.apache.xerces.jaxp;resolution:=optional com.springsource.org.castor diff --git a/runtime/org.argeo.slc.support.osgi/pom.xml b/runtime/org.argeo.slc.support.osgi/pom.xml index 535f2cb01..a34ce66ef 100644 --- a/runtime/org.argeo.slc.support.osgi/pom.xml +++ b/runtime/org.argeo.slc.support.osgi/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 org.argeo.slc @@ -67,5 +68,14 @@ org.argeo.slc.osgiboot + + + org.apache.xalan + com.springsource.org.apache.xalan + + diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/MultipleServiceExporterPostProcessor.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/MultipleServiceExporterPostProcessor.java index de759110f..f5d0a3853 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/MultipleServiceExporterPostProcessor.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/MultipleServiceExporterPostProcessor.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.core.Ordered; import org.springframework.core.PriorityOrdered; +import org.springframework.osgi.service.exporter.support.ExportContextClassLoader; import org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean; @SuppressWarnings(value = { "unchecked" }) @@ -29,6 +30,8 @@ public class MultipleServiceExporterPostProcessor implements private Class osgiServiceFactoryClass = OsgiServiceFactoryBean.class; + private Boolean useServiceProviderContextClassLoader = false; + public void postProcessBeanFactory( ConfigurableListableBeanFactory beanFactory) throws BeansException { if (!(beanFactory instanceof BeanDefinitionRegistry)) { @@ -50,6 +53,9 @@ public class MultipleServiceExporterPostProcessor implements MutablePropertyValues mpv = new MutablePropertyValues(); mpv.addPropertyValue("interfaces", interfaces.toArray()); mpv.addPropertyValue("targetBeanName", beanName); + if (useServiceProviderContextClassLoader) + mpv.addPropertyValue("contextClassLoader", + ExportContextClassLoader.SERVICE_PROVIDER); RootBeanDefinition bd = new RootBeanDefinition( osgiServiceFactoryClass, mpv); @@ -79,4 +85,10 @@ public class MultipleServiceExporterPostProcessor implements public int getOrder() { return Ordered.LOWEST_PRECEDENCE; } + + public void setUseServiceProviderContextClassLoader( + Boolean useServiceProviderContextClassLoader) { + this.useServiceProviderContextClassLoader = useServiceProviderContextClassLoader; + } + } diff --git a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java index b2038b928..6c442c71d 100644 --- a/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java +++ b/runtime/org.argeo.slc.support.osgi/src/main/java/org/argeo/slc/osgi/OsgiExecutionModulesManager.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.Set; import org.apache.commons.logging.Log; @@ -34,6 +35,27 @@ import org.springframework.osgi.service.importer.OsgiServiceLifecycleListener; public class OsgiExecutionModulesManager extends AbstractExecutionModulesManager implements InitializingBean, DisposableBean, OsgiServiceLifecycleListener { + + static { + // Force usage of vanilla Xalan when in OSGi + // We would like to do it in a cleaner way + // but the integration of Xalan and Xerces in the JRE + // makes it very difficult + // Suggestions welcome! + Properties systemProperties = System.getProperties(); +// if (!systemProperties +// .containsKey("javax.xml.parsers.DocumentBuilderFactory")) +// System.setProperty("javax.xml.parsers.DocumentBuilderFactory", +// "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"); +// if (!systemProperties.containsKey("javax.xml.parsers.SAXParserFactory")) +// System.setProperty("javax.xml.parsers.SAXParserFactory", +// "org.apache.xerces.jaxp.SAXParserFactoryImpl"); + if (!systemProperties + .containsKey("javax.xml.transform.TransformerFactory")) + System.setProperty("javax.xml.transform.TransformerFactory", + "org.apache.xalan.processor.TransformerFactoryImpl"); + } + private final static String PROPERTY_CACHE_SERVICES = "slc.osgi.execution.cacheServices"; private final static Log log = LogFactory