Author: heiko.braun(a)jboss.com
Date: 2008-02-26 05:46:38 -0500 (Tue, 26 Feb 2008)
New Revision: 5806
Modified:
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
Log:
JAXBIntros: Pick resources through VFS instead of classloader
Modified:
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java 2008-02-26
10:29:53 UTC (rev 5805)
+++
stack/native/trunk/src/main/java/org/jboss/wsf/stack/jbws/JAXBIntroDeploymentAspect.java 2008-02-26
10:46:38 UTC (rev 5806)
@@ -28,9 +28,7 @@
import org.jboss.logging.Logger;
import org.jboss.ws.core.jaxws.JAXBBindingCustomization;
import org.jboss.wsf.spi.binding.BindingCustomization;
-import org.jboss.wsf.spi.deployment.Deployment;
-import org.jboss.wsf.spi.deployment.DeploymentAspect;
-import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.deployment.*;
import java.io.IOException;
import java.io.InputStream;
@@ -42,30 +40,46 @@
public class JAXBIntroDeploymentAspect extends DeploymentAspect
{
private static Logger logger = Logger.getLogger(JAXBIntroDeploymentAspect.class);
+ private static final String META_INF_JAXB_INTROS_XML =
"META-INF/jaxb-intros.xml";
+ private static final String WEB_INF_JAXB_INTROS_XML =
"WEB-INF/jaxb-intros.xml";
public void create(Deployment deployment)
{
+ // assert ArchiveDeployment
+ if(! (deployment instanceof ArchiveDeployment) )
+ {
+ log.debug("JAXBIntroDeploymentAspect doesn't work on " +
deployment.getClass());
+ return;
+ }
+
+ ArchiveDeployment archive = (ArchiveDeployment)deployment;
InputStream introsConfigStream = null;
- try { // META-INF first
- ClassLoader classLoader = deployment.getRuntimeClassLoader();
- introsConfigStream =
classLoader.getResource("META-INF/jaxb-intros.xml").openStream();
+ try
+ {
+ // META-INF first
+ UnifiedVirtualFile vfs =
archive.getRootFile().findChild(META_INF_JAXB_INTROS_XML);
+ introsConfigStream = vfs.toURL().openStream();
} catch (Exception e) {}
if(null == introsConfigStream)
{
- try { // WEB-INF second
-
- ClassLoader classLoader = deployment.getRuntimeClassLoader();
- introsConfigStream =
classLoader.getResource("WEB-INF/jaxb-intros.xml").openStream();
+ try
+ {
+ // WEB-INF second
+ UnifiedVirtualFile vfs =
archive.getRootFile().findChild(WEB_INF_JAXB_INTROS_XML);
+ introsConfigStream = vfs.toURL().openStream();
} catch (Exception e) {
return;
}
}
- try {
- if(introsConfigStream != null) {
+ try
+ {
+
+ if(introsConfigStream != null)
+ {
JaxbIntros jaxbIntros =
IntroductionsConfigParser.parseConfig(introsConfigStream);
IntroductionsAnnotationReader annotationReader = new
IntroductionsAnnotationReader(jaxbIntros);
String defaultNamespace = jaxbIntros.getDefaultNamespace();
@@ -83,8 +97,12 @@
}
}
- } finally {
- if(introsConfigStream != null) {
+
+ }
+ finally
+ {
+ if(introsConfigStream != null)
+ {
try {
introsConfigStream.close();
} catch (IOException e) {
Show replies by date