camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r775599 - in /camel/trunk/components: camel-cxf/src/main/java/org/apache/camel/component/cxf/ camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/ camel-http/src/main/java/org/apache/camel/component/http/ camel-jetty/src/main/jav...
Date Sun, 17 May 2009 08:26:47 GMT
Author: ningjiang
Date: Sun May 17 08:26:47 2009
New Revision: 775599

URL: http://svn.apache.org/viewvc?rev=775599&view=rev
Log:
CAMEL-1617 Introduced HeaderFilterStrategyComponent and refectored the code

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
    camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
    camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
    camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
    camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/ContentTypeResolver.java
    camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfComponent.java
Sun May 17 08:26:47 2009
@@ -22,9 +22,7 @@
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.component.cxf.spring.CxfEndpointBean;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.util.CamelContextHelper;
 
 /**
@@ -32,9 +30,8 @@
  * 
  * @version $Revision$
  */
-public class CxfComponent extends DefaultComponent implements HeaderFilterStrategyAware{
-    private HeaderFilterStrategy headerFilterStrategy;
-    
+public class CxfComponent extends HeaderFilterStrategyComponent {
+        
     public CxfComponent() {
     }
 
@@ -64,9 +61,7 @@
                     CxfEndpointBean.class);
 
             result = new CxfSpringEndpoint(this, bean);
-            if (getHeaderFilterStrategy() != null) {
-                result.setHeaderFilterStrategy(headerFilterStrategy);
-            }
+            setEndpointHeaderFilterStrategy(result);
            
             // Apply Spring bean properties (including # notation referenced bean).  Note
that the
             // Spring bean properties values can be overridden by property defined in URI
query.
@@ -85,13 +80,5 @@
         
         return result;
     }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {
-        return headerFilterStrategy;
-    }
-
-    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
-        headerFilterStrategy = strategy;
-    }
-    
+        
 }

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/cxfbean/CxfBeanComponent.java
Sun May 17 08:26:47 2009
@@ -20,9 +20,8 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.HeaderFilterStrategyAware;
 
 /**
  * CXF Bean component creates {@link CxfBeanEndpoint} which represents a
@@ -31,19 +30,16 @@
  * 
  * @version $Revision$
  */
