From 68b030840e7cadb726f3be292b8456444e815344 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Mon, 6 Jan 2014 17:33:22 +0000 Subject: [PATCH] Remove the deprecated loading of the single workqueue config format. git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1555935 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/cxf/bus/osgi/CXFActivator.java | 9 +-- .../cxf/bus/osgi/WorkQueueSingleConfig.java | 73 ------------------- .../bus/osgi/WorkQueueSingleConfigTest.java | 55 -------------- 3 files changed, 1 insertion(+), 136 deletions(-) delete mode 100644 core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java delete mode 100644 core/src/test/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfigTest.java diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java b/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java index 652aa7734b8..06e79888bf2 100644 --- a/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java +++ b/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java @@ -33,7 +33,6 @@ import org.osgi.framework.Constants; import org.osgi.framework.ServiceRegistration; import org.osgi.service.cm.ConfigurationAdmin; -import org.osgi.service.cm.ManagedService; import org.osgi.service.cm.ManagedServiceFactory; import org.osgi.util.tracker.ServiceTracker; @@ -54,7 +53,6 @@ public class CXFActivator implements BundleActivator { private ServiceRegistration wqSingleConfigRegistratin; /** {@inheritDoc}*/ - @SuppressWarnings("deprecation") public void start(BundleContext context) throws Exception { cxfBundleListener = new CXFExtensionBundleListener(context.getBundle().getBundleId()); context.addBundleListener(cxfBundleListener); @@ -66,12 +64,7 @@ public void start(BundleContext context) throws Exception { workQueueServiceRegistration = registerManagedServiceFactory(context, ManagedServiceFactory.class, workQueues, ManagedWorkQueueList.FACTORY_PID); - - WorkQueueSingleConfig wqSingleConfig = new WorkQueueSingleConfig(workQueues); - wqSingleConfigRegistratin = registerManagedServiceFactory(context, ManagedService.class, - wqSingleConfig, - WorkQueueSingleConfig.SERVICE_PID); - + extensions = new ArrayList(); extensions.add(createOsgiBusListenerExtension(context)); extensions.add(createManagedWorkQueueListExtension(workQueues)); diff --git a/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java b/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java deleted file mode 100644 index d0024495804..00000000000 --- a/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java +++ /dev/null @@ -1,73 +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.bus.osgi; - -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Hashtable; - -import org.apache.cxf.common.util.StringUtils; -import org.apache.cxf.helpers.CastUtils; -import org.apache.cxf.workqueue.AutomaticWorkQueueImpl; -import org.osgi.service.cm.ConfigurationException; -import org.osgi.service.cm.ManagedService; - -/** - * Use the ManagedWorkQueueList config style instead - */ -@Deprecated -public class WorkQueueSingleConfig implements ManagedService { - public static final String SERVICE_PID = "org.apache.cxf.workqueue"; - public static final String PROPERTY_PREFIX = "org.apache.cxf.workqueue"; - ManagedWorkQueueList workQueueList; - - public WorkQueueSingleConfig(ManagedWorkQueueList workQueueList) { - this.workQueueList = workQueueList; - } - - public void updated(@SuppressWarnings("rawtypes") Dictionary properties) throws ConfigurationException { - if (properties == null) { - return; - } - Dictionary p = CastUtils.cast(properties); - String names = (String)properties.get(PROPERTY_PREFIX + ".names"); - String[] nameAr = StringUtils.split(names, ","); - for (String name : nameAr) { - updateQueue(name.trim(), p); - } - } - - private void updateQueue(String name, Dictionary properties) - throws ConfigurationException { - Dictionary queueProperties = new Hashtable(); - Enumeration it = properties.keys(); - while (it.hasMoreElements()) { - String key = (String)it.nextElement(); - String prefix = PROPERTY_PREFIX + "." + name + "."; - if (key.startsWith(prefix)) { - String newKey = (String)key.substring(prefix.length()); - queueProperties.put(newKey, (String)properties.get(key)); - } - } - queueProperties.put(AutomaticWorkQueueImpl.PROPERTY_NAME, name); - workQueueList.updated(name, queueProperties); - } - - -} diff --git a/core/src/test/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfigTest.java b/core/src/test/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfigTest.java deleted file mode 100644 index 1fb5e2758be..00000000000 --- a/core/src/test/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfigTest.java +++ /dev/null @@ -1,55 +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.bus.osgi; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.apache.cxf.bus.managers.WorkQueueManagerImpl; -import org.apache.cxf.workqueue.AutomaticWorkQueueImpl; -import org.apache.cxf.workqueue.WorkQueueManager; -import org.junit.Assert; -import org.junit.Test; -import org.osgi.service.cm.ConfigurationException; - -@Deprecated -public class WorkQueueSingleConfigTest { - @Test - public void testReadConfig() throws IOException, ConfigurationException { - WorkQueueManager wqm = new WorkQueueManagerImpl(); - Assert.assertNull(wqm.getNamedWorkQueue("default")); - ManagedWorkQueueList workQueueList = new ManagedWorkQueueList(); - WorkQueueSingleConfig wqlSingleConfig = - new WorkQueueSingleConfig(workQueueList); - InputStream is = this.getClass().getResourceAsStream("org.apache.cxf.workqueues.cfg"); - Properties properties = new Properties(); - properties.load(is); - wqlSingleConfig.updated(properties); - workQueueList.addAllToWorkQueueManager(wqm); - checkDefaultQueue(wqm); - } - - private void checkDefaultQueue(WorkQueueManager wqm) { - AutomaticWorkQueueImpl queue = (AutomaticWorkQueueImpl)wqm.getNamedWorkQueue("default"); - Assert.assertEquals(50, queue.getHighWaterMark()); - Assert.assertEquals(5, queue.getLowWaterMark()); - Assert.assertEquals(5, queue.getInitialSize()); - } -}