camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r660216 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/builder/ main/java/org/apache/camel/component/file/ main/java/org/apache/camel/component/mock/ main/java/org/apache/camel/component/vm/ main/java/org/apache/camel...
Date Mon, 26 May 2008 15:42:03 GMT
Author: ningjiang
Date: Mon May 26 08:41:59 2008
New Revision: 660216

URL: http://svn.apache.org/viewvc?rev=660216&view=rev
Log:
CAMEL-550 fixed the NPE error , also fixed some CS errors

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerProducerFileNamesTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
Mon May 26 08:41:59 2008
@@ -17,7 +17,8 @@
 package org.apache.camel.builder;
 
 import java.util.ArrayList;
-import java.util.List;import java.util.Arrays;
+import java.util.Arrays;
+import java.util.List;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
Mon May 26 08:41:59 2008
@@ -21,8 +21,8 @@
 
 import org.apache.camel.AsyncCallback;
 import org.apache.camel.Processor;
-import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.camel.impl.ScheduledPollConsumer;
+import org.apache.camel.processor.DeadLetterChannel;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java
Mon May 26 08:41:59 2008
@@ -19,10 +19,11 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;import java.util.Arrays;
+import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -286,12 +287,12 @@
         expects(new Runnable() {
             public void run() {
                 assertTrue("No header with name " + headerName + " found.", actualHeader
!= null);
-                
+
                 assertEquals("Header of message", headerValue, actualHeader);
             }
         });
