You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2017/06/19 15:34:07 UTC
[03/11] aries-jax-rs-whiteboard git commit: Revert "Register services
in order"
Revert "Register services in order"
This reverts commit 32396a87fd90de88f5472e0c21354ce5da5a246b.
Project: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/repo
Commit: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/commit/e788939c
Tree: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/tree/e788939c
Diff: http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/diff/e788939c
Branch: refs/heads/master
Commit: e788939ce5ca7c419b028b4c53e346710b43727b
Parents: 3f44291
Author: Carlos Sierra <cs...@apache.org>
Authored: Mon Jun 19 17:30:38 2017 +0200
Committer: Carlos Sierra <cs...@apache.org>
Committed: Mon Jun 19 17:30:38 2017 +0200
----------------------------------------------------------------------
.../internal/CXFJaxRsServiceRegistrator.java | 35 ++++++--------------
.../aries/jax/rs/whiteboard/internal/Utils.java | 10 +++---
2 files changed, 14 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/e788939c/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/CXFJaxRsServiceRegistrator.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/CXFJaxRsServiceRegistrator.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/CXFJaxRsServiceRegistrator.java
index 57e095a..dd91521 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/CXFJaxRsServiceRegistrator.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/CXFJaxRsServiceRegistrator.java
@@ -19,11 +19,9 @@ package org.apache.aries.jax.rs.whiteboard.internal;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.TreeSet;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.RuntimeDelegate;
@@ -49,8 +47,7 @@ public class CXFJaxRsServiceRegistrator {
private final Map<String, Object> _properties;
private final Collection<Object> _providers = new ArrayList<>();
private Server _server;
- private final Collection<ResourceInformation<ServiceReference<?>>>
- _services = new TreeSet<>(Comparator.reverseOrder());
+ private final Collection<ResourceInformation> _services = new ArrayList<>();
private static final String CXF_ENDPOINT_ADDRESS = "CXF_ENDPOINT_ADDRESS";
@@ -196,46 +193,34 @@ public class CXFJaxRsServiceRegistrator {
String address = safeToString(_properties.get(CXF_ENDPOINT_ADDRESS));
- jaxRsServerFactoryBean.setAddress(address);
+ if (address != null) {
+ jaxRsServerFactoryBean.setAddress(address);
+ }
_server = jaxRsServerFactoryBean.create();
_server.start();
}
- public static class ResourceInformation<T extends Comparable<? super T>>
- implements Comparable<ResourceInformation<T>> {
-
- private final String _prefixPath;
- private final T _comparable;
+ public static class ResourceInformation {
+ private final String prefixPath;
private final ResourceProvider _resourceProvider;
public ResourceInformation(
- T comparable, String prefixPath,
- ResourceProvider resourceProvider) {
+ String prefixPath, ResourceProvider resourceProvider) {
- _comparable = comparable;
-
- _resourceProvider = resourceProvider;
+ this.prefixPath = prefixPath;
+ this._resourceProvider = resourceProvider;
}
public String getPrefixPath() {
- return _prefixPath;
+ return prefixPath;
}
public ResourceProvider getResourceProvider() {
return _resourceProvider;
}
- @Override
- public int compareTo(ResourceInformation<T> resourceInformation) {
- if (resourceInformation == null) {
- return 1;
- }
-
- return _comparable.compareTo(resourceInformation._comparable);
- }
-
}
}
http://git-wip-us.apache.org/repos/asf/aries-jax-rs-whiteboard/blob/e788939c/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Utils.java
----------------------------------------------------------------------
diff --git a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Utils.java b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Utils.java
index 0836ac0..0951f6e 100644
--- a/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Utils.java
+++ b/jax-rs.whiteboard/src/main/java/org/apache/aries/jax/rs/whiteboard/internal/Utils.java
@@ -23,7 +23,6 @@ import org.apache.cxf.Bus;
import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
import org.apache.cxf.message.Message;
import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
import org.osgi.framework.ServiceObjects;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.wiring.BundleWiring;
@@ -130,9 +129,8 @@ public class Utils {
try {
thread.setContextClassLoader(classLoader);
- ResourceInformation<ServiceReference<?>> resourceInformation =
- new ResourceInformation<>(
- serviceReference, resourceBase, resourceProvider);
+ ResourceInformation resourceInformation = new ResourceInformation(
+ resourceBase, resourceProvider);
registrator.add(resourceInformation);
return just(resourceInformation);
}
@@ -141,8 +139,8 @@ public class Utils {
}
}
- public static String safeToString(Object object) {
- return object == null ? "" : object.toString();
+ public static String safeToString(Object resourceBaseObject) {
+ return resourceBaseObject == null ? "" : resourceBaseObject.toString();
}
public static <T> ResourceProvider getResourceProvider(