Просмотр исходного кода

modify调用X_program_center出错

o2wwx 5 лет назад
Родитель
Сommit
d04d896ce8

+ 169 - 2
o2server/x_base_core_project/src/main/java/com/x/base/core/project/Applications.java

@@ -111,6 +111,25 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public ActionResponse getQuery(Boolean xdebugger, String applicationName, String uri, String seed)
 			throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+					return CipherConnectionAction.get(xdebugger, buffer.toString()+ CipherConnectionAction.trim(uri));
+
+				}
+			}
+		}
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -164,6 +183,27 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public byte[] getQueryBinary(Boolean xdebugger, String applicationName, String uri, String seed) throws Exception {
 		String name = this.findApplicationName(applicationName);
+
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+					return CipherConnectionAction.getBinary(xdebugger,
+							buffer.toString() + CipherConnectionAction.trim(uri));
+				}
+			}
+		}
+
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
 		}
@@ -217,6 +257,26 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public ActionResponse deleteQuery(Boolean xdebugger, String applicationName, String uri, String seed)
 			throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.delete(xdebugger,
+							buffer.toString() + CipherConnectionAction.trim(uri));
+				}
+			}
+		}
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -271,6 +331,26 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public byte[] deleteQueryBinary(Boolean xdebugger, String applicationName, String uri, String seed)
 			throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.deleteBinary(xdebugger,
+							buffer.toString()  + CipherConnectionAction.trim(uri));
+				}
+			}
+		}
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -327,6 +407,26 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public ActionResponse postQuery(Boolean xdebugger, String applicationName, String uri, Object body, String seed)
 			throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.post(xdebugger, buffer.toString()  + CipherConnectionAction.trim(uri),
+							body);
+				}
+			}
+		}
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -383,6 +483,27 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public byte[] postQueryBinary(Boolean xdebugger, String applicationName, String uri, Object body, String seed)
 			throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.postBinary(xdebugger,
+							buffer.toString()  + CipherConnectionAction.trim(uri), body);
+				}
+			}
+		}
+
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -444,6 +565,27 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public byte[] postQueryMultiPartBinary(Boolean xdebugger, String applicationName, String uri,
 			Collection<FormField> formFields, Collection<FilePart> fileParts, String seed) throws Exception {
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.postMultiPartBinary(xdebugger,
+							buffer.toString() + CipherConnectionAction.trim(uri), formFields, fileParts);
+				}
+			}
+		}
+
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -500,6 +642,28 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 
 	public ActionResponse putQuery(Boolean xdebugger, String applicationName, String uri, Object body, String seed)
 			throws Exception {
+
+		if(applicationName.equalsIgnoreCase("x_program_center")|| applicationName.equalsIgnoreCase(x_program_center.class.getName())) {
+			Nodes nodes = Config.nodes();
+			for (String node : nodes.keySet()) {
+				if (nodes.get(node).getCenter().getEnable()) {
+					Integer port = nodes.get(node).getCenter().getPort();
+					StringBuffer buffer = new StringBuffer();
+					if (BooleanUtils.isTrue(nodes.get(node).getCenter().getSslEnable())) {
+						buffer.append("https://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					} else {
+						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
+								.append(":" + port);
+					}
+					buffer.append("/x_program_center/jaxrs/");
+
+					return CipherConnectionAction.put(xdebugger, buffer.toString() + CipherConnectionAction.trim(uri),
+							body);
+				}
+			}
+		}
+
 		String name = this.findApplicationName(applicationName);
 		if (StringUtils.isEmpty(name)) {
 			throw new ExceptionFindApplicationName(applicationName);
@@ -524,7 +688,10 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 				return str;
 			}
 		}
-		return null;
+		if(name.equalsIgnoreCase("x_program_center")|| name.equalsIgnoreCase(x_program_center.class.getName())) {
+			return "x_program_center";
+		}
+			return null;
 	}
 
 	public Application findApplicationWithNode(String className, String node) throws Exception {
@@ -618,7 +785,7 @@ public class Applications extends ConcurrentHashMap<String, CopyOnWriteArrayList
 						buffer.append("http://").append(StringUtils.isNotEmpty(node) ? node : "127.0.0.1")
 								.append(":" + port);
 					}
-					buffer.append("x_program_center/describe/api.json");
+					buffer.append("/x_program_center/describe/api.json");
 					urlDescribeApiJson = buffer.toString();
 					break;
 				}