This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch console in repository https://gitbox.apache.org/repos/asf/camel.git
commit 361b4153571f131d9a893aa5d8b0c4020f88a598 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Dec 27 11:05:34 2021 +0100 CAMEL-17384: Developer Console SPI --- .../java/org/apache/camel/console/DevConsole.java | 62 ++++++++++++++++++++++ .../java/org/apache/camel/health/HealthCheck.java | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/core/camel-api/src/main/java/org/apache/camel/console/DevConsole.java b/core/camel-api/src/main/java/org/apache/camel/console/DevConsole.java new file mode 100644 index 0000000..d131a07 --- /dev/null +++ b/core/camel-api/src/main/java/org/apache/camel/console/DevConsole.java @@ -0,0 +1,62 @@ +/* + * 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.console; + +import java.util.Collections; +import java.util.Map; + +/** + * Developer Console + */ +public interface DevConsole { + + String CONSOLE_ID = "console.id"; + + enum MediaType { + TEXT, + JSON + } + + /** + * The ID of this console. + */ + String getId(); + + /** + * Whether this console supports the given media type. + * + * @param mediaType the media type + * @return true if support, false if not + */ + boolean supportMediaType(MediaType mediaType); + + /** + * Invokes and gets the output from this console. + */ + default Object call(MediaType mediaType) { + return call(mediaType, Collections.emptyMap()); + } + + /** + * Invokes and gets the output from this console. + * + * The options argument can be used to pass information specific to the call. The implementation is responsible to + * catch and handle any exception thrown by the underlying technology, including unchecked ones. + */ + Object call(MediaType mediaType, Map<String, Object> options); + +} diff --git a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java index abb8931..59ea3ae 100644 --- a/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java +++ b/core/camel-api/src/main/java/org/apache/camel/health/HealthCheck.java @@ -98,7 +98,7 @@ public interface HealthCheck extends HasGroup, HasId, Ordered { * The implementation is responsible to eventually perform the check according to the limitation of the third party * system i.e. it should not be performed too often to avoid rate limiting. The options argument can be used to pass * information specific to the check like forcing the check to be performed against the policies. The implementation - * is responsible to catch an handle any exception thrown by the underlying technology, including unchecked ones. + * is responsible to catch and handle any exception thrown by the underlying technology, including unchecked ones. */ Result call(Map<String, Object> options);