Repository: camel Updated Branches: refs/heads/master d918a9c40 -> 0b4c5f341
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/3b8c71c9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3b8c71c9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3b8c71c9 Branch: refs/heads/master Commit: 3b8c71c92831ea54ac4a9d4e1bc5475c5c727feb Parents: cfce63d Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Jul 21 17:32:22 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Jul 21 18:06:25 2015 +0200 ---------------------------------------------------------------------- .../management/mbean/ManagedSetBodyMBean.java | 26 +++++++++++ .../management/mbean/ManagedSetHeaderMBean.java | 29 ++++++++++++ .../mbean/ManagedSetPropertyMBean.java | 29 ++++++++++++ .../management/mbean/ManagedTransformMBean.java | 26 +++++++++++ .../DefaultManagementObjectStrategy.java | 16 +++++++ .../camel/management/mbean/ManagedSetBody.java | 43 ++++++++++++++++++ .../management/mbean/ManagedSetHeader.java | 48 ++++++++++++++++++++ .../management/mbean/ManagedSetProperty.java | 48 ++++++++++++++++++++ .../management/mbean/ManagedTransformer.java | 43 ++++++++++++++++++ 9 files changed, 308 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetBodyMBean.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetBodyMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetBodyMBean.java new file mode 100644 index 0000000..28e27fe --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetBodyMBean.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 ManagedSetBodyMBean 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/3b8c71c9/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetHeaderMBean.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetHeaderMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetHeaderMBean.java new file mode 100644 index 0000000..97d391c --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetHeaderMBean.java @@ -0,0 +1,29 @@ +/** + * 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 ManagedSetHeaderMBean extends ManagedProcessorMBean { + + @ManagedAttribute(description = "Name of message header to set a new value") + String getHeaderName(); + + @ManagedAttribute(description = "Expression to return the value of the header") + String getExpression(); + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetPropertyMBean.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetPropertyMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetPropertyMBean.java new file mode 100644 index 0000000..7556435 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedSetPropertyMBean.java @@ -0,0 +1,29 @@ +/** + * 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 ManagedSetPropertyMBean extends ManagedProcessorMBean { + + @ManagedAttribute(description = "Name of exchange property to set a new value") + String getPropertyName(); + + @ManagedAttribute(description = "Expression to return the value of the message exchange property") + String getExpression(); + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedTransformMBean.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedTransformMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedTransformMBean.java new file mode 100644 index 0000000..adc948f --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedTransformMBean.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 ManagedTransformMBean 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/3b8c71c9/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 bc1686d..b55f466 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 @@ -60,10 +60,14 @@ import org.apache.camel.management.mbean.ManagedScheduledPollConsumer; 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.ManagedSetHeader; +import org.apache.camel.management.mbean.ManagedSetProperty; import org.apache.camel.management.mbean.ManagedSuspendableRoute; import org.apache.camel.management.mbean.ManagedThreadPool; import org.apache.camel.management.mbean.ManagedThrottler; import org.apache.camel.management.mbean.ManagedThroughputLogger; +import org.apache.camel.management.mbean.ManagedTransformer; import org.apache.camel.management.mbean.ManagedWireTapProcessor; import org.apache.camel.model.ModelCamelContext; import org.apache.camel.model.ProcessorDefinition; @@ -84,9 +88,13 @@ import org.apache.camel.processor.RoutingSlip; import org.apache.camel.processor.SamplingThrottler; import org.apache.camel.processor.SendDynamicProcessor; import org.apache.camel.processor.SendProcessor; +import org.apache.camel.processor.SetBodyProcessor; +import org.apache.camel.processor.SetHeaderProcessor; +import org.apache.camel.processor.SetPropertyProcessor; import org.apache.camel.processor.StreamResequencer; import org.apache.camel.processor.Throttler; import org.apache.camel.processor.ThroughputLogger; +import org.apache.camel.processor.TransformProcessor; import org.apache.camel.processor.WireTapProcessor; import org.apache.camel.processor.aggregate.AggregateProcessor; import org.apache.camel.processor.idempotent.IdempotentConsumer; @@ -237,6 +245,14 @@ public class DefaultManagementObjectStrategy implements ManagementObjectStrategy answer = new ManagedResequencer(context, (Resequencer) target, definition); } else if (target instanceof StreamResequencer) { answer = new ManagedResequencer(context, (StreamResequencer) target, definition); + } else if (target instanceof SetBodyProcessor) { + answer = new ManagedSetBody(context, (SetBodyProcessor) target, definition); + } else if (target instanceof SetHeaderProcessor) { + answer = new ManagedSetHeader(context, (SetHeaderProcessor) target, definition); + } else if (target instanceof SetPropertyProcessor) { + answer = new ManagedSetProperty(context, (SetPropertyProcessor) target, definition); + } else if (target instanceof TransformProcessor) { + answer = new ManagedTransformer(context, (TransformProcessor) target, definition); } else if (target instanceof WireTapProcessor) { answer = new ManagedWireTapProcessor(context, (WireTapProcessor) target, definition); } else if (target instanceof SendDynamicProcessor) { http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetBody.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetBody.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetBody.java new file mode 100644 index 0000000..f396d45 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetBody.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.ManagedSetBodyMBean; +import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.processor.SetBodyProcessor; + +/** + * @version + */ +@ManagedResource(description = "Managed SetBody") +public class ManagedSetBody extends ManagedProcessor implements ManagedSetBodyMBean { + private final SetBodyProcessor processor; + private final String expression; + + public ManagedSetBody(CamelContext context, SetBodyProcessor 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/3b8c71c9/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetHeader.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetHeader.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetHeader.java new file mode 100644 index 0000000..6c7941d --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetHeader.java @@ -0,0 +1,48 @@ +/** + * 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.ManagedSetHeaderMBean; +import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.processor.SetHeaderProcessor; + +/** + * @version + */ +@ManagedResource(description = "Managed SetHeader") +public class ManagedSetHeader extends ManagedProcessor implements ManagedSetHeaderMBean { + private final SetHeaderProcessor processor; + private final String expression; + + public ManagedSetHeader(CamelContext context, SetHeaderProcessor processor, ProcessorDefinition<?> definition) { + super(context, processor, definition); + this.processor = processor; + this.expression = processor.getExpression().toString(); + } + + @Override + public String getHeaderName() { + return processor.getHeaderName(); + } + + @Override + public String getExpression() { + return expression; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetProperty.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetProperty.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetProperty.java new file mode 100644 index 0000000..e5e12e1 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedSetProperty.java @@ -0,0 +1,48 @@ +/** + * 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.ManagedSetPropertyMBean; +import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.processor.SetPropertyProcessor; + +/** + * @version + */ +@ManagedResource(description = "Managed SetProperty") +public class ManagedSetProperty extends ManagedProcessor implements ManagedSetPropertyMBean { + private final SetPropertyProcessor processor; + private final String expression; + + public ManagedSetProperty(CamelContext context, SetPropertyProcessor processor, ProcessorDefinition<?> definition) { + super(context, processor, definition); + this.processor = processor; + this.expression = processor.getExpression().toString(); + } + + @Override + public String getPropertyName() { + return processor.getPropertyName(); + } + + @Override + public String getExpression() { + return expression; + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/3b8c71c9/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTransformer.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTransformer.java b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTransformer.java new file mode 100644 index 0000000..f467441 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedTransformer.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.ManagedTransformMBean; +import org.apache.camel.model.ProcessorDefinition; +import org.apache.camel.processor.TransformProcessor; + +/** + * @version + */ +@ManagedResource(description = "Managed Transformer") +public class ManagedTransformer extends ManagedProcessor implements ManagedTransformMBean { + private final TransformProcessor processor; + private final String expression; + + public ManagedTransformer(CamelContext context, TransformProcessor processor, ProcessorDefinition<?> definition) { + super(context, processor, definition); + this.processor = processor; + this.expression = processor.getExpression().toString(); + } + + @Override + public String getExpression() { + return expression; + } +}