servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r357766 - /incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java
Date Mon, 19 Dec 2005 19:50:41 GMT
Author: gnodet
Date: Mon Dec 19 11:50:36 2005
New Revision: 357766

URL: http://svn.apache.org/viewcvs?rev=357766&view=rev
Log:
Make ServiceAndEndpointNameResolver inherit from EndpointResolverSupport for a cleaner hierarchy

Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java?rev=357766&r1=357765&r2=357766&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java
Mon Dec 19 11:50:36 2005
@@ -17,23 +17,23 @@
  **/
 package org.servicemix.jbi.resolver;
 
-import org.servicemix.jbi.NoServiceEndpointAvailableException;
-
 import javax.jbi.JBIException;
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
 
+import org.servicemix.jbi.NoServiceAvailableException;
+
 /**
  * Resolves the endpoint using the service name and endpoint name to resolve the {@link ServiceEndpoint}
  *
  * @version $Revision$
  */
-public class ServiceAndEndpointNameResolver implements EndpointResolver {
+public class ServiceAndEndpointNameResolver extends EndpointResolverSupport {
+	
     private QName serviceName;
     private String endpointName;
-    private boolean failIfUnavailable = true;
 
     public ServiceAndEndpointNameResolver() {
     }
@@ -43,17 +43,6 @@
         this.endpointName = endpointName;
     }
 
-    public ServiceEndpoint resolveEndpoint(ComponentContext context, MessageExchange exchange,
EndpointFilter filter) throws JBIException {
-        ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName);
-        if (!filter.evaluate(endpoint, exchange)) {
-            endpoint = null;
-        }
-        if (endpoint == null && failIfUnavailable) {
-            throw new NoServiceEndpointAvailableException(serviceName, endpointName);
-        }
-        return endpoint;
-    }
-
     public ServiceEndpoint[] resolveAvailableEndpoints(ComponentContext context, MessageExchange
exchange) throws JBIException {
         ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName);
         if (endpoint != null) {
@@ -64,6 +53,8 @@
         }
     }
 
+    // Properties
+    //-------------------------------------------------------------------------
     public QName getServiceName() {
         return serviceName;
     }
@@ -80,11 +71,9 @@
         this.endpointName = endpointName;
     }
 
-    public boolean isFailIfUnavailable() {
-        return failIfUnavailable;
-    }
-
-    public void setFailIfUnavailable(boolean failIfUnavailable) {
-        this.failIfUnavailable = failIfUnavailable;
+    // Implementation methods
+    //-------------------------------------------------------------------------
+    protected JBIException createServiceUnavailableException() {
+        return new NoServiceAvailableException(serviceName);
     }
 }



Mime
View raw message