Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 56763200C26 for ; Fri, 10 Feb 2017 10:06:23 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 553DB160B5B; Fri, 10 Feb 2017 09:06:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A845C160B5C for ; Fri, 10 Feb 2017 10:06:22 +0100 (CET) Received: (qmail 74658 invoked by uid 500); 10 Feb 2017 09:06:21 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 74539 invoked by uid 99); 10 Feb 2017 09:06:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2017 09:06:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6799CE001C; Fri, 10 Feb 2017 09:06:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: amichai@apache.org To: commits@cxf.apache.org Date: Fri, 10 Feb 2017 09:06:21 -0000 Message-Id: <4f99625e608d423fabf7441c24b38e9f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] cxf-dosgi git commit: [DOSGI-257] Add ability to set bus properties via service properties of the form cxf.bus.prop.= archived-at: Fri, 10 Feb 2017 09:06:23 -0000 Repository: cxf-dosgi Updated Branches: refs/heads/master 628a128b6 -> bec022021 [DOSGI-257] Add ability to set bus properties via service properties of the form cxf.bus.prop.= Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/d785e345 Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/d785e345 Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/d785e345 Branch: refs/heads/master Commit: d785e345d39d91d89e9be57eea8799d4d54d691e Parents: 628a128 Author: Amichai Rothman Authored: Thu Feb 9 16:09:24 2017 +0200 Committer: Amichai Rothman Committed: Fri Feb 10 11:02:25 2017 +0200 ---------------------------------------------------------------------- .../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 21 +++++++++++++++----- .../cxf/dosgi/dsw/handlers/ws/WsProvider.java | 12 ++++++++--- 2 files changed, 25 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/d785e345/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java ---------------------------------------------------------------------- diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java index 5ef58d2..1c5e2f9 100644 --- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java +++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java @@ -138,10 +138,7 @@ public class RsProvider implements DistributionProvider { final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID); Set intentNames = intentManager.getExported(endpointProps); List intents = intentManager.getRequiredIntents(intentNames); - Bus bus = BusFactory.newInstance().createBus(); - if (contextRoot != null) { - httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid); - } + Bus bus = createBus(sid, callingContext, contextRoot, endpointProps); LOG.info("Creating JAXRS endpoint for " + iClass.getName() + " with address " + address); JAXRSServerFactoryBean factory = createServerFactory(callingContext, endpointProps, @@ -154,7 +151,21 @@ public class RsProvider implements DistributionProvider { intentNames); return createServerFromFactory(factory, epd); } - + + protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot, + Map endpointProps) { + Bus bus = BusFactory.newInstance().createBus(); + for (Map.Entry prop : endpointProps.entrySet()) { + if (prop.getKey().startsWith("cxf.bus.prop.")) { + bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue()); + } + } + if (contextRoot != null) { + httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid); + } + return bus; + } + private void applyIntents(List intents, AbstractJAXRSFactoryBean factory) { List features = intentManager.getIntents(Feature.class, intents); factory.setFeatures(features); http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/d785e345/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java ---------------------------------------------------------------------- diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java index 27fe72b..c13c93d 100644 --- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java +++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java @@ -169,7 +169,7 @@ public class WsProvider implements DistributionProvider { final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID); Set intentNames = intentManager.getExported(endpointProps); List intents = intentManager.getRequiredIntents(intentNames); - Bus bus = createBus(sid, serviceContext, contextRoot); + Bus bus = createBus(sid, serviceContext, contextRoot, endpointProps); factory.setDataBinding(getDataBinding(endpointProps, iClass)); factory.setBindingConfig(new SoapBindingConfiguration()); factory.setBus(bus); @@ -247,9 +247,15 @@ public class WsProvider implements DistributionProvider { String address = getClientAddress(sd); return address == null ? httpServiceManager.getDefaultAddress(iClass) : address; } - - protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot) { + + protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot, + Map endpointProps) { Bus bus = BusFactory.newInstance().createBus(); + for (Map.Entry prop : endpointProps.entrySet()) { + if (prop.getKey().startsWith("cxf.bus.prop.")) { + bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue()); + } + } if (contextRoot != null) { httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid); }