-public class CxfBeanComponent extends DefaultComponent implements HeaderFilterStrategyAware{
+public class CxfBeanComponent extends HeaderFilterStrategyComponent {
 
     private Map<String, CxfBeanEndpoint> endpoints = new HashMap<String, CxfBeanEndpoint>();
-    private HeaderFilterStrategy headerFilterStrategy;
-    
+        
     @SuppressWarnings("unchecked")
     @Override
     protected Endpoint createEndpoint(String uri, String remaining,
             Map parameters) throws Exception {
         CxfBeanEndpoint answer = new CxfBeanEndpoint(remaining, this);
-        if (getHeaderFilterStrategy() != null) {
-            answer.setHeaderFilterStrategy(getHeaderFilterStrategy());
-        }
+        setEndpointHeaderFilterStrategy(answer);
         setProperties(answer, parameters);
 
         // add to the endpoints map before calling the endpoint's init() method to 
@@ -80,14 +76,5 @@
     public CxfBeanEndpoint getEndpoint(String endpointUri) {
         return endpoints.get(endpointUri);
     }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {        
-        return headerFilterStrategy;
-    }
-
-    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
-        headerFilterStrategy = strategy;        
-    }
-
-
+   
 }

Modified: camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
(original)
+++ camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpComponent.java
Sun May 17 08:26:47 2009
@@ -21,9 +21,7 @@
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.ResolveEndpointFailedException;
-import org.apache.camel.impl.DefaultComponent;
-import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.HeaderFilterStrategyAware;
+import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.util.CamelContextHelper;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.URISupport;
@@ -37,13 +35,12 @@
  *
  * @version $Revision$
  */
-public class HttpComponent extends DefaultComponent implements HeaderFilterStrategyAware
{
+public class HttpComponent extends HeaderFilterStrategyComponent {
     protected HttpClientConfigurer httpClientConfigurer;
     protected HttpConnectionManager httpConnectionManager = new MultiThreadedHttpConnectionManager();
     protected HttpBinding httpBinding;
     private boolean matchOnUriPrefix;
-    private HeaderFilterStrategy headerFilterstrategy;
-
+    
     /**
      * Connects the URL specified on the endpoint to the specified processor.
      *
@@ -125,9 +122,7 @@
         if (httpBinding != null) {
             endpoint.setBinding(httpBinding);
         }
-        if (getHeaderFilterStrategy() != null) {
-            endpoint.setHeaderFilterStrategy(getHeaderFilterStrategy());
-        }
+        setEndpointHeaderFilterStrategy(endpoint);
         if (throwExceptionOnFailure != null) {
             endpoint.setThrowExceptionOnFailure(throwExceptionOnFailure);
         }
@@ -166,15 +161,6 @@
 
     public boolean isMatchOnUriPrefix() {
         return matchOnUriPrefix;
-    }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {
-        return headerFilterstrategy;
-    }
-
-    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
-        headerFilterstrategy = strategy;
-        
-    }
+    }  
     
 }

Modified: camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
(original)
+++ camel/trunk/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
Sun May 17 08:26:47 2009
@@ -113,9 +113,7 @@
         if (httpBinding != null) {
             result.setBinding(httpBinding);
         }
-        if (getHeaderFilterStrategy() != null) {
-            result.setHeaderFilterStrategy(getHeaderFilterStrategy());
-        }
+        setEndpointHeaderFilterStrategy(result);
         if (handlerList.size() > 0) {
             result.setHandlers(handlerList);
         }

Modified: camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
(original)
+++ camel/trunk/components/camel-jhc/src/main/java/org/apache/camel/component/jhc/JhcComponent.java
Sun May 17 08:26:47 2009
@@ -21,6 +21,7 @@
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.spi.HeaderFilterStrategy;
 import org.apache.camel.spi.HeaderFilterStrategyAware;
 import org.apache.http.params.BasicHttpParams;
@@ -28,10 +29,10 @@
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
 
-public class JhcComponent extends DefaultComponent implements HeaderFilterStrategyAware {
+public class JhcComponent extends HeaderFilterStrategyComponent {
 
     private HttpParams params;
-    private HeaderFilterStrategy headerFilterStrategy;
+    
 
     public JhcComponent() {
         
@@ -59,13 +60,5 @@
         }
         return jhcEndpoint;
     }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {        
-        return headerFilterStrategy;
-    }
-
-    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
-        headerFilterStrategy = strategy;        
-    }
-
+    
 }

Modified: camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/ContentTypeResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/ContentTypeResolver.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/ContentTypeResolver.java
(original)
+++ camel/trunk/components/camel-mail/src/main/java/org/apache/camel/component/mail/ContentTypeResolver.java
Sun May 17 08:26:47 2009
@@ -23,7 +23,7 @@
  * <p/>
  * Note using SUN mail jar have no problem with resolving Content-Type based on file attachments.
This resolver
  * is thus only needed to work around mail providers having bugs or when you a new mime type
is unknown by the
- * mail provider allowing you to deterime it.
+ * mail provider allowing you to determine it.
  *
  * @version $Revision$
  */
@@ -38,7 +38,7 @@
      * The returned value should only be the mime part of the ContentType header, for example:
      * <tt>image/jpeg</tt> should be returned. Camel will add the remaining <tt>;
name=FILENAME</tt>.
      *
-     * @param fileName  the attachment file nane
+     * @param fileName  the attachment file name
      * @return the Content-Type or <tt>null</tt> to rely on the mail provider
      */
     String resolveContentType(String fileName);

Modified: camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java?rev=775599&r1=775598&r2=775599&view=diff
==============================================================================
--- camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
(original)
+++ camel/trunk/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletComponent.java
Sun May 17 08:26:47 2009
@@ -21,9 +21,8 @@
 import java.util.Map;
 
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.HeaderFilterStrategyComponent;
 import org.apache.camel.spi.HeaderFilterStrategy;
-import org.apache.camel.spi.HeaderFilterStrategyAware;
 import org.apache.camel.util.URISupport;
 import org.apache.camel.util.UnsafeUriCharactersEncoder;
 import org.apache.commons.logging.Log;
@@ -40,22 +39,19 @@
  *
  * @version $Revision$
  */
-public class RestletComponent extends DefaultComponent implements HeaderFilterStrategyAware
{
+public class RestletComponent extends HeaderFilterStrategyComponent {
     private static final Log LOG = LogFactory.getLog(RestletComponent.class);
 
     private final Map<String, Server> servers = new HashMap<String, Server>();
     private final Map<String, MethodBasedRouter> routers = new HashMap<String, MethodBasedRouter>();
     private final Component component = new Component();
-    private HeaderFilterStrategy headerFilterStrategy;
-
+    
     @Override
     @SuppressWarnings("unchecked")
     protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws
Exception {
         
         RestletEndpoint result = new RestletEndpoint(this, remaining);
-        if (getHeaderFilterStrategy() != null) {
-            result.setHeaderFilterStrategy(getHeaderFilterStrategy());
-        }
+        setEndpointHeaderFilterStrategy(result);
         setProperties(result, parameters);
         
         // construct URI so we can use it to get the splitted information
@@ -181,14 +177,7 @@
     private static String buildKey(RestletEndpoint endpoint) {
         return endpoint.getHost() + ":" + endpoint.getPort();
     }
-
-    public HeaderFilterStrategy getHeaderFilterStrategy() {
-        return headerFilterStrategy;
-    }
-
-    public void setHeaderFilterStrategy(HeaderFilterStrategy strategy) {
-        headerFilterStrategy = strategy;        
-    }
+  
     
 }
 



Mime
View raw message