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/05 02:40:58 UTC
svn commit: r1489675 [3/7] - in /cxf/dosgi/trunk: ./ discovery/
discovery/distributed/ discovery/distributed/cxf-discovery/
discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/
discovery/distributed/cxf-discovery/...
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -21,6 +21,7 @@ package org.apache.cxf.dosgi.dsw;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
public final class Constants {
+
// Constants from RFC 119, they should ultimately be picked up from an OSGi class.
@Deprecated
public static final String EXPORTED_INTERFACES = RemoteConstants.SERVICE_EXPORTED_INTERFACES;
@@ -30,23 +31,23 @@ public final class Constants {
@Deprecated
public static final String EXPORTED_CONFIGS = RemoteConstants.SERVICE_EXPORTED_CONFIGS;
@Deprecated
- public static final String EXPORTED_CONFIGS_OLD = "osgi.remote.configuration.type"; // for BW comp.
-
+ public static final String EXPORTED_CONFIGS_OLD = "osgi.remote.configuration.type"; // for BW compatibility
+
@Deprecated
public static final String EXPORTED_INTENTS = RemoteConstants.SERVICE_EXPORTED_INTENTS;
@Deprecated
public static final String EXPORTED_INTENTS_EXTRA = RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA;
@Deprecated
public static final String EXPORTED_INTENTS_OLD = "osgi.remote.requires.intents";
-
+
@Deprecated
public static final String IMPORTED = RemoteConstants.SERVICE_IMPORTED;
@Deprecated
public static final String IMPORTD_CONFIGS = RemoteConstants.SERVICE_IMPORTED_CONFIGS;
-
+
@Deprecated
public static final String INTENTS = RemoteConstants.SERVICE_INTENTS;
-
+
// WSDL
public static final String WSDL_CONFIG_TYPE = "wsdl";
public static final String WSDL_CONFIG_PREFIX = "osgi.remote.configuration" + "." + WSDL_CONFIG_TYPE;
@@ -57,7 +58,7 @@ public final class Constants {
public static final String WSDL_HTTP_SERVICE_CONTEXT = WSDL_CONFIG_PREFIX + ".httpservice.context";
// Provider prefix
public static final String PROVIDER_PREFIX = "org.apache.cxf";
-
+
// WS
public static final String WS_CONFIG_TYPE = PROVIDER_PREFIX + ".ws";
public static final String WS_ADDRESS_PROPERTY = WS_CONFIG_TYPE + ".address";
@@ -79,10 +80,10 @@ public final class Constants {
public static final String WS_DATA_BINDING_JAXB = "jaxb";
public static final String WS_DATA_BINDING_AEGIS = "aegis";
- public static final String WS_WSDL_SERVICE_NAMESPACE = WS_CONFIG_TYPE + ".service.ns";
- public static final String WS_WSDL_SERVICE_NAME = WS_CONFIG_TYPE + ".service.name";
- public static final String WS_WSDL_PORT_NAME = WS_CONFIG_TYPE + ".port.name";
- public static final String WS_WSDL_LOCATION = WS_CONFIG_TYPE + ".wsdl.location";
+ public static final String WS_WSDL_SERVICE_NAMESPACE = WS_CONFIG_TYPE + ".service.ns";
+ public static final String WS_WSDL_SERVICE_NAME = WS_CONFIG_TYPE + ".service.name";
+ public static final String WS_WSDL_PORT_NAME = WS_CONFIG_TYPE + ".port.name";
+ public static final String WS_WSDL_LOCATION = WS_CONFIG_TYPE + ".wsdl.location";
// Rest
public static final String RS_CONFIG_TYPE = PROVIDER_PREFIX + ".rs";
public static final String RS_ADDRESS_PROPERTY = RS_CONFIG_TYPE + ".address";
@@ -102,11 +103,11 @@ public final class Constants {
public static final String WS_CONFIG_TYPE_OLD = "pojo";
public static final String WS_CONFIG_OLD_PREFIX = "osgi.remote.configuration." + WS_CONFIG_TYPE_OLD;
public static final String WS_ADDRESS_PROPERTY_OLD = WS_CONFIG_OLD_PREFIX + ".address";
- public static final String WS_HTTP_SERVICE_CONTEXT_OLD = WS_CONFIG_OLD_PREFIX + ".httpservice.context";
+ public static final String WS_HTTP_SERVICE_CONTEXT_OLD = WS_CONFIG_OLD_PREFIX + ".httpservice.context";
// Common Configuration Properties
public static final String CHECK_BUNDLE = "check.bundle";
-
+
// The following constants are not evaluated anymore
@Deprecated
public static final String DEFAULT_PORT_CONFIG = "default.port";
@@ -118,26 +119,26 @@ public final class Constants {
public static final String DEFAULT_HOST_VALUE = "localhost";
@Deprecated
public static final String USE_MASTER_MAP = "use.master.map";
-
+
// 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";
-
+
/**
* Prefix to create an absolute URL from a relative URL.
- * See HttpServiceManager.getAbsoluteAddress
- *
+ * See HttpServiceManager.getAbsoluteAddress
+ *
* Defaults to: http://<host name>:8181
*/
public static final String HTTP_BASE = "httpBase";
-
+
/**
* Name of the cxf servlet alias
*/
public static final String CXF_SERVLET_ALIAS = "cxfServletAlias";
public static final String DEFAULT_CXF_SERVLET_ALIAS = "/cxf";
-
+
private Constants() {
// never constructed
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/InterfaceRule.java Wed Jun 5 00:40:54 2013
@@ -31,13 +31,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class InterfaceRule implements Rule {
+
private static final Logger LOG = LoggerFactory.getLogger(InterfaceRule.class);
-
+
private final Bundle bundle;
private final Pattern matchPattern;
private final Map<String, String> propMatches = new HashMap<String, String>();
private final Map<String, Object> addProps = new HashMap<String, Object>();
-
+
public InterfaceRule(Bundle b, String im) {
bundle = b;
matchPattern = Pattern.compile(im);
@@ -49,26 +50,26 @@ public class InterfaceRule implements Ru
public synchronized void addProperty(String name, String value, String type) {
Object obj = value;
-
+
if (!String.class.getName().equals(type)) {
try {
Class<?> cls = getClass().getClassLoader().loadClass(type);
- Constructor<?> ctor = cls.getConstructor(new Class [] {String.class});
+ Constructor<?> ctor = cls.getConstructor(new Class[] {String.class});
obj = ctor.newInstance(value);
} catch (Throwable th) {
- LOG.warn("Could not handle property '" + name
+ LOG.warn("Could not handle property '" + name
+ "' with value '" + value + "' of type: " + type, th);
return;
}
}
-
+
addProps.put(name, obj);
}
public synchronized void apply(ServiceReference sref, Map<String, Object> target) {
- String [] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
+ String[] objectClass = (String[]) sref.getProperty(Constants.OBJECTCLASS);
boolean matches = false;
- for (String cls : objectClass) {
+ for (String cls : objectClass) {
Matcher m = matchPattern.matcher(cls);
if (m.matches()) {
for (Map.Entry<String, String> pm : propMatches.entrySet()) {
@@ -87,12 +88,12 @@ public class InterfaceRule implements Ru
if (!matches) {
return;
}
-
+
LOG.info("Adding the following properties to " + sref + ": " + addProps);
target.putAll(addProps);
}
public Bundle getBundle() {
return bundle;
- }
+ }
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/Rule.java Wed Jun 5 00:40:54 2013
@@ -24,14 +24,17 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
public interface Rule {
- /** When the ServiceReference passed in matches the rule's condition,
+
+ /**
+ * When the ServiceReference passed in matches the rule's condition,
* set the additional properties in the target.
* @param sref The Service Reference to be checked.
* @param target Any additional properties are to be set in this map.
*/
void apply(ServiceReference sref, Map<String, Object> target);
-
- /** Returns the bundle that provided this rule.
+
+ /**
+ * Returns the bundle that provided this rule.
* @return The Bundle where the Rule was defined.
*/
Bundle getBundle();
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/decorator/ServiceDecorator.java Wed Jun 5 00:40:54 2013
@@ -23,5 +23,6 @@ import java.util.Map;
import org.osgi.framework.ServiceReference;
public interface ServiceDecorator {
+
void decorate(ServiceReference sref, Map<String, Object> properties);
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -39,8 +39,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServiceDecoratorImpl implements ServiceDecorator {
+
private static final Logger LOG = LoggerFactory.getLogger(ServiceDecoratorImpl.class);
-
+
final List<Rule> decorations = new CopyOnWriteArrayList<Rule>();
private final BundleContext bundleContext;
private final BundleListenerImpl bundleListener;
@@ -50,7 +51,7 @@ public class ServiceDecoratorImpl implem
bundleListener = new BundleListenerImpl();
bc.addBundleListener(bundleListener);
}
-
+
public void shutdown() {
bundleContext.removeBundleListener(bundleListener);
}
@@ -60,7 +61,7 @@ public class ServiceDecoratorImpl implem
matcher.apply(sref, target);
}
}
-
+
@SuppressWarnings("unchecked")
void addDecorations(Bundle bundle) {
Namespace ns = Namespace.getNamespace("http://cxf.apache.org/xmlns/service-decoration/1.0.0");
@@ -71,7 +72,7 @@ public class ServiceDecoratorImpl implem
m.addPropMatch(propMatch.getAttributeValue("name"), propMatch.getAttributeValue("value"));
}
for (Element addProp : (List<Element>) match.getChildren("add-property", ns)) {
- m.addProperty(addProp.getAttributeValue("name"),
+ m.addProperty(addProp.getAttributeValue("name"),
addProp.getAttributeValue("value"),
addProp.getAttributeValue("type", String.class.getName()));
}
@@ -86,7 +87,7 @@ public class ServiceDecoratorImpl implem
if (entries == null) {
return Collections.emptyList();
}
-
+
List<Element> elements = new ArrayList<Element>();
while (entries.hasMoreElements()) {
URL resourceURL = (URL) entries.nextElement();
@@ -100,7 +101,7 @@ public class ServiceDecoratorImpl implem
}
return elements;
}
-
+
void removeDecorations(Bundle bundle) {
for (Rule r : decorations) {
if (bundle.equals(r.getBundle())) {
@@ -120,6 +121,6 @@ public class ServiceDecoratorImpl implem
break;
default:
}
- }
+ }
}
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -47,6 +47,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractPojoConfigurationTypeHandler implements ConfigurationTypeHandler {
+
private static final Logger LOG = LoggerFactory.getLogger(AbstractPojoConfigurationTypeHandler.class);
protected BundleContext bundleContext;
protected IntentManager intentManager;
@@ -98,7 +99,6 @@ public abstract class AbstractPojoConfig
props.put(RemoteConstants.SERVICE_INTENTS, allIntents);
props.put(RemoteConstants.ENDPOINT_ID, address);
return props;
-
}
private void copyEndpointProperties(Map<String, Object> sd, Map<String, Object> endpointProps) {
@@ -110,7 +110,7 @@ public abstract class AbstractPojoConfig
endpointProps.put(skey, entry.getValue());
}
} catch (ClassCastException e) {
- LOG.warn("ServiceProperties Map contained non String key. Skipped " + entry + " "
+ LOG.warn("ServiceProperties Map contained non String key. Skipped " + entry + " "
+ e.getLocalizedMessage());
}
}
@@ -225,7 +225,6 @@ public abstract class AbstractPojoConfig
private static void addInterceptors(AbstractEndpointFactory factory, BundleContext callingContext,
Map<String, Object> sd, String propName) {
-
List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
boolean in = propName.contains("in.interceptors");
boolean out = propName.contains("out.interceptors");
@@ -247,7 +246,6 @@ public abstract class AbstractPojoConfig
private static void addFeatures(AbstractEndpointFactory factory, BundleContext callingContext,
Map<String, Object> sd, String propName) {
-
List<Object> providers = ClassUtils.loadProviderClasses(callingContext, sd, propName);
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConfigTypeHandlerFactory {
+
protected static final String DEFAULT_CONFIGURATION_TYPE = Constants.WS_CONFIG_TYPE;
private static final Logger LOG = LoggerFactory.getLogger(ConfigTypeHandlerFactory.class);
@@ -79,9 +80,7 @@ public class ConfigTypeHandlerFactory {
if (configurationTypes.contains(Constants.WS_CONFIG_TYPE)
|| configurationTypes.contains(Constants.WS_CONFIG_TYPE_OLD)
|| configurationTypes.contains(Constants.RS_CONFIG_TYPE)) {
-
boolean jaxrs = isJaxrsRequested(configurationTypes, serviceProperties);
-
return jaxrs ? jaxRsPojoConfigurationTypeHandler : pojoConfigurationTypeHandler;
} else if (configurationTypes.contains(Constants.WSDL_CONFIG_TYPE)) {
return wsdlConfigurationTypeHandler;
@@ -89,14 +88,13 @@ public class ConfigTypeHandlerFactory {
throw new RuntimeException("None of the configuration types in " + configurationTypes + " is supported.");
}
- private boolean isJaxrsRequested(Collection<String> types, Map<String, Object> serviceProperties) {
-
+ private boolean isJaxrsRequested(Collection<String> types, Map<String, Object> serviceProperties) {
if (types == null) {
return false;
}
if (types.contains(Constants.RS_CONFIG_TYPE)) {
- Collection<String> intentsProperty
+ Collection<String> intentsProperty
= OsgiUtils.getMultiValueProperty(serviceProperties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
boolean hasHttpIntent = false;
boolean hasSoapIntent = false;
@@ -159,10 +157,8 @@ public class ConfigTypeHandlerFactory {
if (usableConfigurationTypes.isEmpty()) {
throw new RuntimeException("The supplied endpoint has no compatible configuration type. "
- + "Supported types are: "
- + supportedConfigurationTypes
- + " Types needed by the endpoint: "
- + remoteConfigurationTypes);
+ + "Supported types are: " + supportedConfigurationTypes
+ + " Types needed by the endpoint: " + remoteConfigurationTypes);
}
return usableConfigurationTypes;
}
@@ -170,5 +166,4 @@ public class ConfigTypeHandlerFactory {
public List<String> getSupportedConfigurationTypes() {
return supportedConfigurationTypes;
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ConfigurationTypeHandler.java Wed Jun 5 00:40:54 2013
@@ -26,13 +26,14 @@ import org.osgi.framework.ServiceReferen
import org.osgi.service.remoteserviceadmin.EndpointDescription;
public interface ConfigurationTypeHandler {
+
String[] getSupportedTypes();
-
+
ExportResult createServer(ServiceReference serviceReference,
BundleContext dswContext,
- BundleContext callingContext,
- Map<String, Object> sd,
- Class<?> iClass,
+ BundleContext callingContext,
+ Map<String, Object> sd,
+ Class<?> iClass,
Object serviceBean);
Object createProxy(ServiceReference serviceReference,
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -23,6 +23,7 @@ import java.util.Map;
import org.apache.cxf.endpoint.Server;
public class ExportResult {
+
private final Map<String, Object> endpointProps;
private final Server server;
private final Exception exception;
@@ -32,7 +33,7 @@ public class ExportResult {
this.server = server;
this.exception = null;
}
-
+
public ExportResult(Map<String, Object> endpointProps, Exception ex) {
this.endpointProps = endpointProps;
this.server = null;
@@ -50,6 +51,4 @@ public class ExportResult {
public Exception getException() {
return exception;
}
-
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -44,6 +44,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpServiceManager {
+
private static final Logger LOG = LoggerFactory.getLogger(HttpServiceManager.class);
private ServiceTracker tracker;
private BundleContext bundleContext;
@@ -52,25 +53,25 @@ public class HttpServiceManager {
private String cxfServletAlias;
public HttpServiceManager(BundleContext bundleContext, String httpBase, String cxfServletAlias) {
- this(bundleContext, httpBase, cxfServletAlias,
+ this(bundleContext, httpBase, cxfServletAlias,
new ServiceTracker(bundleContext, HttpService.class.getName(), null));
this.tracker.open();
}
// Only for tests
- public HttpServiceManager(BundleContext bundleContext,
- String httpBase, String cxfServletAlias,
+ 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 registerServletAndGetBus(String contextRoot, BundleContext callingContext,
ServiceReference sref) {
Bus bus = BusFactory.newInstance().createBus();
@@ -79,10 +80,10 @@ public class HttpServiceManager {
cxf.setBus(bus);
try {
HttpService httpService = getHttpService();
- httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(),
+ httpService.registerServlet(contextRoot, cxf, new Hashtable<String, String>(),
getHttpContext(callingContext, httpService));
registerUnexportHook(sref, contextRoot);
-
+
LOG.info("Successfully registered CXF DOSGi servlet at " + contextRoot);
} catch (Exception e) {
throw new ServiceException("CXF DOSGi: problem registering CXF HTTP Servlet", e);
@@ -99,7 +100,7 @@ public class HttpServiceManager {
}
public String getServletContextRoot(Map<?, ?> sd, Class<?> iClass) {
- return OsgiUtils.getFirstNonEmptyStringProperty(sd,
+ return OsgiUtils.getFirstNonEmptyStringProperty(sd,
Constants.WS_HTTP_SERVICE_CONTEXT,
Constants.WS_HTTP_SERVICE_CONTEXT_OLD,
Constants.WSDL_HTTP_SERVICE_CONTEXT,
@@ -110,26 +111,26 @@ public class HttpServiceManager {
HttpContext httpContext = httpService.createDefaultHttpContext();
return new SecurityDelegatingHttpContext(bc, httpContext);
}
-
+
/**
* This listens for service removal events and "un-exports" the service
* from the HttpService.
- *
+ *
* @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);
LOG.debug("Registering service listener for service with ID {}", sid);
-
+
String previous = exportedAliases.put(sid, alias);
if (previous != null) {
LOG.warn("Overwriting service export for service with ID {}", sid);
}
-
+
try {
Filter f = bundleContext.createFilter("(" + org.osgi.framework.Constants.SERVICE_ID + "=" + sid + ")");
-
+
if (f != null) {
bundleContext.addServiceListener(new UnregisterListener(), f.toString());
} else {
@@ -139,7 +140,7 @@ public class HttpServiceManager {
LOG.warn("Service listener could not be started. The service will not be automatically unexported.", e);
}
}
-
+
protected String getDefaultAddress(Class<?> type) {
return "/" + type.getName().replace('.', '/');
}
@@ -148,17 +149,17 @@ public class HttpServiceManager {
if (relativeEndpointAddress.startsWith("http")) {
return relativeEndpointAddress;
}
- String effContextRoot = contextRoot == null ? cxfServletAlias : contextRoot;
+ String effContextRoot = contextRoot == null ? cxfServletAlias : contextRoot;
return this.httpBase + effContextRoot + relativeEndpointAddress;
}
-
+
public void close() {
tracker.close();
}
-
+
private final class UnregisterListener implements ServiceListener {
- public void serviceChanged(ServiceEvent event) {
+ public void serviceChanged(ServiceEvent event) {
if (!(event.getType() == ServiceEvent.UNREGISTERING)) {
return;
}
@@ -166,8 +167,7 @@ public class HttpServiceManager {
final Long sid = (Long) sref.getProperty(org.osgi.framework.Constants.SERVICE_ID);
final String alias = exportedAliases.remove(sid);
if (alias == null) {
- LOG.error(
- "Unable to unexport HTTP servlet for service class ''{0}'',"
+ LOG.error("Unable to unexport HTTP servlet for service class ''{0}'',"
+ " service-id {1}: no servlet alias found",
new Object[] {sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS), sid});
return;
@@ -177,7 +177,7 @@ public class HttpServiceManager {
HttpService http = getHttpService();
http.unregister(alias);
} catch (Exception e) {
- LOG.warn("An exception occurred while unregistering service for HTTP servlet alias '"
+ LOG.warn("An exception occurred while unregistering service for HTTP servlet alias '"
+ alias + "'", e);
}
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -41,10 +41,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JaxRSPojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
private static final Logger LOG = LoggerFactory.getLogger(JaxRSPojoConfigurationTypeHandler.class);
public JaxRSPojoConfigurationTypeHandler(BundleContext dswBC,
- IntentManager intentManager,
+ IntentManager intentManager,
HttpServiceManager httpServiceManager) {
super(dswBC, intentManager, httpServiceManager);
}
@@ -52,11 +53,10 @@ public class JaxRSPojoConfigurationTypeH
public String[] getSupportedTypes() {
return new String[] {Constants.RS_CONFIG_TYPE};
}
-
+
public Object createProxy(ServiceReference serviceReference, BundleContext dswContext,
BundleContext callingContext, Class<?> iClass,
EndpointDescription sd) throws IntentUnsatisfiedException {
-
String address = getPojoAddress(sd, iClass);
if (address == null) {
LOG.warn("Remote address is unavailable");
@@ -69,7 +69,7 @@ public class JaxRSPojoConfigurationTypeH
} catch (Throwable e) {
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
-
+
try {
ProxyClassLoader cl = new ProxyClassLoader();
cl.addLoader(iClass.getClassLoader());
@@ -78,12 +78,11 @@ public class JaxRSPojoConfigurationTypeH
} catch (Throwable e) {
LOG.warn("proxy creation failed", e);
}
-
- return null;
+ return null;
}
- protected Object createJaxrsProxy(String address,
+ protected Object createJaxrsProxy(String address,
BundleContext dswContext,
BundleContext callingContext,
Class<?> iClass,
@@ -94,9 +93,9 @@ public class JaxRSPojoConfigurationTypeH
if (loader != null) {
bean.setClassLoader(loader);
}
-
+
addRsInterceptorsFeaturesProps(bean, callingContext, sd.getProperties());
-
+
List<UserResource> resources = JaxRSUtils.getModel(callingContext, iClass);
if (resources != null) {
bean.setModelBeansWithServiceClass(resources, iClass);
@@ -110,13 +109,12 @@ public class JaxRSPojoConfigurationTypeH
Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
return getProxy(bean.create(), iClass);
}
-
+
public ExportResult createServer(ServiceReference sref,
BundleContext dswContext,
- BundleContext callingContext,
+ BundleContext callingContext,
Map<String, Object> sd, Class<?> iClass,
Object serviceBean) throws IntentUnsatisfiedException {
-
String contextRoot = httpServiceManager.getServletContextRoot(sd, iClass);
String address;
if (contextRoot == null) {
@@ -128,7 +126,7 @@ public class JaxRSPojoConfigurationTypeH
}
}
- Bus bus = contextRoot != null
+ Bus bus = contextRoot != null
? httpServiceManager.registerServletAndGetBus(contextRoot, callingContext, sref) : null;
LOG.info("Creating a " + iClass.getName()
@@ -144,7 +142,7 @@ public class JaxRSPojoConfigurationTypeH
return createServerFromFactory(factory, endpointProps);
}
-
+
private ExportResult createServerFromFactory(JAXRSServerFactoryBean factory,
Map<String, Object> endpointProps) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -158,13 +156,13 @@ public class JaxRSPojoConfigurationTypeH
Thread.currentThread().setContextClassLoader(oldClassLoader);
}
}
-
- private JAXRSServerFactoryBean createServerFactory(BundleContext dswContext,
+
+ private JAXRSServerFactoryBean createServerFactory(BundleContext dswContext,
BundleContext callingContext,
Map<String, Object> sd,
- Class<?> iClass,
- Object serviceBean,
- String address,
+ Class<?> iClass,
+ Object serviceBean,
+ String address,
Bus bus) {
JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
if (bus != null) {
@@ -205,5 +203,4 @@ public class JaxRSPojoConfigurationTypeH
}
return address;
}
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -38,14 +38,14 @@ public final class JaxRSUtils {
public static final String MODEL_FOLDER = "/OSGI-INF/cxf/jaxrs/";
public static final String DEFAULT_MODEL = "/OSGI-INF/cxf/jaxrs/model.xml";
- public static final String PROVIDERS_FILTER = "(|"
+ public static final String PROVIDERS_FILTER = "(|"
+ "(objectClass=javax.ws.rs.ext.MessageBodyReader)"
- + "(objectClass=javax.ws.rs.ext.MessageBodyWriter)"
- + "(objectClass=javax.ws.rs.ext.ExceptionMapper)"
- + "(objectClass=org.apache.cxf.jaxrs.ext.RequestHandler)"
- + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseHandler)"
- + "(objectClass=org.apache.cxf.jaxrs.ext.ParameterHandler)"
- + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseExceptionMapper)"
+ + "(objectClass=javax.ws.rs.ext.MessageBodyWriter)"
+ + "(objectClass=javax.ws.rs.ext.ExceptionMapper)"
+ + "(objectClass=org.apache.cxf.jaxrs.ext.RequestHandler)"
+ + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseHandler)"
+ + "(objectClass=org.apache.cxf.jaxrs.ext.ParameterHandler)"
+ + "(objectClass=org.apache.cxf.jaxrs.ext.ResponseExceptionMapper)"
+ ")";
private static final Logger LOG = LoggerFactory.getLogger(JaxRSUtils.class);
@@ -55,14 +55,13 @@ public final class JaxRSUtils {
@SuppressWarnings("rawtypes")
static List<Object> getProviders(BundleContext callingContext, BundleContext dswBC, Map sd) {
-
List<Object> providers = new ArrayList<Object>();
if ("aegis".equals(sd.get(org.apache.cxf.dosgi.dsw.Constants.RS_DATABINDING_PROP_KEY))) {
providers.add(new AegisElementProvider());
}
-
- providers.addAll(ClassUtils.loadProviderClasses(callingContext,
- sd,
+
+ providers.addAll(ClassUtils.loadProviderClasses(callingContext,
+ sd,
org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_PROP_KEY));
Object globalQueryProp = sd.get(org.apache.cxf.dosgi.dsw.Constants.RS_PROVIDER_GLOBAL_PROP_KEY);
@@ -118,5 +117,4 @@ public final class JaxRSUtils {
}
return null;
}
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -39,8 +39,8 @@ public final class LocalHostUtil {
* Returns an InetAddress representing the address of the localhost. Every
* attempt is made to find an address for this host that is not the loopback
* address. If no other address can be found, the loopback will be returned.
- *
- * @return InetAddress - the address of localhost
+ *
+ * @return InetAddress the address of localhost
* @throws UnknownHostException if there is a problem determining the address
*/
public static InetAddress getLocalHost() throws UnknownHostException {
@@ -60,10 +60,9 @@ public final class LocalHostUtil {
/**
* Utility method that delegates to the methods of NetworkInterface to
* determine addresses for this machine.
- *
- * @return InetAddress[] - all addresses found from the NetworkInterfaces
- * @throws UnknownHostException
- * - if there is a problem determining addresses
+ *
+ * @return all addresses found from the NetworkInterfaces
+ * @throws UnknownHostException if there is a problem determining addresses
*/
private static InetAddress[] getAllLocalUsingNetworkInterface() throws UnknownHostException {
try {
@@ -90,5 +89,4 @@ public final class LocalHostUtil {
}
return localIP;
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandler.java Wed Jun 5 00:40:54 2013
@@ -40,6 +40,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PojoConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
private static final Logger LOG = LoggerFactory.getLogger(PojoConfigurationTypeHandler.class);
public PojoConfigurationTypeHandler(BundleContext dswBC,
@@ -166,5 +167,4 @@ public class PojoConfigurationTypeHandle
|| Constants.WS_FRONTEND_JAXWS.equals(frontEnd))
&& !Constants.WS_FRONTEND_SIMPLE.equals(frontEnd);
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/SecurityDelegatingHttpContext.java Wed Jun 5 00:40:54 2013
@@ -48,6 +48,7 @@ import org.slf4j.LoggerFactory;
* </p>
*/
public class SecurityDelegatingHttpContext implements HttpContext {
+
public static final String FILTER_PROP = "org.apache.cxf.httpservice.filter";
public static final String FILTER_REQUIRED_PROP = "org.apache.cxf.httpservice.requirefilter";
private static final Logger LOG = LoggerFactory.getLogger(SecurityDelegatingHttpContext.class);
@@ -109,6 +110,7 @@ public class SecurityDelegatingHttpConte
* A {@link FilterChain} composed of {@link Filter}s with the
*/
class Chain implements FilterChain {
+
private static final Logger LOG = LoggerFactory.getLogger(Chain.class);
int current;
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ServiceInvocationHandler.java Wed Jun 5 00:40:54 2013
@@ -33,19 +33,18 @@ import java.util.Map;
import org.osgi.framework.ServiceException;
public class ServiceInvocationHandler implements InvocationHandler {
+
private static final String REMOTE_EXCEPTION_TYPE = "REMOTE";
- private static final Collection<Method> OBJECT_METHODS =
- Arrays.asList(Object.class.getMethods());
+ private static final Collection<Method> OBJECT_METHODS = Arrays.asList(Object.class.getMethods());
- private Map<Method, List<Class<?>>> exceptionsMap
- = new HashMap<Method, List<Class<?>>>();
+ private Map<Method, List<Class<?>>> exceptionsMap = new HashMap<Method, List<Class<?>>>();
private Object serviceObject;
-
+
public ServiceInvocationHandler(Object serviceObject, Class<?> iType) {
this.serviceObject = serviceObject;
introspectType(iType);
}
-
+
public Object invoke(Object proxy, final Method m, Object[] params) throws Throwable {
if (OBJECT_METHODS.contains(m)) {
if (m.getName().equals("equals")) {
@@ -55,14 +54,14 @@ public class ServiceInvocationHandler im
}
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- try {
+ try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
final Object[] paramsFinal = params;
return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
return m.invoke(serviceObject, paramsFinal);
}
- });
+ });
} catch (Throwable ex) {
Throwable theCause = ex.getCause() == null ? ex : ex.getCause();
Throwable theCauseCause = theCause.getCause() == null ? theCause : theCause.getCause();
@@ -76,9 +75,8 @@ public class ServiceInvocationHandler im
throw theCauseCause;
}
}
-
}
-
+
throw new ServiceException(REMOTE_EXCEPTION_TYPE, theCause);
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -40,30 +40,30 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WsdlConfigurationTypeHandler extends AbstractPojoConfigurationTypeHandler {
+
private static final Logger LOG = LoggerFactory.getLogger(WsdlConfigurationTypeHandler.class);
-
+
public WsdlConfigurationTypeHandler(BundleContext dswBC,
IntentManager intentManager,
HttpServiceManager httpServiceManager) {
super(dswBC, intentManager, httpServiceManager);
}
-
+
public String[] getSupportedTypes() {
return new String[] {Constants.WSDL_CONFIG_TYPE};
}
-
+
public Object createProxy(ServiceReference serviceReference,
BundleContext dswContext,
BundleContext callingContext,
- Class<?> iClass,
+ Class<?> iClass,
EndpointDescription sd) {
-
String wsdlAddressProp = getWsdlAddress(sd, iClass);
if (wsdlAddressProp == null) {
LOG.warn("WSDL address is unavailable");
return null;
}
-
+
URL wsdlAddress;
try {
wsdlAddress = new URL(wsdlAddressProp);
@@ -71,14 +71,13 @@ public class WsdlConfigurationTypeHandle
LOG.warn("WSDL address is malformed");
return null;
}
-
+
LOG.info("Creating a " + sd.getInterfaces().toArray()[0] + " client, wsdl address is "
+ OsgiUtils.getProperty(sd, Constants.WSDL_CONFIG_PREFIX));
-
+
String serviceNs = OsgiUtils.getProperty(sd, Constants.WSDL_SERVICE_NAMESPACE);
if (serviceNs == null) {
- serviceNs = PackageUtils.getNamespace(
- PackageUtils.getPackageName(iClass));
+ serviceNs = PackageUtils.getNamespace(PackageUtils.getPackageName(iClass));
}
String serviceName = OsgiUtils.getProperty(sd, Constants.WSDL_SERVICE_NAME);
if (serviceName == null) {
@@ -89,11 +88,10 @@ public class WsdlConfigurationTypeHandle
Constants.WSDL_SERVICE_NAME);
QName portQname = getPortQName(serviceQname.getNamespaceURI(), sd.getProperties(), Constants.WSDL_PORT_NAME);
Service service = createWebService(wsdlAddress, serviceQname);
- Object proxy = getProxy(portQname == null ? service.getPort(iClass) : service.getPort(portQname, iClass),
+ Object proxy = getProxy(portQname == null ? service.getPort(iClass) : service.getPort(portQname, iClass),
iClass);
// MARC: FIXME!!!! getDistributionProvider().addRemoteService(serviceReference);
return proxy;
-
}
// Isolated so that it can be overridden for test purposes.
@@ -104,10 +102,9 @@ public class WsdlConfigurationTypeHandle
public ExportResult createServer(ServiceReference sref,
BundleContext dswContext,
BundleContext callingContext,
- Map<String, Object> sd,
- Class<?> iClass,
+ Map<String, Object> sd,
+ Class<?> iClass,
Object serviceBean) {
-
String location = OsgiUtils.getProperty(sd, Constants.WSDL_LOCATION);
if (location == null) {
throw new RuntimeException("WSDL location property is unavailable");
@@ -116,7 +113,7 @@ public class WsdlConfigurationTypeHandle
if (wsdlURL == null) {
throw new RuntimeException("WSDL resource at " + location + " is unavailable");
}
-
+
String address = getServerAddress(sd, iClass);
String contextRoot = httpServiceManager.getServletContextRoot(sd, iClass);
if (address == null && contextRoot == null) {
@@ -137,28 +134,26 @@ public class WsdlConfigurationTypeHandle
factory.setServiceBean(serviceBean);
addWsInterceptorsFeaturesProps(factory, callingContext, sd);
-
+
setWsdlProperties(factory, callingContext, sd, true);
-
+
String[] intents = intentManager.applyIntents(factory.getFeatures(), factory, sd);
// The properties for the EndpointDescription
Map<String, Object> endpointProps = createEndpointProps(sd, iClass,
- new String[]{Constants.WS_CONFIG_TYPE},
+ new String[]{Constants.WS_CONFIG_TYPE},
address, intents);
-
return createServerFromFactory(factory, endpointProps);
}
-
+
private String getWsdlAddress(EndpointDescription sd, Class<?> iClass) {
String address = OsgiUtils.getProperty(sd, Constants.WSDL_CONFIG_PREFIX);
if (address == null) {
address = httpServiceManager.getDefaultAddress(iClass);
if (address != null) {
- address += "?wsdl";
+ address += "?wsdl";
}
}
return address;
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/DefaultIntentMapFactory.java Wed Jun 5 00:40:54 2013
@@ -28,6 +28,7 @@ import org.apache.cxf.binding.soap.SoapV
import org.apache.cxf.feature.LoggingFeature;
public class DefaultIntentMapFactory {
+
public Map<String, Object> create() {
Map<String, Object> intentMap = new HashMap<String, Object>();
intentMap.put("logging", getLoggingFeature());
@@ -48,5 +49,4 @@ public class DefaultIntentMapFactory {
soapBindingConfig.setVersion(soapVersion);
return soapBindingConfig;
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentManager.java Wed Jun 5 00:40:54 2013
@@ -25,6 +25,7 @@ import org.apache.cxf.endpoint.AbstractE
import org.apache.cxf.feature.Feature;
public interface IntentManager {
+
String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory, Map<String, Object> props);
void assertAllIntentsSupported(Map<String, Object> serviceProperties);
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -33,21 +33,22 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class IntentManagerImpl implements IntentManager {
+
static final Logger LOG = LoggerFactory.getLogger(IntentManagerImpl.class);
private static final String PROVIDED_INTENT_VALUE = "PROVIDED";
private final IntentMap intentMap;
private long maxIntentWaitTime;
-
+
public IntentManagerImpl(IntentMap intentMap) {
this(intentMap, 0);
}
-
+
public IntentManagerImpl(IntentMap intentMap, int maxIntentWaitTime) {
this.intentMap = intentMap;
this.maxIntentWaitTime = maxIntentWaitTime;
}
-
+
public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
Map<String, Object> props) throws IntentUnsatisfiedException {
Set<String> requestedIntents = IntentUtils.getRequestedIntents(props);
@@ -66,7 +67,7 @@ public class IntentManagerImpl implement
appliedIntents.addAll(addSynonymIntents(appliedIntents, intentMap));
return appliedIntents.toArray(new String[appliedIntents.size()]);
}
-
+
private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory,
String intentName, Object intent) throws IntentUnsatisfiedException {
if (intent instanceof String) {
@@ -120,7 +121,7 @@ public class IntentManagerImpl implement
}
return intentsFound;
}
-
+
public void assertAllIntentsSupported(Map<String, Object> serviceProperties) {
long endTime = System.currentTimeMillis() + maxIntentWaitTime;
Set<String> requiredIntents = IntentUtils.getRequestedIntents(serviceProperties);
@@ -144,12 +145,10 @@ public class IntentManagerImpl implement
}
}
} while (!unsupportedIntents.isEmpty() && System.currentTimeMillis() < endTime);
-
+
if (!unsupportedIntents.isEmpty()) {
throw new RuntimeException("service cannot be exported because the following "
- + "intents are not supported by this RSA: "
- + unsupportedIntents);
+ + "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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -25,22 +25,23 @@ import java.util.concurrent.ConcurrentHa
/**
* Maps intent names to intent objects
* An intent object can be a Feature, a BindingConfiguration or a String
- *
- * Also supports a default intent map. Custom intents can override the defaults
+ *
+ * Also supports a default intent map. Custom intents can override the defaults
*/
public class IntentMap extends ConcurrentHashMap<String, Object> {
+
private static final long serialVersionUID = 2606460607920520767L;
private Map<String, Object> defaultMap;
-
+
public IntentMap() {
this(new HashMap<String, Object>());
}
-
+
public IntentMap(Map<String, Object> defaultMap) {
this.defaultMap = defaultMap;
putAll(defaultMap);
}
-
+
@Override
public Object put(String key, Object value) {
Object result = super.put(key, value);
@@ -58,5 +59,4 @@ public class IntentMap extends Concurren
}
return old;
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentTracker.java Wed Jun 5 00:40:54 2013
@@ -26,13 +26,14 @@ import org.osgi.framework.ServiceReferen
import org.osgi.util.tracker.ServiceTracker;
public class IntentTracker extends ServiceTracker {
+
private final IntentMap intentMap;
public IntentTracker(BundleContext context, IntentMap intentMap) {
super(context, getFilter(context), null);
this.intentMap = intentMap;
}
-
+
static Filter getFilter(BundleContext context) {
try {
return context.createFilter("(" + Constants.INTENT_NAME_PROP + "=*)");
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/qos/IntentUnsatisfiedException.java Wed Jun 5 00:40:54 2013
@@ -19,15 +19,16 @@
package org.apache.cxf.dosgi.dsw.qos;
public class IntentUnsatisfiedException extends RuntimeException {
+
private static final long serialVersionUID = 1L;
-
+
private String intent;
-
+
public IntentUnsatisfiedException(String theIntent) {
super(theIntent);
intent = theIntent;
}
-
+
public String getIntent() {
return intent;
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -33,6 +33,7 @@ import org.apache.cxf.dosgi.dsw.util.Uti
import org.osgi.service.remoteserviceadmin.RemoteConstants;
public final class IntentUtils {
+
private IntentUtils() {
// never constructed
}
@@ -64,7 +65,7 @@ public final class IntentUtils {
public static Set<String> getRequestedIntents(Map<?, ?> sd) {
Collection<String> intents = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
- Collection<String> intents2
+ Collection<String> intents2
= OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
@SuppressWarnings("deprecation")
Collection<String> oldIntents = OsgiUtils.getMultiValueProperty(sd.get(Constants.EXPORTED_INTENTS_OLD));
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -76,15 +76,13 @@ public class ClientServiceFactory implem
LOG.info("Did not create proxy for " + interfaceName + " because intent " + iue.getIntent()
+ " could not be satisfied");
} catch (Exception ex) {
- LOG.warn("Problem creating a remote proxy for " + interfaceName
- + " from CXF FindHook: ", ex);
+ LOG.warn("Problem creating a remote proxy for " + interfaceName + " from CXF FindHook: ", ex);
}
return null;
}
public void ungetService(Bundle requestingBundle, ServiceRegistration sreg, Object serviceObject) {
-
StringBuilder sb = new StringBuilder();
sb.append("Releasing a client object");
Object objectClass = sreg.getReference().getProperty(org.osgi.framework.Constants.OBJECTCLASS);
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -44,7 +44,6 @@ public class EventAdminHelper {
@SuppressWarnings("rawtypes")
private Event createEvent(Properties props, String type) {
-
String topic = "org/osgi/service/remoteserviceadmin/" + type;
props.put("bundle", bctx.getBundle());
props.put("bundle.id", bctx.getBundle().getBundleId());
@@ -64,13 +63,11 @@ public class EventAdminHelper {
}
public void notifyEventAdmin(RemoteServiceAdminEvent rsae) {
-
String topic = remoteServiceAdminEventTypeToString(rsae.getType());
Properties props = new Properties();
setIfNotNull(props, "cause", rsae.getException());
-
EndpointDescription epd = null;
if (rsae.getImportReference() != null) {
epd = ((ImportRegistrationImpl)rsae.getImportReference()).getImportedEndpointAlways();
@@ -110,7 +107,7 @@ public class EventAdminHelper {
}
if (refs != null) {
- LOG.debug("Publishing event to {} EventAdmins; Topic:[{}]", refs.length, topic);
+ LOG.debug("Publishing event to {} EventAdmins; Topic:[{}]", refs.length, topic);
for (ServiceReference serviceReference : refs) {
EventAdmin eventAdmin = (EventAdmin) bctx.getService(serviceReference);
try {
@@ -156,5 +153,4 @@ public class EventAdminHelper {
}
return retval;
}
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -48,8 +48,8 @@ public class EventProducer {
}
protected void publishNotification(ExportRegistration er) {
- int type = er.getException() == null
- ? RemoteServiceAdminEvent.EXPORT_REGISTRATION
+ int type = er.getException() == null
+ ? RemoteServiceAdminEvent.EXPORT_REGISTRATION
: RemoteServiceAdminEvent.EXPORT_ERROR;
RemoteServiceAdminEvent rsae = new RemoteServiceAdminEvent(type, bctx.getBundle(), er.getExportReference(),
er.getException());
@@ -76,7 +76,6 @@ public class EventProducer {
}
}
}
-
} catch (InvalidSyntaxException e) {
LOG.error(e.getMessage(), e);
}
@@ -105,7 +104,6 @@ public class EventProducer {
eaHelper.notifyEventAdmin(rsae);
}
-
public void notifyRemoval(ImportRegistration eri) {
RemoteServiceAdminEvent rsae = new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_UNREGISTRATION,
bctx.getBundle(), eri.getImportReference(), eri.getException());
@@ -113,5 +111,4 @@ public class EventProducer {
notifyListeners(rsae);
eaHelper.notifyEventAdmin(rsae);
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java Wed Jun 5 00:40:54 2013
@@ -23,6 +23,7 @@ import org.osgi.service.remoteserviceadm
import org.osgi.service.remoteserviceadmin.ExportReference;
public class ExportReferenceImpl implements ExportReference {
+
private ServiceReference serviceReference;
private EndpointDescription endpointDescription;
@@ -65,7 +66,7 @@ public class ExportReferenceImpl impleme
return false;
}
ExportReferenceImpl other = (ExportReferenceImpl) obj;
- if (endpointDescription == null) {
+ if (endpointDescription == null) {
if (other.endpointDescription != null) {
return false;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java Wed Jun 5 00:40:54 2013
@@ -73,7 +73,6 @@ public class ExportRegistrationImpl impl
++instanceCount;
}
-
public synchronized void close() {
if (closed) {
return;
@@ -134,8 +133,8 @@ public class ExportRegistrationImpl impl
Set<Map.Entry<String, Object>> props = endpointDescription.getProperties().entrySet();
for (Map.Entry<String, Object> entry : props) {
Object value = entry.getValue();
- r += entry.getKey() + " => "
- + (value instanceof Object[] ? Arrays.toString((Object []) value) : value) + "\n";
+ r += entry.getKey() + " => "
+ + (value instanceof Object[] ? Arrays.toString((Object[]) value) : value) + "\n";
}
}
return r;
@@ -162,7 +161,6 @@ public class ExportRegistrationImpl impl
* is exported by this exportRegistration
* */
public void startServiceTracker(BundleContext bctx) {
-
// only the parent should do this
if (parent != this) {
parent.startServiceTracker(bctx);
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java Wed Jun 5 00:40:54 2013
@@ -201,5 +201,4 @@ public class ImportRegistrationImpl impl
public EndpointDescription getImportedEndpointAlways() {
return importedEndpoint;
}
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -78,7 +78,6 @@ public class RemoteServiceAdminCore impl
@SuppressWarnings({ "rawtypes", "unchecked" })
public List<ExportRegistration> exportService(ServiceReference serviceReference, Map additionalProperties)
throws IllegalArgumentException, UnsupportedOperationException {
-
Map<String, Object> serviceProperties = getProperties(serviceReference);
if (additionalProperties != null) {
OsgiUtils.overlayProperties(serviceProperties, additionalProperties);
@@ -280,7 +279,6 @@ public class RemoteServiceAdminCore impl
return copy;
}
-
private boolean isCreatedByThisRSA(ServiceReference sref) {
return (sref.getBundle() != null) && sref.getBundle().equals(bctx.getBundle());
}
@@ -313,7 +311,6 @@ public class RemoteServiceAdminCore impl
* Importing form here...
*/
public ImportRegistration importService(EndpointDescription endpoint) {
-
LOG.debug("importService() Endpoint: {}", endpoint.getProperties());
synchronized (importedServices) {
@@ -363,7 +360,6 @@ public class RemoteServiceAdminCore impl
protected void proxifyMatchingInterface(String interfaceName, ImportRegistrationImpl imReg,
ConfigurationTypeHandler handler, BundleContext requestingContext) {
-
try {
// MARC: relies on dynamic imports?
Class<?> iClass = bctx.getBundle().loadClass(interfaceName);
@@ -376,7 +372,7 @@ public class RemoteServiceAdminCore impl
if (actualClass != iClass) {
LOG.info("Class " + interfaceName + " loaded by DSW's bundle context is not "
+ "equal to the one loaded by the requesting bundle context, "
- + "DSW will use the requesting bundle context to register " + "a proxy service");
+ + "DSW will use the requesting bundle context to register a proxy service");
iClass = actualClass;
actualContext = requestingContext;
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java Wed Jun 5 00:40:54 2013
@@ -35,6 +35,7 @@ import org.osgi.service.remoteserviceadm
import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
public class RemoteServiceAdminInstance implements RemoteServiceAdmin {
+
private BundleContext bctx;
private RemoteServiceAdminCore rsaCore;
@@ -48,7 +49,6 @@ public class RemoteServiceAdminInstance
@SuppressWarnings({ "rawtypes", "unchecked" })
public List /* ExportRegistration */exportService(final ServiceReference ref, final Map properties)
throws IllegalArgumentException, UnsupportedOperationException {
-
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
EndpointPermission epp = new EndpointPermission("*", EndpointPermission.EXPORT);
@@ -60,7 +60,6 @@ public class RemoteServiceAdminInstance
if (closed) {
return Collections.emptyList();
}
-
return rsaCore.exportService(ref, properties);
}
});
@@ -68,7 +67,6 @@ public class RemoteServiceAdminInstance
@SuppressWarnings({ "rawtypes", "unchecked" })
public Collection getExportedServices() {
-
SecurityManager sm = System.getSecurityManager();
EndpointPermission epp = new EndpointPermission("*", EndpointPermission.READ);
if (sm != null) {
@@ -83,7 +81,6 @@ public class RemoteServiceAdminInstance
@SuppressWarnings({ "rawtypes", "unchecked" })
public Collection getImportedEndpoints() {
-
SecurityManager sm = System.getSecurityManager();
EndpointPermission epp = new EndpointPermission("*", EndpointPermission.READ);
if (sm != null) {
@@ -97,9 +94,7 @@ public class RemoteServiceAdminInstance
}
public ImportRegistration importService(EndpointDescription endpoint) {
-
final EndpointDescription epd = endpoint;
-
SecurityManager sm = System.getSecurityManager();
EndpointPermission epp = new EndpointPermission(epd, OsgiUtils.getUUID(bctx),
EndpointPermission.IMPORT);
@@ -109,11 +104,9 @@ public class RemoteServiceAdminInstance
return AccessController.doPrivileged(new PrivilegedAction<ImportRegistration>() {
public ImportRegistration run() {
-
if (closed) {
return null;
}
-
return rsaCore.importService(epd);
}
});
@@ -121,7 +114,6 @@ public class RemoteServiceAdminInstance
public void close() {
closed = true;
-
rsaCore.removeExportRegistrations(bctx.getBundle());
}
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java Wed Jun 5 00:40:54 2013
@@ -53,5 +53,4 @@ public class RemoteServiceadminFactory i
rsaServiceInstances.remove(rsai);
}
}
-
}
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -29,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class ClassUtils {
+
private static final Logger LOG = LoggerFactory.getLogger(ClassUtils.class);
private ClassUtils() {
@@ -63,13 +64,13 @@ public final class ClassUtils {
/**
* <pre>
- *
- * The following method tries to deal specifically with classes that might have been proxied
+ *
+ * The following method tries to deal specifically with classes that might have been proxied
* eg. CGLIB proxies of which there might be a chain of proxies as different osgi frameworks
* might be proxying the original service class that has been registered and then proxying the proxy.
- *
+ *
* </pre>
- *
+ *
* @param serviceClass
* @param interfaceName
* @return
@@ -96,7 +97,6 @@ public final class ClassUtils {
@SuppressWarnings("rawtypes")
public static List<Object> loadProviderClasses(BundleContext callingContext, Map sd, String propName) {
-
Object serviceProviders = sd.get(propName);
if (serviceProviders != null) {
if (serviceProviders.getClass().isArray()) {
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -87,15 +87,14 @@ public final class OsgiUtils {
}
/**
- * Tries to retrieve the version of iClass via the PackageAdmin
+ * Tries to retrieve the version of iClass via the PackageAdmin.
*
- * @param iClass - The interface for which the version should be found
- * @param bc - any valid BundleContext
+ * @param iClass tThe interface for which the version should be found
+ * @param bc any valid BundleContext
* @return the version of the interface or "0.0.0" if no version information could be found or an error
* occurred during the retrieval
*/
public static String getVersion(Class<?> iClass, BundleContext bc) {
-
ServiceReference paRef = bc.getServiceReference(PackageAdmin.class.getName());
if (paRef != null) {
PackageAdmin pa = (PackageAdmin)bc.getService(paRef);
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=1489675&r1=1489674&r2=1489675&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 Wed Jun 5 00:40:54 2013
@@ -31,10 +31,9 @@ public final class Utils {
private Utils() {
// never constructed
}
-
+
@SuppressWarnings("rawtypes")
public static String[] normalizeStringPlus(Object object) {
-
if (object instanceof String) {
String s = (String)object;
String[] values = s.split(",");
@@ -67,6 +66,4 @@ public final class Utils {
return null;
}
-
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java Wed Jun 5 00:40:54 2013
@@ -32,17 +32,18 @@ import org.osgi.framework.ServiceRegistr
import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
public class ActivatorTest extends TestCase {
+
private BundleContext getMockBundleContext(IMocksControl control) {
Bundle b = control.createMock(Bundle.class);
Dictionary<String, String> ht = new Hashtable<String, String>();
- EasyMock.expect(b.getHeaders()).andReturn(ht).anyTimes();
+ 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;
}
-
+
public void testCreateAndShutdownRemoteServiceAdminService() throws Exception {
IMocksControl control = EasyMock.createNiceControl();
BundleContext bc = getMockBundleContext(control);
@@ -53,11 +54,10 @@ public class ActivatorTest extends TestC
EasyMock.expect(bc.registerService(EasyMock.eq(RemoteServiceAdmin.class.getName()),
EasyMock.anyObject(), (Dictionary<String, String>)EasyMock.anyObject()))
.andReturn(sr).atLeastOnce();
-
+
control.replay();
Activator a = new Activator();
a.start(bc);
control.verify();
}
-
}
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java?rev=1489675&r1=1489674&r2=1489675&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java (original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/TestUtils.java Wed Jun 5 00:40:54 2013
@@ -18,8 +18,8 @@
*/
package org.apache.cxf.dosgi.dsw;
-
public final class TestUtils {
+
// private TestUtils() {
// }
//
@@ -28,7 +28,7 @@ public final class TestUtils {
// for (String iName : interfaceNames) {
// iList.add(iName);
// }
-//
+//
// ServiceEndpointDescription sd = EasyMock.createNiceMock(ServiceEndpointDescription.class);
// sd.getProvidedInterfaces();
// EasyMock.expectLastCall().andReturn(iList);