pandaapo commented on code in PR #4272:
URL: https://github.com/apache/eventmesh/pull/4272#discussion_r1272111971
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java:
##########
@@ -33,29 +33,69 @@
import lombok.extern.slf4j.Slf4j;
+/**
+ * This class handles the HTTP requests of {@code
/webhook/deleteWebHookConfig} endpoint
+ * and deletes an existing WebHook configuration
+ * according to the given {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfig WebHookConfig}.
+ * <p>
+ * The implementation of
+ * {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation#deleteWebHookConfig
WebHookConfigOperation}
+ * interface depends on the {@code eventMesh.webHook.operationMode}
configuration in {@code eventmesh.properties}.
+ * <p>
+ * For example, when {@code eventMesh.webHook.operationMode=file}, It calls the
+ * {@linkplain
org.apache.eventmesh.webhook.admin.FileWebHookConfigOperation#deleteWebHookConfig
FileWebHookConfigOperation}
+ * method as implementation to delete the WebHook configuration file;
+ * <p>
+ * When {@code eventMesh.webHook.operationMode=nacos}, It calls the
+ * {@linkplain
org.apache.eventmesh.webhook.admin.NacosWebHookConfigOperation#deleteWebHookConfig
NacosWebHookConfigOperation}
+ * method as implementation to delete the WebHook configuration from Nacos.
+ * <p>
+ * The {@linkplain
org.apache.eventmesh.webhook.receive.storage.HookConfigOperationManager#deleteWebHookConfig
HookConfigOperationManager}
+ * which implements the {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation WebHookConfigOperation}
+ * interface, does not participate in the implementation of this endpoint.
Review Comment:
I have doubts about the necessity of explaining HookConfigOperationManager.
The same opinion on your other similar docs.
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandler.java:
##########
@@ -38,30 +38,61 @@
import lombok.extern.slf4j.Slf4j;
/**
- * query recommend eventmesh
+ * This class handles the HTTP requests of {@code /eventMesh/recommend}
endpoint,
+ * which is used to calculate and return the recommended EventMesh server node
to the client
+ * based on the provided {@code group} and {@code purpose} parameters.
+ * <p>
+ * Parameters:
+ * <ul>
+ * <li>client group: {@code group} | Example: {@code
EventmeshTestGroup}</li>
+ * <li>client purpose: {@code purpose} | Example: {@code sub}</li>
+ * </ul>
+ * It uses an {@link EventMeshRecommendStrategy} which is implemented by
{@link EventMeshRecommendImpl}
+ * to calculate the recommended EventMesh server node.
+ *
+ * @see AbstractHttpHandler
*/
@Slf4j
@EventHttpHandler(path = "/eventMesh/recommend")
public class QueryRecommendEventMeshHandler extends AbstractHttpHandler {
private final EventMeshTCPServer eventMeshTCPServer;
+ /**
+ * Constructs a new instance with the provided server instance and HTTP
handler manager.
+ *
+ * @param eventMeshTCPServer the TCP server instance of EventMesh
+ * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
+ * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ */
public QueryRecommendEventMeshHandler(EventMeshTCPServer
eventMeshTCPServer, HttpHandlerManager httpHandlerManager) {
super(httpHandlerManager);
this.eventMeshTCPServer = eventMeshTCPServer;
}
+ /**
+ * Handles the HTTP requests by calculating a recommended EventMesh server
node.
+ * <p>
+ * This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
+ *
+ * @param httpExchange the exchange containing the request from the client
and used to send the response
+ * @throws IOException if an I/O error occurs while handling the request
+ */
@Override
public void handle(HttpExchange httpExchange) throws IOException {
String result = "";
try (OutputStream out = httpExchange.getResponseBody()) {
+ // Check whether the registry is enabled
Review Comment:
I have doubts about the necessity of such explanations. Because by looking
at the target code's naming, developers can essentially understand the purpose
of the code. The same opinion on the next 5 comments and other similar places
including some old comments.
##########
eventmesh-webhook/eventmesh-webhook-receive/src/main/java/org/apache/eventmesh/webhook/receive/storage/HookConfigOperationManager.java:
##########
@@ -42,6 +41,20 @@
import lombok.extern.slf4j.Slf4j;
+/**
+ * This class manages the operations related to WebHook configurations. Mainly
used by
+ * {@linkplain org.apache.eventmesh.webhook.receive.WebHookController#execute
WebHookController}
+ * to retrieve existing WebHook configuration by callback path when processing
received WebHook data from manufacturers.
+ * <p>
+ * This class is initialized together with the {@linkplain
org.apache.eventmesh.webhook.receive.WebHookController WebHookController}
+ * during the initialization phase of the {@code EventMeshHTTPServer}.
+ * Differs from the other two implementations that implement the
+ * {@linkplain org.apache.eventmesh.webhook.api.WebHookConfigOperation
WebHookConfigOperation} interface,
+ * which are located in the {@code org.apache.eventmesh.webhook.admin} package.
Review Comment:
I have doubts about the necessity of this explanations, `Differs from the
other two ... admin} package.`.
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/DeleteWebHookConfigHandler.java:
##########
@@ -33,29 +33,69 @@
import lombok.extern.slf4j.Slf4j;
+/**
+ * This class handles the HTTP requests of {@code
/webhook/deleteWebHookConfig} endpoint
+ * and deletes an existing WebHook configuration
+ * according to the given {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfig WebHookConfig}.
+ * <p>
+ * The implementation of
+ * {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation#deleteWebHookConfig
WebHookConfigOperation}
+ * interface depends on the {@code eventMesh.webHook.operationMode}
configuration in {@code eventmesh.properties}.
+ * <p>
+ * For example, when {@code eventMesh.webHook.operationMode=file}, It calls the
+ * {@linkplain
org.apache.eventmesh.webhook.admin.FileWebHookConfigOperation#deleteWebHookConfig
FileWebHookConfigOperation}
+ * method as implementation to delete the WebHook configuration file;
+ * <p>
+ * When {@code eventMesh.webHook.operationMode=nacos}, It calls the
+ * {@linkplain
org.apache.eventmesh.webhook.admin.NacosWebHookConfigOperation#deleteWebHookConfig
NacosWebHookConfigOperation}
+ * method as implementation to delete the WebHook configuration from Nacos.
+ * <p>
+ * The {@linkplain
org.apache.eventmesh.webhook.receive.storage.HookConfigOperationManager#deleteWebHookConfig
HookConfigOperationManager}
+ * which implements the {@linkplain
org.apache.eventmesh.webhook.api.WebHookConfigOperation WebHookConfigOperation}
+ * interface, does not participate in the implementation of this endpoint.
+ *
+ * @see AbstractHttpHandler
+ */
+
@SuppressWarnings("restriction")
@Slf4j
@EventHttpHandler(path = "/webhook/deleteWebHookConfig")
public class DeleteWebHookConfigHandler extends AbstractHttpHandler {
private final WebHookConfigOperation operation;
+ /**
+ * Constructs a new instance with the specified WebHook config operation
and HTTP handler manager.
+ *
+ * @param operation the WebHookConfigOperation implementation used to
delete the WebHook config
+ * @param httpHandlerManager Manages the registration of {@linkplain
com.sun.net.httpserver.HttpHandler HttpHandler}
+ * for an {@link
com.sun.net.httpserver.HttpServer HttpServer}.
+ */
public DeleteWebHookConfigHandler(WebHookConfigOperation operation,
HttpHandlerManager httpHandlerManager) {
super(httpHandlerManager);
this.operation = operation;
}
-
+ /**
+ * Handles the HTTP requests by deleting a WebHook configuration.
+ * <p>
+ * This method is an implementation of {@linkplain
com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
Review Comment:
I think it seems no need to to explain this. The same opinion on your other
similar docs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]