[13/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
--
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
new file mode 100644
index 000..d9bc98d
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import junit.framework.TestCase;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceRegistration;
+
+public class ActivatorTest extends TestCase {
+
+private BundleContext getMockBundleContext(IMocksControl control) {
+Bundle b = control.createMock(Bundle.class);
+Dictionary ht = new Hashtable();
+EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();
+BundleContext bc = control.createMock(BundleContext.class);
+
+EasyMock.expect(b.getBundleContext()).andReturn(bc).anyTimes();
+EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
+return bc;
+}
+
+@SuppressWarnings({
+ "rawtypes", "unchecked"
+})
+public void testCreateAndShutdownRemoteServiceAdminService() throws 
Exception {
+IMocksControl control = EasyMock.createNiceControl();
+BundleContext bc = getMockBundleContext(control);
+Filter filter = control.createMock(Filter.class);
+
EasyMock.expect(bc.createFilter(EasyMock.anyObject())).andReturn(filter);
+EasyMock.expectLastCall().atLeastOnce();
+ServiceRegistration sr = control.createMock(ServiceRegistration.class);
+
EasyMock.expect(bc.registerService(EasyMock.eq(DistributionProvider.class.getName()),
+   EasyMock.anyObject(), 
(Dictionary)EasyMock.anyObject()))
+   .andReturn(sr).atLeastOnce();
+
+control.replay();
+Activator a = new Activator();
+a.start(bc);
+control.verify();
+}
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
--
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
new file mode 100644
index 000..b81bf3e
--- /dev/null
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw;
+
+public final class TestUtils {
+
+//private TestUtils() {
+//}
+//
+//public static ServiceEndpointDescription 
mockServiceDescription(String... interfaceNames) {
+//List iList = new ArrayList();
+//for (String iName : interfaceNames) {
+//iList.add(iName);
+//}
+//
+//ServiceEndpointDescription sd = 
EasyMock.createNiceMock(ServiceEndpointDescription.class);
+//sd.getProvidedInterfaces();

[05/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
--
diff --git 
a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
 
b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
deleted file mode 100644
index 46f83eb..000
--- 
a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.handlers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.apache.cxf.dosgi.dsw.util.StringPlus;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CXFDistributionProvider implements DistributionProvider {
-
-protected static final String DEFAULT_CONFIGURATION_TYPE = 
Constants.WS_CONFIG_TYPE;
-private static final Logger LOG = 
LoggerFactory.getLogger(CXFDistributionProvider.class);
-
-// protected because of tests
-protected final String[] supportedConfigurationTypes;
-
-private IntentManager intentManager;
-private PojoConfigurationTypeHandler pojoConfigurationTypeHandler;
-private JaxRSPojoConfigurationTypeHandler 
jaxRsPojoConfigurationTypeHandler;
-private WsdlConfigurationTypeHandler wsdlConfigurationTypeHandler;
-private Set configTypesSet;
-
-public CXFDistributionProvider(BundleContext bc, IntentManager 
intentManager,
-HttpServiceManager httpServiceManager) {
-this.intentManager = intentManager;
-this.pojoConfigurationTypeHandler = new 
PojoConfigurationTypeHandler(bc, intentManager, httpServiceManager);
-this.jaxRsPojoConfigurationTypeHandler = new 
JaxRSPojoConfigurationTypeHandler(bc,
-   
intentManager,
-   
httpServiceManager);
-this.wsdlConfigurationTypeHandler = new 
WsdlConfigurationTypeHandler(bc, intentManager, httpServiceManager);
-supportedConfigurationTypes = new String[] {Constants.WS_CONFIG_TYPE,
-
Constants.WSDL_CONFIG_TYPE, 
-Constants.RS_CONFIG_TYPE, 
-
Constants.WS_CONFIG_TYPE_OLD};
-configTypesSet = new 
HashSet<>(Arrays.asList(supportedConfigurationTypes));
-}
-
-@SuppressWarnings("rawtypes")
-@Override
-public Endpoint exportService(Object serviceO, 
-  BundleContext serviceContext,
-  Map effectiveProperties,
-  Class[] exportedInterfaces) {
-List configurationTypes = 
determineConfigurationTypes(effectiveProperties);
-DistributionProvider handler = getHandler(configurationTypes, 
effectiveProperties);
-return handler != null ? handler.exportService(serviceO, 
serviceContext, 
-   effectiveProperties, 
exportedInterfaces) : null;
-}
-
-@SuppressWarnings("rawtypes")
-@Override
-public Object importEndpoint(ClassLoader consumerLoader, BundleContext 
consumerContext, 
- Class[] iClass, EndpointDescription

[03/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
--
diff --git 
a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
 
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
deleted file mode 100644
index 002f172..000
--- 
a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.handlers;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.EndpointHelper;
-import org.apache.cxf.dosgi.dsw.handlers.jaxws.MyJaxWsEchoService;
-import org.apache.cxf.dosgi.dsw.handlers.simple.MySimpleEchoService;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
-import org.apache.cxf.dosgi.dsw.qos.IntentMap;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.endpoint.EndpointImpl;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.feature.Feature;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
-import org.apache.cxf.transport.Destination;
-import org.apache.cxf.ws.addressing.AttributedURIType;
-import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Version;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class PojoConfigurationTypeHandlerTest extends TestCase {
-
-public void testGetPojoAddressEndpointURI() {
-IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null,
-   
 intentManager,
-   
 dummyHttpServiceManager());
-Map sd = new HashMap();
-String url = "http://somewhere:1234/blah";;
-sd.put(RemoteConstants.ENDPOINT_ID, url);
-assertEquals(url, handler.getServerAddress(sd, String.class));
-}
-
-private HttpServiceManager dummyHttpServiceManager() {
-return new HttpServiceManager(null, null, null, null);
-}
-
-public void testGetPojoAddressEndpointCxf() {
-IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null,
-   
 intentManager,
-   
 dummyHttpServiceManager());
-Map sd = new HashMap();
-String url = "http://somewhere:29/boo";;
-sd.put("org.apache.cxf.ws.address", url);
-assertEquals(url, handler.getServerAddress(sd, String.class));
-}
-
-public void testGetPojoAddressEndpointPojo() {
-IntentManager intentManager = new IntentManagerImpl(new IntentMap());
-PojoConfigurationTypeHandler handler = new 
PojoConfigurationTypeHandler(null,
-   
 intentManager,
-   
 dummyHttpServiceManager());
-Map sd = new HashMap();
-S

[02/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
--
diff --git 
a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
 
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
deleted file mode 100644
index 9057e46..000
--- 
a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.qos;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.binding.BindingConfiguration;
-import org.apache.cxf.dosgi.dsw.api.IntentUnsatisfiedException;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
-import org.apache.cxf.feature.AbstractFeature;
-import org.apache.cxf.feature.Feature;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class IntentManagerImplTest extends Assert {
-
-@Test
-public void testIntents() throws Exception {
-Map intents = new HashMap();
-intents.put("A", new TestFeature("A"));
-intents.put("SOAP", new TestFeature("SOAP"));
-final IntentMap intentMap = new IntentMap(intents);
-
-IMocksControl control = EasyMock.createNiceControl();
-List features = new ArrayList();
-AbstractEndpointFactory factory = 
control.createMock(AbstractEndpointFactory.class);
-control.replay();
-
-IntentManager intentManager = new IntentManagerImpl(intentMap, 1);
-
-Map props = new HashMap();
-props.put("osgi.remote.requires.intents", "A");
-
-List effectiveIntents = 
Arrays.asList(intentManager.applyIntents(features, factory, props));
-assertEquals(Arrays.asList("A", "SOAP"), effectiveIntents);
-}
-
-@Test
-public void testMultiIntents() {
-final IntentMap intentMap = new IntentMap(new 
DefaultIntentMapFactory().create());
-intentMap.put("confidentiality.message", new 
TestFeature("confidentiality.message"));
-intentMap.put("transactionality", new TestFeature("transactionality"));
-
-IMocksControl control = EasyMock.createNiceControl();
-List features = new ArrayList();
-AbstractEndpointFactory factory = 
control.createMock(AbstractEndpointFactory.class);
-control.replay();
-
-IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-Map props = new HashMap();
-props.put("osgi.remote.requires.intents", "transactionality 
confidentiality.message");
-
-List effectiveIntents = 
Arrays.asList(intentManager.applyIntents(features, factory, props));
-assertTrue(effectiveIntents.contains("transactionality"));
-assertTrue(effectiveIntents.contains("confidentiality.message"));
-}
-
-@Test
-public void testFailedIntent() {
-Map intents = new HashMap();
-intents.put("A", new TestFeature("A"));
-final IntentMap intentMap = new IntentMap(intents);
-
-IMocksControl control = EasyMock.createNiceControl();
-List features = new ArrayList();
-AbstractEndpointFactory factory = 
control.createMock(AbstractEndpointFactory.class);
-control.replay();
-
-IntentManager intentManager = new IntentManagerImpl(intentMap);
-
-Map props = new HashMap();
-props.put("osgi.remote.requires.intents", "A B");
-// ServiceEndpointDescription sd =
-// new 
ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
-
-try {
-intentManager.applyIntents(features, factory, props);
-Assert.fail("applyIntents() should have thrown an exception as 
there was an unsatisfiable intent");
-} catch (IntentUnsatisfiedException iue) {
-assertEquals("B", iue.getIntent());
-}
-}
-
-@Test
-publ

[04/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
--
diff --git 
a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java 
b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
deleted file mode 100644
index 31b1e42..000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.qos;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public final class IntentUtils {
-
-private IntentUtils() {
-// never constructed
-}
-
-public static String[] mergeArrays(String[] a1, String[] a2) {
-if (a1 == null) {
-return a2;
-}
-if (a2 == null) {
-return a1;
-}
-
-List list = new ArrayList(a1.length + a2.length);
-Collections.addAll(list, a1);
-for (String s : a2) {
-if (!list.contains(s)) {
-list.add(s);
-}
-}
-
-return list.toArray(new String[list.size()]);
-}
-
-public static Set getRequestedIntents(Map sd) {
-Collection intents = 
OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
-Collection intents2
-= 
OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
-@SuppressWarnings("deprecation")
-Collection oldIntents = 
OsgiUtils.getMultiValueProperty(sd.get(Constants.EXPORTED_INTENTS_OLD));
-Set allIntents = new HashSet();
-if (intents != null) {
-allIntents.addAll(parseIntents(intents));
-}
-if (intents2 != null) {
-allIntents.addAll(parseIntents(intents2));
-}
-if (oldIntents != null) {
-allIntents.addAll(parseIntents(oldIntents));
-}
-
-return allIntents;
-}
-
-private static Collection parseIntents(Collection intents) 
{
-List parsed = new ArrayList();
-for (String intent : intents) {
-parsed.addAll(Arrays.asList(intent.split("[ ]")));
-}
-return parsed;
-}
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
--
diff --git 
a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java 
b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
deleted file mode 100644
index 9acd0f0..000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleC

[08/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed3.xml
--
diff --git a/discovery/local/src/test/resources/ed3.xml 
b/discovery/local/src/test/resources/ed3.xml
deleted file mode 100644
index 7d4d681..000
--- a/discovery/local/src/test/resources/ed3.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-http://www.osgi.org/xmlns/rsa/v1.0.0";>
-  
-
-  
-SomeService
-  
-
-http://somewhere:12345
-
-  
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/ed4.xml
--
diff --git a/discovery/local/src/test/resources/ed4.xml 
b/discovery/local/src/test/resources/ed4.xml
deleted file mode 100644
index cef5d18..000
--- a/discovery/local/src/test/resources/ed4.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-http://www.osgi.org/xmlns/rsa/v1.0.0";
-  xmlns:other="http://www.acme.org/xmlns/other/v1.0.0";>
-  
-
-  
-org.example.ClassA
-  
-
-http://somewhere
-
-  
-
-  
-
-  
-org.example.ClassB
-  
-
-http://somewhere:1
-
-  
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/sd.xml
--
diff --git a/discovery/local/src/test/resources/sd.xml 
b/discovery/local/src/test/resources/sd.xml
deleted file mode 100644
index c476116..000
--- a/discovery/local/src/test/resources/sd.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-  
-http://www.osgi.org/xmlns/sd/v1.0.0";>
-  
-
-*
-org.apache.cxf.ws
-http://localhost:9090/greeter
-  
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/test/resources/sd2.xml
--
diff --git a/discovery/local/src/test/resources/sd2.xml 
b/discovery/local/src/test/resources/sd2.xml
deleted file mode 100644
index 5a156ea..000
--- a/discovery/local/src/test/resources/sd2.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-http://www.osgi.org/xmlns/sd/v1.0.0";>
-  
-
-confidentiality
-  
-  
-
-
-5
-  
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/pom.xml
--
diff --git a/discovery/pom.xml b/discovery/pom.xml
deleted file mode 100644
index f176e51..000
--- a/discovery/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-
-4.0.0
-org.apache.cxf.dosgi
-cxf-dosgi-ri-discovery
-pom
-Distributed OSGI Discovery Service Modules
-1.8-SNAPSHOT
-
-
-  org.apache.cxf.dosgi
-  cxf-dosgi-ri-parent
-  1.8-SNAPSHOT
-  ../parent/pom.xml
-
-
-
-  local
-  distributed
-
-
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/distribution/features/src/main/resources/features.xml
--
diff --git a/distribution/features/src/main/resources/features.xml 
b/distribution/features/src/main/resources/features.xml
index d8f74d4..26932b1 100644
--- a/distribution/features/src/main/resources/features.xml
+++ b/distribution/features/src/main/resources/features.xml
@@ -1,6 +1,7 @@
 
 http://karaf.apache.org/xmlns/features/v1.0.0"; 
name="cxf-dosgi-${project.version}">
 
mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features
+
mvn:org.apache.aries.rsa/rsa-features/1.8-SNAPSHOT/xml/features
 

 mvn:org.ops4j.pax.logging/pax-logging-api/1.8.5
@@ -15,20 +16,8 @@
 mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.0.7
 
 
-
-mvn:${project.groupId}/cxf-dosgi-ri-osgi-api/${project.version}
-
mvn:${project.groupId}/cxf-dosgi-ri-provider-api/${project.version}
-
mvn:${project.groupId}/cxf-dosgi-ri-rsa/${project.version}
-
mvn:${project.groupId}/cxf-dosgi-ri-topology-manager/${project.version}
-
-
-
-cxf-dosgi-core
-
mvn:${project.groupId}/cxf-dosgi-ri-tcp/${project.version}
-
-
 
-cxf-dosgi-core
+aries-rsa-core
 cxf-specs
 cxf-jaxws
 cxf-jaxrs
@@ -37,23 +26,7 @@
 cxf-http
 http
 
mvn:${project.groupId}/cxf-dosgi-ri-dsw-cxf/${project.version}
+
mvn:${project.groupId}/cxf-dosgi-ri-dsw-cxf/${project.version}
 
 
-
-
-cxf-dosgi-core
-
mvn:${project.groupId}/cxf-dosgi-ri-discovery-local/${project.version}
-
-
-
-cxf-dosgi-core
-
mvn:org.apache.zookeeper/zookeeper/${zookeeper.version}
-
mvn:${project.groupId}/cxf-d

[09/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
--
diff --git 
a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
 
b/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
deleted file mode 100644
index 2761cf3..000
--- 
a/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.discovery.local.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.cxf.dosgi.discovery.local.util.Utils;
-import org.apache.cxf.dosgi.endpointdesc.EndpointDescriptionBundleParser;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.EndpointListener;
-import org.osgi.util.tracker.ServiceTracker;
-
-public class LocalDiscovery implements BundleListener {
-
-// this is effectively a set which allows for multiple service 
descriptions with the
-// same interface name but different properties and takes care of itself 
with respect to concurrency
-ConcurrentHashMap endpointDescriptions =
-new ConcurrentHashMap();
-Map> listenerToFilters =
-new HashMap>();
-Map> filterToListeners =
-new HashMap>();
-final BundleContext bundleContext;
-
-EndpointDescriptionBundleParser bundleParser;
-ServiceTracker listenerTracker;
-
-public LocalDiscovery(BundleContext bc) {
-this.bundleParser = new EndpointDescriptionBundleParser();
-bundleContext = bc;
-
-listenerTracker = new ServiceTracker(bundleContext, 
-EndpointListener.class, null) {
-
-@Override
-public EndpointListener 
addingService(ServiceReference reference) {
-EndpointListener service = super.addingService(reference);
-addListener(reference, service);
-return service;
-}
-
-@Override
-public void modifiedService(ServiceReference 
reference, EndpointListener service) {
-super.modifiedService(reference, service);
-removeListener(service);
-
-// This may cause duplicate registrations of remote services,
-// but that's fine and should be filtered out on another level.
-// See Remote Service Admin spec section 122.6.3
-addListener(reference, service);
-}
-
-@Override
-public void removedService(ServiceReference 
reference, EndpointListener service) {
-super.removedService(reference, service);
-removeListener(service);
-}
-};
-listenerTracker.open();
-
-bundleContext.addBundleListener(this);
-processExistingBundles();
-}
-
-private void processExistingBundles() {
-Bundle[] bundles = bundleContext.getBundles();
-if (bundles == null) {
-return;
-}
-
-for (Bundle b : bundles) {
-if (b.getState() == Bundle.ACTIVE) {
-findDeclaredRemoteServices(b);
-}
-}
-}
-
-void addListener(ServiceReference endpointListenerRef, 
EndpointListener endpointListener) {
-List filters = Utils.getStringPlusProperty(endpointListenerRef,
-EndpointListener.ENDPOINT_LISTENER_SCOPE);
-if (filters.isEmpty()) {
-return;
-}
-
-synchronized (listenerToFilters) {
-listenerToFilters.put(endpointListener, filte

[12/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
--
diff --git 
a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
new file mode 100644
index 000..64beeac
--- /dev/null
+++ 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandlerTest.java
@@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+public class ServiceInvocationHandlerTest extends TestCase {
+
+private static final Map OBJECT_METHODS = new 
HashMap(); {
+for (Method m : Object.class.getMethods()) {
+OBJECT_METHODS.put(m.getName(), m);
+}
+}
+
+public void testInvoke() throws Throwable {
+ServiceInvocationHandler sih = new ServiceInvocationHandler("hello", 
String.class);
+Method m = String.class.getMethod("length", new Class[] {});
+assertEquals(5, sih.invoke(null, m, new Object[] {}));
+}
+
+public void testInvokeObjectMethod() throws Throwable {
+final List called = new ArrayList();
+ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", 
String.class) {
+public boolean equals(Object obj) {
+called.add("equals");
+return super.equals(obj);
+}
+
+public int hashCode() {
+called.add("hashCode");
+return super.hashCode();
+}
+
+public String toString() {
+called.add("toString");
+return "somestring";
+}
+};
+
+Object proxy = Proxy.newProxyInstance(
+getClass().getClassLoader(), new Class[] {Runnable.class}, 
sih);
+
+assertEquals(true,
+sih.invoke(null, OBJECT_METHODS.get("equals"), new Object[] 
{proxy}));
+assertEquals(System.identityHashCode(sih),
+sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object[] 
{}));
+assertEquals("somestring",
+sih.invoke(null, OBJECT_METHODS.get("toString"), new Object[] 
{}));
+assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
+}
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
--
diff --git 
a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
new file mode 100644
index 000..df90758
--- /dev/null
+++ 
b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandlerTest.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import junit.framework.TestCase;
+
+public class WsdlCo

[15/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
[DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead


Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/1425743f
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/1425743f
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/1425743f

Branch: refs/heads/master
Commit: 1425743fb41db6c5ede9fba7a8872c73a835a80e
Parents: 9ed37be
Author: Christian Schneider 
Authored: Fri Mar 11 23:53:28 2016 +0100
Committer: Christian Schneider 
Committed: Fri Mar 11 23:53:28 2016 +0100

--
 cxf-dsw/pom.xml | 155 +
 .../org/apache/cxf/dosgi/dsw/Activator.java | 160 +
 .../org/apache/cxf/dosgi/dsw/Constants.java | 146 +
 .../dosgi/dsw/decorator/DecorationParser.java   |  85 +++
 .../cxf/dosgi/dsw/decorator/InterfaceRule.java  |  96 +++
 .../apache/cxf/dosgi/dsw/decorator/Rule.java|  41 ++
 .../dosgi/dsw/decorator/ServiceDecorator.java   |  28 +
 .../ServiceDecoratorBundleListener.java |  48 ++
 .../dsw/decorator/ServiceDecoratorImpl.java |  97 +++
 .../AbstractPojoConfigurationTypeHandler.java   | 243 
 .../dsw/handlers/CXFDistributionProvider.java   | 178 ++
 .../cxf/dosgi/dsw/handlers/ClassUtils.java  | 142 +
 .../dosgi/dsw/handlers/HttpServiceManager.java  | 176 ++
 .../JaxRSPojoConfigurationTypeHandler.java  | 201 +++
 .../cxf/dosgi/dsw/handlers/JaxRSUtils.java  | 121 
 .../cxf/dosgi/dsw/handlers/LocalHostUtil.java   |  92 +++
 .../handlers/PojoConfigurationTypeHandler.java  | 172 ++
 .../handlers/SecurityDelegatingHttpContext.java | 133 +
 .../cxf/dosgi/dsw/handlers/ServerWrapper.java   |  49 ++
 .../dsw/handlers/ServiceInvocationHandler.java  | 100 
 .../handlers/WsdlConfigurationTypeHandler.java  | 160 +
 .../dosgi/dsw/qos/DefaultIntentMapFactory.java  |  52 ++
 .../apache/cxf/dosgi/dsw/qos/IntentManager.java |  31 +
 .../cxf/dosgi/dsw/qos/IntentManagerImpl.java| 155 +
 .../org/apache/cxf/dosgi/dsw/qos/IntentMap.java |  62 ++
 .../apache/cxf/dosgi/dsw/qos/IntentTracker.java |  62 ++
 .../apache/cxf/dosgi/dsw/qos/IntentUtils.java   |  86 +++
 .../apache/cxf/dosgi/dsw/util/OsgiUtils.java| 132 +
 .../apache/cxf/dosgi/dsw/util/StringPlus.java   |  72 +++
 .../src/main/resources/service-decoration.xsd   |  67 +++
 .../org/apache/cxf/dosgi/dsw/ActivatorTest.java |  66 +++
 .../org/apache/cxf/dosgi/dsw/TestUtils.java |  37 ++
 .../dsw/decorator/DecorationParserTest.java |  63 ++
 .../dosgi/dsw/decorator/InterfaceRuleTest.java  | 163 +
 .../ServiceDecoratorBundleListenerTest.java |  69 +++
 .../dsw/decorator/ServiceDecoratorImplTest.java | 187 ++
 .../handlers/CXFDistributionProviderTest.java   | 104 
 .../cxf/dosgi/dsw/handlers/ClassUtilsTest.java  | 134 +
 .../dsw/handlers/HttpServiceManagerTest.java| 125 
 .../cxf/dosgi/dsw/handlers/JaxRSUtilsTest.java  | 195 ++
 .../PojoConfigurationTypeHandlerTest.java   | 422 +
 .../SecurityDelegatingHttpContextTest.java  | 267 +
 .../handlers/ServiceInvocationHandlerTest.java  |  75 +++
 .../WsdlConfigurationTypeHandlerTest.java   |  67 +++
 .../dsw/handlers/jaxws/MyJaxWsEchoService.java  |  26 +
 .../handlers/jaxws/MyJaxWsEchoServiceImpl.java  |  27 +
 .../handlers/simple/MySimpleEchoService.java|  23 +
 .../simple/MySimpleEchoServiceImpl.java |  27 +
 .../dsw/hooks/CxfFindListenerHookTest.java  | 341 +++
 .../cxf/dosgi/dsw/hooks/CxfPublishHookTest.java | 299 ++
 .../dosgi/dsw/hooks/ServiceHookUtilsTest.java   | 116 
 .../apache/cxf/dosgi/dsw/hooks/TestService.java |  22 +
 .../dosgi/dsw/qos/IntentManagerImplTest.java| 278 +
 .../apache/cxf/dosgi/dsw/qos/IntentMapTest.java |  41 ++
 .../cxf/dosgi/dsw/qos/IntentTrackerTest.java|  80 +++
 .../cxf/dosgi/dsw/qos/IntentUtilsTest.java  |  70 +++
 .../cxf/dosgi/dsw/util/OsgiUtilsTest.java   | 152 +
 .../org/apache/cxf/dosgi/dsw/util/Provider.java |  23 +
 .../remote-service/alt-remote-services.xml  |  32 +
 .../OSGI-INF/remote-service/multi-services.xml  |  38 ++
 .../OSGI-INF/remote-service/remote-services.xml |  32 +
 .../src/test/resources/test-resources/rs1.xml   |  31 +
 .../src/test/resources/test-resources/rs2.xml   |  28 +
 .../src/test/resources/test-resources/sd-1.xml  |   3 +
 .../src/test/resources/test-resources/sd.xml|   8 +
 .../src/test/resources/test-resources/sd0.xml   |   2 +
 .../src/test/resources/test-resources/sd1.xml   |   8 +
 .../src/test/resources/test-resources/sd2.xml   |  14 +
 discovery/distributed/cxf-discovery/pom.xml | 120 
 .../dosgi/discovery/zookeeper/Activator.java|  43 --
 .../discovery/zookeeper/ZooKeeperDiscovery.java | 164 --
 .../zookeeper/publish/DiscoveryPlugin.java  |  54 --
 .../publish/PublishingEndpointListener.java

[14/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
--
diff --git 
a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
 
b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
new file mode 100644
index 000..eca5460
--- /dev/null
+++ 
b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.handlers;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.transport.http.DestinationRegistry;
+import org.apache.cxf.transport.http.DestinationRegistryImpl;
+import org.apache.cxf.transport.servlet.CXFNonSpringServlet;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HttpServiceManager {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(HttpServiceManager.class);
+private static final long SERVICE_LOOKUP_TIMEOUT = 1;
+private ServiceTracker tracker;
+private BundleContext bundleContext;
+private Map exportedAliases = 
Collections.synchronizedMap(new HashMap());
+private String httpBase;
+private String cxfServletAlias;
+
+public HttpServiceManager(BundleContext bundleContext, String httpBase, 
String cxfServletAlias) {
+this(bundleContext, httpBase, cxfServletAlias,
+ new ServiceTracker(bundleContext, 
HttpService.class, null));
+this.tracker.open();
+}
+
+// Only for tests
+public HttpServiceManager(BundleContext bundleContext,
+  String httpBase, String cxfServletAlias,
+  ServiceTracker 
tracker) {
+this.bundleContext = bundleContext;
+this.tracker = tracker;
+this.httpBase = getWithDefault(httpBase, "http://"; + 
LocalHostUtil.getLocalIp() + ":8181");
+this.cxfServletAlias = getWithDefault(cxfServletAlias, "/cxf");
+}
+
+private String getWithDefault(String value, String defaultValue) {
+return value == null ? defaultValue : value;
+}
+
+public Bus registerServlet(Bus bus, String contextRoot, BundleContext 
callingContext, Long sid) {
+bus.setExtension(new DestinationRegistryImpl(), 
DestinationRegistry.class);
+CXFNonSpringServlet cxf = new CXFNonSpringServlet();
+cxf.setBus(bus);
+try {
+HttpService httpService = getHttpService();
+httpService.registerServlet(contextRoot, cxf, new 
Hashtable(),
+   getHttpContext(callingContext, 
httpService));
+
+registerUnexportHook(sid, contextRoot);
+
+LOG.info("Successfully registered CXF DOSGi servlet at " + 
contextRoot);
+} catch (Exception e) {
+throw new ServiceException("CXF DOSGi: problem registering CXF 
HTTP Servlet", e);
+}
+return bus;
+}
+
+protected HttpService getHttpService() {
+HttpService service = null;
+try {
+service = tracker.waitForService(SERVICE_LOOKUP_TIMEOUT);
+} catch (InterruptedException ex) {
+LOG.warn("waitForService interrupeted", ex);
+}
+if (service == null) {
+throw new RuntimeException("No HTTPService found");
+}
+return service;
+}
+
+private HttpContext getHttpContext(BundleContext bc, HttpService 
httpService) {
+HttpContext httpContext = httpService.createDefaultHttpContext();
+return new SecurityDelegating

[07/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
--
diff --git 
a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
 
b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
deleted file mode 100644
index 356de5e..000
--- 
a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.api.EndpointHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-import org.osgi.service.remoteserviceadmin.ExportReference;
-import org.osgi.service.remoteserviceadmin.ExportRegistration;
-import org.osgi.service.remoteserviceadmin.ImportReference;
-import org.osgi.service.remoteserviceadmin.ImportRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RemoteServiceAdminCore implements RemoteServiceAdmin {
-
-private static final Logger LOG = 
LoggerFactory.getLogger(RemoteServiceAdminCore.class);
-
-private final Map, Collection> 
exportedServices
-= new LinkedHashMap, 
Collection>();
-private final Map> 
importedServices
-= new LinkedHashMap>();
-
-// Is stored in exportedServices while the export is in progress as a 
marker
-private final List exportInProgress = 
Collections.emptyList();
-
-private final BundleContext bctx;
-private final EventProducer eventProducer;
-private final ServiceListener exportedServiceListener;
-private DistributionProvider provider;
-private BundleContext apictx;
-
-public RemoteServiceAdminCore(BundleContext context, BundleContext 
apiContext, DistributionProvider provider) {
-this.bctx = context;
-this.apictx = apiContext;
-this.eventProducer = new EventProducer(bctx);
-this.provider = provider;
-// listen for exported services being unregistered so we can close the 
export
-this.exportedServiceListener = new ServiceListener() {
-public void serviceChanged(ServiceEvent event) {
-if (event.getType() == ServiceEvent.UNREGISTERING) {
-removeServiceExports(event.getServiceReference());
-}
-}
-};
-try {
-String filter = "(" + RemoteConstants.SERVICE_EXPORTED_INTERFACES 
+ "=*)";
-context.addServiceListener(exportedServiceListener, filter);
-} catch (InvalidSyntaxException ise) {
-throw new RuntimeException(ise); // can never happen
-}
-}
-
-@Override
-@SuppressWarnings({ "rawtypes", "unchecked" })
-public List exportService(ServiceReference 
serviceReference, Map additionalProperties)
-throws IllegalArgumentException, UnsupportedOperationException {
-Map serviceProperties = 
getProperties(serviceReference);
-if (additionalProperties != null) {
-overlayProperties(serviceProperties, additionalProperties);
-}
-Map key = makeKey(serviceProperties);
-
-

[01/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
Repository: cxf-dosgi
Updated Branches:
  refs/heads/master 9ed37bef0 -> 1425743fb


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
--
diff --git 
a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
 
b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
deleted file mode 100644
index 3739f16..000
--- 
a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/FilterHelper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.topologymanager.importer;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.osgi.framework.Constants;
-
-public final class FilterHelper {
-private static final String OBJECTCLASS_EXPRESSION = ".*\\(" + 
Constants.OBJECTCLASS + "=([a-zA-Z_0-9.]+)\\).*";
-private static final Pattern OBJECTCLASS_PATTERN = 
Pattern.compile(OBJECTCLASS_EXPRESSION);
-
-private FilterHelper() {
-// prevent instantiation
-}
-
-public static String getObjectClass(String filter) {
-if (filter != null) {
-Matcher matcher = OBJECTCLASS_PATTERN.matcher(filter);
-if (matcher.matches() && matcher.groupCount() >= 1) {
-return matcher.group(1);
-}
-}
-return null;
-}
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
--
diff --git 
a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
 
b/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
deleted file mode 100644
index 03ec9da..000
--- 
a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/importer/ListenerHookImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.topologymanager.importer;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.hooks.service.ListenerHook;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Listens for service listeners and informs ServiceInterestListener about 
added and removed interest
- * in services
- */
-public class ListenerHookImpl implements ListenerHook {
-
-private static final Logger LOG = 
LoggerFactory.getLogger(ListenerHookImpl.class);
-
-// From the old impl.
-private static final Set SYSTEM_PACKAGES;
-static {
-SYSTEM_PACKAGES = new HashSet();
-SYSTEM_PACKAGES.add("org.osgi.service");
-SYSTEM_PACKAGES.add("org.apache.felix");
-SYSTEM_PACKAGES.add("org.ops4j.pax.logging");
-SYSTEM_PACKAGES.add("ch.ethz.iks.slp");
-SYSTEM_PACKAGES.add("org.ungoverned.osgi.service");
-
SYSTEM_PACKAGES.add("org.springframework.osgi.context.e

[11/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd.xml
--
diff --git a/cxf-dsw/src/test/resources/test-resources/sd.xml 
b/cxf-dsw/src/test/resources/test-resources/sd.xml
new file mode 100644
index 000..c7cebfb
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd.xml
@@ -0,0 +1,8 @@
+http://cxf.apache.org/xmlns/service-decoration/1.0.0";>
+  
+
+  
+  
+
+  
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd0.xml
--
diff --git a/cxf-dsw/src/test/resources/test-resources/sd0.xml 
b/cxf-dsw/src/test/resources/test-resources/sd0.xml
new file mode 100644
index 000..0ad0ad1
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd0.xml
@@ -0,0 +1,2 @@
+http://cxf.apache.org/xmlns/service-decoration/1.0.0";>
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd1.xml
--
diff --git a/cxf-dsw/src/test/resources/test-resources/sd1.xml 
b/cxf-dsw/src/test/resources/test-resources/sd1.xml
new file mode 100644
index 000..6a5e811
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd1.xml
@@ -0,0 +1,8 @@
+http://cxf.apache.org/xmlns/service-decoration/1.0.0";>
+  
+
+  
+  
+
+  
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/cxf-dsw/src/test/resources/test-resources/sd2.xml
--
diff --git a/cxf-dsw/src/test/resources/test-resources/sd2.xml 
b/cxf-dsw/src/test/resources/test-resources/sd2.xml
new file mode 100644
index 000..fb6a93a
--- /dev/null
+++ b/cxf-dsw/src/test/resources/test-resources/sd2.xml
@@ -0,0 +1,14 @@
+http://cxf.apache.org/xmlns/service-decoration/1.0.0";>
+  
+
+  
+  
+
+  
+  
+
+  
+  
+
+  
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/pom.xml
--
diff --git a/discovery/distributed/cxf-discovery/pom.xml 
b/discovery/distributed/cxf-discovery/pom.xml
deleted file mode 100644
index b34a1db..000
--- a/discovery/distributed/cxf-discovery/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-
-4.0.0
-cxf-dosgi-ri-discovery-distributed
-bundle
-CXF DOSGi ZooKeeper-based Discovery Service Bundle
-An implementation of the Distributed OSGi Discovery Service 
using ZooKeeper
-
-
-org.apache.cxf.dosgi
-cxf-dosgi-ri-parent
-1.8-SNAPSHOT
-../../../parent/pom.xml
-
-
-
-../../..
-
-
-
-
-org.osgi
-org.osgi.core
-provided
-
-
-org.osgi
-org.osgi.compendium
-provided
-
-
-
-org.apache.zookeeper
-zookeeper
-${zookeeper.version}
-provided
-
-
-com.sun.jdmk
-jmxtools
-
-
-com.sun.jmx
-jmxri
-
-
-log4j
-log4j
-
-
-
-
-
-
-log4j
-log4j
-${log4j.version}
-provided
-
-
-
-org.apache.cxf.dosgi
-cxf-dosgi-ri-discovery-local
-${project.version}
-
-
-
-org.slf4j
-slf4j-api
-
-
-
-junit
-junit
-test
-
-
-org.easymock
-easymockclassextension
-test
-
-
-
-
-
-
-org.apache.felix
-maven-bundle-plugin
-
-
-
${project.artifactId}
-
org.apache.cxf.dosgi.discovery.zookeeper.Activator
-
-!*
-
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/Activator.java
--

[10/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
--
diff --git 
a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
 
b/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
deleted file mode 100644
index 53b6139..000
--- 
a/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceDataMonitorListenerImplTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.discovery.zookeeper;
-
-import junit.framework.TestCase;
-
-public class InterfaceDataMonitorListenerImplTest extends TestCase {
-
-public void testDUMMY() {
-assertTrue(true);
-}
-
-//public void testChange() throws Exception {
-//final List dsnCallbacks = new 
ArrayList();
-//DiscoveredServiceTracker dst = new DiscoveredServiceTracker() {
-//public void serviceChanged(DiscoveredServiceNotification dsn) {
-//dsnCallbacks.add(dsn);
-//}
-//};
-//
-////
-//// Test DiscoveredServiceNotification.AVAILABLE
-////
-//Properties initial = new Properties();
-//initial.put("a", "b");
-//initial.put(ServicePublication.ENDPOINT_LOCATION, 
"http://somehost:12345/some/context";);
-//ByteArrayOutputStream propBytes = new ByteArrayOutputStream();
-//initial.store(propBytes, "");
-//
-//ZooKeeper zk = EasyMock.createMock(ZooKeeper.class);
-//
EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), 
false))
-//.andReturn(Arrays.asList("x#y#z"));
-//
EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + 
"/x#y#z", false, null))
-//.andReturn(propBytes.toByteArray());
-//EasyMock.replay(zk);
-//
-//InterfaceDataMonitorListenerImpl dml = new 
InterfaceDataMonitorListenerImpl(zk, String.class.getName(), dst);
-//
-//assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//dml.change();
-//assertEquals(1, dsnCallbacks.size());
-//DiscoveredServiceNotification dsn = dsnCallbacks.iterator().next();
-//assertEquals(Collections.singleton(String.class.getName()), 
dsn.getInterfaces());
-//assertEquals(DiscoveredServiceNotification.AVAILABLE, dsn.getType());
-//assertEquals(0, dsn.getFilters().size());
-//ServiceEndpointDescription sed = dsn.getServiceEndpointDescription();
-//assertEquals(Collections.singleton(String.class.getName()), 
sed.getProvidedInterfaces());
-//
-//Properties expected = new Properties();
-//expected.load(new ByteArrayInputStream(propBytes.toByteArray()));
-//expected.put("service.exported.configs", "org.apache.cxf.ws");
-//expected.put("org.apache.cxf.ws.address", 
"http://somehost:12345/some/context";);
-//
-//assertEquals(expected, sed.getProperties());
-//EasyMock.verify(zk);
-//
-//// Again with the same data
-//EasyMock.reset(zk);
-//
EasyMock.expect(zk.getChildren(Utils.getZooKeeperPath(String.class.getName()), 
false))
-//.andReturn(Arrays.asList("x#y#z"));
-//
EasyMock.expect(zk.getData(Utils.getZooKeeperPath(String.class.getName()) + 
"/x#y#z", false, null))
-//.andReturn(propBytes.toByteArray());
-//EasyMock.replay(zk);
-//
-//dsnCallbacks.clear();
-//assertEquals("Precondition failed", 0, dsnCallbacks.size());
-//dml.change();
-//assertEquals(0, dsnCallbacks.size());
-//
-//EasyMock.verify(zk);
-////
-//// Test DiscoveredServ

[06/15] cxf-dosgi git commit: [DOSGI-232] Remove code that moved to Aries-rsa and refer to it instead

2016-03-11 Thread cschneider
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/pom.xml
--
diff --git a/dsw/cxf-dosgi-tcp/pom.xml b/dsw/cxf-dosgi-tcp/pom.xml
deleted file mode 100644
index 8e40ee1..000
--- a/dsw/cxf-dosgi-tcp/pom.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  4.0.0
-
-org.apache.cxf.dosgi
-cxf-dosgi-ri-parent
-1.8-SNAPSHOT
-../../parent/pom.xml
-
-cxf-dosgi-ri-tcp
-bundle
-CXF dOSGi Remote Service Admin TCP provider
-Provider for Java Serialization over TCP
-
-
-../..
-
-
-
-
-org.slf4j
-slf4j-api
-
-
-org.osgi
-org.osgi.core
-provided
-
-
-org.osgi
-org.osgi.compendium
-provided
-
-
-org.apache.cxf.dosgi
-cxf-dosgi-ri-provider-api
-${project.version}
-
-
-
-junit
-junit
-test
-
-
-org.easymock
-easymockclassextension
-test
-
-
-org.slf4j
-slf4j-jdk14
-1.7.14
-test
-
-
-
-
-
-
-org.apache.felix
-maven-bundle-plugin
-true
-
-
-
${project.artifactId}
-
org.apache.aries.rsa.provider.tcp.Activator
-
-
-
-
-
-

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
--
diff --git 
a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
 
b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
deleted file mode 100644
index 128c3d8..000
--- 
a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.aries.rsa.provider.tcp;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-public class Activator implements BundleActivator {
-
-@Override
-public void start(BundleContext context) throws Exception {
-DistributionProvider provider = new TCPProvider();
-Dictionary props = new Hashtable<>();
-props.put(RemoteConstants.REMOTE_INTENTS_SUPPORTED, new String[]{});
-props.put(RemoteConstants.REMOTE_CONFIGS_SUPPORTED, 
provider.getSupportedTypes());
-context.registerService(DistributionProvider.class, provider, props);
-}
-
-@Override
-public void stop(BundleContext context) throws Exception {
-// unregister happens automatically
-}
-
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/1425743f/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
--
diff --git 
a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
 
b/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
deleted file mode 100644
index ac60950..000
--- 
a/dsw/cxf-dosgi-tcp/src/main/java/org/apache/aries/rsa/provider/tcp/LoaderObjectInputStream.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional informatio

cxf git commit: Avoid OBR update for local maven repo to speedup build

2016-03-11 Thread cschneider
Repository: cxf
Updated Branches:
  refs/heads/master 2196b6c2c -> 4b37844e9


Avoid OBR update for local maven repo to speedup build


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4b37844e
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4b37844e
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4b37844e

Branch: refs/heads/master
Commit: 4b37844e9c15812d1855d0babded79880d2cd6fb
Parents: 2196b6c
Author: Christian Schneider 
Authored: Fri Mar 11 23:19:10 2016 +0100
Committer: Christian Schneider 
Committed: Fri Mar 11 23:19:10 2016 +0100

--
 parent/pom.xml | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/4b37844e/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index 50ce729..a43e847 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -561,6 +561,7 @@
 
 
 
+NONE
 
 
${cxf.osgi.symbolic.name}
 lazy



cxf-dosgi git commit: Add test for DistributionProviderTracker

2016-03-11 Thread cschneider
Repository: cxf-dosgi
Updated Branches:
  refs/heads/master 8c7fbc8c5 -> 9ed37bef0


Add test for DistributionProviderTracker


Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/9ed37bef
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/9ed37bef
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/9ed37bef

Branch: refs/heads/master
Commit: 9ed37bef0eb4daf9f0e8dfbc098b14608c90c670
Parents: 8c7fbc8
Author: Christian Schneider 
Authored: Fri Mar 11 13:58:50 2016 +0100
Committer: Christian Schneider 
Committed: Fri Mar 11 13:58:50 2016 +0100

--
 .../service/DistributionProviderTracker.java| 10 ++-
 .../DistributionProviderTrackerTest.java| 82 
 2 files changed, 90 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/9ed37bef/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
--
diff --git 
a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
 
b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
index 7dd31b7..675fcc6 100644
--- 
a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
+++ 
b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
@@ -44,9 +44,9 @@ public class DistributionProviderTracker extends 
ServiceTracker reference) {
 LOG.debug("RemoteServiceAdmin Implementation is starting up");
 DistributionProvider provider = context.getService(reference);
-Bundle apiBundle = FrameworkUtil.getBundle(DistributionProvider.class);
+BundleContext apiContext = getAPIContext();
 RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(context, 
-
apiBundle.getBundleContext(), 
+
apiContext, 
 provider);
 RemoteServiceadminFactory rsaf = new 
RemoteServiceadminFactory(rsaCore);
 Dictionary props = new Hashtable();
@@ -55,6 +55,12 @@ public class DistributionProviderTracker extends 
ServiceTracker 
reference,

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/9ed37bef/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
--
diff --git 
a/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
 
b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
new file mode 100644
index 000..6ae7004
--- /dev/null
+++ 
b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTrackerTest.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.service;
+
+import java.util.Dictionary;
+
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+import org.junit.Test;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public class DistributionProviderTrackerTest {
+
+@SuppressWarnings({
+ "unchecked", "rawtypes"
+})
+@Test
+public void testAddingRemoved() throws InvalidSyntaxException {
+IMocksControl c = EasyMock.createControl();
+DistributionProvider provider = 
c.createMock

[1/2] cxf git commit: [CXF-6826] Cache MediaTypeHeaderProvider.valueOf results (with automatic cache cleanup when reaching a threshold)

2016-03-11 Thread asoldano
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 810063b93 -> e4cab6471


[CXF-6826] Cache MediaTypeHeaderProvider.valueOf results (with automatic cache 
cleanup when reaching a threshold)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/8a9f6cda
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/8a9f6cda
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/8a9f6cda

Branch: refs/heads/3.1.x-fixes
Commit: 8a9f6cdafc87a22314c805e995fc5d286fe8beed
Parents: 810063b
Author: Alessio Soldano 
Authored: Thu Mar 10 20:39:49 2016 +0100
Committer: Alessio Soldano 
Committed: Fri Mar 11 10:38:08 2016 +0100

--
 .../cxf/jaxrs/impl/MediaTypeHeaderProvider.java | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/8a9f6cda/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
--
diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
index 39f484e..5d297b6 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
@@ -25,6 +25,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -45,17 +46,34 @@ public class MediaTypeHeaderProvider implements 
HeaderDelegate {
 private static final Pattern COMPLEX_PARAMETERS = 
 Pattern.compile("(([\\w-]+=\"[^\"]*\")|([\\w-]+=[\\w-/\\+]+))");
 
+private static Map map = new ConcurrentHashMap();
+private static final int MAX_MT_CACHE_SIZE = 
+Integer.getInteger("org.apache.cxf.jaxrs.max_mediatype_cache_size", 
200);
+
 public MediaType fromString(String mType) {
 
 return valueOf(mType);
 }
 
 public static MediaType valueOf(String mType) {
-
 if (mType == null) {
 throw new IllegalArgumentException("Media type value can not be 
null");
 }
 
+MediaType result = map.get(mType);
+if (result == null) {
+result = internalValueOf(mType);
+final int size = map.size();
+if (size >= MAX_MT_CACHE_SIZE) {
+map.clear();
+}
+map.put(mType, result);
+}
+return result;
+}
+
+public static MediaType internalValueOf(String mType) {
+
 int i = mType.indexOf('/');
 if (i == -1) {
 return handleMediaTypeWithoutSubtype(mType.trim());



[2/2] cxf git commit: Recording .gitmergeinfo Changes

2016-03-11 Thread asoldano
Recording .gitmergeinfo Changes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/e4cab647
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/e4cab647
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/e4cab647

Branch: refs/heads/3.1.x-fixes
Commit: e4cab6471a5dafedcd5b69418266f03235adf5d6
Parents: 8a9f6cd
Author: Alessio Soldano 
Authored: Fri Mar 11 10:38:41 2016 +0100
Committer: Alessio Soldano 
Committed: Fri Mar 11 10:38:41 2016 +0100

--
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/e4cab647/.gitmergeinfo
--
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 889afbb..8191d2a 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -68,4 +68,5 @@ M 9ecea375930d1a217f35da65e0d6073f7a80bf7d
 M a1710bdd783afcd667d9e72ccb031480d3806850
 M abcc137cb9b27e0da0b4270a18ac2a32df1e9990
 M b2b6f0137cd9f1bafff5d487e8383453692a2ff0
+M fa973bd7ab43099151f83beea351b80c7140eaab
 M fe89bf0fb8379428667f66312e6942e906142d6f



cxf-dosgi git commit: [DOSGI-231] Create ExportPolicy SPI

2016-03-11 Thread cschneider
Repository: cxf-dosgi
Updated Branches:
  refs/heads/master c5ba7e405 -> 8c7fbc8c5


[DOSGI-231] Create ExportPolicy SPI


Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/8c7fbc8c
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/8c7fbc8c
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/8c7fbc8c

Branch: refs/heads/master
Commit: 8c7fbc8c5a76069eb5604cb0405fc888adb38139
Parents: c5ba7e4
Author: Christian Schneider 
Authored: Fri Mar 11 10:01:08 2016 +0100
Committer: Christian Schneider 
Committed: Fri Mar 11 10:01:08 2016 +0100

--
 .../apache/cxf/dosgi/dsw/api/ExportPolicy.java  |  46 +
 dsw/cxf-topology-manager/pom.xml|   8 +-
 .../cxf/dosgi/topologymanager/Activator.java| 100 +++
 .../exporter/DefaultExportPolicy.java   |  37 +++
 .../exporter/EndpointListenerNotifier.java  |  70 +++--
 .../exporter/EndpointRepository.java|  38 ---
 .../exporter/TopologyManagerExport.java |  40 +---
 .../dosgi/topologymanager/ActivatorTest.java|   5 +-
 .../exporter/EndpointListenerNotifierTest.java  |  16 ++-
 .../exporter/EndpointRepositoryTest.java|  82 +++
 .../exporter/TopologyManagerExportTest.java |  27 ++---
 11 files changed, 359 insertions(+), 110 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/8c7fbc8c/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
--
diff --git 
a/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
 
b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
new file mode 100644
index 000..9e82c04
--- /dev/null
+++ 
b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+import java.util.Map;
+
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * SPI for TopologyManagerExport. Allows to export services that are
+ * not marked for export as well customize the way services are exported.
+ * 
+ * Use cases:
+ * - Mandate SSL and basic authoriziation by adding the respective intents and 
configs
+ * - Add logging interceptor as intent
+ * - Remove exported interfaces to filter out services
+ */
+public interface ExportPolicy {
+/**
+ * Allows to supply additional properties for a service that are then
+ * given to RemoteServiceAdmin. The service will be exported
+ * if the original service or the additional properties contain the
+ * non empty property service.exported.interfaces. 
+ * 
+ * @param service to export
+ * @return additional properties for exported Service (must not be null)
+ */
+Map additionalParameters(ServiceReference sref);
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/8c7fbc8c/dsw/cxf-topology-manager/pom.xml
--
diff --git a/dsw/cxf-topology-manager/pom.xml b/dsw/cxf-topology-manager/pom.xml
index 2c64d28..b6c143e 100644
--- a/dsw/cxf-topology-manager/pom.xml
+++ b/dsw/cxf-topology-manager/pom.xml
@@ -39,12 +39,18 @@
 
 org.osgi
 org.osgi.core
+provided
 
 
 org.osgi
 org.osgi.compendium
+provided
+
+
+org.apache.cxf.dosgi
+cxf-dosgi-ri-provider-api
+${project.version}
 
-
 
 org.slf4j
 slf4j-api

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/8c7fbc8c/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java
--
diff --git 
a/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/Activator.java

[2/2] cxf git commit: Merge remote-tracking branch 'asoldano/CXF-6826'

2016-03-11 Thread asoldano
Merge remote-tracking branch 'asoldano/CXF-6826'


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2196b6c2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2196b6c2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2196b6c2

Branch: refs/heads/master
Commit: 2196b6c2ccdfc2029c3ef9c7c99a338ce4d40db5
Parents: 15504ab fa973bd
Author: Alessio Soldano 
Authored: Fri Mar 11 09:36:25 2016 +0100
Committer: Alessio Soldano 
Committed: Fri Mar 11 09:36:25 2016 +0100

--
 .../cxf/jaxrs/impl/MediaTypeHeaderProvider.java | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)
--




[1/2] cxf git commit: [CXF-6826] Cache MediaTypeHeaderProvider.valueOf results (with automatic cache cleanup when reaching a threshold)

2016-03-11 Thread asoldano
Repository: cxf
Updated Branches:
  refs/heads/master 15504ab90 -> 2196b6c2c


[CXF-6826] Cache MediaTypeHeaderProvider.valueOf results (with automatic cache 
cleanup when reaching a threshold)


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/fa973bd7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/fa973bd7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/fa973bd7

Branch: refs/heads/master
Commit: fa973bd7ab43099151f83beea351b80c7140eaab
Parents: 53aed2e
Author: Alessio Soldano 
Authored: Thu Mar 10 20:39:49 2016 +0100
Committer: Alessio Soldano 
Committed: Thu Mar 10 20:39:49 2016 +0100

--
 .../cxf/jaxrs/impl/MediaTypeHeaderProvider.java | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/fa973bd7/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
--
diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
index 39f484e..5d297b6 100644
--- 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
+++ 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/MediaTypeHeaderProvider.java
@@ -25,6 +25,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -45,17 +46,34 @@ public class MediaTypeHeaderProvider implements 
HeaderDelegate {
 private static final Pattern COMPLEX_PARAMETERS = 
 Pattern.compile("(([\\w-]+=\"[^\"]*\")|([\\w-]+=[\\w-/\\+]+))");
 
+private static Map map = new ConcurrentHashMap();
+private static final int MAX_MT_CACHE_SIZE = 
+Integer.getInteger("org.apache.cxf.jaxrs.max_mediatype_cache_size", 
200);
+
 public MediaType fromString(String mType) {
 
 return valueOf(mType);
 }
 
 public static MediaType valueOf(String mType) {
-
 if (mType == null) {
 throw new IllegalArgumentException("Media type value can not be 
null");
 }
 
+MediaType result = map.get(mType);
+if (result == null) {
+result = internalValueOf(mType);
+final int size = map.size();
+if (size >= MAX_MT_CACHE_SIZE) {
+map.clear();
+}
+map.put(mType, result);
+}
+return result;
+}
+
+public static MediaType internalValueOf(String mType) {
+
 int i = mType.indexOf('/');
 if (i == -1) {
 return handleMediaTypeWithoutSubtype(mType.trim());