Modified: openejb/trunk/openejb/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/FeatureTest.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/FeatureTest.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/FeatureTest.java (original) +++ openejb/trunk/openejb/server/openejb-cxf-rs/src/test/java/org/apache/openejb/server/cxf/rs/FeatureTest.java Thu Aug 23 15:58:44 2012 @@ -9,6 +9,8 @@ import org.apache.openejb.config.sys.Res import org.apache.openejb.config.sys.Service; import org.apache.openejb.jee.EjbJar; import org.apache.openejb.jee.StatelessBean; +import org.apache.openejb.jee.oejb3.EjbDeployment; +import org.apache.openejb.jee.oejb3.OpenejbJar; import org.apache.openejb.junit.ApplicationComposer; import org.apache.openejb.junit.Configuration; import org.apache.openejb.junit.Module; @@ -38,13 +40,15 @@ public class FeatureTest { final EjbJar ejbJar = new EjbJar(); ejbJar.addEnterpriseBean(bean); + final OpenejbJar openejbJar = new OpenejbJar(); + openejbJar.addEjbDeployment(new EjbDeployment(ejbJar.getEnterpriseBeans()[0])); + final Properties properties = openejbJar.getEjbDeployment().iterator().next().getProperties(); + properties.setProperty(CxfRsHttpListener.CXF_JAXRS_PREFIX + CxfUtil.FEATURES, "my-feature"); + final EjbModule module = new EjbModule(ejbJar); - final Resources resources = new Resources(); + module.setOpenejbJar(openejbJar); - final Service beanService = new Service(null); - beanService.setClassName(MySecondRestClass.class.getName()); - beanService.getProperties().setProperty(CxfRsHttpListener.CXF_JAXRS_PREFIX + CxfUtil.FEATURES, "my-feature"); - resources.getService().add(beanService); + final Resources resources = new Resources(); final Service feature = new Service("my-feature", null); feature.setClassName(MyFeature.class.getName());
Copied: openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.app-ctx.xml (from r1376398, openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.resources.xml) URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.app-ctx.xml?p2=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.app-ctx.xml&p1=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.resources.xml&r1=1376398&r2=1376560&rev=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.resources.xml (original) +++ openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom-config.app-ctx.xml Thu Aug 23 15:58:44 2012 @@ -15,11 +15,19 @@ See the License for the specific language governing permissions and limitations under the License. --> -<resources> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderWithConfigTest$CustomizedService"> - cxf.jaxrs.providers = configured - </Service> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderWithConfigTest$ConfigurableProvider" id="configured"> - str = done! - </Service> -</resources> +<AppContext> + <BeanContexts> + <BeanContext id="CustomizedService"> + <Configuration> + <cxf.jaxrs> + providers = configured + </cxf.jaxrs> + </Configuration> + </BeanContext> + </BeanContexts> + <Resources> + <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderWithConfigTest$ConfigurableProvider" id="configured"> + str = done! + </Service> + </Resources> +</AppContext> Copied: openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.app-ctx.xml (from r1376398, openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.resources.xml) URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.app-ctx.xml?p2=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.app-ctx.xml&p1=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.resources.xml&r1=1376398&r2=1376560&rev=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.resources.xml (original) +++ openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/custom.app-ctx.xml Thu Aug 23 15:58:44 2012 @@ -15,14 +15,25 @@ See the License for the specific language governing permissions and limitations under the License. --> -<resources> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$CustomService"> - cxf.jaxrs.providers = reverse - </Service> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$ReverseProvider" id="reverse" /> - - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$CustomSpecificService"> - cxf.jaxrs.providers = constant - </Service> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$ConstantProvider" id="constant" /> -</resources> +<AppContext> + <BeanContexts> + <BeanContext id="CustomSpecificService"> + <Configuration> + <cxf.jaxrs> + providers = constant + </cxf.jaxrs> + </Configuration> + </BeanContext> + <BeanContext id="CustomService"> + <Configuration> + <cxf.jaxrs> + providers = reverse + </cxf.jaxrs> + </Configuration> + </BeanContext> + </BeanContexts> + <Resources> + <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$ConstantProvider" id="constant" /> + <Service class-name="org.apache.openejb.server.cxf.rs.CustomProviderTest$ReverseProvider" id="reverse" /> + </Resources> +</AppContext> Copied: openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.app-ctx.xml (from r1376398, openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.resources.xml) URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.app-ctx.xml?p2=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.app-ctx.xml&p1=openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.resources.xml&r1=1376398&r2=1376560&rev=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.resources.xml (original) +++ openejb/trunk/openejb/server/openejb-cxf-rs/src/test/resources/META-INF/em.app-ctx.xml Thu Aug 23 15:58:44 2012 @@ -15,9 +15,18 @@ See the License for the specific language governing permissions and limitations under the License. --> -<resources> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomExceptionMapperTest$RestWithExceptionMapper"> - cxf.jaxrs.providers = em - </Service> - <Service class-name="org.apache.openejb.server.cxf.rs.CustomExceptionMapperTest$EM" id="em" /> -</resources> +<AppContext> + <BeanContexts> + <BeanContext id="RestWithExceptionMapper"> + <Configuration> + <cxf.jaxrs> + providers = em + </cxf.jaxrs> + </Configuration> + </BeanContext> + </BeanContexts> + <Resources> + <Service class-name="org.apache.openejb.server.cxf.rs.CustomExceptionMapperTest$EM" id="em" /> + </Resources> +</AppContext> + Modified: openejb/trunk/openejb/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java (original) +++ openejb/trunk/openejb/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java Thu Aug 23 15:58:44 2012 @@ -29,6 +29,7 @@ import org.apache.cxf.message.Message; import org.apache.openejb.OpenEJBRuntimeException; import org.apache.openejb.assembler.classic.OpenEjbConfiguration; import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.assembler.classic.util.ServiceInfos; import org.apache.openejb.loader.SystemInstance; import org.apache.openejb.util.PropertiesHelper; @@ -47,7 +48,8 @@ public final class CxfUtil { public static final String DATABINDING = "databinding"; public static final String ADDRESS = "address"; public static final String DEBUG = "debug"; - public static final String BUS_PREFIX = "bus-"; + public static final String BUS_PREFIX = "org.apache.openejb.cxf.bus."; + public static final String BUS_CONFIGURED_FLAG = "openejb.cxf.bus.configured"; private CxfUtil() { // no-op @@ -77,45 +79,47 @@ public final class CxfUtil { } } - public static void configureEndpoint(final AbstractEndpointFactory svrFactory, final Collection<ServiceInfo> availableServices, final String prefix, final String beanId) { - final ServiceInfo beanInfo = ServiceInfos.findByClass(availableServices, beanId); - if (beanInfo != null) { - final Properties beanConfig = beanInfo.properties; - - // endpoint properties - final Properties properties = ServiceInfos.serviceProperties(availableServices, beanConfig.getProperty(prefix + ENDPOINT_PROPERTIES)); - if (properties != null) { - svrFactory.setProperties(PropertiesHelper.map(properties)); - } - if (SystemInstance.get().getOptions().get(prefix + DEBUG, false)) { - svrFactory.getProperties(true).put("faultStackTraceEnabled", "true"); - } + public static void configureEndpoint(final AbstractEndpointFactory svrFactory, final ServiceConfiguration configuration, final String prefix, final String beanId) { + final Properties beanConfig = configuration.getProperties(); + if (beanConfig == null || beanConfig.isEmpty()) { + return; + } - // endpoint features - final String featuresIds = beanConfig.getProperty(prefix + FEATURES); - if (featuresIds != null) { - final List<?> features = createFeatures(availableServices, featuresIds); - svrFactory.setFeatures((List<AbstractFeature>) features); - } + final Collection<ServiceInfo> availableServices = configuration.getAvailableServices(); - configureInterceptors(svrFactory, prefix, availableServices, beanConfig); + // endpoint properties + final Properties properties = ServiceInfos.serviceProperties(availableServices, beanConfig.getProperty(prefix + ENDPOINT_PROPERTIES)); + if (properties != null) { + svrFactory.setProperties(PropertiesHelper.map(properties)); + } + if (SystemInstance.get().getOptions().get(prefix + DEBUG, false)) { + svrFactory.getProperties(true).put("faultStackTraceEnabled", "true"); + } - // databinding - final String databinding = beanConfig.getProperty(prefix + DATABINDING); - if (databinding != null && !databinding.trim().isEmpty()) { - final Object instance = ServiceInfos.resolve(availableServices, databinding); - if (!DataBinding.class.isInstance(instance)) { - throw new OpenEJBRuntimeException(instance + " is not a " + DataBinding.class.getName() - + ", please check configuration of service [id=" + databinding + "]"); - } - svrFactory.setDataBinding((DataBinding) instance); - } + // endpoint features + final String featuresIds = beanConfig.getProperty(prefix + FEATURES); + if (featuresIds != null) { + final List<?> features = createFeatures(availableServices, featuresIds); + svrFactory.setFeatures((List<AbstractFeature>) features); + } + + configureInterceptors(svrFactory, prefix, availableServices, beanConfig); - // address: easier than using openejb-jar.xml - final String changedAddress = beanConfig.getProperty(prefix + ADDRESS); - if (changedAddress != null && !changedAddress.trim().isEmpty()) { - svrFactory.setAddress(changedAddress); + // databinding + final String databinding = beanConfig.getProperty(prefix + DATABINDING); + if (databinding != null && !databinding.trim().isEmpty()) { + final Object instance = ServiceInfos.resolve(availableServices, databinding); + if (!DataBinding.class.isInstance(instance)) { + throw new OpenEJBRuntimeException(instance + " is not a " + DataBinding.class.getName() + + ", please check configuration of service [id=" + databinding + "]"); } + svrFactory.setDataBinding((DataBinding) instance); + } + + // address: easier than using openejb-jar.xml + final String changedAddress = beanConfig.getProperty(prefix + ADDRESS); + if (changedAddress != null && !changedAddress.trim().isEmpty()) { + svrFactory.setAddress(changedAddress); } } @@ -162,31 +166,40 @@ public final class CxfUtil { return (List<Interceptor<? extends Message>>) instances; } - public static void configureBus(final String name) { + public static void configureBus() { + if (SystemInstance.get().getProperties().containsKey(BUS_CONFIGURED_FLAG)) { // jaxws and jaxrs for instance + return; + } + final Bus bus = getDefaultBus(); if (bus instanceof CXFBusImpl) { + final ServiceConfiguration configuration = new ServiceConfiguration(SystemInstance.get().getProperties(), + SystemInstance.get().getComponent(OpenEjbConfiguration.class).facilities.services); + final CXFBusImpl busImpl = (CXFBusImpl) bus; - final List<ServiceInfo> serviceInfos = SystemInstance.get() - .getComponent(OpenEjbConfiguration.class).facilities.services; - for (ServiceInfo service : serviceInfos) { - if (service.id.equals(BUS_PREFIX + name)) { - final String featuresIds = service.properties.getProperty(FEATURES); - if (featuresIds != null) { - final List<AbstractFeature> features = createFeatures(serviceInfos, featuresIds); - if (features != null) { - features.addAll(busImpl.getFeatures()); - busImpl.setFeatures(features); - } - } - - final Properties properties = ServiceInfos.serviceProperties(serviceInfos, service.properties.getProperty(ENDPOINT_PROPERTIES)); - if (properties != null) { - busImpl.getProperties().putAll(PropertiesHelper.map(properties)); - } + final Collection<ServiceInfo> serviceInfos = configuration.getAvailableServices(); + final Properties properties = configuration.getProperties(); + if (properties == null || properties.isEmpty()) { + return; + } - configureInterceptors(busImpl, "", serviceInfos, service.properties); + final String featuresIds = properties.getProperty(BUS_PREFIX + FEATURES); + if (featuresIds != null) { + final List<AbstractFeature> features = createFeatures(serviceInfos, featuresIds); + if (features != null) { + features.addAll(busImpl.getFeatures()); + busImpl.setFeatures(features); } } + + final Properties busProperties = ServiceInfos.serviceProperties(serviceInfos, properties.getProperty(BUS_PREFIX + ENDPOINT_PROPERTIES)); + if (busProperties != null) { + busImpl.getProperties().putAll(PropertiesHelper.map(busProperties)); + } + + configureInterceptors(busImpl, BUS_PREFIX, serviceInfos, configuration.getProperties()); + + SystemInstance.get().getProperties().setProperty(BUS_CONFIGURED_FLAG, "true"); } } } Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfEndpoint.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfEndpoint.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfEndpoint.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfEndpoint.java Thu Aug 23 15:58:44 2012 @@ -18,26 +18,19 @@ package org.apache.openejb.server.cxf; import org.apache.cxf.Bus; -import org.apache.cxf.databinding.DataBinding; import org.apache.cxf.endpoint.Server; import org.apache.cxf.endpoint.ServerImpl; -import org.apache.cxf.feature.AbstractFeature; -import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.jaxws.JaxWsServerFactoryBean; import org.apache.cxf.jaxws.handler.PortInfoImpl; import org.apache.cxf.jaxws.support.JaxWsEndpointImpl; import org.apache.cxf.jaxws.support.JaxWsImplementorInfo; import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean; -import org.apache.cxf.message.Message; import org.apache.cxf.service.Service; import org.apache.cxf.transport.http.HTTPTransportFactory; -import org.apache.openejb.OpenEJBRuntimeException; -import org.apache.openejb.assembler.classic.ServiceInfo; -import org.apache.openejb.assembler.classic.util.ServiceInfos; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.HandlerResolverImpl; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.transport.util.CxfUtil; -import org.apache.openejb.util.PropertiesHelper; import javax.naming.Context; import javax.xml.transform.Source; @@ -45,10 +38,8 @@ import javax.xml.ws.Binding; import javax.xml.ws.handler.Handler; import javax.xml.ws.http.HTTPBinding; import javax.xml.ws.soap.SOAPBinding; -import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.concurrent.Executor; public abstract class CxfEndpoint { @@ -73,16 +64,17 @@ public abstract class CxfEndpoint { protected HTTPTransportFactory httpTransportFactory; - protected Collection<ServiceInfo> availableServices; + protected ServiceConfiguration serviceConfiguration; public CxfEndpoint(Bus bus, PortData port, Context context, - Object implementor, HTTPTransportFactory httpTransportFactory, Collection<ServiceInfo> services) { + Object implementor, HTTPTransportFactory httpTransportFactory, + ServiceConfiguration configuration) { this.bus = bus; this.port = port; this.context = context; this.implementor = implementor; this.httpTransportFactory = httpTransportFactory; - this.availableServices = services; + this.serviceConfiguration = configuration; this.bus.setExtension(this, CxfEndpoint.class); } @@ -165,7 +157,7 @@ public abstract class CxfEndpoint { svrFactory.setDestinationFactory(httpTransportFactory); // look for bean info if exists - CxfUtil.configureEndpoint(svrFactory, availableServices, CXF_JAXWS_PREFIX, getImplementorClass().getName()); + CxfUtil.configureEndpoint(svrFactory, serviceConfiguration, CXF_JAXWS_PREFIX, getImplementorClass().getName()); if (HTTPBinding.HTTP_BINDING.equals(implInfo.getBindingType())) { svrFactory.setTransportId("http://cxf.apache.org/bindings/xformat"); Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfService.java Thu Aug 23 15:58:44 2012 @@ -19,7 +19,7 @@ package org.apache.openejb.server.cxf; import org.apache.cxf.Bus; import org.apache.openejb.BeanContext; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.client.SaajInterceptor; import org.apache.openejb.server.cxf.ejb.EjbWsContainer; @@ -30,7 +30,6 @@ import org.apache.openejb.server.webserv import javax.naming.Context; import java.net.URL; -import java.util.Collection; import java.util.Map; import java.util.Properties; import java.util.TreeMap; @@ -50,15 +49,15 @@ public class CxfService extends WsServic public void init(final Properties props) throws java.lang.Exception { super.init(props); - CxfUtil.configureBus(getName()); + CxfUtil.configureBus(); } - protected HttpListener createEjbWsContainer(URL moduleBaseUrl, PortData port, BeanContext beanContext, Collection<ServiceInfo> services) { + protected HttpListener createEjbWsContainer(URL moduleBaseUrl, PortData port, BeanContext beanContext, ServiceConfiguration config) { Bus bus = CxfUtil.getBus(); CxfCatalogUtils.loadOASISCatalog(bus, moduleBaseUrl, "META-INF/jax-ws-catalog.xml"); - EjbWsContainer container = new EjbWsContainer(bus, port, beanContext, services); + EjbWsContainer container = new EjbWsContainer(bus, port, beanContext, config); container.start(); wsContainers.put(beanContext.getDeploymentID().toString(), container); return container; @@ -71,7 +70,7 @@ public class CxfService extends WsServic } } - protected HttpListener createPojoWsContainer(URL moduleBaseUrl, PortData port, String serviceId, Class target, Context context, String contextRoot, Map<String, Object> bdgs, Collection<ServiceInfo> services) { + protected HttpListener createPojoWsContainer(URL moduleBaseUrl, PortData port, String serviceId, Class target, Context context, String contextRoot, Map<String, Object> bdgs, ServiceConfiguration services) { Bus bus = CxfUtil.getBus(); CxfCatalogUtils.loadOASISCatalog(bus, moduleBaseUrl, "META-INF/jax-ws-catalog.xml"); Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfWsContainer.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfWsContainer.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfWsContainer.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/CxfWsContainer.java Thu Aug 23 15:58:44 2012 @@ -18,11 +18,9 @@ package org.apache.openejb.server.cxf; import org.apache.cxf.Bus; -import org.apache.cxf.BusFactory; -import org.apache.cxf.bus.extension.ExtensionManagerBus; import org.apache.cxf.transport.http.AbstractHTTPDestination; import org.apache.cxf.transport.http.HTTPTransportFactory; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.transport.HttpTransportFactory; import org.apache.openejb.server.httpd.HttpListener; @@ -30,7 +28,6 @@ import org.apache.openejb.server.httpd.H import org.apache.openejb.server.httpd.HttpResponse; import java.util.ArrayList; -import java.util.Collection; import java.util.List; public abstract class CxfWsContainer implements HttpListener { @@ -38,13 +35,13 @@ public abstract class CxfWsContainer imp protected final PortData port; protected AbstractHTTPDestination destination; protected CxfEndpoint endpoint; - protected HTTPTransportFactory httpTransportFactory; - protected final Collection<ServiceInfo> availableServices; + protected final HTTPTransportFactory httpTransportFactory; + protected final ServiceConfiguration serviceConfiguration; - public CxfWsContainer(Bus bus, PortData port, Collection<ServiceInfo> services) { + public CxfWsContainer(final Bus bus, final PortData port, final ServiceConfiguration config) { this.bus = bus; this.port = port; - this.availableServices = services; + this.serviceConfiguration = config; List<String> ids = new ArrayList<String>(); ids.add("http://schemas.xmlsoap.org/wsdl/soap/"); Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbEndpoint.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbEndpoint.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbEndpoint.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbEndpoint.java Thu Aug 23 15:58:44 2012 @@ -28,7 +28,7 @@ import org.apache.cxf.jaxws.handler.soap import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean; import org.apache.cxf.transport.http.HTTPTransportFactory; import org.apache.openejb.BeanContext; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.JaxWsUtils; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.ConfigureCxfSecurity; @@ -37,7 +37,6 @@ import org.apache.openejb.server.cxf.Cxf import org.apache.openejb.server.cxf.JaxWsImplementorInfoImpl; import javax.xml.ws.WebServiceException; -import java.util.Collection; import java.util.List; /** @@ -46,8 +45,8 @@ import java.util.List; public class EjbEndpoint extends CxfEndpoint { private final BeanContext beanContext; - public EjbEndpoint(Bus bus, PortData portData, BeanContext beanContext, HTTPTransportFactory httpTransportFactory, Collection<ServiceInfo> services) { - super(bus, portData, beanContext.getJndiEnc(), beanContext.getBeanClass(), httpTransportFactory, services); + public EjbEndpoint(Bus bus, PortData portData, BeanContext beanContext, HTTPTransportFactory httpTransportFactory, ServiceConfiguration config) { + super(bus, portData, beanContext.getJndiEnc(), beanContext.getBeanClass(), httpTransportFactory, config); this.beanContext = beanContext; String bindingURI = JaxWsUtils.getBindingURI(portData.getBindingID()); Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbWsContainer.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbWsContainer.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbWsContainer.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/ejb/EjbWsContainer.java Thu Aug 23 15:58:44 2012 @@ -19,22 +19,20 @@ package org.apache.openejb.server.cxf.ej import org.apache.cxf.Bus; import org.apache.openejb.BeanContext; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.CxfWsContainer; -import java.util.Collection; - public class EjbWsContainer extends CxfWsContainer { private final BeanContext beanContext; - public EjbWsContainer(Bus bus, PortData port, BeanContext beanContext, Collection<ServiceInfo> services) { - super(bus, port, services); + public EjbWsContainer(Bus bus, PortData port, BeanContext beanContext, ServiceConfiguration config) { + super(bus, port, config); if (beanContext == null) throw new NullPointerException("deploymentInfo is null"); this.beanContext = beanContext; } protected EjbEndpoint createEndpoint() { - return new EjbEndpoint(bus, port, beanContext, httpTransportFactory, availableServices); + return new EjbEndpoint(bus, port, beanContext, httpTransportFactory, serviceConfiguration); } } Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoEndpoint.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoEndpoint.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoEndpoint.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoEndpoint.java Thu Aug 23 15:58:44 2012 @@ -27,7 +27,7 @@ import org.apache.cxf.resource.ResourceM import org.apache.cxf.resource.ResourceResolver; import org.apache.cxf.transport.http.HTTPTransportFactory; import org.apache.openejb.InjectionProcessor; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.JaxWsUtils; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.CxfEndpoint; @@ -36,7 +36,6 @@ import org.apache.openejb.server.cxf.Jax import javax.naming.Context; import javax.xml.ws.WebServiceException; -import java.util.Collection; import java.util.List; import java.util.Map; @@ -45,8 +44,10 @@ import static org.apache.openejb.Injecti public class PojoEndpoint extends CxfEndpoint { private InjectionProcessor<Object> injectionProcessor; - public PojoEndpoint(Bus bus, PortData port, Context context, Class<?> instance, HTTPTransportFactory httpTransportFactory, Map<String, Object> bindings, Collection<ServiceInfo> services) { - super(bus, port, context, instance, httpTransportFactory, services); + public PojoEndpoint(Bus bus, PortData port, Context context, Class<?> instance, + HTTPTransportFactory httpTransportFactory, + Map<String, Object> bindings, ServiceConfiguration config) { + super(bus, port, context, instance, httpTransportFactory, config); String bindingURI = null; if (port.getBindingID() != null) { Modified: openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoWsContainer.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoWsContainer.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoWsContainer.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/main/java/org/apache/openejb/server/cxf/pojo/PojoWsContainer.java Thu Aug 23 15:58:44 2012 @@ -18,12 +18,11 @@ package org.apache.openejb.server.cxf.pojo; import org.apache.cxf.Bus; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.webservices.PortData; import org.apache.openejb.server.cxf.CxfWsContainer; import javax.naming.Context; -import java.util.Collection; import java.util.Map; public class PojoWsContainer extends CxfWsContainer { @@ -31,9 +30,9 @@ public class PojoWsContainer extends Cxf private final Class target; private final Map<String, Object> bindings; - - public PojoWsContainer(Bus bus, PortData port, Context context, Class target, Map<String, Object> bdgs, Collection<ServiceInfo> services) { - super(bus, port, services); + public PojoWsContainer(Bus bus, PortData port, Context context, Class target, + Map<String, Object> bdgs, ServiceConfiguration configuration) { + super(bus, port, configuration); if (target == null) throw new NullPointerException("target is null"); this.context = context; this.target = target; @@ -41,6 +40,6 @@ public class PojoWsContainer extends Cxf } protected PojoEndpoint createEndpoint() { - return new PojoEndpoint(bus, port, context, target, httpTransportFactory, bindings, availableServices); + return new PojoEndpoint(bus, port, context, target, httpTransportFactory, bindings, serviceConfiguration); } } Modified: openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/FeatureTest.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/FeatureTest.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/FeatureTest.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/FeatureTest.java Thu Aug 23 15:58:44 2012 @@ -40,8 +40,10 @@ public class FeatureTest { final OpenejbJar openejbJar = new OpenejbJar(); openejbJar.addEjbDeployment(new EjbDeployment(jar.getEnterpriseBeans()[0])); - openejbJar.getEjbDeployment().iterator().next().getProperties() - .setProperty(CxfService.OPENEJB_JAXWS_CXF_FEATURES, MyFeature.class.getName()); + final Properties properties = openejbJar.getEjbDeployment().iterator().next().getProperties(); + properties.setProperty(CxfService.OPENEJB_JAXWS_CXF_FEATURES, MyFeature.class.getName()); + properties.setProperty("cxf.jaxws.features", "my-feature"); + properties.setProperty("cxf.jaxws.properties", "my-props"); final EjbModule module = new EjbModule(jar); module.setOpenejbJar(openejbJar); @@ -52,16 +54,10 @@ public class FeatureTest { service.setClassName(MyFeature.class.getName()); resources.add(service); - final Service properties = new Service("my-props", null, null, null); - properties.setClassName(Properties.class.getName()); - properties.getProperties().setProperty("faultStackTraceEnabled", "true"); - resources.add(properties); - - final Service beanService = new Service("bean-config", null, null, null); - beanService.setClassName(AuthenticatorServiceBean.class.getName()); - beanService.getProperties().setProperty("cxf.jaxws.features", "my-feature"); - beanService.getProperties().setProperty("cxf.jaxws.properties", "my-props"); - resources.add(beanService); + final Service myProps = new Service("my-props", null, null, null); + myProps.setClassName(Properties.class.getName()); + myProps.getProperties().setProperty("faultStackTraceEnabled", "true"); + resources.add(myProps); module.initResources(resources); Modified: openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/GlobalFeatureConfigTest.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/GlobalFeatureConfigTest.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/GlobalFeatureConfigTest.java (original) +++ openejb/trunk/openejb/server/openejb-cxf/src/test/java/org/apache/openejb/server/cxf/GlobalFeatureConfigTest.java Thu Aug 23 15:58:44 2012 @@ -42,9 +42,7 @@ public class GlobalFeatureConfigTest { return new Properties() {{ setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - setProperty("bus-cxf", "new://Service?class-name=java.util.Properties"); - setProperty("bus-cxf.features", "logging"); - + setProperty(CxfUtil.BUS_PREFIX + CxfUtil.FEATURES, "logging"); setProperty("logging", "new://Service?class-name=" + LoggingFeature.class.getName()); }}; } Modified: openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java (original) +++ openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RESTService.java Thu Aug 23 15:58:44 2012 @@ -28,6 +28,7 @@ import org.apache.openejb.assembler.clas import org.apache.openejb.assembler.classic.WebAppInfo; import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreated; import org.apache.openejb.assembler.classic.event.AssemblerBeforeApplicationDestroyed; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.CoreContainerSystem; import org.apache.openejb.core.WebContext; import org.apache.openejb.loader.SystemInstance; @@ -40,6 +41,7 @@ import org.apache.openejb.server.httpd.H import org.apache.openejb.spi.ContainerSystem; import org.apache.openejb.util.LogCategory; import org.apache.openejb.util.Logger; +import org.apache.openejb.util.PojoUtil; import org.apache.webbeans.config.WebBeansContext; import javax.naming.Context; @@ -158,19 +160,21 @@ public abstract class RESTService implem continue; } - if (hasEjbAndIsNotAManagedBean(restEjbs, o.getClass())) { + if (hasEjbAndIsNotAManagedBean(restEjbs, o.getClass().getName())) { // no more a singleton if the ejb is not a singleton...but it is a weird case deployEJB(appPrefix, restEjbs.get(o.getClass().getName()).context, additionalProviders, appInfo.services); } else { - deploySingleton(appPrefix, o, appInstance, classLoader, additionalProviders, appInfo.services); + deploySingleton(appPrefix, o, appInstance, classLoader, additionalProviders, + new ServiceConfiguration(PojoUtil.findConfiguration(appInfo.pojoConfigurations, o.getClass().getName()), appInfo.services)); } } Set<Class<?>> classes = appInstance.getClasses(); for (Class<?> clazz : classes) { - if (hasEjbAndIsNotAManagedBean(restEjbs, clazz)) { + if (hasEjbAndIsNotAManagedBean(restEjbs, clazz.getName())) { deployEJB(appPrefix, restEjbs.get(clazz.getName()).context, additionalProviders, appInfo.services); } else { - deployPojo(appPrefix, clazz, appInstance, classLoader, injections, context, owbCtx, additionalProviders, appInfo.services); + deployPojo(appPrefix, clazz, appInstance, classLoader, injections, context, owbCtx, additionalProviders, + new ServiceConfiguration(PojoUtil.findConfiguration(appInfo.pojoConfigurations, clazz.getName()), appInfo.services)); } } @@ -185,15 +189,18 @@ public abstract class RESTService implem for (String clazz : restClasses) { if (restEjbs.containsKey(clazz)) { final BeanContext ctx = restEjbs.get(clazz).context; - if (BeanType.MANAGED.equals(ctx.getComponentType())) { - deployPojo(appPrefix, ctx.getBeanClass(), null, ctx.getClassLoader(), ctx.getInjections(), context, owbCtx, additionalProviders, appInfo.services); - } else { + if (hasEjbAndIsNotAManagedBean(restEjbs, clazz)) { deployEJB(appPrefix, restEjbs.get(clazz).context, additionalProviders, appInfo.services); + } else { + deployPojo(appPrefix, ctx.getBeanClass(), null, ctx.getClassLoader(), ctx.getInjections(), context, + owbCtx, additionalProviders, new ServiceConfiguration(ctx.getProperties(), appInfo.services)); } } else { try { Class<?> loadedClazz = classLoader.loadClass(clazz); - deployPojo(appPrefix, loadedClazz, null, classLoader, injections, context, owbCtx, additionalProviders, appInfo.services); + deployPojo(appPrefix, loadedClazz, null, classLoader, injections, context, owbCtx, + additionalProviders, + new ServiceConfiguration(PojoUtil.findConfiguration(appInfo.pojoConfigurations, loadedClazz.getName()), appInfo.services)); } catch (ClassNotFoundException e) { throw new OpenEJBRestRuntimeException("can't find class " + clazz, e); } @@ -204,8 +211,12 @@ public abstract class RESTService implem restEjbs.clear(); } - private boolean hasEjbAndIsNotAManagedBean(final Map<String, EJBRestServiceInfo> restEjbs, final Class<?> clazz) { - return restEjbs.containsKey(clazz.getName()) && !BeanType.MANAGED.equals(restEjbs.get(clazz.getName()).context.getComponentType()); + private static boolean isManagedBean(final BeanContext ctx) { + return BeanType.MANAGED.equals(ctx.getComponentType()); + } + + private boolean hasEjbAndIsNotAManagedBean(final Map<String, EJBRestServiceInfo> restEjbs, final String clazz) { + return restEjbs.containsKey(clazz) && !BeanType.MANAGED.equals(restEjbs.get(clazz).context.getComponentType()); } private boolean useDiscoveredProviders() { @@ -242,7 +253,7 @@ public abstract class RESTService implem deployPojo(ejb.getValue().path, ctx.getBeanClass(), null, ctx.getClassLoader(), ctx.getInjections(), ctx.getJndiContext(), containerSystem.getAppContext(appInfo.appId).getWebBeansContext(), - providers, appInfo.services); + providers, new ServiceConfiguration(ctx.getProperties(), appInfo.services)); } else { deployEJB(ejb.getValue().path, ctx, providers, appInfo.services); } @@ -298,19 +309,19 @@ public abstract class RESTService implem } private void deploySingleton(String contextRoot, Object o, Application appInstance, ClassLoader classLoader, - Collection<Class<?>> additionalProviders, Collection<ServiceInfo> serviceInfos) { + Collection<Class<?>> additionalProviders, ServiceConfiguration configuration) { final String nopath = getAddress(contextRoot, o.getClass()); final RsHttpListener listener = createHttpListener(); final RsRegistry.AddressInfo address = rsRegistry.createRsHttpListener(contextRoot, listener, classLoader, nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost); services.add(new DeployedService(address.complete, contextRoot, o.getClass().getName())); - listener.deploySingleton(getFullContext(address.base, contextRoot), o, appInstance, additionalProviders, serviceInfos); + listener.deploySingleton(getFullContext(address.base, contextRoot), o, appInstance, additionalProviders, configuration); LOGGER.info("deployed REST singleton: " + o); } private void deployPojo(String contextRoot, Class<?> loadedClazz, Application app, ClassLoader classLoader, Collection<Injection> injections, - Context context, WebBeansContext owbCtx, Collection<Class<?>> additionalProviders, Collection<ServiceInfo> serviceInfos) { + Context context, WebBeansContext owbCtx, Collection<Class<?>> additionalProviders, ServiceConfiguration config) { if (loadedClazz.isInterface()) { return; } @@ -320,7 +331,8 @@ public abstract class RESTService implem final RsRegistry.AddressInfo address = rsRegistry.createRsHttpListener(contextRoot, listener, classLoader, nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost); services.add(new DeployedService(address.complete, contextRoot, loadedClazz.getName())); - listener.deployPojo(getFullContext(address.base, contextRoot), loadedClazz, app, injections, context, owbCtx, additionalProviders, serviceInfos); + listener.deployPojo(getFullContext(address.base, contextRoot), loadedClazz, app, injections, context, owbCtx, + additionalProviders, config); LOGGER.info("REST Service: " + address.complete + " -> Pojo " + loadedClazz.getName()); } @@ -331,7 +343,8 @@ public abstract class RESTService implem final RsRegistry.AddressInfo address = rsRegistry.createRsHttpListener(context, listener, beanContext.getClassLoader(), nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost); services.add(new DeployedService(address.complete, context, beanContext.getBeanClass().getName())); - listener.deployEJB(getFullContext(address.base, context), beanContext, additionalProviders, serviceInfos); + listener.deployEJB(getFullContext(address.base, context), beanContext, + additionalProviders, new ServiceConfiguration(beanContext.getProperties(), serviceInfos)); LOGGER.info("REST Service: " + address.complete + " -> EJB " + beanContext.getEjbName()); } Modified: openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RsHttpListener.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RsHttpListener.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RsHttpListener.java (original) +++ openejb/trunk/openejb/server/openejb-rest/src/main/java/org/apache/openejb/server/rest/RsHttpListener.java Thu Aug 23 15:58:44 2012 @@ -17,23 +17,24 @@ package org.apache.openejb.server.rest; -import java.util.Collection; -import javax.naming.Context; -import javax.ws.rs.core.Application; import org.apache.openejb.BeanContext; import org.apache.openejb.Injection; -import org.apache.openejb.assembler.classic.ServiceInfo; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.server.httpd.HttpListener; import org.apache.webbeans.config.WebBeansContext; +import javax.naming.Context; +import javax.ws.rs.core.Application; +import java.util.Collection; + public interface RsHttpListener extends HttpListener { void deploySingleton(String fullContext, Object o, Application appInstance, - Collection<Class<?>> additionalProviders, Collection<ServiceInfo> serviceInfos); + Collection<Class<?>> additionalProviders, ServiceConfiguration serviceInfos); void deployPojo(String fullContext, Class<?> loadedClazz, Application app, Collection<Injection> injections, - Context context, WebBeansContext owbCtx, Collection<Class<?>> additionalProviders, Collection<ServiceInfo> serviceInfos); + Context context, WebBeansContext owbCtx, Collection<Class<?>> additionalProviders, ServiceConfiguration serviceInfos); - void deployEJB(String fullContext, BeanContext beanContext, Collection<Class<?>> additionalProviders, Collection<ServiceInfo> serviceInfos); + void deployEJB(String fullContext, BeanContext beanContext, Collection<Class<?>> additionalProviders, ServiceConfiguration serviceInfos); void undeploy(); } Modified: openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java?rev=1376560&r1=1376559&r2=1376560&view=diff ============================================================================== --- openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java (original) +++ openejb/trunk/openejb/server/openejb-webservices/src/main/java/org/apache/openejb/server/webservices/WsService.java Thu Aug 23 15:58:44 2012 @@ -24,7 +24,6 @@ import org.apache.openejb.assembler.clas import org.apache.openejb.assembler.classic.EjbJarInfo; import org.apache.openejb.assembler.classic.EnterpriseBeanInfo; import org.apache.openejb.assembler.classic.PortInfo; -import org.apache.openejb.assembler.classic.ServiceInfo; import org.apache.openejb.assembler.classic.ServletInfo; import org.apache.openejb.assembler.classic.SingletonBeanInfo; import org.apache.openejb.assembler.classic.StatelessBeanInfo; @@ -32,6 +31,7 @@ import org.apache.openejb.assembler.clas import org.apache.openejb.assembler.classic.WsBuilder; import org.apache.openejb.assembler.classic.event.AssemblerAfterApplicationCreated; import org.apache.openejb.assembler.classic.event.AssemblerBeforeApplicationDestroyed; +import org.apache.openejb.assembler.classic.util.ServiceConfiguration; import org.apache.openejb.core.CoreContainerSystem; import org.apache.openejb.core.WebContext; import org.apache.openejb.core.webservices.PortAddressRegistry; @@ -48,6 +48,7 @@ import org.apache.openejb.server.httpd.u import org.apache.openejb.spi.ContainerSystem; import org.apache.openejb.util.LogCategory; import org.apache.openejb.util.Logger; +import org.apache.openejb.util.PojoUtil; import org.apache.openejb.util.StringTemplate; import javax.naming.Context; @@ -193,11 +194,11 @@ public abstract class WsService implemen } } - protected abstract HttpListener createEjbWsContainer(URL moduleBaseUrl, PortData port, BeanContext beanContext, Collection<ServiceInfo> services) throws Exception; + protected abstract HttpListener createEjbWsContainer(URL moduleBaseUrl, PortData port, BeanContext beanContext, ServiceConfiguration configuration) throws Exception; protected abstract void destroyEjbWsContainer(String deploymentId); - protected abstract HttpListener createPojoWsContainer(URL moduleBaseUrl, PortData port, String serviceId, Class target, Context context, String contextRoot, Map<String, Object> bindings, Collection<ServiceInfo> services) throws Exception; + protected abstract HttpListener createPojoWsContainer(URL moduleBaseUrl, PortData port, String serviceId, Class target, Context context, String contextRoot, Map<String, Object> bindings, ServiceConfiguration configuration) throws Exception; protected abstract void destroyPojoWsContainer(String serviceId); @@ -248,7 +249,7 @@ public abstract class WsService implemen try { PortData port = WsBuilder.toPortData(portInfo, beanContext.getInjections(), moduleBaseUrl, beanContext.getClassLoader()); - HttpListener container = createEjbWsContainer(moduleBaseUrl, port, beanContext, appInfo.services); + HttpListener container = createEjbWsContainer(moduleBaseUrl, port, beanContext, new ServiceConfiguration(beanContext.getProperties(), appInfo.services)); // generate a location if one was not assigned String location = port.getLocation(); @@ -345,7 +346,9 @@ public abstract class WsService implemen PortData port = WsBuilder.toPortData(portInfo, injections, moduleBaseUrl, classLoader); - HttpListener container = createPojoWsContainer(moduleBaseUrl, port, portInfo.serviceLink, target, context, webApp.contextRoot, bindings, appInfo.services); + HttpListener container = createPojoWsContainer(moduleBaseUrl, port, portInfo.serviceLink, + target, context, webApp.contextRoot, bindings, + new ServiceConfiguration(PojoUtil.findConfiguration(appInfo.pojoConfigurations, target.getName()), appInfo.services)); if (wsRegistry != null) { // give servlet a reference to the webservice container
