/*
* Zed Attack Proxy (ZAP) and its related class files.
 * 
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 * 
 * Copyright the ZAP Development Team
 * 
 * Licensed 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.zaproxy.zap.extension;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.zaproxy.zap.extension.api.ApiImplementor;
import org.zaproxy.zap.extension.api.JavaAPIGenerator;
import org.zaproxy.zap.extension.api.NodeJSAPIGenerator;
import org.zaproxy.zap.extension.api.PhpAPIGenerator;
import org.zaproxy.zap.extension.api.PythonAPIGenerator;
import org.zaproxy.zap.extension.api.WikiAPIGenerator;
import org.zaproxy.zap.extension.importLogFiles.ImportLogAPI;

public class ApiGenerator {

	public static List<ApiImplementor> getApiImplementors() {
		List<ApiImplementor> list = new ArrayList<ApiImplementor>();
		
		// If you implement an API for an _alpha_ add-on please add it here (in alphabetical order)
		// so that all of the client APIs are generated
		// Note that the following zaproxy(-2.4) files will also need to be edited manually:
		//	src/org/zaproxy/clientapi/core/clientApi.java
		// 	nodejs/api/zapv2/index.js
		//	php/api/zapv2/src/Zap/Zapv2.php
		//	python/api/src/zapv2/__init__.py

		list.add(new ImportLogAPI(null));

		return list;
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			JavaAPIGenerator japi = new JavaAPIGenerator("../zaproxy/src/org/zaproxy/clientapi/gen", true);
			japi.generateJavaFiles(getApiImplementors());

			NodeJSAPIGenerator napi = new NodeJSAPIGenerator("../zaproxy/nodejs/api/zapv2", true);
			napi.generateNodeJSFiles(getApiImplementors());
		
			PhpAPIGenerator phapi = new PhpAPIGenerator("../zaproxy/php/api/zapv2/src/Zap", true);
			phapi.generatePhpFiles(getApiImplementors());

			PythonAPIGenerator pyapi = new PythonAPIGenerator("../zaproxy/python/api/src/zapv2", true);
			pyapi.generatePythonFiles(getApiImplementors());

			//WikiAPIGenerator wapi = new WikiAPIGenerator("../zaproxy-wiki", true);
			//wapi.generateWikiFiles(getApiImplementors());
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}

@@ -1136,63 +1136,8 @@
 or;%0A
-import org.zaproxy.zap.extension.api.WikiAPIGenerator;%0A
 impo
@@ -1224,16 +1224,231 @@
 ator %7B%0A%0A
+%09private static final String JAVA_OUTPUT_DIR = %22../zap-api-java/subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/gen%22;%0A%0A%09private static final String PYTHON_OUTPUT_DIR = %22../zap-api-python/src/zapv2/%22;%0A%0A
 %09public 
@@ -1740,22 +1740,8 @@
 wing
- zaproxy(-2.4)
  fil
@@ -1789,54 +1789,125 @@
 %09%09//
-%09src/org/zaproxy/clientapi/core/clientApi.java
+    __init__.py (in zap-api-python project)%0A%09%09//    ClientApi.java (in zap-api-java project)%0A%09%09// In zaproxy project:
 %0A%09%09/
@@ -1975,46 +1975,8 @@
 .php
-%0A%09%09//%09python/api/src/zapv2/__init__.py
 %0A%0A%09%09
@@ -2158,50 +2158,23 @@
 tor(
-%22../zaproxy/src/org/zaproxy/clientapi/gen%22
+JAVA_OUTPUT_DIR
 , tr
@@ -2569,41 +2569,25 @@
 tor(
-%22../zaproxy/python/api/src/zapv2%22
+PYTHON_OUTPUT_DIR
 , tr

Update (alpha) ApiGenerator to use new API repos