-    }   
-    
+    }
+
     /**
      * Adds an expectation that the given body values are received by this
      * endpoint

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/vm/VmComponent.java
Mon May 26 08:41:59 2008
@@ -35,7 +35,7 @@
  * @version $Revision$
  */
 public class VmComponent extends SedaComponent {
-    protected static final Map<String, BlockingQueue> queues = new HashMap<String,
BlockingQueue>();
+    protected static final Map<String, BlockingQueue> QUEUES = new HashMap<String,
BlockingQueue>();
     private static final AtomicInteger START_COUNTER = new AtomicInteger();
 
 
@@ -46,11 +46,11 @@
     }
 
     protected BlockingQueue<Exchange> getBlockingQueue(String uri, Map parameters)
{
-        synchronized (queues) {
-            BlockingQueue<Exchange> answer = queues.get(uri);
+        synchronized (QUEUES) {
+            BlockingQueue<Exchange> answer = QUEUES.get(uri);
             if (answer == null) {
                 answer = createQueue(uri, parameters);
-                queues.put(uri, answer);
+                QUEUES.put(uri, answer);
             }
             return answer;
         }
@@ -66,11 +66,11 @@
     protected void doStop() throws Exception {
         super.doStop();
         if (START_COUNTER.decrementAndGet() == 0) {
-            synchronized (queues) {
-                for (BlockingQueue q : queues.values()) {
+            synchronized (QUEUES) {
+                for (BlockingQueue q : QUEUES.values()) {
                     q.clear();
                 }
-                queues.clear();
+                QUEUES.clear();
             }
         }
     }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/management/InstrumentationLifecycleStrategy.java
Mon May 26 08:41:59 2008
@@ -31,6 +31,7 @@
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.model.ProcessorType;
 import org.apache.camel.model.RouteType;
+import org.apache.camel.processor.interceptor.Debugger;
 import org.apache.camel.spi.InstrumentationAgent;
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.RouteContext;
@@ -83,13 +84,13 @@
             try {
                 ManagedRoute mr = new ManagedRoute(route);
                 // retrieve the per-route intercept for this route
-                InstrumentationProcessor interceptor = interceptorMap.get(route.getEndpoint());
+                /*InstrumentationProcessor interceptor = interceptorMap.get(route.getEndpoint());
                 if (interceptor == null) {
                     LOG.warn("Instrumentation processor not found for route endpoint "
                              + route.getEndpoint());
                 } else {
                     interceptor.setCounter(mr);
-                }
+                }*/
                 agent.register(mr, getNamingStrategy().getObjectName(mr));
             } catch (JMException e) {
                 LOG.warn("Could not register Route MBean", e);
@@ -134,9 +135,15 @@
 
         routeContext.addInterceptStrategy(new InstrumentationInterceptStrategy(counterMap));
 
+        // TODO we need to find other way to instrument the route.
+        // below codes adding wrap the processor with all the processors which are already
wrapped
+        // by the InstrumentationInterceptStrategy
+
+        /*
         // Add an InstrumentationProcessor at the beginning of each route and
         // set up the interceptorMap for onRoutesAdd() method to register the
         // ManagedRoute MBeans.
+
         RouteType routeType = routeContext.getRoute();
         if (routeType.getInputs() != null && !routeType.getInputs().isEmpty()) {
             if (routeType.getInputs().size() > 1) {
@@ -144,19 +151,13 @@
             }
 
             Endpoint endpoint  = routeType.getInputs().get(0).getEndpoint();
-            ProcessorType<?>[] outputs =
-                routeType.getOutputs().toArray(new ProcessorType<?>[0]);
 
-            //routeType.clearOutput();
             InstrumentationProcessor processor = new InstrumentationProcessor();
+
             routeType.addInterceptor(processor);
 
-            /*for (ProcessorType<?> output : outputs) {
-                routeType.addOutput(output);
-            }
-*/
             interceptorMap.put(endpoint, processor);
-        }
+        }*/
     }
 
     public CamelNamingStrategy getNamingStrategy() {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ChoiceType.java Mon
May 26 08:41:59 2008
@@ -47,7 +47,12 @@
 
     @Override
     public String toString() {
-        return "Choice[ " + getWhenClauses() + " " + getOtherwise() + "]";
+        if (getOtherwise() != null) {
+            return "Choice[ " + getWhenClauses() + " " + getOtherwise() + "]";
+        } else {
+            return "Choice[ " + getWhenClauses() + "]";
+
+        }
     }
 
     @Override

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Mon May 26 08:41:59 2008
@@ -18,12 +18,13 @@
 
 import java.rmi.registry.Registry;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Set;import java.util.Arrays;
+import java.util.Set;
 import java.util.concurrent.ThreadPoolExecutor;
 
 import javax.xml.bind.annotation.XmlAccessType;

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/view/NodeData.java Mon
May 26 08:41:59 2008
@@ -109,7 +109,9 @@
 
             ChoiceType choice = (ChoiceType)node;
             List<ProcessorType> outputs = new ArrayList<ProcessorType>(choice.getWhenClauses());
-            outputs.add(choice.getOtherwise());
+            if (choice.getOtherwise() != null) {
+                outputs.add(choice.getOtherwise());
+            }
             this.outputs = outputs;
         } else if (node instanceof RecipientListType) {
             this.image = imagePrefix + "RecipientListIcon.png";
@@ -131,7 +133,7 @@
         }
 
         // lets auto-default as many values as we can
-        if (isNullOrBlank(this.nodeType)) {
+        if (isNullOrBlank(this.nodeType) && node != null) {
             // TODO we could add this to the model?
             String name = node.getClass().getName();
             int idx = name.lastIndexOf('.');

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileNoOpLockFileTest.java
Mon May 26 08:41:59 2008
@@ -1,3 +1,19 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.camel.component.file;
 
 import java.io.File;

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerProducerFileNamesTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerProducerFileNamesTest.java?rev=660216&r1=660215&r2=660216&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerProducerFileNamesTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FilerProducerFileNamesTest.java
Mon May 26 08:41:59 2008
@@ -19,8 +19,8 @@
 import java.io.File;
 
 import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
 import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 
 /**
@@ -56,11 +56,11 @@
     protected RouteBuilder createRouteBuilder() throws Exception {
         return new RouteBuilder() {
             public void configure() throws Exception {
-                from("direct:report").to( "file:target/reports/report.txt");
+                from("direct:report").to("file:target/reports/report.txt");
 
-                from("direct:report2").to( "file:target/report2.txt?autoCreate=false");
+                from("direct:report2").to("file:target/report2.txt?autoCreate=false");
 
-                from("direct:report3").setHeader(FileComponent.HEADER_FILE_NAME, "report-super.txt").to(
"file:target/");
+                from("direct:report3").setHeader(FileComponent.HEADER_FILE_NAME, "report-super.txt").to("file:target/");
             }
         };
     }



Mime
View raw message