More license header changes to appc-client files
[appc.git] / appc-client / code-generator / src / main / java / org / onap / appc / tools / generator / api / CLI.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.tools.generator.api;
25
26 import org.onap.appc.tools.generator.impl.ModelGenerator;
27
28 import java.io.File;
29
30 public class CLI {
31     public static void main(String... args) throws Exception {
32         String sourceFile = args[0];
33         if(sourceFile == null)
34             throw new IllegalArgumentException("Source file is missing. Please add argument 'client <source file> <destination file> <model template>'");
35
36         String destinationFile = args[1];
37         if(destinationFile == null)
38             throw new IllegalArgumentException("Destination file name is missing. Please add argument 'client "
39                     + sourceFile
40                     + " <destination> <model template> <builder> <conf file>'");
41
42         String templateFile = args[2];
43         if(templateFile == null)
44             throw new IllegalArgumentException("template file name is missing. Please add argument 'client "
45                     + sourceFile
46                     + " "+destinationFile
47                     + " <model template> <builder> <conf file>'");
48
49         String builderName = args[3];
50         if(builderName == null)
51             throw new IllegalArgumentException("builder FQDN is missing. Please add argument 'client "
52                     + sourceFile
53                     + " "+destinationFile
54                     + " "+templateFile
55                     + " <builder> <conf file>'");
56         String contextConfName = args[4];
57         if(contextConfName == null)
58             throw new IllegalArgumentException("context conf file is missing. Please add argument 'client "
59                     + sourceFile
60                     + " "+destinationFile
61                     + " "+templateFile
62                     + " "+builderName
63                     + " <conf file>'");
64         ModelGenerator generator = new ModelGenerator();
65         generator.execute((new File(sourceFile)).toURI().toURL(), destinationFile, templateFile, builderName, contextConfName);
66     }
67 }