Updated Branches: refs/heads/cellar-2.3.x 0a246101e -> 4702f2057
Code cleanup. git-svn-id: https://svn.apache.org/repos/asf/karaf/cellar/branches/cellar-2.3.x@1471422 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/karaf-cellar/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf-cellar/commit/7669c31f Tree: http://git-wip-us.apache.org/repos/asf/karaf-cellar/tree/7669c31f Diff: http://git-wip-us.apache.org/repos/asf/karaf-cellar/diff/7669c31f Branch: refs/heads/cellar-2.3.x Commit: 7669c31f0e6183f91972551b71da6ec4618cc146 Parents: c2fbf61 Author: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Authored: Wed Apr 24 14:09:55 2013 +0000 Committer: jbonofre <jbonofre@13f79535-47bb-0310-9956-ffa450edef68> Committed: Wed Apr 24 14:09:55 2013 +0000 ---------------------------------------------------------------------- .../apache/karaf/cellar/dosgi/Constants.java | 3 + .../cellar/dosgi/ExportServiceListener.java | 78 ++++++++++---------- .../cellar/dosgi/ImportServiceListener.java | 28 +++---- .../karaf/cellar/dosgi/RemoteServiceCall.java | 7 +- .../cellar/dosgi/RemoteServiceCallHandler.java | 7 +- .../cellar/dosgi/RemoteServiceFactory.java | 14 ++-- .../cellar/dosgi/RemoteServiceFindHook.java | 4 +- .../dosgi/RemoteServiceInvocationHandler.java | 9 +-- .../karaf/cellar/dosgi/RemoteServiceResult.java | 7 +- .../dosgi/RemoteServiceResultHandler.java | 2 +- .../shell/ListDistributedServicesCommand.java | 5 +- .../resources/OSGI-INF/blueprint/blueprint.xml | 11 ++- .../OSGI-INF/blueprint/shell-dosgi.xml | 2 - .../cellar/dosgi/EndpointDescriptionTest.java | 5 +- .../cellar/dosgi/ExportServiceListenerTest.java | 14 +--- 15 files changed, 79 insertions(+), 117 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/Constants.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/Constants.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/Constants.java index cb87db1..2187374 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/Constants.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/Constants.java @@ -13,6 +13,9 @@ */ package org.apache.karaf.cellar.dosgi; +/** + * Cellar DOSGi Constants. + */ public abstract class Constants { public static final String SEPARATOR = "/"; http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java index 127282f..7c6a697 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ExportServiceListener.java @@ -32,7 +32,7 @@ import java.util.Map; import java.util.Set; /** - * Listener on the export service action. + * Listener on the export service. */ public class ExportServiceListener implements ServiceListener { @@ -42,9 +42,9 @@ public class ExportServiceListener implements ServiceListener { private EventTransportFactory eventTransportFactory; private BundleContext bundleContext; - private Map<String,EndpointDescription> remoteEndpoints; + private Map<String, EndpointDescription> remoteEndpoints; - private final Map<String,EventConsumer> consumers = new HashMap<String,EventConsumer>(); + private final Map<String, EventConsumer> consumers = new HashMap<String, EventConsumer>(); private Node node; @@ -53,7 +53,7 @@ public class ExportServiceListener implements ServiceListener { remoteEndpoints = clusterManager.getMap(Constants.REMOTE_ENDPOINTS); bundleContext.addServiceListener(this); - //Lookup for already exported services. + // lookup for already exported services. ServiceReference[] references = null; try { String filter = "(" + Constants.EXPORTED_INTERFACES + "=" + Constants.ALL_INTERFACES + ")"; @@ -65,40 +65,40 @@ public class ExportServiceListener implements ServiceListener { } } } catch (InvalidSyntaxException e) { - LOGGER.error("CELLAR DOSGI: unable to export existing remote services", e); + LOGGER.error("CELLAR DOSGI: failed to export existing remote services", e); } } public void destroy() { bundleContext.removeServiceListener(this); - for(Map.Entry<String,EventConsumer> consumerEntry:consumers.entrySet()) { - EventConsumer consumer = consumerEntry.getValue(); - consumer.stop(); - } - consumers.clear(); + for (Map.Entry<String, EventConsumer> consumerEntry : consumers.entrySet()) { + EventConsumer consumer = consumerEntry.getValue(); + consumer.stop(); + } + consumers.clear(); } @Override public void serviceChanged(ServiceEvent event) { - if (event != null) { - switch (event.getType()) { - case ServiceEvent.REGISTERED: - exportService(event.getServiceReference()); - break; - case ServiceEvent.UNREGISTERING: - unExportService(event.getServiceReference()); - break; - case ServiceEvent.MODIFIED: - case ServiceEvent.MODIFIED_ENDMATCH: - default: - break; - } + if (event != null) { + switch (event.getType()) { + case ServiceEvent.REGISTERED: + exportService(event.getServiceReference()); + break; + case ServiceEvent.UNREGISTERING: + unExportService(event.getServiceReference()); + break; + case ServiceEvent.MODIFIED: + case ServiceEvent.MODIFIED_ENDMATCH: + default: + break; } + } } /** - * Registers {@link EventConsumer}s for consuming remote service calls. + * Register {@link EventConsumer}s for consuming remote service calls. * * @param serviceReference The reference of the service to be exported. */ @@ -116,7 +116,7 @@ public class ExportServiceListener implements ServiceListener { Set<String> exportedInterfaces = getServiceInterfaces(service, interfaces); for (String iface : exportedInterfaces) { - //Add endpoint description to the set. + // add endpoint description to the set. Version version = serviceReference.getBundle().getVersion(); String endpointId = iface + Constants.SEPARATOR + version.toString(); @@ -126,17 +126,17 @@ public class ExportServiceListener implements ServiceListener { endpoint = remoteEndpoints.get(endpointId); endpoint.getNodes().add(node); } else { - endpoint = new EndpointDescription(endpointId,node); + endpoint = new EndpointDescription(endpointId, node); } remoteEndpoints.put(endpointId, endpoint); - //Register the endpoint consumer + // register the endpoint consumer EventConsumer consumer = consumers.get(endpointId); - if(consumer == null) { + if (consumer == null) { consumer = eventTransportFactory.getEventConsumer(Constants.INTERFACE_PREFIX + Constants.SEPARATOR + endpointId, false); consumers.put(endpointId, consumer); - } else if(!consumer.isConsuming()) { + } else if (!consumer.isConsuming()) { consumer.start(); } } @@ -147,12 +147,12 @@ public class ExportServiceListener implements ServiceListener { } /** - * Removes {@link EventConsumer}s for consuming remote service calls. + * Remove {@link EventConsumer}s for consuming remote service calls. * * @param serviceReference */ public void unExportService(ServiceReference serviceReference) { - ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); + ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); String exportedServices = (String) serviceReference.getProperty(Constants.EXPORTED_INTERFACES); @@ -164,15 +164,15 @@ public class ExportServiceListener implements ServiceListener { Set<String> exportedInterfaces = getServiceInterfaces(service, interfaces); for (String iface : exportedInterfaces) { - //Add endpoint description to the set. + // add endpoint description to the set. Version version = serviceReference.getBundle().getVersion(); String endpointId = iface + Constants.SEPARATOR + version.toString(); EndpointDescription endpointDescription = remoteEndpoints.remove(endpointId); endpointDescription.getNodes().remove(node); - //If the endpoint is used for export from other nodes too, then put it back. - if(endpointDescription.getNodes().size() > 0) { - remoteEndpoints.put(endpointId,endpointDescription); + // if the endpoint is used for export from other nodes too, then put it back. + if (endpointDescription.getNodes().size() > 0) { + remoteEndpoints.put(endpointId, endpointDescription); } EventConsumer eventConsumer = consumers.remove(endpointId); @@ -185,11 +185,11 @@ public class ExportServiceListener implements ServiceListener { } /** - * Returns a Set of interfaces that match the actual exported service interfaces of a service. + * Return a Set of interfaces that match the actual exported service interfaces of a service. * - * @param service - * @param services - * @return + * @param service the service. + * @param services the services. + * @return the set of interfaces. */ public Set<String> getServiceInterfaces(Object service, String[] services) { Set<String> interfaceList = new LinkedHashSet<String>(); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ImportServiceListener.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ImportServiceListener.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ImportServiceListener.java index 79c4f46..006b8e1 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ImportServiceListener.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/ImportServiceListener.java @@ -14,7 +14,6 @@ package org.apache.karaf.cellar.dosgi; import org.apache.karaf.cellar.core.ClusterManager; -import org.apache.karaf.cellar.core.Producer; import org.apache.karaf.cellar.core.command.ClusteredExecutionContext; import org.apache.karaf.cellar.core.command.CommandStore; import org.apache.karaf.cellar.core.command.ExecutionContext; @@ -78,6 +77,7 @@ public class ImportServiceListener implements ListenerHook, Runnable { producers.clear(); } + @Override public void run() { for (ListenerInfo listener : pendingListeners) { checkListener(listener); @@ -96,7 +96,7 @@ public class ImportServiceListener implements ListenerHook, Runnable { } pendingListeners.add(listenerInfo); - // Make sure we only import remote services + // make sure we only import remote services checkListener(listenerInfo); } } finally { @@ -114,9 +114,9 @@ public class ImportServiceListener implements ListenerHook, Runnable { continue; } - // Make sure we only import remote services + // make sure we only import remote services String filter = "(&" + listenerInfo.getFilter() + "(!(" + Constants.ENDPOINT_FRAMEWORK_UUID + "=" + clusterManager.getNode().getId() + ")))"; - // Iterate through known services and import them if needed + // iterate through known services and import them if needed Set<EndpointDescription> matches = new LinkedHashSet<EndpointDescription>(); for (Map.Entry<String, EndpointDescription> entry : remoteEndpoints.entrySet()) { EndpointDescription endpointDescription = entry.getValue(); @@ -126,7 +126,7 @@ public class ImportServiceListener implements ListenerHook, Runnable { } for (EndpointDescription endpoint : matches) { - unimportService(endpoint); + unImportService(endpoint); } pendingListeners.remove(listenerInfo); @@ -137,15 +137,15 @@ public class ImportServiceListener implements ListenerHook, Runnable { } /** - * Checks if there is a match for the current {@link ListenerInfo}. + * Check if there is a match for the current {@link ListenerInfo}. * - * @param listenerInfo + * @param listenerInfo the listener info. */ private void checkListener(ListenerInfo listenerInfo) { ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); - // Iterate through known services and import them if needed + // iterate through known services and import them if needed Set<EndpointDescription> matches = new LinkedHashSet<EndpointDescription>(); for (Map.Entry<String, EndpointDescription> entry : remoteEndpoints.entrySet()) { EndpointDescription endpointDescription = entry.getValue(); @@ -162,10 +162,10 @@ public class ImportServiceListener implements ListenerHook, Runnable { } /** - * Imports a remote service to the service registry. + * Import a remote service to the service registry. * - * @param endpoint - * @param listenerInfo + * @param endpoint the endpoint description. + * @param listenerInfo the listener info. */ private void importService(EndpointDescription endpoint, ListenerInfo listenerInfo) { LOGGER.debug("CELLAR DOSGI: importing remote service"); @@ -199,11 +199,11 @@ public class ImportServiceListener implements ListenerHook, Runnable { } /** - * Unregisters an imported service + * Un-register an imported service. * - * @param endpoint + * @param endpoint the endpoint description. */ - private void unimportService(EndpointDescription endpoint) { + private void unImportService(EndpointDescription endpoint) { ServiceRegistration registration = registrations.get(endpoint); registration.unregister(); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCall.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCall.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCall.java index f337f6b..7ffcba4 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCall.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCall.java @@ -18,7 +18,7 @@ import org.apache.karaf.cellar.core.command.Command; import java.util.List; /** - * Call to a remote service. + * Cluster remote service call event. */ public class RemoteServiceCall extends Command<RemoteServiceResult> { @@ -27,11 +27,6 @@ public class RemoteServiceCall extends Command<RemoteServiceResult> { private String serviceClass; private List<Object> arguments; - /** - * Constructor - * - * @param id - */ public RemoteServiceCall(String id) { super(id); } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCallHandler.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCallHandler.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCallHandler.java index ef21769..99b9b99 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCallHandler.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceCallHandler.java @@ -32,7 +32,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** - * Handler on a remote service call. + * Handler for cluster remote service call event. */ public class RemoteServiceCallHandler extends CellarSupport implements EventHandler<RemoteServiceCall> { @@ -61,25 +61,20 @@ public class RemoteServiceCallHandler extends CellarSupport implements EventHand ServiceReference[] serviceReferences = null; try { - serviceReferences = bundleContext.getServiceReferences(event.getServiceClass(), null); if (serviceReferences != null && serviceReferences.length > 0) { targetService = bundleContext.getService(serviceReferences[0]); bundleContext.ungetService(serviceReferences[0]); } - } catch (InvalidSyntaxException e) { LOGGER.error("CELLAR DOSGI: unable to lookup service", e); } if (targetService != null) { - Class[] classes = new Class[0]; - if (event.getArguments() != null && event.getArguments().size() > 0) { classes = new Class[event.getArguments().size()]; int i = 0; - for (Object obj : event.getArguments()) { classes[i++] = obj.getClass(); } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFactory.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFactory.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFactory.java index 51db5c3..1a759a3 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFactory.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFactory.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.List; /** - * Remote service factory. + * Factory for remote service. */ public class RemoteServiceFactory implements ServiceFactory { @@ -43,12 +43,12 @@ public class RemoteServiceFactory implements ServiceFactory { ClassLoader classLoader = new RemoteServiceProxyClassLoader(bundle); List<Class> interfaces = new ArrayList<Class>(); String interfaceName = description.getServiceClass(); - try { - interfaces.add(classLoader.loadClass(interfaceName)); - } catch (ClassNotFoundException e) { - // Ignore - } - RemoteServiceInvocationHandler handler = new RemoteServiceInvocationHandler(description.getId(), interfaceName,clusterManager,executionContext); + try { + interfaces.add(classLoader.loadClass(interfaceName)); + } catch (ClassNotFoundException e) { + // ignore + } + RemoteServiceInvocationHandler handler = new RemoteServiceInvocationHandler(description.getId(), interfaceName, clusterManager, executionContext); return Proxy.newProxyInstance(classLoader, interfaces.toArray(new Class[interfaces.size()]), handler); } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFindHook.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFindHook.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFindHook.java index 9d13992..f850ece 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFindHook.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceFindHook.java @@ -19,13 +19,13 @@ import org.osgi.framework.hooks.service.FindHook; import java.util.Collection; /** - * Remote service finder. + * Hook for remote service finder. */ public class RemoteServiceFindHook implements FindHook { @Override public void find(BundleContext context, String name, String filter, boolean allServices, Collection references) { - + // nothing to do } } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceInvocationHandler.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceInvocationHandler.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceInvocationHandler.java index 08c852d..fc82ed4 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceInvocationHandler.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceInvocationHandler.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.Map; /** - * Handler on a remote service invocation. + * Handler for cluster remote service invocation event. */ public class RemoteServiceInvocationHandler implements InvocationHandler { @@ -33,13 +33,6 @@ public class RemoteServiceInvocationHandler implements InvocationHandler { private ClusterManager clusterManager; private ExecutionContext executionContext; - /** - * Constructor - * @param endpointId - * @param serviceClass - * @param clusterManager - * @param executionContext - */ public RemoteServiceInvocationHandler(String endpointId,String serviceClass, ClusterManager clusterManager, ExecutionContext executionContext) { this.endpointId = endpointId; this.serviceClass = serviceClass; http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResult.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResult.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResult.java index 7a7cd5f..ed694d7 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResult.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResult.java @@ -16,17 +16,12 @@ package org.apache.karaf.cellar.dosgi; import org.apache.karaf.cellar.core.command.Result; /** - * Result of a remote service call. + * Cluster remote service result event. */ public class RemoteServiceResult extends Result { private Object result; - /** - * Constructor - * - * @param id - */ public RemoteServiceResult(String id) { super(id); } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResultHandler.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResultHandler.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResultHandler.java index fc5b13d..22c4e29 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResultHandler.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/RemoteServiceResultHandler.java @@ -16,7 +16,7 @@ package org.apache.karaf.cellar.dosgi; import org.apache.karaf.cellar.core.command.ResultHandler; /** - * Handler on a remote service result. + * Handler for cluster remote service result event. */ public class RemoteServiceResultHandler extends ResultHandler<RemoteServiceResult> { http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java ---------------------------------------------------------------------- diff --git a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java index 70399d2..42583ae 100644 --- a/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java +++ b/dosgi/src/main/java/org/apache/karaf/cellar/dosgi/shell/ListDistributedServicesCommand.java @@ -22,7 +22,7 @@ import org.apache.karaf.cellar.dosgi.EndpointDescription; import java.util.Map; import java.util.Set; -@Command(scope = "cluster", name = "service-list", description = "List the cluster distributed services.") +@Command(scope = "cluster", name = "service-list", description = "List the services available on the cluster") public class ListDistributedServicesCommand extends CellarCommandSupport { private static final String LIST_FORMAT = "%-80s %-20s"; @@ -44,9 +44,8 @@ public class ListDistributedServicesCommand extends CellarCommandSupport { serviceClass = ""; } } - } else { - System.out.println("There are no distributed service"); + System.out.println("No services available on the cluster"); } } finally { Thread.currentThread().setContextClassLoader(originalClassLoader); http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml ---------------------------------------------------------------------- diff --git a/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml index 7bf30ad..298a4b7 100644 --- a/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml +++ b/dosgi/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -16,22 +16,22 @@ <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> <!-- Import Service Listener --> - <bean id="importListener" class="org.apache.karaf.cellar.dosgi.ImportServiceListener" init-method="init" destroy-method="destroy"> + <bean id="importServiceListener" class="org.apache.karaf.cellar.dosgi.ImportServiceListener" init-method="init" destroy-method="destroy"> <property name="clusterManager" ref="clusterManager"/> <property name="commandStore" ref="commandStore"/> <property name="bundleContext" ref="blueprintBundleContext"/> <property name="eventTransportFactory" ref="eventTransportFactory"/> </bean> - <service ref="importListener" interface="org.osgi.framework.hooks.service.ListenerHook"/> + <service ref="importServiceListener" interface="org.osgi.framework.hooks.service.ListenerHook"/> <!-- Export Service Listener --> - <bean id="exportListener" class="org.apache.karaf.cellar.dosgi.ExportServiceListener" init-method="init" destroy-method="destroy"> + <bean id="exportServiceListener" class="org.apache.karaf.cellar.dosgi.ExportServiceListener" init-method="init" destroy-method="destroy"> <property name="clusterManager" ref="clusterManager"/> <property name="bundleContext" ref="blueprintBundleContext"/> <property name="eventTransportFactory" ref="eventTransportFactory"/> </bean> - <!-- Cluster Event Handler --> + <!-- Cluster Remote Service Call Event Handler --> <bean id="remoteServiceCallHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceCallHandler"> <property name="clusterManager" ref="clusterManager"/> <property name="eventTransportFactory" ref="eventTransportFactory"/> @@ -44,13 +44,12 @@ </service-properties> </service> - <!-- Cluster Event Handler --> + <!-- Cluster Remote Service Result Event Handler --> <bean id="remoteServiceResultHandler" class="org.apache.karaf.cellar.dosgi.RemoteServiceResultHandler"> <property name="commandStore" ref="commandStore"/> </bean> <service ref="remoteServiceResultHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/> - <!-- Cluster Core Services --> <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/> <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/> <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/> http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml ---------------------------------------------------------------------- diff --git a/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml b/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml index 1de4eb5..4aafd27 100644 --- a/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml +++ b/dosgi/src/main/resources/OSGI-INF/blueprint/shell-dosgi.xml @@ -14,7 +14,6 @@ --> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy"> - <!-- Command Bundle --> <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0"> <command name="cluster/service-list"> <action class="org.apache.karaf.cellar.dosgi.shell.ListDistributedServicesCommand"> @@ -23,5 +22,4 @@ </command> </command-bundle> - </blueprint> http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java ---------------------------------------------------------------------- diff --git a/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java b/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java index e8bd9b6..88b44c3 100644 --- a/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java +++ b/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/EndpointDescriptionTest.java @@ -22,13 +22,11 @@ import org.junit.Test; public class EndpointDescriptionTest { String objectClass = "org.apache.karaf.cellar.dosgi.Test"; - String frameworkUUID1 = "192.168.1.101:5701"; - String frameworkUUID2 = "192.168.1.102:5702"; String filterPattern = "(&(objectClass=%s))"; @Test public void testMatches() throws Exception { - //This is a dummy test for testing the behaviour of matches method. + // this is a dummy test for testing the behaviour of matches method String testEndpointFilter = String.format(filterPattern,objectClass); String endpointId = objectClass+Constants.SEPARATOR+"1.0.0"; @@ -36,7 +34,6 @@ public class EndpointDescriptionTest { EndpointDescription endpointDescription2 = new EndpointDescription(endpointId,null); Assert.assertTrue(endpointDescription1.matches(testEndpointFilter)); Assert.assertTrue(endpointDescription2.matches(testEndpointFilter)); - } } http://git-wip-us.apache.org/repos/asf/karaf-cellar/blob/7669c31f/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java ---------------------------------------------------------------------- diff --git a/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java b/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java index c5fafe5..5a8cfe6 100644 --- a/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java +++ b/dosgi/src/test/java/org/apache/karaf/cellar/dosgi/ExportServiceListenerTest.java @@ -13,9 +13,7 @@ */ package org.apache.karaf.cellar.dosgi; -import org.junit.After; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import java.util.ArrayList; @@ -29,16 +27,6 @@ public class ExportServiceListenerTest { private ExportServiceListener listener = new ExportServiceListener(); - @Before - public void setUp() throws Exception { - - } - - @After - public void tearDown() throws Exception { - - } - @Test public void testGetServiceInterfaces() throws Exception { System.out.println("Test Service interfaces with null service"); @@ -49,7 +37,7 @@ public class ExportServiceListenerTest { result = listener.getServiceInterfaces(null,new String[] {"*"}); Assert.assertEquals(expectedResult,result); - System.out.println("Test Service interfaces with ArrayList and wildchard services"); + System.out.println("Test Service interfaces with ArrayList and wildcard services"); result = listener.getServiceInterfaces(new ArrayList(),new String[] {"*"}); Assert.assertTrue(result.contains("java.util.List"));
