Author: alessio.soldano(a)jboss.com
Date: 2013-01-09 07:37:30 -0500 (Wed, 09 Jan 2013)
New Revision: 17226
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
Log:
[JBWS-3396] Few minor improvements and optimizations
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2013-01-09
10:37:23 UTC (rev 17225)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/SpringBusHolder.java 2013-01-09
12:37:30 UTC (rev 17226)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -65,26 +65,19 @@
private boolean configured = false;
protected BusApplicationContext ctx;
-
- protected GenericApplicationContext jbosswsCxfContext;
-
protected List<GenericApplicationContext> additionalCtx = new
LinkedList<GenericApplicationContext>();
+
private ConfiguredBeanLocator delegatingBeanLocator;
+ protected URL jbosswsCxfLocation;
protected URL[] additionalLocations;
-
- protected URL jbosswsCXF;
public SpringBusHolder(URL location, URL jbosswscxf, URL... additionalLocations)
{
super();
createBus(location);
- jbosswsCXF = jbosswscxf;
+ jbosswsCxfLocation = jbosswscxf;
this.additionalLocations = additionalLocations;
- if (jbosswsCxfContext != null &&
jbosswsCxfContext.getBeanNamesForType(JBossWSSpringEndpointImpl.class).length >=1)
- {
- this.additionalLocations = new URL[]{};
- }
}
/**
@@ -139,28 +132,29 @@
}
super.configure(resolver, configurer, wsmd);
- if (jbosswsCXF != null)
+ GenericApplicationContext jbosswsCxfContext = null;
+ //load stuff from provided jbossws-cxf.xml DD
+ if (jbosswsCxfLocation != null)
{
try
{
- jbosswsCxfContext = loadAdditionalConfig(ctx, jbosswsCXF);
+ jbosswsCxfContext = loadAdditionalConfig(ctx, jbosswsCxfLocation);
}
catch (IOException e)
{
- DEPLOYMENT_LOGGER.unableToLoadAdditionalConfigurationFrom(jbosswsCXF, e);
+ throw MESSAGES.unableToLoadConfigurationFrom(jbosswsCxfLocation, e);
}
}
-
- if (jbosswsCxfContext != null
- &&
jbosswsCxfContext.getBeansOfType(JBossWSSpringEndpointImpl.class).isEmpty() &&
additionalLocations != null)
+ //possibly load stuff from additional DD / DD generated from metadata if the
provided jbossws-cxf.xml did not specify endpoints
+ if (additionalLocations != null &&
+ (jbosswsCxfLocation == null ||
jbosswsCxfContext.getBeansOfType(JBossWSSpringEndpointImpl.class).isEmpty()))
{
-
for (URL additionXml : additionalLocations)
{
try
{
- loadAdditionalConfig(jbosswsCxfContext, additionXml);
+ loadAdditionalConfig(jbosswsCxfLocation != null ? jbosswsCxfContext : ctx,
additionXml);
}
catch (IOException e)
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-01-09
10:37:23 UTC (rev 17225)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java 2013-01-09
12:37:30 UTC (rev 17226)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -88,7 +88,6 @@
final ResourceResolver deploymentResolver = aDep.getResourceResolver();
final org.apache.cxf.resource.ResourceResolver resolver = new
JBossWSResourceResolver(deploymentResolver);
Map<String, String> contextParams = (Map<String, String>)
dep.getProperty(WSConstants.STACK_CONTEXT_PARAMS);
- String jbosswsGenXml = contextParams == null ? null :
contextParams.get(BusHolder.PARAM_CXF_GEN_URL);
String jbosswsCxfXml = contextParams == null ? null :
contextParams.get(BusHolder.PARAM_CXF_BEANS_URL);
BusHolder holder = null;
@@ -102,8 +101,8 @@
// Spring available and jbossws-cxf.xml provided
final URL cxfServletUrl =
deploymentResolver.resolveFailSafe("WEB-INF/cxf-servlet.xml"); // TODO: decide
not to support this?
final URL jbosswsCxfUrl = getResourceUrl(deploymentResolver, jbosswsCxfXml);
- final URL genCxfUrl = getResourceUrl(deploymentResolver, jbosswsGenXml);
- holder = new SpringBusHolder(cxfServletUrl, jbosswsCxfUrl, new
URL[]{genCxfUrl});
+ final URL genCxfUrl = getResourceUrl(deploymentResolver,
contextParams.get(BusHolder.PARAM_CXF_GEN_URL));
+ holder = new SpringBusHolder(cxfServletUrl, jbosswsCxfUrl, genCxfUrl);
}
else
{
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2013-01-09
10:37:23 UTC (rev 17225)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/DescriptorDeploymentAspect.java 2013-01-09
12:37:30 UTC (rev 17226)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2013, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -42,8 +42,6 @@
import org.jboss.wsf.stack.cxf.metadata.MetadataBuilder;
import org.jboss.wsf.stack.cxf.metadata.services.DDBeans;
-import com.ibm.wsdl.util.xml.DOMUtils;
-
/**
* A deployer that locates or generates cxf.xml
*
@@ -67,16 +65,12 @@
putCXFConfigToDeployment(dep, BusHolder.PARAM_CXF_BEANS_URL, cxfURL);
}
}
- if (cxfURL == null) //no spring or no jbossws-cxf.xml
+ DDBeans dd = generateMetadataFromDeployment(dep); //metadata attached to
deployment
+ //create additional DD if user provided jbossws-cxf.xml and Spring is available OR
spring descriptor generation is forced
+ if (cxfURL != null || PREFER_SPRING_DESCRIPTOR_GENERATION)
{
- generateMetadataFromDeployment(dep);
- }
- else
- {
- DEPLOYMENT_LOGGER.actualConfFromFile(cxfURL);
- DDBeans dd = generateMetadataFromDeployment(dep);
URL generated = dd.createFileURL();
- DEPLOYMENT_LOGGER.jbwscxfConfGenerated(cxfURL);
+ DEPLOYMENT_LOGGER.jbwscxfConfGenerated(generated);
putCXFConfigToDeployment(dep, BusHolder.PARAM_CXF_GEN_URL, generated);
}
}