You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by cs...@apache.org on 2011/09/11 15:56:30 UTC
svn commit: r1169457 - in /camel/trunk/camel-core/src:
main/java/org/apache/camel/ main/java/org/apache/camel/model/
main/java/org/apache/camel/processor/ test/java/org/apache/camel/processor/
Author: cschneider
Date: Sun Sep 11 13:56:28 2011
New Revision: 1169457
URL: http://svn.apache.org/viewvc?rev=1169457&view=rev
Log:
CAMEL-4428 Introduce ModelChannel for Channel and move all methods that reference model elements there
Added:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelChannel.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/Channel.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Channel.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Channel.java?rev=1169457&r1=1169456&r2=1169457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Channel.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Channel.java Sun Sep 11 13:56:28 2011
@@ -18,7 +18,6 @@ package org.apache.camel;
import java.util.List;
-import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.InterceptStrategy;
import org.apache.camel.spi.RouteContext;
@@ -76,32 +75,6 @@ public interface Channel extends AsyncPr
List<InterceptStrategy> getInterceptStrategies();
/**
- * Initializes the channel.
- *
- * @param outputDefinition the route definition the {@link Channel} represents
- * @param routeContext the route context
- * @throws Exception is thrown if some error occurred
- */
- void initChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception;
-
- /**
- * Post initializes the channel.
- *
- * @param outputDefinition the route definition the {@link Channel} represents
- * @param routeContext the route context
- * @throws Exception is thrown if some error occurred
- */
- void postInitChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception;
-
- /**
- * If the initialized output definition contained outputs (children) then we need to
- * set the child so we can leverage fine grained tracing
- *
- * @param child the child
- */
- void setChildDefinition(ProcessorDefinition<?> child);
-
- /**
* Gets the wrapped output that at runtime should be delegated to.
*
* @return the output to route the {@link Exchange} to
@@ -123,13 +96,6 @@ public interface Channel extends AsyncPr
Processor getNextProcessor();
/**
- * Gets the definition of the next processor
- *
- * @return the processor definition
- */
- ProcessorDefinition<?> getProcessorDefinition();
-
- /**
* Gets the {@link RouteContext}
*
* @return the route context
Added: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelChannel.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelChannel.java?rev=1169457&view=auto
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelChannel.java (added)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ModelChannel.java Sun Sep 11 13:56:28 2011
@@ -0,0 +1,55 @@
+/**
+ * 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.model;
+
+import org.apache.camel.Channel;
+import org.apache.camel.spi.RouteContext;
+
+public interface ModelChannel extends Channel {
+ /**
+ * Initializes the channel.
+ *
+ * @param outputDefinition the route definition the {@link Channel} represents
+ * @param routeContext the route context
+ * @throws Exception is thrown if some error occurred
+ */
+ void initChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception;
+
+ /**
+ * Post initializes the channel.
+ *
+ * @param outputDefinition the route definition the {@link Channel} represents
+ * @param routeContext the route context
+ * @throws Exception is thrown if some error occurred
+ */
+ void postInitChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception;
+
+ /**
+ * If the initialized output definition contained outputs (children) then we need to
+ * set the child so we can leverage fine grained tracing
+ *
+ * @param child the child
+ */
+ void setChildDefinition(ProcessorDefinition<?> child);
+
+ /**
+ * Gets the definition of the next processor
+ *
+ * @return the processor definition
+ */
+ ProcessorDefinition<?> getProcessorDefinition();
+}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=1169457&r1=1169456&r2=1169457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Sun Sep 11 13:56:28 2011
@@ -223,7 +223,7 @@ public abstract class ProcessorDefinitio
protected Processor wrapChannel(RouteContext routeContext, Processor processor, ProcessorDefinition child) throws Exception {
// put a channel in between this and each output to control the route flow logic
- Channel channel = createChannel(routeContext);
+ ModelChannel channel = createChannel(routeContext);
channel.setNextProcessor(processor);
// add interceptor strategies to the channel must be in this order: camel context, route context, local
@@ -374,7 +374,7 @@ public abstract class ProcessorDefinitio
/**
* Creates a new instance of the {@link Channel}.
*/
- protected Channel createChannel(RouteContext routeContext) throws Exception {
+ protected ModelChannel createChannel(RouteContext routeContext) throws Exception {
return new DefaultChannel();
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java?rev=1169457&r1=1169456&r2=1169457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DefaultChannel.java Sun Sep 11 13:56:28 2011
@@ -29,6 +29,7 @@ import org.apache.camel.Channel;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.Service;
+import org.apache.camel.model.ModelChannel;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.processor.interceptor.StreamCaching;
import org.apache.camel.processor.interceptor.TraceFormatter;
@@ -57,7 +58,7 @@ import org.slf4j.LoggerFactory;
*
* @version
*/
-public class DefaultChannel extends ServiceSupport implements Channel {
+public class DefaultChannel extends ServiceSupport implements ModelChannel {
private static final transient Logger LOG = LoggerFactory.getLogger(DefaultChannel.class);
@@ -234,7 +235,7 @@ public class DefaultChannel extends Serv
output = target;
}
- @Override
+ //@Override
public void postInitChannel(ProcessorDefinition<?> outputDefinition, RouteContext routeContext) throws Exception {
for (InterceptStrategy strategy : interceptors) {
// apply stream caching at the end as it should be outer most
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java?rev=1169457&r1=1169456&r2=1169457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RandomLoadBalanceJavaDSLBuilderTest.java Sun Sep 11 13:56:28 2011
@@ -76,8 +76,8 @@ public class RandomLoadBalanceJavaDSLBui
for (Processor child : nav.next()) {
- if (child instanceof Channel) {
- Channel channel = (Channel) child;
+ if (child instanceof DefaultChannel) {
+ DefaultChannel channel = (DefaultChannel) child;
ProcessorDefinition def = channel.getProcessorDefinition();
navigateDefinition(def, sb);
}