You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by am...@apache.org on 2013/06/04 14:25:18 UTC
svn commit: r1489409 - in /cxf/dosgi/trunk:
discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/
discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/
discovery/distributed/zo...
Author: amichai
Date: Tue Jun 4 12:25:17 2013
New Revision: 1489409
URL: http://svn.apache.org/r1489409
Log:
Cleanup code with many little refactorings
Modified:
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitor.java
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishingEndpointListener.java
cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitorManagerTest.java
cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java
cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
cxf/dosgi/trunk/felix/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
cxf/dosgi/trunk/samples/discovery/client/src/main/java/org/apache/cxf/dosgi/samples/discovery/consumer/Activator.java
cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java
cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/GreetingPhrase.java
cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java
cxf/dosgi/trunk/samples/spring_dm/impl/src/main/java/org/apache/cxf/dosgi/samples/springdm/impl/DinnerServiceImpl.java
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitor.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitor.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitor.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitor.java Tue Jun 4 12:25:17 2013
@@ -218,7 +218,7 @@ public class InterfaceMonitor implements
LOG.debug("Got data for node: {}", node);
List<Element> elements = LocalDiscoveryUtils.getElements(new ByteArrayInputStream(data));
- if (elements.size() > 0) {
+ if (!elements.isEmpty()) {
return LocalDiscoveryUtils.getEndpointDescription(elements.get(0));
}
LOG.warn("No Discovery information found for node: {}", node);
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishingEndpointListener.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishingEndpointListener.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishingEndpointListener.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/PublishingEndpointListener.java Tue Jun 4 12:25:17 2013
@@ -125,8 +125,7 @@ public class PublishingEndpointListener
}
- private void removeEndpoint(EndpointDescription endpoint) throws UnknownHostException, URISyntaxException,
- InterruptedException, KeeperException {
+ private void removeEndpoint(EndpointDescription endpoint) throws UnknownHostException, URISyntaxException {
Collection<String> interfaces = endpoint.getInterfaces();
String endpointKey = getKey(endpoint.getId());
@@ -145,25 +144,21 @@ public class PublishingEndpointListener
private static void ensurePath(String path, ZooKeeper zk) throws KeeperException, InterruptedException {
StringBuilder current = new StringBuilder();
- String[] tree = path.split("/");
- for (int i = 0; i < tree.length; i++) {
- if (tree[i].length() == 0) {
- continue;
- }
-
+ String[] parts = Util.removeEmpty(path.split("/"));
+ for (String part : parts) {
current.append('/');
- current.append(tree[i]);
+ current.append(part);
if (zk.exists(current.toString(), false) == null) {
zk.create(current.toString(), new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
}
}
- static byte[] getData(Map<String, Object> props) throws IOException {
+ static byte[] getData(Map<String, Object> props) {
return LocalDiscoveryUtils.getEndpointDescriptionXML(props).getBytes();
}
- static String getKey(String endpoint) throws UnknownHostException, URISyntaxException {
+ static String getKey(String endpoint) throws URISyntaxException {
URI uri = new URI(endpoint);
StringBuilder sb = new StringBuilder();
Modified: cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitorManagerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitorManagerTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitorManagerTest.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/cxf-discovery/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/InterfaceMonitorManagerTest.java Tue Jun 4 12:25:17 2013
@@ -19,20 +19,23 @@
package org.apache.cxf.dosgi.discovery.zookeeper;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
+import java.util.Map;
import org.apache.zookeeper.ZooKeeper;
import org.easymock.IAnswer;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
+import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
-public class InterfaceMonitorManagerTest extends TestCase {
+import static org.junit.Assert.assertEquals;
+
+public class InterfaceMonitorManagerTest {
+ @Test
public void testEndpointListenerTrackerCustomizer() {
IMocksControl c = EasyMock.createNiceControl();
@@ -43,31 +46,31 @@ public class InterfaceMonitorManagerTest
ServiceReference sref = c.createMock(ServiceReference.class);
ServiceReference sref2 = c.createMock(ServiceReference.class);
- final Properties p = new Properties();
+ final Map<String, ?> p = new HashMap<String, Object>();
EasyMock.expect(sref.getPropertyKeys()).andAnswer(new IAnswer<String[]>() {
public String[] answer() throws Throwable {
- return p.keySet().toArray(new String[p.keySet().size()]);
+ return p.keySet().toArray(new String[p.size()]);
}
}).anyTimes();
EasyMock.expect(sref.getProperty((String)EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
String key = (String)(EasyMock.getCurrentArguments()[0]);
- return p.getProperty(key);
+ return p.get(key);
}
}).anyTimes();
EasyMock.expect(sref2.getPropertyKeys()).andAnswer(new IAnswer<String[]>() {
public String[] answer() throws Throwable {
- return p.keySet().toArray(new String[p.keySet().size()]);
+ return p.keySet().toArray(new String[p.size()]);
}
}).anyTimes();
EasyMock.expect(sref2.getProperty((String)EasyMock.anyObject())).andAnswer(new IAnswer<Object>() {
public Object answer() throws Throwable {
String key = (String)(EasyMock.getCurrentArguments()[0]);
- return p.getProperty(key);
+ return p.get(key);
}
}).anyTimes();
Modified: cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarter.java Tue Jun 4 12:25:17 2013
@@ -127,7 +127,7 @@ public class ZookeeperStarter implements
return config;
}
- protected void startFromConfig(final QuorumPeerConfig config) throws IOException, InterruptedException {
+ protected void startFromConfig(final QuorumPeerConfig config) {
int numServers = config.getServers().size();
if (numServers > 1) {
main = new MyQuorumPeerMain(config);
Modified: cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java (original)
+++ cxf/dosgi/trunk/discovery/distributed/zookeeper-server/src/test/java/org/apache/cxf/dosgi/discovery/zookeeper/server/ZookeeperStarterTest.java Tue Jun 4 12:25:17 2013
@@ -19,7 +19,6 @@
package org.apache.cxf.dosgi.discovery.zookeeper.server;
import java.io.File;
-import java.io.IOException;
import java.util.Dictionary;
import java.util.Hashtable;
@@ -35,7 +34,6 @@ import static org.easymock.EasyMock.expe
import static org.easymock.classextension.EasyMock.replay;
import static org.easymock.classextension.EasyMock.verify;
-
public class ZookeeperStarterTest extends TestCase {
public void testUpdateConfig() throws Exception {
final File tempDir = new File("target");
@@ -48,7 +46,7 @@ public class ZookeeperStarterTest extend
ZookeeperStarter starter = new ZookeeperStarter(bc) {
@Override
- protected void startFromConfig(QuorumPeerConfig config) throws IOException, InterruptedException {
+ protected void startFromConfig(QuorumPeerConfig config) {
assertEquals(1234, config.getClientPortAddress().getPort());
assertTrue(config.getDataDir().contains(tempDir + File.separator + "zkdata"));
assertEquals(2000, config.getTickTime());
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java Tue Jun 4 12:25:17 2013
@@ -390,7 +390,7 @@ public final class LocalDiscoveryUtils {
String iface = p.getAttributeValue(PROPERTY_INTERFACE_ATTRIBUTE);
if (key != null) {
- props.put(iface == null || iface.length() == 0
+ props.put(iface == null || iface.isEmpty()
? key
: key + INTERFACE_SEPARATOR + iface,
value);
@@ -437,9 +437,8 @@ public final class LocalDiscoveryUtils {
if (value instanceof Collection<?>) {
Collection<?> values = (Collection<?>) value;
List<String> result = new ArrayList<String>(values.size());
- for (Iterator<?> iter = values.iterator(); iter.hasNext();) {
- Object v = iter.next();
- if ((v != null) && (v instanceof String)) {
+ for (Object v : values) {
+ if (v instanceof String) {
result.add((String) v);
}
}
@@ -458,7 +457,7 @@ public final class LocalDiscoveryUtils {
rootEl.addContent(contentEl);
for (Map.Entry<String, Object> entry : m.entrySet()) {
- String key = entry.getKey().toString();
+ String key = entry.getKey();
Object val = entry.getValue();
Element propEl = new Element("property", ns);
@@ -491,7 +490,7 @@ public final class LocalDiscoveryUtils {
|| val instanceof Float
|| val instanceof Integer
|| val instanceof Short) {
- //various numbers.. maybe "val instanceof Number"?
+ // various numbers.. maybe "val instanceof Number"?
setValueType(propEl, val);
propEl.setAttribute("value", val.toString());
} else {
Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/internal/LocalDiscovery.java Tue Jun 4 12:25:17 2013
@@ -20,7 +20,6 @@ package org.apache.cxf.dosgi.discovery.l
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
@@ -128,7 +127,7 @@ public class LocalDiscovery implements B
EndpointListener listener) {
List<String> filters =
LocalDiscoveryUtils.getStringPlusProperty(reference, EndpointListener.ENDPOINT_LISTENER_SCOPE);
- if (filters.size() == 0) {
+ if (filters.isEmpty()) {
return filters;
}
@@ -237,13 +236,7 @@ public class LocalDiscovery implements B
private boolean filterMatches(String match, EndpointDescription ed) {
Filter filter = createFilter(match);
-
- Dictionary<String, Object> props =
- new Hashtable<String, Object>(ed.getProperties());
-
- return filter != null
- ? filter.match(props)
- : false;
+ return filter != null && filter.match(new Hashtable<String, Object>(ed.getProperties()));
}
private Filter createFilter(String filterValue) {
Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java (original)
+++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java Tue Jun 4 12:25:17 2013
@@ -136,21 +136,21 @@ public class LocalDiscoveryUtilsTest ext
normXML((String) props.get("someXML")));
assertEquals(Long.MAX_VALUE, props.get("long"));
- assertEquals(new Long(-1), props.get("long2"));
+ assertEquals(-1L, props.get("long2"));
assertEquals(Double.MAX_VALUE, props.get("double"));
- assertEquals(new Double(1.0d), props.get("Double2"));
- assertEquals(new Float(42.24f), props.get("float"));
- assertEquals(new Float(1.0f), props.get("Float2"));
- assertEquals(new Integer(17), props.get("int"));
- assertEquals(new Integer(42), props.get("Integer2"));
- assertEquals(new Byte((byte) 127), props.get("byte"));
- assertEquals(new Byte((byte) -128), props.get("Byte2"));
+ assertEquals(1.0d, props.get("Double2"));
+ assertEquals(42.24f, props.get("float"));
+ assertEquals(1.0f, props.get("Float2"));
+ assertEquals(17, props.get("int"));
+ assertEquals(42, props.get("Integer2"));
+ assertEquals((byte) 127, props.get("byte"));
+ assertEquals((byte) -128, props.get("Byte2"));
assertEquals(Boolean.TRUE, props.get("boolean"));
assertEquals(Boolean.TRUE, props.get("Boolean2"));
- assertEquals(new Short((short) 99), props.get("short"));
- assertEquals(new Short((short) -99), props.get("Short2"));
- assertEquals(new Character('@'), props.get("char"));
- assertEquals(new Character('X'), props.get("Character2"));
+ assertEquals((short) 99, props.get("short"));
+ assertEquals((short) -99, props.get("Short2"));
+ assertEquals('@', props.get("char"));
+ assertEquals('X', props.get("Character2"));
int [] intArray = (int []) props.get("int-array");
assertTrue(Arrays.equals(new int[] {1, 2}, intArray));
@@ -288,7 +288,7 @@ public class LocalDiscoveryUtilsTest ext
public static void drainStream(InputStream is, OutputStream os) throws IOException {
byte[] bytes = new byte[8192];
- int length = 0;
+ int length;
int offset = 0;
while ((length = is.read(bytes, offset, bytes.length - offset)) != -1) {
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Constants.java Tue Jun 4 12:25:17 2013
@@ -119,7 +119,7 @@ public final class Constants {
@Deprecated
public static final String USE_MASTER_MAP = "use.master.map";
- //DSW Identification - TODO do we really need this one?
+ // DSW Identification - TODO do we really need this one?
public static final String DSW_CLIENT_ID = PROVIDER_PREFIX + ".remote.dsw.client";
public static final String INTENT_NAME_PROP = "org.apache.cxf.dosgi.IntentName";
@@ -139,6 +139,6 @@ public final class Constants {
public static final String DEFAULT_CXF_SERVLET_ALIAS = "/cxf";
private Constants() {
- //never constructed
+ // never constructed
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImpl.java Tue Jun 4 12:25:17 2013
@@ -22,7 +22,6 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -103,10 +102,9 @@ public class ServiceDecoratorImpl implem
}
void removeDecorations(Bundle bundle) {
- for (Iterator<Rule> i = decorations.iterator(); i.hasNext();) {
- Rule r = i.next();
+ for (Rule r : decorations) {
if (bundle.equals(r.getBundle())) {
- decorations.remove(r); // The iterator doesn't support 'remove'
+ decorations.remove(r); // the iterator doesn't support 'remove'
}
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/AbstractPojoConfigurationTypeHandler.java Tue Jun 4 12:25:17 2013
@@ -36,6 +36,7 @@ import org.apache.cxf.dosgi.dsw.util.Osg
import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.AbstractFeature;
+import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.frontend.ClientFactoryBean;
import org.apache.cxf.frontend.ServerFactoryBean;
import org.apache.cxf.helpers.CastUtils;
@@ -115,21 +116,21 @@ public abstract class AbstractPojoConfig
}
}
- protected void setWsdlProperties(ServerFactoryBean factory, BundleContext callingContext, Map<String, Object> sd,
- boolean wsdlType) {
+ protected void setCommonWsdlProperties(AbstractWSDLBasedEndpointFactory factory, BundleContext context,
+ Map<String, Object> sd, boolean wsdlType) {
String location = OsgiUtils.getProperty(sd, wsdlType ? Constants.WSDL_LOCATION : Constants.WS_WSDL_LOCATION);
if (location != null) {
- URL wsdlURL = callingContext.getBundle().getResource(location);
+ URL wsdlURL = context.getBundle().getResource(location);
if (wsdlURL != null) {
factory.setWsdlURL(wsdlURL.toString());
}
- QName serviceName = getServiceQName(null, sd, wsdlType
- ? Constants.WSDL_SERVICE_NAMESPACE : Constants.WS_WSDL_SERVICE_NAMESPACE, wsdlType
- ? Constants.WSDL_SERVICE_NAME : Constants.WS_WSDL_SERVICE_NAME);
+ QName serviceName = getServiceQName(null, sd,
+ wsdlType ? Constants.WSDL_SERVICE_NAMESPACE : Constants.WS_WSDL_SERVICE_NAMESPACE,
+ wsdlType ? Constants.WSDL_SERVICE_NAME : Constants.WS_WSDL_SERVICE_NAME);
if (serviceName != null) {
factory.setServiceName(serviceName);
- QName portName = getPortQName(serviceName.getNamespaceURI(), sd, wsdlType
- ? Constants.WSDL_PORT_NAME : Constants.WS_WSDL_PORT_NAME);
+ QName portName = getPortQName(serviceName.getNamespaceURI(), sd,
+ wsdlType ? Constants.WSDL_PORT_NAME : Constants.WS_WSDL_PORT_NAME);
if (portName != null) {
factory.setEndpointName(portName);
}
@@ -137,26 +138,14 @@ public abstract class AbstractPojoConfig
}
}
+ protected void setWsdlProperties(ServerFactoryBean factory, BundleContext callingContext, Map<String, Object> sd,
+ boolean wsdlType) {
+ setCommonWsdlProperties(factory, callingContext, sd, wsdlType);
+ }
+
protected void setClientWsdlProperties(ClientFactoryBean factory, BundleContext dswContext, Map<String, Object> sd,
boolean wsdlType) {
- String location = OsgiUtils.getProperty(sd, wsdlType ? Constants.WSDL_LOCATION : Constants.WS_WSDL_LOCATION);
- if (location != null) {
- URL wsdlURL = dswContext.getBundle().getResource(location);
- if (wsdlURL != null) {
- factory.setWsdlURL(wsdlURL.toString());
- }
- QName serviceName = getServiceQName(null, sd, wsdlType
- ? Constants.WSDL_SERVICE_NAMESPACE : Constants.WS_WSDL_SERVICE_NAMESPACE, wsdlType
- ? Constants.WSDL_SERVICE_NAME : Constants.WS_WSDL_SERVICE_NAME);
- if (serviceName != null) {
- factory.setServiceName(serviceName);
- QName portName = getPortQName(serviceName.getNamespaceURI(), sd, wsdlType
- ? Constants.WSDL_PORT_NAME : Constants.WS_WSDL_PORT_NAME);
- if (portName != null) {
- factory.setEndpointName(portName);
- }
- }
- }
+ setCommonWsdlProperties(factory, dswContext, sd, wsdlType);
}
protected static QName getServiceQName(Class<?> iClass, Map<String, Object> sd, String nsPropName,
@@ -191,7 +180,7 @@ public abstract class AbstractPojoConfig
}
protected String getServerAddress(Map<String, Object> sd, Class<?> iClass) {
- String address = null;
+ String address;
try {
address = getClientAddress(sd, iClass);
} catch (RuntimeException e) {
@@ -242,8 +231,8 @@ public abstract class AbstractPojoConfig
boolean out = propName.contains("out.interceptors");
boolean inFault = propName.contains("in.fault.interceptors");
boolean outFault = propName.contains("out.fault.interceptors");
- for (int i = 0; i < providers.size(); i++) {
- Interceptor<?> interceptor = (Interceptor<?>)providers.get(i);
+ for (Object provider : providers) {
+ Interceptor<?> interceptor = (Interceptor<?>) provider;
if (in) {
factory.getInInterceptors().add(interceptor);
} else if (out) {
@@ -260,7 +249,7 @@ public abstract class AbstractPojoConfig
Map<String, Object> sd, String propName) {
List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
- if (providers.size() > 0) {
+ if (!providers.isEmpty()) {
factory.getFeatures().addAll(CastUtils.cast(providers, AbstractFeature.class));
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactory.java Tue Jun 4 12:25:17 2013
@@ -102,12 +102,12 @@ public class ConfigTypeHandlerFactory {
boolean hasSoapIntent = false;
if (intentsProperty != null) {
for (String intent : intentsProperty) {
- if (intent.indexOf("SOAP") > -1) {
+ if (intent.contains("SOAP")) {
hasSoapIntent = true;
break;
}
- if (intent.indexOf("HTTP") > -1) {
+ if (intent.contains("HTTP")) {
hasHttpIntent = true;
}
}
@@ -137,7 +137,7 @@ public class ConfigTypeHandlerFactory {
}
}
LOG.info("configuration types selected for export: " + configurationTypes);
- if (configurationTypes.size() == 0) {
+ if (configurationTypes.isEmpty()) {
throw new RuntimeException("the requested configuration types are not supported");
}
return configurationTypes;
@@ -157,7 +157,7 @@ public class ConfigTypeHandlerFactory {
}
}
- if (usableConfigurationTypes.size() == 0) {
+ if (usableConfigurationTypes.isEmpty()) {
throw new RuntimeException("The supplied endpoint has no compatible configuration type. "
+ "Supported types are: "
+ supportedConfigurationTypes
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ExportResult.java Tue Jun 4 12:25:17 2013
@@ -28,14 +28,12 @@ public class ExportResult {
private final Exception exception;
public ExportResult(Map<String, Object> endpointProps, Server server) {
- super();
this.endpointProps = endpointProps;
this.server = server;
this.exception = null;
}
public ExportResult(Map<String, Object> endpointProps, Exception ex) {
- super();
this.endpointProps = endpointProps;
this.server = null;
this.exception = ex;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/HttpServiceManager.java Tue Jun 4 12:25:17 2013
@@ -115,8 +115,8 @@ public class HttpServiceManager {
* This listens for service removal events and "un-exports" the service
* from the HttpService.
*
- * @param reference The service reference to track
- * @param alias The HTTP servlet context alias
+ * @param sref the service reference to track
+ * @param alias the HTTP servlet context alias
*/
private void registerUnexportHook(ServiceReference sref, String alias) {
final Long sid = (Long) sref.getProperty(org.osgi.framework.Constants.SERVICE_ID);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSPojoConfigurationTypeHandler.java Tue Jun 4 12:25:17 2013
@@ -21,8 +21,6 @@ package org.apache.cxf.dosgi.dsw.handler
import java.net.URL;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
import org.apache.cxf.Bus;
import org.apache.cxf.dosgi.dsw.Constants;
@@ -45,8 +43,6 @@ import org.slf4j.LoggerFactory;
public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
private static final Logger LOG = LoggerFactory.getLogger(JaxRSPojoConfigurationTypeHandler.class);
- Set<ServiceReference> httpServiceReferences = new CopyOnWriteArraySet<ServiceReference>();
-
public JaxRSPojoConfigurationTypeHandler(BundleContext dswBC,
IntentManager intentManager,
HttpServiceManager httpServiceManager) {
@@ -108,7 +104,7 @@ public class JaxRSPojoConfigurationTypeH
bean.setServiceClass(iClass);
}
List<Object> providers = JaxRSUtils.getProviders(callingContext, dswContext, sd.getProperties());
- if (providers != null && providers.size() > 0) {
+ if (providers != null && !providers.isEmpty()) {
bean.setProviders(providers);
}
Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
@@ -184,7 +180,7 @@ public class JaxRSPojoConfigurationTypeH
}
factory.setAddress(address);
List<Object> providers = JaxRSUtils.getProviders(callingContext, dswContext, sd);
- if (providers != null && providers.size() > 0) {
+ if (providers != null && !providers.isEmpty()) {
factory.setProviders(providers);
}
addRsInterceptorsFeaturesProps(factory, callingContext, sd);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSUtils.java Tue Jun 4 12:25:17 2013
@@ -79,8 +79,7 @@ public final class JaxRSUtils {
if (refs != null) {
for (ServiceReference ref : refs) {
if (!cxfProvidersOnly
- || cxfProvidersOnly
- && OsgiUtils.toBoolean(ref
+ || OsgiUtils.toBoolean(ref
.getProperty(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY))) {
providers.add(callingContext.getService(ref));
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/LocalHostUtil.java Tue Jun 4 12:25:17 2013
@@ -49,9 +49,9 @@ public final class LocalHostUtil {
return localHost;
}
InetAddress[] addrs = getAllLocalUsingNetworkInterface();
- for (int i = 0; i < addrs.length; i++) {
- if (!addrs[i].isLoopbackAddress() && !addrs[i].getHostAddress().contains(":")) {
- return addrs[i];
+ for (InetAddress addr : addrs) {
+ if (!addr.isLoopbackAddress() && !addr.getHostAddress().contains(":")) {
+ return addr;
}
}
return localHost;
@@ -70,7 +70,7 @@ public final class LocalHostUtil {
List<InetAddress> addresses = new ArrayList<InetAddress>();
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
while (e.hasMoreElements()) {
- NetworkInterface ni = (NetworkInterface) e.nextElement();
+ NetworkInterface ni = e.nextElement();
for (Enumeration<InetAddress> e2 = ni.getInetAddresses(); e2.hasMoreElements();) {
addresses.add(e2.nextElement());
}
@@ -81,19 +81,10 @@ public final class LocalHostUtil {
}
}
- public static Object getLocalHostAddress() {
- try {
- String host = LocalHostUtil.getLocalHost().getHostAddress();
- return (host == null) ? "localhost" : host;
- } catch (Exception e) {
- return "localhost";
- }
- }
-
public static String getLocalIp() {
String localIP;
try {
- localIP = LocalHostUtil.getLocalHost().getHostAddress();
+ localIP = getLocalHost().getHostAddress();
} catch (Exception e) {
localIP = "localhost";
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/WsdlConfigurationTypeHandler.java Tue Jun 4 12:25:17 2013
@@ -64,7 +64,7 @@ public class WsdlConfigurationTypeHandle
return null;
}
- URL wsdlAddress = null;
+ URL wsdlAddress;
try {
wsdlAddress = new URL(wsdlAddressProp);
} catch (MalformedURLException ex) {
@@ -91,7 +91,7 @@ public class WsdlConfigurationTypeHandle
Service service = createWebService(wsdlAddress, serviceQname);
Object proxy = getProxy(portQname == null ? service.getPort(iClass) : service.getPort(portQname, iClass),
iClass);
- //MARC: FIXME!!!! getDistributionProvider().addRemoteService(serviceReference);
+ // MARC: FIXME!!!! getDistributionProvider().addRemoteService(serviceReference);
return proxy;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImpl.java Tue Jun 4 12:25:17 2013
@@ -90,7 +90,7 @@ public class IntentManagerImpl implement
return false;
}
- private Collection<String> addSynonymIntents(Collection<String> appliedIntents,
+ private static Collection<String> addSynonymIntents(Collection<String> appliedIntents,
IntentMap map) {
// E.g. SOAP and SOAP.1_1 are synonyms
List<Object> values = new ArrayList<Object>();
@@ -100,20 +100,21 @@ public class IntentManagerImpl implement
return reverseLookup(map, values);
}
- private Collection<String> reverseLookup(IntentMap im, Object obj) {
+ private static Collection<String> reverseLookup(IntentMap im, Object obj) {
return reverseLookup(im, Collections.singleton(obj));
}
/**
- * Retrieves all keys that have a value that can be found in objs
- * @param intentMap
- * @param objs
- * @return
+ * Retrieves all keys whose mapped values are found in the given collection.
+ *
+ * @param im an intent map
+ * @param values a collection of potential values
+ * @return all keys whose mapped values are found in the given collection
*/
- private Collection<String> reverseLookup(IntentMap im, Collection<? extends Object> objs) {
+ private static Collection<String> reverseLookup(IntentMap im, Collection<?> values) {
Set<String> intentsFound = new HashSet<String>();
for (Map.Entry<String, Object> entry : im.entrySet()) {
- if (objs.contains(entry.getValue())) {
+ if (values.contains(entry.getValue())) {
intentsFound.add(entry.getKey());
}
}
@@ -132,7 +133,7 @@ public class IntentManagerImpl implement
}
}
long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
- if (unsupportedIntents.size() > 0 && remainingSeconds > 0) {
+ if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
LOG.debug("Waiting for custom intents " + unsupportedIntents + " timeout in " + remainingSeconds);
try {
synchronized (intentMap) {
@@ -142,9 +143,9 @@ public class IntentManagerImpl implement
LOG.warn(e.getMessage(), e);
}
}
- } while (unsupportedIntents.size() > 0 && System.currentTimeMillis() < endTime);
+ } while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
- if (unsupportedIntents.size() > 0) {
+ if (!unsupportedIntents.isEmpty()) {
throw new RuntimeException("service cannot be exported because the following "
+ "intents are not supported by this RSA: "
+ unsupportedIntents);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentMap.java Tue Jun 4 12:25:17 2013
@@ -37,7 +37,6 @@ public class IntentMap extends Concurren
}
public IntentMap(Map<String, Object> defaultMap) {
- super();
this.defaultMap = defaultMap;
putAll(defaultMap);
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUtils.java Tue Jun 4 12:25:17 2013
@@ -21,6 +21,7 @@ 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;
@@ -33,15 +34,13 @@ import org.osgi.service.remoteserviceadm
public final class IntentUtils {
private IntentUtils() {
- //never constructed
+ // never constructed
}
@SuppressWarnings("rawtypes")
public static String[] getIntentsImplementedByTheService(Map serviceProperties) {
// Get the Intents that are implemented by the service
- String[] serviceIntents = Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_INTENTS));
-
- return serviceIntents;
+ return Utils.normalizeStringPlus(serviceProperties.get(RemoteConstants.SERVICE_INTENTS));
}
public static String[] mergeArrays(String[] a1, String[] a2) {
@@ -53,11 +52,7 @@ public final class IntentUtils {
}
List<String> list = new ArrayList<String>(a1.length + a2.length);
-
- for (String s : a1) {
- list.add(s);
- }
-
+ Collections.addAll(list, a1);
for (String s : a2) {
if (!list.contains(s)) {
list.add(s);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java Tue Jun 4 12:25:17 2013
@@ -55,7 +55,7 @@ public class ClientServiceFactory implem
}
public Object getService(final Bundle requestingBundle, final ServiceRegistration sreg) {
- String interfaceName = sd.getInterfaces() != null && sd.getInterfaces().size() > 0 ? (String)sd
+ String interfaceName = sd.getInterfaces() != null && !sd.getInterfaces().isEmpty() ? (String)sd
.getInterfaces().toArray()[0] : null;
LOG.debug("getService() from serviceFactory for {}", interfaceName);
@@ -91,7 +91,7 @@ public class ClientServiceFactory implem
if (objectClass != null) {
sb.append(", interfaces: ");
for (String s : (String[])objectClass) {
- sb.append(" " + s);
+ sb.append(' ').append(s);
}
}
LOG.info(sb.toString());
@@ -118,9 +118,4 @@ public class ClientServiceFactory implem
}
}
}
-
- public boolean isCloseable() {
- return closeable;
- }
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java Tue Jun 4 12:25:17 2013
@@ -76,7 +76,7 @@ public class EventAdminHelper {
epd = ((ImportRegistrationImpl)rsae.getImportReference()).getImportedEndpointAlways();
setIfNotNull(props, "import.registration", epd);
} else if (rsae.getExportReference() != null) {
- epd = ((ExportReferenceImpl)rsae.getExportReference()).getExportedEndpoint();
+ epd = rsae.getExportReference().getExportedEndpoint();
setIfNotNull(props, "export.registration", epd);
}
@@ -125,7 +125,7 @@ public class EventAdminHelper {
}
static String remoteServiceAdminEventTypeToString(int type) {
- String retval = null;
+ String retval;
switch (type) {
case RemoteServiceAdminEvent.EXPORT_ERROR:
retval = "EXPORT_ERROR";
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java Tue Jun 4 12:25:17 2013
@@ -83,7 +83,7 @@ public class EventProducer {
}
protected void publishNotifcation(ImportRegistration ir) {
- RemoteServiceAdminEvent rsae = null;
+ RemoteServiceAdminEvent rsae;
if (ir.getException() != null) {
rsae = new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_ERROR, bctx.getBundle(),
ir.getImportReference(), ir.getException());
@@ -97,7 +97,7 @@ public class EventProducer {
}
public void notifyRemoval(ExportRegistration eri) {
- RemoteServiceAdminEvent rsae = null;
+ RemoteServiceAdminEvent rsae;
rsae = new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_UNREGISTRATION, bctx.getBundle(),
eri.getExportReference(), eri.getException());
@@ -107,9 +107,8 @@ public class EventProducer {
public void notifyRemoval(ImportRegistration eri) {
- RemoteServiceAdminEvent rsae = null;
- rsae = new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_UNREGISTRATION, bctx.getBundle(),
- eri.getImportReference(), eri.getException());
+ RemoteServiceAdminEvent rsae = new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_UNREGISTRATION,
+ bctx.getBundle(), eri.getImportReference(), eri.getException());
notifyListeners(rsae);
eaHelper.notifyEventAdmin(rsae);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java Tue Jun 4 12:25:17 2013
@@ -318,7 +318,7 @@ public class RemoteServiceAdminCore impl
synchronized (importedServices) {
Collection<ImportRegistrationImpl> imRegs = importedServices.get(endpoint);
- if (imRegs != null && imRegs.size() > 0) {
+ if (imRegs != null && !imRegs.isEmpty()) {
LOG.debug("creating copy of existing import registrations");
ImportRegistrationImpl irParent = imRegs.iterator().next();
ImportRegistrationImpl ir = new ImportRegistrationImpl(irParent);
@@ -412,7 +412,7 @@ public class RemoteServiceAdminCore impl
if (er.equals(eri)) {
eventProducer.notifyRemoval(eri);
it2.remove();
- if (value.size() == 0) {
+ if (value.isEmpty()) {
it.remove();
}
return;
@@ -456,7 +456,7 @@ public class RemoteServiceAdminCore impl
LOG.error("An importRegistration was intended to be removed form internal management "
+ "structure but couldn't be found in it!");
}
- if (imRegs == null || imRegs.size() == 0) {
+ if (imRegs == null || imRegs.isEmpty()) {
importedServices.remove(iri.getImportedEndpointAlways());
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/ClassUtils.java Tue Jun 4 12:25:17 2013
@@ -121,7 +121,7 @@ public final class ClassUtils {
for (String className : classNames) {
try {
String realName = className.trim();
- if (realName.length() > 0) {
+ if (!realName.isEmpty()) {
Class<?> pClass = callingContext.getBundle().loadClass(realName);
providers.add(pClass.newInstance());
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/OsgiUtils.java Tue Jun 4 12:25:17 2013
@@ -41,26 +41,23 @@ public final class OsgiUtils {
private OsgiUtils() {
}
- // TODO : move these property helpers into PropertyUtils ?
+ // TODO : move these property helpers into PropertyUtils?
@SuppressWarnings("rawtypes")
public static boolean getBooleanProperty(Map sd, String name) {
- Object value = sd.get(name);
- return toBoolean(value);
+ return toBoolean(sd.get(name));
}
public static boolean toBoolean(Object value) {
- return value instanceof Boolean && ((Boolean)value).booleanValue() || value instanceof String
- && Boolean.parseBoolean((String)value);
+ return value instanceof Boolean && (Boolean) value
+ || value instanceof String && Boolean.parseBoolean((String)value);
}
@SuppressWarnings("unchecked")
public static Collection<String> getMultiValueProperty(Object property) {
if (property == null) {
return null;
- }
-
- if (property instanceof Collection) {
+ } else if (property instanceof Collection) {
return (Collection<String>)property;
} else if (property instanceof String[]) {
return Arrays.asList((String[])property);
@@ -70,29 +67,18 @@ public final class OsgiUtils {
}
public static String getProperty(EndpointDescription sd, String name) {
- Object o = sd.getProperties().get(name);
-
- if (o instanceof String) {
- return (String)o;
- }
-
- return null;
-
+ return getProperty(sd.getProperties(), name);
}
@SuppressWarnings("rawtypes")
public static String getProperty(Map dict, String name) {
Object o = dict.get(name);
-
- if (o instanceof String) {
- return (String)o;
- }
- return null;
+ return o instanceof String ? (String) o : null;
}
public static String getFirstNonEmptyStringProperty(@SuppressWarnings("rawtypes") Map dict, String ... keys) {
for (String key : keys) {
- String value = getStringProperty(dict, key);
+ String value = getProperty(dict, key);
if (value != null) {
return value;
}
@@ -100,16 +86,6 @@ public final class OsgiUtils {
return null;
}
- @SuppressWarnings("rawtypes")
- private static String getStringProperty(Map dict, String name) {
- Object o = dict.get(name);
-
- if (o instanceof String) {
- return (String)o;
- }
- return null;
- }
-
/**
* Tries to retrieve the version of iClass via the PackageAdmin
*
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java Tue Jun 4 12:25:17 2013
@@ -29,7 +29,7 @@ public final class Utils {
private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
private Utils() {
- //never constructed
+ // never constructed
}
@SuppressWarnings("rawtypes")
@@ -41,7 +41,7 @@ public final class Utils {
List<String> list = new ArrayList<String>();
for (String val : values) {
String actualValue = val.trim();
- if (actualValue.length() > 0) {
+ if (!actualValue.isEmpty()) {
list.add(actualValue);
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRuleTest.java Tue Jun 4 12:25:17 2013
@@ -73,7 +73,7 @@ public class InterfaceRuleTest extends T
Map<String, Object> m = new HashMap<String, Object>();
ir.apply(sref, m);
Map<String, Object> expected = new HashMap<String, Object>();
- expected.put("x", new Integer(1));
+ expected.put("x", 1);
expected.put("aaa.bbb", Boolean.TRUE);
assertEquals(expected, m);
}
@@ -112,7 +112,7 @@ public class InterfaceRuleTest extends T
ir.addProperty("x", "1", Long.class.getName());
final Map<String, Object> serviceProps = new HashMap<String, Object>();
- serviceProps.put("test.int", new Integer(42));
+ serviceProps.put("test.int", 42);
serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
@@ -121,7 +121,7 @@ public class InterfaceRuleTest extends T
m.put("aaa.bbb", Boolean.TRUE);
ir.apply(sref, m);
Map<String, Object> expected = new HashMap<String, Object>();
- expected.put("x", new Long(1));
+ expected.put("x", 1L);
expected.put("aaa.bbb", Boolean.TRUE);
assertEquals(expected, m);
}
@@ -132,7 +132,7 @@ public class InterfaceRuleTest extends T
ir.addProperty("x", "1", Long.class.getName());
final Map<String, Object> serviceProps = new HashMap<String, Object>();
- serviceProps.put("test.int", new Integer(51));
+ serviceProps.put("test.int", 51);
serviceProps.put(Constants.OBJECTCLASS, new String [] {"org.apache.Foo"});
ServiceReference sref = mockServiceReference(serviceProps);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecoratorImplTest.java Tue Jun 4 12:25:17 2013
@@ -150,7 +150,7 @@ public class ServiceDecoratorImplTest ex
Map<String, Object> actual = testDecorate(serviceProps, r1, r2);
Map<String, Object> expected = new HashMap<String, Object>();
expected.put("A", "B");
- expected.put("C", new Integer(2));
+ expected.put("C", 2);
assertEquals(expected, actual);
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContextTest.java Tue Jun 4 12:25:17 2013
@@ -225,7 +225,7 @@ class CommitResponseFilter implements Fi
throws java.io.IOException, javax.servlet.ServletException {
called = true;
response.getWriter().write("committing the response");
- };
+ }
}
class DoNothingFilter implements Filter {
@@ -241,7 +241,7 @@ class DoNothingFilter implements Filter
throws java.io.IOException, javax.servlet.ServletException {
called = true;
chain.doFilter(request, response);
- };
+ }
}
class AccessDeniedFilter implements Filter {
@@ -257,5 +257,5 @@ class AccessDeniedFilter implements Filt
throws java.io.IOException, javax.servlet.ServletException {
called = true;
((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
- };
+ }
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentManagerImplTest.java Tue Jun 4 12:25:17 2013
@@ -167,7 +167,8 @@ public class IntentManagerImplTest exten
assertTrue(effectiveIntents.contains("SOAP"));
assertTrue(effectiveIntents.contains("SOAP.1_1"));
}
-
+
+ @Test
public void testExplicitBindingIntent() {
IMocksControl control = EasyMock.createNiceControl();
@@ -197,7 +198,7 @@ public class IntentManagerImplTest exten
assertTrue(effectiveIntents.contains("A"));
assertTrue(effectiveIntents.contains("SOAP.1_2"));
}
-
+
public void testInheritMasterIntentMapDefault() {
List<String> features = runTestInheritMasterIntentMap("A B");
@@ -205,7 +206,7 @@ public class IntentManagerImplTest exten
assertTrue(features.contains("appFeatureA"));
assertTrue(features.contains("masterFeatureB"));
}
-
+
public void testInheritMasterIntentMap() {
List<String> features = runTestInheritMasterIntentMap("A B");
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java Tue Jun 4 12:25:17 2013
@@ -74,13 +74,13 @@ public class EventProducerTest {
Assert.assertEquals("org/osgi/service/remoteserviceadmin/EXPORT_REGISTRATION", event.getTopic());
Assert.assertSame(bundle, event.getProperty("bundle"));
- Assert.assertEquals(new Long(42), event.getProperty("bundle.id"));
+ Assert.assertEquals(42L, event.getProperty("bundle.id"));
Assert.assertEquals("test.bundle", event.getProperty("bundle.symbolicname"));
Assert.assertEquals(new Version(1, 2, 3, "test"), event.getProperty("bundle.version"));
Assert.assertNull(event.getProperty("cause"));
Assert.assertEquals(endpoint, event.getProperty("export.registration"));
- Assert.assertEquals(new Long(Long.MAX_VALUE), event.getProperty("service.remote.id"));
+ Assert.assertEquals(Long.MAX_VALUE, event.getProperty("service.remote.id"));
Assert.assertEquals(uuid, event.getProperty("service.remote.uuid"));
Assert.assertEquals("foo://bar", event.getProperty("service.remote.uri"));
Assert.assertTrue(Arrays.equals(interfaces.toArray(new String[] {}),
@@ -144,7 +144,7 @@ public class EventProducerTest {
Assert.assertEquals("org/osgi/service/remoteserviceadmin/EXPORT_ERROR", event.getTopic());
Assert.assertSame(bundle, event.getProperty("bundle"));
- Assert.assertEquals(new Long(42), event.getProperty("bundle.id"));
+ Assert.assertEquals(42L, event.getProperty("bundle.id"));
Assert.assertEquals("test.bundle", event.getProperty("bundle.symbolicname"));
Assert.assertEquals(new Version("0"), event.getProperty("bundle.version"));
Assert.assertSame(exportException, event.getProperty("cause"));
Modified: cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java Tue Jun 4 12:25:17 2013
@@ -138,7 +138,7 @@ public class TopologyManagerExport {
protected void doExportService(final ServiceReference sref) {
endpointRepo.addService(sref);
List<RemoteServiceAdmin> rsaList = remoteServiceAdminTracker.getList();
- if (rsaList.size() == 0) {
+ if (rsaList.isEmpty()) {
LOG.error(
"No RemoteServiceAdmin available! Unable to export service from bundle {}, interfaces: {}",
sref.getBundle().getSymbolicName(),
Modified: cxf/dosgi/trunk/felix/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/felix/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/felix/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java (original)
+++ cxf/dosgi/trunk/felix/shell.tui/src/main/java/org/apache/felix/shell/tui/Activator.java Tue Jun 4 12:25:17 2013
@@ -112,7 +112,7 @@ public class Activator implements Bundle
}
public void run() {
- String line = null;
+ String line;
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
while (!stop) {
@@ -137,7 +137,7 @@ public class Activator implements Bundle
line = line.trim();
- if (line.length() == 0) {
+ if (line.isEmpty()) {
continue;
}
@@ -150,7 +150,7 @@ public class Activator implements Bundle
BufferedReader reader = new BufferedReader(new FileReader(commands));
String command = reader.readLine().trim();
while (command != null) {
- if (command.length() > 0) {
+ if (!command.isEmpty()) {
System.out.println("\nexecuting: " + command);
shell.executeCommand(command.trim(), System.out, System.err);
}
Modified: cxf/dosgi/trunk/samples/discovery/client/src/main/java/org/apache/cxf/dosgi/samples/discovery/consumer/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/discovery/client/src/main/java/org/apache/cxf/dosgi/samples/discovery/consumer/Activator.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/discovery/client/src/main/java/org/apache/cxf/dosgi/samples/discovery/consumer/Activator.java (original)
+++ cxf/dosgi/trunk/samples/discovery/client/src/main/java/org/apache/cxf/dosgi/samples/discovery/consumer/Activator.java Tue Jun 4 12:25:17 2013
@@ -18,7 +18,6 @@
*/
package org.apache.cxf.dosgi.samples.discovery.consumer;
-import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@@ -66,8 +65,7 @@ public class Activator implements Bundle
counter++;
String text = "some text " + counter;
System.out.println("Sending text to displays: " + text);
- for (Iterator<Entry<DisplayService, String>> it = displays.entrySet().iterator(); it.hasNext();) {
- Entry<DisplayService, String> entry = it.next();
+ for (Entry<DisplayService, String> entry : displays.entrySet()) {
try {
entry.getKey().displayText(text);
} catch (Throwable th) {
Modified: cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java (original)
+++ cxf/dosgi/trunk/samples/discovery/impl/src/main/java/org/apache/cxf/dosgi/samples/discovery/impl/Activator.java Tue Jun 4 12:25:17 2013
@@ -48,7 +48,7 @@ public class Activator implements Bundle
new DisplayServiceImpl(host + ":" + port), props);
}
- private static String getAddress(String host, int port) throws Exception {
+ private static String getAddress(String host, int port) {
return "http://" + host + ":" + port + "/display";
}
Modified: cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/GreetingPhrase.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/GreetingPhrase.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/GreetingPhrase.java (original)
+++ cxf/dosgi/trunk/samples/greeter/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/GreetingPhrase.java Tue Jun 4 12:25:17 2013
@@ -43,10 +43,8 @@ public class GreetingPhrase {
@Override
public boolean equals(Object other) {
- if (!GreetingPhrase.class.isAssignableFrom(other.getClass())) {
- return false;
- }
-
- return phrase.equals(((GreetingPhrase)other).phrase);
+ return GreetingPhrase.class.isAssignableFrom(other.getClass())
+ && phrase.equals(((GreetingPhrase) other).phrase);
+
}
}
Modified: cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java (original)
+++ cxf/dosgi/trunk/samples/greeter_rest/interface/src/main/java/org/apache/cxf/dosgi/samples/greeter/rest/GreetingPhrase.java Tue Jun 4 12:25:17 2013
@@ -56,11 +56,9 @@ public class GreetingPhrase {
@Override
public boolean equals(Object other) {
- if (!GreetingPhrase.class.isAssignableFrom(other.getClass())) {
- return false;
- }
-
- return phrase.equals(((GreetingPhrase)other).phrase)
- && name.equals(((GreetingPhrase)other).name);
+ return GreetingPhrase.class.isAssignableFrom(other.getClass())
+ && phrase.equals(((GreetingPhrase) other).phrase)
+ && name.equals(((GreetingPhrase) other).name);
+
}
}
Modified: cxf/dosgi/trunk/samples/spring_dm/impl/src/main/java/org/apache/cxf/dosgi/samples/springdm/impl/DinnerServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/spring_dm/impl/src/main/java/org/apache/cxf/dosgi/samples/springdm/impl/DinnerServiceImpl.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/samples/spring_dm/impl/src/main/java/org/apache/cxf/dosgi/samples/springdm/impl/DinnerServiceImpl.java (original)
+++ cxf/dosgi/trunk/samples/spring_dm/impl/src/main/java/org/apache/cxf/dosgi/samples/springdm/impl/DinnerServiceImpl.java Tue Jun 4 12:25:17 2013
@@ -25,12 +25,11 @@ import org.apache.cxf.dosgi.samples.spri
import org.apache.cxf.dosgi.samples.springdm.Restaurant;
public class DinnerServiceImpl implements DinnerService {
- List<Restaurant> restaurants
- = Arrays.<Restaurant>asList(
- new Restaurant("Jojo's", "1 food way", 3),
- new Restaurant("Boohaa's", "95 forage ave", 1),
- new Restaurant("MicMac", "Plastic Plaza", 1)
- );
+ List<Restaurant> restaurants = Arrays.asList(
+ new Restaurant("Jojo's", "1 food way", 3),
+ new Restaurant("Boohaa's", "95 forage ave", 1),
+ new Restaurant("MicMac", "Plastic Plaza", 1)
+ );
public List<Restaurant> findRestaurants(String query) {
System.out.println("Hey! Someone's using the Dinner Service! Query: " + query);
Modified: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java (original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java Tue Jun 4 12:25:17 2013
@@ -34,7 +34,7 @@ public class AbstractDosgiTest {
protected ServiceReference waitService(BundleContext bc, Class<?> cls, String filter, int timeout)
throws Exception {
- ServiceReference[] refs = null;
+ ServiceReference[] refs;
for (int i = 0; i < timeout; i++) {
refs = bc.getServiceReferences(cls.getName(), filter);
if (refs != null && refs.length > 0) {
Modified: cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java?rev=1489409&r1=1489408&r2=1489409&view=diff
==============================================================================
--- cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java (original)
+++ cxf/dosgi/trunk/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java Tue Jun 4 12:25:17 2013
@@ -114,7 +114,7 @@ public final class MultiBundleTools {
private static Option[] getDistroBundleOptions(boolean b) throws Exception {
Map<Integer, String> bundles = new TreeMap<Integer, String>();
- MultiBundleTools.getDistroBundles(bundles, true);
+ getDistroBundles(bundles, true);
List<Option> opts = new ArrayList<Option>();
for (Map.Entry<Integer, String> entry : bundles.entrySet()) {
String bundleUri = entry.getValue();