nizhikov commented on a change in pull request #8909:
URL: https://github.com/apache/ignite/pull/8909#discussion_r642957112



##########
File path: 
modules/core/src/main/java/org/apache/ignite/startup/cmdline/ChangeDataCaptureCommandLineStartup.java
##########
@@ -0,0 +1,159 @@
+/*
+ * 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.startup.cmdline;
+
+import java.net.URL;
+import java.util.Map;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteSystemProperties;
+import org.apache.ignite.cdc.ChangeDataCaptureConfiguration;
+import org.apache.ignite.cdc.ChangeDataCaptureLoader;
+import org.apache.ignite.internal.cdc.ChangeDataCapture;
+import org.apache.ignite.internal.util.spring.IgniteSpringHelper;
+import org.apache.ignite.internal.util.typedef.X;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_SHUTDOWN_HOOK;
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_PROG_NAME;
+import static org.apache.ignite.internal.IgniteVersionUtils.ACK_VER_STR;
+import static org.apache.ignite.internal.IgniteVersionUtils.COPYRIGHT;
+import static org.apache.ignite.startup.cmdline.CommandLineStartup.isHelp;
+
+/**
+ * This class defines command-line Ignite Capture Data Change startup. This 
startup can be used to start Ignite
+ * Capture Data Change application outside of any hosting environment from 
command line.
+ * This startup is a Java application with {@link #main(String[])} method that 
accepts command line arguments.
+ * It accepts just one parameter which is Spring XML configuration file path.
+ * You can run this class from command line without parameters to get help 
message.
+ * <p>
+ * Note that scripts {@code ${IGNITE_HOME}/bin/cdc.{sh|bat}} shipped with 
Ignite use
+ * this startup and you can use them as an example.
+ * <p>
+ *
+ * @see ChangeDataCapture
+ */
+public class ChangeDataCaptureCommandLineStartup {
+    /** Quite log flag. */
+    private static final boolean QUITE = 
IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_QUIET);
+
+    /**
+     * Main entry point.
+     *
+     * @param args Command line arguments.
+     */
+    public static void main(String[] args) {
+        if (!QUITE) {
+            X.println("Ignite CDC Command Line Startup, ver. " + ACK_VER_STR);
+            X.println(COPYRIGHT);
+            X.println();
+        }
+
+        if (args.length > 1)
+            exit("Too many arguments.", true, -1);
+
+        if (args.length > 0 && isHelp(args[0]))
+            exit(null, true, 0);
+
+        if (args.length > 0 && args[0].isEmpty())
+            exit("Empty argument.", true, 1);
+
+        if (args.length > 0 && args[0].charAt(0) == '-')
+            exit("Invalid arguments: " + args[0], true, -1);
+
+        try {
+            ChangeDataCapture cdc = 
ChangeDataCaptureLoader.loadChangeDataCapture(args[0]);
+
+            if (!IgniteSystemProperties.getBoolean(IGNITE_NO_SHUTDOWN_HOOK, 
false)) {

Review comment:
       Yes, but I think the initial implementation should follow the same 
strategy and use the same flag as Ignite here.




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to