cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1484699 - in /cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter: EndpointRepository.java TopologyManagerExport.java
Date Tue, 21 May 2013 08:45:03 GMT
Author: cschneider
Date: Tue May 21 08:45:03 2013
New Revision: 1484699

URL: http://svn.apache.org/r1484699
Log:
DOSGI-184 Using correct formatting

Modified:
    cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
    cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java

Modified: cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java?rev=1484699&r1=1484698&r2=1484699&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/EndpointRepository.java
Tue May 21 08:45:03 2013
@@ -33,86 +33,85 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * Holds all endpoints that are exported by a TopologyManager.
- * For each ServiceReference that is exported a map is maintained which contains information
- * on the endpoints for each RemoteAdminService that created the endpoints 
+ * Holds all endpoints that are exported by a TopologyManager. For each ServiceReference
that is exported a
+ * map is maintained which contains information on the endpoints for each RemoteAdminService
that created the
+ * endpoints
  */
 class EndpointRepository {
-	private static final Logger LOG = LoggerFactory.getLogger(EndpointRepository.class);
+    private static final Logger LOG = LoggerFactory.getLogger(EndpointRepository.class);
+
+    private final Map<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>>
exportedServices = new LinkedHashMap<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>>();
 
-    private final Map<ServiceReference, 
-                      Map<RemoteServiceAdmin, Collection<EndpointDescription>>>
exportedServices = 
-        new LinkedHashMap<ServiceReference, Map<RemoteServiceAdmin, Collection<EndpointDescription>>>();
-    
     /**
      * Remove all services exported by the given rsa and notify listeners
+     * 
      * @param rsa
      * @return list of removed endpoints
      */
     synchronized List<EndpointDescription> removeRemoteServiceAdmin(RemoteServiceAdmin
rsa) {
-    	List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
-    	for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports :
exportedServices
-    			.values()) {
-    		if (exports.containsKey(rsa)) {
-    			removedEndpoints.addAll(exports.get(rsa));
-    			exports.remove(rsa);
-    		}
-    	}
-    	return removedEndpoints;
+        List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
+        for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports
: exportedServices.values()) {
+            if (exports.containsKey(rsa)) {
+                removedEndpoints.addAll(exports.get(rsa));
+                exports.remove(rsa);
+            }
+        }
+        return removedEndpoints;
     }
-    
+
     synchronized List<EndpointDescription> removeService(ServiceReference sref) {
-    	List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
-    	if (exportedServices.containsKey(sref)) {
-    		Map<RemoteServiceAdmin, Collection<EndpointDescription>> rsas = exportedServices.get(sref);
-    		for (Map.Entry<RemoteServiceAdmin, Collection<EndpointDescription>> entry
: rsas.entrySet()) {
-    			if (entry.getValue() != null) {
-    				removedEndpoints.addAll(entry.getValue());
-    			}
-    		}
-    		exportedServices.remove(sref);
-    	}
-    	return removedEndpoints;
+        List<EndpointDescription> removedEndpoints = new ArrayList<EndpointDescription>();
+        if (exportedServices.containsKey(sref)) {
+            Map<RemoteServiceAdmin, Collection<EndpointDescription>> rsas = exportedServices.get(sref);
+            for (Map.Entry<RemoteServiceAdmin, Collection<EndpointDescription>>
entry : rsas.entrySet()) {
+                if (entry.getValue() != null) {
+                    removedEndpoints.addAll(entry.getValue());
+                }
+            }
+            exportedServices.remove(sref);
+        }
+        return removedEndpoints;
     }
-    
+
     synchronized void addService(ServiceReference sref) {
-    	if (!exportedServices.containsKey(sref)) {
-        	LOG.info("Marking service from bundle {} for export", sref.getBundle().getSymbolicName());
-    		exportedServices.put(sref,
-    			new LinkedHashMap<RemoteServiceAdmin, Collection<EndpointDescription>>());
-    	}
-    }
-    
-    synchronized void addEndpoints(ServiceReference sref, RemoteServiceAdmin rsa, List<EndpointDescription>
endpoints) {
-    	addService(sref);
-    	Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
-    	exports.put(rsa, endpoints);
+        if (!exportedServices.containsKey(sref)) {
+            LOG.info("Marking service from bundle {} for export", sref.getBundle().getSymbolicName());
+            exportedServices.put(sref,
+                                 new LinkedHashMap<RemoteServiceAdmin, Collection<EndpointDescription>>());
+        }
     }
-    
+
+    synchronized void addEndpoints(ServiceReference sref, RemoteServiceAdmin rsa,
+                                   List<EndpointDescription> endpoints) {
+        addService(sref);
+        Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
+        exports.put(rsa, endpoints);
+    }
+
     synchronized boolean isAlreadyExportedForRsa(ServiceReference sref, RemoteServiceAdmin
rsa) {
-    	Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
-    	return exports != null && exports.containsKey(rsa);
+        Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports = exportedServices.get(sref);
+        return exports != null && exports.containsKey(rsa);
     }
