You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/11/10 08:26:08 UTC

[GitHub] [ignite-3] valepakh commented on a diff in pull request #1283: IGNITE-18012 Add connect command to start CLI in REPL mode

valepakh commented on code in PR #1283:
URL: https://github.com/apache/ignite-3/pull/1283#discussion_r1018781820


##########
modules/cli/src/main/java/org/apache/ignite/internal/cli/ReplFactory.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.ignite.internal.cli;
+
+import jakarta.inject.Inject;
+import jakarta.inject.Singleton;
+import org.apache.ignite.internal.cli.commands.TopLevelCliReplCommand;
+import org.apache.ignite.internal.cli.commands.questions.ConnectToClusterQuestion;
+import org.apache.ignite.internal.cli.core.call.CallExecutionPipeline;
+import org.apache.ignite.internal.cli.core.call.StringCallInput;
+import org.apache.ignite.internal.cli.core.exception.handler.DefaultExceptionHandlers;
+import org.apache.ignite.internal.cli.core.repl.Repl;
+import org.apache.ignite.internal.cli.core.repl.SessionDefaultValueProvider;
+import org.apache.ignite.internal.cli.core.repl.executor.ReplExecutorProvider;
+import org.apache.ignite.internal.cli.core.repl.prompt.PromptProvider;
+
+/**
+ * Class which runs main REPL mode, it's used both when starting directly into the REPL mode and from the `connect` command.
+ */
+@Singleton
+public class ReplFactory {
+    @Inject
+    private ReplExecutorProvider replExecutorProvider;
+
+    @Inject
+    private PromptProvider promptProvider;
+
+    @Inject
+    private SessionDefaultValueProvider defaultValueProvider;
+
+    @Inject
+    private ConnectToClusterQuestion question;
+
+    /**
+     * Enters REPL mode.
+     */
+    public void enterRepl() {
+        replExecutorProvider.get().execute(Repl.builder()

Review Comment:
   `ReplExecutor.execute` is a thread blocking method so I don't think it's possible to do that, also SQL REPL mode works just fine entering REPL from REPL.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org