camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/5] camel git commit: CAMEL-8526: Add more EIP as specialized mbeans
Date Wed, 22 Jul 2015 09:23:52 GMT
CAMEL-8526: Add more EIP as specialized mbeans


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/687eda14
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/687eda14
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/687eda14

Branch: refs/heads/master
Commit: 687eda147075ac10a4e0c9f1f9433e32119aa692
Parents: 9eadc03
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Jul 22 10:51:02 2015 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Jul 22 10:51:02 2015 +0200

----------------------------------------------------------------------
 .../management/mbean/ManagedScriptMBean.java    | 26 ++++++++++++
 .../mbean/ManagedSetExchangePatternMBean.java   | 26 ++++++++++++
 .../DefaultManagementObjectStrategy.java        |  8 ++++
 .../camel/management/mbean/ManagedScript.java   | 43 ++++++++++++++++++++
 .../mbean/ManagedSetExchangePattern.java        | 41 +++++++++++++++++++
 .../processor/ExchangePatternProcessor.java     |  4 ++
 6 files changed, 148 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedScriptMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedScriptMBean.java
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedScriptMBean.java
new file mode 100644
index 0000000..6397179
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedScriptMBean.java
@@ -0,0 +1,26 @@
+/**
+ * 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.api.management.mbean;
+
+import org.apache.camel.api.management.ManagedAttribute;
+
+public interface ManagedScriptMBean extends ManagedProcessorMBean {
+
+    @ManagedAttribute(description = "Expression to return the transformed message body (the
new message body to use)")
+    String getExpression();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetExchangePatternMBean.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetExchangePatternMBean.java
b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetExchangePatternMBean.java
new file mode 100644
index 0000000..6e9fdeb
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetExchangePatternMBean.java
@@ -0,0 +1,26 @@
+/**
+ * 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.api.management.mbean;
+
+import org.apache.camel.api.management.ManagedAttribute;
+
+public interface ManagedSetExchangePatternMBean extends ManagedProcessorMBean {
+
+    @ManagedAttribute(description = "the new exchange pattern of the Exchange to be used
from this point forward")
+    String getPattern();
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
index 2f5ad21..12fbff1 100644
--- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementObjectStrategy.java
@@ -65,10 +65,12 @@ import org.apache.camel.management.mbean.ManagedRoute;
 import org.apache.camel.management.mbean.ManagedRoutingSlip;
 import org.apache.camel.management.mbean.ManagedSamplingThrottler;
 import org.apache.camel.management.mbean.ManagedScheduledPollConsumer;
+import org.apache.camel.management.mbean.ManagedScript;
 import org.apache.camel.management.mbean.ManagedSendDynamicProcessor;
 import org.apache.camel.management.mbean.ManagedSendProcessor;
 import org.apache.camel.management.mbean.ManagedService;
 import org.apache.camel.management.mbean.ManagedSetBody;
+import org.apache.camel.management.mbean.ManagedSetExchangePattern;
 import org.apache.camel.management.mbean.ManagedSetHeader;
 import org.apache.camel.management.mbean.ManagedSetProperty;
 import org.apache.camel.management.mbean.ManagedSplitter;
@@ -90,6 +92,7 @@ import org.apache.camel.processor.Delayer;
 import org.apache.camel.processor.DynamicRouter;
 import org.apache.camel.processor.Enricher;
 import org.apache.camel.processor.ErrorHandler;
+import org.apache.camel.processor.ExchangePatternProcessor;
 import org.apache.camel.processor.FilterProcessor;
 import org.apache.camel.processor.LogProcessor;
 import org.apache.camel.processor.LoopProcessor;
@@ -105,6 +108,7 @@ import org.apache.camel.processor.Resequencer;
 import org.apache.camel.processor.RollbackProcessor;
 import org.apache.camel.processor.RoutingSlip;
 import org.apache.camel.processor.SamplingThrottler;
+import org.apache.camel.processor.ScriptProcessor;
 import org.apache.camel.processor.SendDynamicProcessor;
 import org.apache.camel.processor.SendProcessor;
 import org.apache.camel.processor.SetBodyProcessor;
@@ -293,6 +297,10 @@ public class DefaultManagementObjectStrategy implements ManagementObjectStrategy
                 answer = new ManagedRemoveProperties(context, (RemovePropertiesProcessor)
target, definition);
             } else if (target instanceof SetPropertyProcessor) {
                 answer = new ManagedSetProperty(context, (SetPropertyProcessor) target, definition);
+            } else if (target instanceof ExchangePatternProcessor) {
+                answer = new ManagedSetExchangePattern(context, (ExchangePatternProcessor)
target, definition);
+            } else if (target instanceof ScriptProcessor) {
+                answer = new ManagedScript(context, (ScriptProcessor) target, definition);
             } else if (target instanceof ThreadsProcessor) {
                 answer = new ManagedThreads(context, (ThreadsProcessor) target, definition);
             } else if (target instanceof TransformProcessor) {

http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedScript.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedScript.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedScript.java
new file mode 100644
index 0000000..74e1a85
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedScript.java
@@ -0,0 +1,43 @@
+/**
+ * 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.management.mbean;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.api.management.mbean.ManagedScriptMBean;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.processor.ScriptProcessor;
+
+/**
+ * @version 
+ */
+@ManagedResource(description = "Managed Script")
+public class ManagedScript extends ManagedProcessor implements ManagedScriptMBean {
+    private final ScriptProcessor processor;
+    private final String expression;
+
+    public ManagedScript(CamelContext context, ScriptProcessor processor, ProcessorDefinition<?>
definition) {
+        super(context, processor, definition);
+        this.processor = processor;
+        this.expression = processor.getExpression().toString();
+    }
+
+    @Override
+    public String getExpression() {
+        return expression;
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetExchangePattern.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetExchangePattern.java
b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetExchangePattern.java
new file mode 100644
index 0000000..204c901
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetExchangePattern.java
@@ -0,0 +1,41 @@
+/**
+ * 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.management.mbean;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.api.management.ManagedResource;
+import org.apache.camel.api.management.mbean.ManagedSetExchangePatternMBean;
+import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.processor.ExchangePatternProcessor;
+
+/**
+ * @version 
+ */
+@ManagedResource(description = "Managed SetExchangePattern")
+public class ManagedSetExchangePattern extends ManagedProcessor implements ManagedSetExchangePatternMBean
{
+    private final ExchangePatternProcessor processor;
+
+    public ManagedSetExchangePattern(CamelContext context, ExchangePatternProcessor processor,
ProcessorDefinition<?> definition) {
+        super(context, processor, definition);
+        this.processor = processor;
+    }
+
+    @Override
+    public String getPattern() {
+        return processor.getExchangePattern().name();
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/687eda14/camel-core/src/main/java/org/apache/camel/processor/ExchangePatternProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/ExchangePatternProcessor.java
b/camel-core/src/main/java/org/apache/camel/processor/ExchangePatternProcessor.java
index 9ff313b..596cc55 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/ExchangePatternProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/ExchangePatternProcessor.java
@@ -50,6 +50,10 @@ public class ExchangePatternProcessor extends ServiceSupport implements
AsyncPro
         this.id = id;
     }
 
+    public ExchangePattern getExchangePattern() {
+        return exchangePattern;
+    }
+
     public void process(Exchange exchange) throws Exception {
         AsyncProcessorHelper.process(this, exchange);
     }


Mime
View raw message