-    
+
     synchronized Collection<EndpointDescription> getAllEndpoints() {
-    	List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
-    	for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports :
exportedServices.values()) {
-    		for (Collection<EndpointDescription> regs : exports.values()) {
-    			if (regs != null) {
-    				endpoints.addAll(regs);
-    			}
-    		}
-    	}
-    	return endpoints;
+        List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
+        for (Map<RemoteServiceAdmin, Collection<EndpointDescription>> exports
: exportedServices.values()) {
+            for (Collection<EndpointDescription> regs : exports.values()) {
+                if (regs != null) {
+                    endpoints.addAll(regs);
+                }
+            }
+        }
+        return endpoints;
     }
 
     synchronized Set<ServiceReference> getServicesToBeExportedFor(RemoteServiceAdmin
rsa) {
-    	Set<ServiceReference> servicesToBeExported = new HashSet<ServiceReference>();
-    	for (ServiceReference sref : exportedServices.keySet()) {
-    		if (!isAlreadyExportedForRsa(sref, rsa)) {
-				servicesToBeExported.add(sref);
-			}
-		}
-		return servicesToBeExported;
+        Set<ServiceReference> servicesToBeExported = new HashSet<ServiceReference>();
+        for (ServiceReference sref : exportedServices.keySet()) {
+            if (!isAlreadyExportedForRsa(sref, rsa)) {
+                servicesToBeExported.add(sref);
+            }
+        }
+        return servicesToBeExported;
     }
 }

Modified: cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java?rev=1484699&r1=1484698&r2=1484699&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/exporter/TopologyManagerExport.java
Tue May 21 08:45:03 2013
@@ -156,27 +156,27 @@ public class TopologyManagerExport {
         }
     }
 
-	private void exportServiceUsingRemoteServiceAdmin(
-			final ServiceReference sref,
-			final RemoteServiceAdmin remoteServiceAdmin) {
-		// TODO: additional parameter Map ?
-		LOG.debug("exporting ...");
-		Collection<ExportRegistration> exportRegs = remoteServiceAdmin
-		        .exportService(sref, null);
-		List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
-		if (exportRegs == null) {
-		    // TODO export failed -> What should be done here?
-		    LOG.error("export failed");
-		} else {
-			for (ExportRegistration exportReg : exportRegs) {
-				endpoints.add(getExportedEndpoint(exportReg));
-			}
-		    LOG.info("TopologyManager: export sucessful Endpoints: {}", endpoints);
-		    epListenerNotifier.nofifyEndpointListenersOfAdding(endpoints);
-		}
-		endpointRepo.addEndpoints(sref, remoteServiceAdmin, endpoints);
-	}
-    
+    private void exportServiceUsingRemoteServiceAdmin(
+                                                      final ServiceReference sref,
+                                                      final RemoteServiceAdmin remoteServiceAdmin)
{
+        // TODO: additional parameter Map ?
+        LOG.debug("exporting ...");
+        Collection<ExportRegistration> exportRegs = remoteServiceAdmin
+            .exportService(sref, null);
+        List<EndpointDescription> endpoints = new ArrayList<EndpointDescription>();
+        if (exportRegs == null) {
+            // TODO export failed -> What should be done here?
+            LOG.error("export failed");
+        } else {
+            for (ExportRegistration exportReg : exportRegs) {
+                endpoints.add(getExportedEndpoint(exportReg));
+            }
+            LOG.info("TopologyManager: export sucessful Endpoints: {}", endpoints);
+            epListenerNotifier.nofifyEndpointListenersOfAdding(endpoints);
+        }
+        endpointRepo.addEndpoints(sref, remoteServiceAdmin, endpoints);
+    }
+
     /**
      * Retrieve exported Endpoint while handling null
      * @param exReg
@@ -189,15 +189,15 @@ public class TopologyManagerExport {
     
     private void exportExistingServices() {
         try {
-			ServiceReference[] references = bctx.getServiceReferences(null, DOSGI_SERVICES);
-			if (references != null) {
-			    for (ServiceReference sref : references) {
-			        triggerExport(sref);
-			    }
-			}
-		} catch (InvalidSyntaxException e) {
-			LOG.error("Error in filter {}. This should not occur !", DOSGI_SERVICES);
-		}
+            ServiceReference[] references = bctx.getServiceReferences(null, DOSGI_SERVICES);
+            if (references != null) {
+                for (ServiceReference sref : references) {
+                    triggerExport(sref);
+                }
+            }
+        } catch (InvalidSyntaxException e) {
+            LOG.error("Error in filter {}. This should not occur !", DOSGI_SERVICES);
+        }
     }
 
 }



Mime
View raw message