1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package ohos;
18 
19 /**
20  * scanEntrance info
21  *
22  * @since 2023/11/23
23  */
24 
25 public class ScanEntrance {
26     private static final int EXIT_STATUS_NORMAL = 0;
27     private static final int EXIT_STATUS_EXCEPTION = 1;
28     private static final Log LOG = new Log(ScanEntrance.class.toString());
29 
30 
31     /**
32      * scan tool main function.
33      *
34      * @param args command line
35      */
36 
main(String[] args)37     public static void main(String[] args) {
38         Utility utility = new Utility();
39 
40         if (!CommandParser.commandParser(utility, args)) {
41             LOG.error(ScanErrorEnum.SCAN_ENTRANCE_PARSER_ERROR.toString());
42             ShowHelp.scanHelp();
43             System.exit(EXIT_STATUS_EXCEPTION);
44         }
45 
46         if (!ScanVerify.commandVerify(utility)) {
47             LOG.error(ScanErrorEnum.SCAN_ENTRANCE_VERIFY_ERROR.toString());
48             ShowHelp.scanHelp();
49             System.exit(EXIT_STATUS_EXCEPTION);
50         }
51 
52         Scan scan = new Scan();
53         if (!scan.scanProcess(utility)) {
54             LOG.error(ScanErrorEnum.SCAN_ENTRANCE_COMPRESS_ERROR.toString());
55             ShowHelp.scanHelp();
56             System.exit(EXIT_STATUS_EXCEPTION);
57         }
58 
59         System.exit(EXIT_STATUS_NORMAL);
60     }
61 }