caixiangyi 8 лет назад
Родитель
Сommit
8f6fc4e085
33 измененных файлов с 938 добавлено и 0 удалено
  1. 47 0
      x_server_console/src/main/java/com/x/server/console/action/ActionSetPassword.java
  2. 109 0
      x_server_console/src/main/java/com/x/server/console/swapcommand/Exit.java
  3. 10 0
      x_server_console/src/main/resources/NewFile.html
  4. 28 0
      x_test/src/main/java/com/x/test/alidayu/TestClient.java
  5. 7 0
      x_test/src/test/java/com/x/test/actionresult/TestClient.java
  6. 35 0
      x_test/src/test/java/com/x/test/nio/TestClient.java
  7. 40 0
      x_test/src/test/java/com/x/test/nio/TestMain.java
  8. 14 0
      x_test/src/test/java/com/x/test/password/TestClient.java
  9. 42 0
      x_test/src/test/java/com/x/test/tcp/SocketTransfer.java
  10. 40 0
      x_test/src/test/java/com/x/test/tcp/SourceToTarget.java
  11. 37 0
      x_test/src/test/java/com/x/test/tcp/TargetToSource.java
  12. 40 0
      x_test/src/test/java/com/x/test/tcp/TestSocketClient.java
  13. BIN
      x_test/target/classes/com/x/test/alidayu/TestClient.class
  14. BIN
      x_test/target/test-classes/com/x/test/actionresult/TestClient.class
  15. BIN
      x_test/target/test-classes/com/x/test/nio/TestClient.class
  16. BIN
      x_test/target/test-classes/com/x/test/nio/TestMain.class
  17. BIN
      x_test/target/test-classes/com/x/test/password/TestClient.class
  18. BIN
      x_test/target/test-classes/com/x/test/tcp/SocketTransfer.class
  19. BIN
      x_test/target/test-classes/com/x/test/tcp/SourceToTarget.class
  20. BIN
      x_test/target/test-classes/com/x/test/tcp/TargetToSource.class
  21. BIN
      x_test/target/test-classes/com/x/test/tcp/TestSocketClient.class
  22. 7 0
      x_test_war/xxx.xml
  23. 20 0
      x_tools/deploy_o2server.xml
  24. 26 0
      x_tools/jest/common.js
  25. 1 0
      x_tools/jest/jquery.js
  26. 105 0
      x_tools/jest/logger.js
  27. 62 0
      x_tools/publish_version_aix.xml
  28. 61 0
      x_tools/publish_version_macos.xml
  29. 105 0
      x_tools/src/main/java/com/x/tools/jest/CopyJest.java
  30. 35 0
      x_tools/src/main/java/com/x/tools/manifest/Store.java
  31. 55 0
      x_tools/update_version.xml
  32. 6 0
      x_updates/classes/20161211以后
  33. 6 0
      x_updates/src/main/resources/20161211以后

+ 47 - 0
x_server_console/src/main/java/com/x/server/console/action/ActionSetPassword.java

@@ -0,0 +1,47 @@
+package com.x.server.console.action;
+
+import java.io.StringReader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.util.Map.Entry;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.h2.tools.RunScript;
+
+import com.x.base.core.project.server.Config;
+import com.x.base.core.project.server.DataServer;
+import com.x.base.core.project.server.Token;
+
+public class ActionSetPassword extends ActionBase {
+	public boolean execute(String oldPassword, String newPassword) throws Exception {
+		/** 如果初始密码没有修改就设置为初始密码 */
+		if (StringUtils.equals(Config.token().getPassword(), Token.initPassword)) {
+			oldPassword = Token.initPassword;
+		}
+		if (!StringUtils.equals(Config.token().getPassword(), oldPassword)) {
+			throw new Exception("old password not match.");
+		}
+		this.changeInternalDataServerPassword(oldPassword, newPassword);
+		Config.token().setPassword(newPassword);
+		Config.token().save();
+		System.out.println("The initial manager password has been modified.");
+		return true;
+	}
+
+	private void changeInternalDataServerPassword(String oldPassword, String newPassword) throws Exception {
+		org.h2.Driver.load();
+		for (Entry<String, DataServer> en : Config.nodes().dataServers().entrySet()) {
+			DataServer o = en.getValue();
+			if (BooleanUtils.isTrue(o.getEnable())) {
+				try (Connection conn = DriverManager.getConnection(
+						"jdbc:h2:tcp://" + en.getKey() + ":" + o.getTcpPort() + "/X", "sa", oldPassword)) {
+					RunScript.execute(conn, new StringReader("ALTER USER SA SET PASSWORD '" + newPassword + "'"));
+				} catch (Exception e) {
+					throw new Exception("Verify that the dataServer:" + en.getKey()
+							+ " is started and that the dataServer password is updated synchronously.", e);
+				}
+			}
+		}
+	}
+}

+ 109 - 0
x_server_console/src/main/java/com/x/server/console/swapcommand/Exit.java

@@ -0,0 +1,109 @@
+package com.x.server.console.swapcommand;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.RandomAccessFile;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.FileChannel.MapMode;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.x.base.core.project.server.Config;
+import com.x.server.console.Main;
+
+public class Exit {
+
+	private static final String MANIFEST_FILENAME = "manifest.cfg";
+
+	public static void main(String... args) throws Exception {
+		String base = getBasePath();
+		loadJars(base);
+		try (RandomAccessFile raf = new RandomAccessFile(Config.base() + "/command.swap", "rw")) {
+			FileChannel fc = raf.getChannel();
+			MappedByteBuffer mbb = fc.map(MapMode.READ_WRITE, 0, 64);
+			FileLock flock = null;
+			flock = fc.lock();
+			mbb.put(0, (byte) 1);
+			flock.release();
+		}
+	}
+
+	private static List<String> readManifest(File file) throws Exception {
+		List<String> list = new ArrayList<>();
+		try (FileReader fileReader = new FileReader(file);
+				BufferedReader bufferedReader = new BufferedReader(fileReader)) {
+			String line;
+			while ((line = bufferedReader.readLine()) != null) {
+				list.add(line);
+			}
+		}
+		return list;
+	}
+
+	private static void loadJars(String base) throws Exception {
+		URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
+		Class<?> urlClass = URLClassLoader.class;
+		Method method = urlClass.getDeclaredMethod("addURL", new Class[] { URL.class });
+		method.setAccessible(true);
+		/* loading ext */
+		File extDir = new File(base, "commons/ext");
+		File extDirManifest = new File(extDir, MANIFEST_FILENAME);
+		if (!extDirManifest.exists()) {
+			throw new Exception("can not find " + MANIFEST_FILENAME + " in commons/ext.");
+		}
+		List<String> extDirManifestNames = readManifest(extDirManifest);
+		if (extDirManifestNames.isEmpty()) {
+			throw new Exception("commons/ext manifest is empty.");
+		}
+		for (File file : extDir.listFiles()) {
+			if (!file.getName().equals(MANIFEST_FILENAME)) {
+				if (!extDirManifestNames.contains(file.getName())) {
+					file.delete();
+				} else {
+					method.invoke(urlClassLoader, new Object[] { file.toURI().toURL() });
+				}
+			}
+		}
+		/* loading jars */
+		File jarsDir = new File(base, "store/jars");
+		File jarsDirManifest = new File(jarsDir, MANIFEST_FILENAME);
+		if (!jarsDirManifest.exists()) {
+			throw new Exception("can not find " + MANIFEST_FILENAME + " in store/jars.");
+		}
+		List<String> jarsDirManifestNames = readManifest(jarsDirManifest);
+		for (File file : jarsDir.listFiles()) {
+			if (!file.getName().equals(MANIFEST_FILENAME)) {
+				if (!jarsDirManifestNames.contains(file.getName())) {
+					file.delete();
+				} else {
+					method.invoke(urlClassLoader, new Object[] { file.toURI().toURL() });
+				}
+			}
+		}
+		File tempDir = new File(base, "local/temp/classes");
+		method.invoke(urlClassLoader, new Object[] { tempDir.toURI().toURL() });
+	}
+
+	private static String getBasePath() throws Exception {
+		String path = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
+		File file = new File(path);
+		if (!file.isDirectory()) {
+			file = file.getParentFile();
+		}
+		while (null != file) {
+			File versionFile = new File(file, "version.o2");
+			if (versionFile.exists()) {
+				return file.getAbsolutePath();
+			}
+			file = file.getParentFile();
+		}
+		throw new Exception("can not define o2server base directory.");
+	}
+
+}

+ 10 - 0
x_server_console/src/main/resources/NewFile.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="UTF-8">
+<title>Insert title here</title>
+</head>
+<body>
+
+</body>
+</html>

+ 28 - 0
x_test/src/main/java/com/x/test/alidayu/TestClient.java

@@ -0,0 +1,28 @@
+package com.x.test.alidayu;
+
+import org.junit.Test;
+
+import com.taobao.api.ApiException;
+import com.taobao.api.DefaultTaobaoClient;
+import com.taobao.api.TaobaoClient;
+import com.taobao.api.request.AlibabaAliqinFcSmsNumSendRequest;
+import com.taobao.api.response.AlibabaAliqinFcSmsNumSendResponse;
+
+import org.junit.Test;
+
+public class TestClient {
+	@Test
+	public void test() throws Exception {
+		TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "23363274",
+				"546784eac4fbea08e36bc71373b0cada");
+		AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest();
+		req.setExtend("");
+		req.setSmsType("normal");
+		req.setSmsFreeSignName("O2平台");
+		req.setSmsParamString("{code:'123'}");
+		req.setRecNum("13336173316");
+		req.setSmsTemplateCode("SMS_52205156");
+		AlibabaAliqinFcSmsNumSendResponse rsp = client.execute(req);
+		System.out.println(rsp.getBody());
+	}
+}

+ 7 - 0
x_test/src/test/java/com/x/test/actionresult/TestClient.java

@@ -0,0 +1,7 @@
+package com.x.test.actionresult;
+
+import org.junit.Test;
+
+public class TestClient {
+
+}

+ 35 - 0
x_test/src/test/java/com/x/test/nio/TestClient.java

@@ -0,0 +1,35 @@
+package com.x.test.nio;
+
+import java.io.RandomAccessFile;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.channels.FileLock;
+
+import org.junit.Test;
+
+public class TestClient {
+
+	private static RandomAccessFile raf;
+
+	public static void main(String... args) {
+		try {
+			// 建立文件和内存的映射,即时双向同步
+			raf = new RandomAccessFile("E:/swap.nio", "rw");
+			FileChannel fc = raf.getChannel();
+			MappedByteBuffer mbb = fc.map(MapMode.READ_WRITE, 0, 1024);
+			FileLock flock = null;
+			flock = fc.lock();
+			mbb.put(0, (byte) 1);
+			flock.release();
+			Thread.sleep(1000);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Test
+	public static void test1() {
+		//ActionResult<WrapOutBoolean> result = new 
+	}
+}

+ 40 - 0
x_test/src/test/java/com/x/test/nio/TestMain.java

@@ -0,0 +1,40 @@
+package com.x.test.nio;
+
+import java.io.RandomAccessFile;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileChannel.MapMode;
+import java.nio.channels.FileLock;
+
+public class TestMain {
+
+	private static RandomAccessFile raf;
+
+	public static void main(String... args) {
+		try {
+			// 建立文件和内存的映射,即时双向同步
+			raf = new RandomAccessFile("E:/swap.nio", "rw");
+			FileChannel fc = raf.getChannel();
+			MappedByteBuffer mbb = fc.map(MapMode.READ_WRITE, 0, 1024);
+			FileLock flock = null;
+			// 阻塞方法一:非阻塞独占锁,当文件锁不可用时,tryLock()会得到null值
+			// do {
+			// flock=fc.tryLock();
+			// } while(null == flock);
+			// 阻塞方法二:非阻塞共享锁,当文件锁不可用时,tryLock()会得到null值
+			// fc.tryLock(0L, Long.MAX_VALUE, true);
+			// 阻塞方法三:阻塞共享锁,有写操作会报异常
+			// flock = fc.lock(0L, Long.MAX_VALUE, true);
+			while (true) {
+				flock = fc.lock();
+				byte b = mbb.get(0);
+				System.out.println((int) b);
+				mbb.put(0, (byte) 0);
+				flock.release();// 释放锁
+				Thread.sleep(2000);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 14 - 0
x_test/src/test/java/com/x/test/password/TestClient.java

@@ -0,0 +1,14 @@
+package com.x.test.password;
+
+import org.junit.Test;
+
+import com.wx.pwd.CheckStrength;
+
+public class TestClient {
+
+	@Test
+	public void test1() {
+		String passwd = "hello123";
+		System.out.println(CheckStrength.checkPasswordStrength(passwd));
+	}
+}

+ 42 - 0
x_test/src/test/java/com/x/test/tcp/SocketTransfer.java

@@ -0,0 +1,42 @@
+package com.x.test.tcp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+public class SocketTransfer extends Thread {
+
+	private Socket client;
+
+	public SocketTransfer(Socket client) throws Exception {
+		this.client = client;
+	}
+
+	public void run() {
+		try (InputStream sourceIn = client.getInputStream();
+				OutputStream sourceOut = client.getOutputStream();
+				Socket target = new Socket("127.0.0.1", 20050);
+				InputStream targetIn = target.getInputStream();
+				OutputStream targetOut = target.getOutputStream()) {
+			int b;
+			while (client.isConnected() && target.isConnected()) {
+				b = sourceIn.read();
+				while (b > -1) {
+					System.out.println("sourceIn read:" + b);
+					targetOut.write(b);
+					b = sourceIn.read();
+				}
+				targetOut.flush();
+				b = targetIn.read();
+				while (b > -1) {
+					System.out.println("targetIn read:" + b);
+					sourceOut.write(b);
+					b = targetIn.read();
+				}
+				sourceOut.flush();
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 40 - 0
x_test/src/test/java/com/x/test/tcp/SourceToTarget.java

@@ -0,0 +1,40 @@
+package com.x.test.tcp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import org.junit.Test;
+
+public class SourceToTarget extends Thread {
+
+	private Socket source;
+	private Socket target;
+
+	public SourceToTarget(Socket source, Socket target) throws Exception {
+		this.source = source;
+		this.target = target;
+	}
+
+	public void run() {
+		try (InputStream sourceIn = source.getInputStream(); OutputStream targetOut = target.getOutputStream()) {
+			int r;
+			byte bs[] = new byte[4096];
+			r = sourceIn.read(bs);
+			while (r > -1 && (!source.isInputShutdown())) {
+				System.out.println();
+				System.out.println("SourceToTarget read:" + r + ",");
+				try {
+					targetOut.write(bs, 0, r);
+					r = sourceIn.read(bs);
+				} catch (Exception e) {
+					break;
+				}
+			}
+			System.out.println("SourceToTarget end loop.");
+			source.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 37 - 0
x_test/src/test/java/com/x/test/tcp/TargetToSource.java

@@ -0,0 +1,37 @@
+package com.x.test.tcp;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+public class TargetToSource extends Thread {
+
+	private Socket source;
+	private Socket target;
+
+	public TargetToSource(Socket source, Socket target) throws Exception {
+		this.source = source;
+		this.target = target;
+	}
+
+	public void run() {
+		try (InputStream targetIn = target.getInputStream(); OutputStream sourceOut = source.getOutputStream()) {
+			int r;
+			byte bs[] = new byte[4096];
+			r = targetIn.read(bs);
+			while (r > -1 && (!target.isInputShutdown())) {
+				System.out.println("TargetToSource read:" + r);
+				try {
+					sourceOut.write(bs, 0, r);
+					r = targetIn.read(bs);
+				} catch (Exception e) {
+					break;
+				}
+			}
+			System.out.println("TargetToSource end loop.");
+			target.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 40 - 0
x_test/src/test/java/com/x/test/tcp/TestSocketClient.java

@@ -0,0 +1,40 @@
+package com.x.test.tcp;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+public class TestSocketClient {
+
+	public static void main(String[] args) throws Exception {
+		try (ServerSocket server = new ServerSocket(30000)) {
+			Socket source = null;
+			while (true) {
+				// 等待客户端的连接,如果没有获取连接
+				source = server.accept();
+				System.out.println("与客户端连接成功!");
+				// SocketTransfer socketTransfer = new SocketTransfer(source);
+				try {
+					Socket target = new Socket("127.0.0.1", 80);
+				Thread targetToSource = new TargetToSource(source, target);
+				Thread sourceToTarget = new SourceToTarget(source, target);
+				targetToSource.start();
+				sourceToTarget.start();
+				// socketTransfer.start();
+				} catch (Exception e){
+					e.printStackTrace();
+				}
+			}
+		}
+	}
+
+	@Test
+	public void intToByteArray() {
+		int a = -1;
+		byte[] bs = new byte[] { (byte) ((a >> 24) & 0xFF), (byte) ((a >> 16) & 0xFF), (byte) ((a >> 8) & 0xFF),
+				(byte) (a & 0xFF) };
+		System.out.println(Arrays.toString(bs));
+	}
+}

BIN
x_test/target/classes/com/x/test/alidayu/TestClient.class


BIN
x_test/target/test-classes/com/x/test/actionresult/TestClient.class


BIN
x_test/target/test-classes/com/x/test/nio/TestClient.class


BIN
x_test/target/test-classes/com/x/test/nio/TestMain.class


BIN
x_test/target/test-classes/com/x/test/password/TestClient.class


BIN
x_test/target/test-classes/com/x/test/tcp/SocketTransfer.class


BIN
x_test/target/test-classes/com/x/test/tcp/SourceToTarget.class


BIN
x_test/target/test-classes/com/x/test/tcp/TargetToSource.class


BIN
x_test/target/test-classes/com/x/test/tcp/TestSocketClient.class


+ 7 - 0
x_test_war/xxx.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Configure class="org.eclipse.jetty.webapp.WebAppContext">
+	<Set name="contextPath">/x_okr_assemble_control</Set>
+	<Set name="war">/o2server/store/x_okr_assemble_control.war</Set>
+	<Set name="extraClasspath">/o2server/commons/ext/openjpa-2.4.2-SNAPSHOT.jar;/o2server/commons/ext/slf4j-api-1.7.21.jar;/o2server/commons/ext/ehcache-2.10.1.jar;/o2server/commons/ext/jetty-all-9.3.14.v20161028-uber.jar;/o2server/commons/ext/slf4j-simple-1.7.21.jar;/o2server/store/jars/x_organization_core_express-4.0.0.jar;/o2server/store/jars/x_collaboration_core_message-4.0.0.jar;/o2server/store/jars/x_okr_core_entity-4.0.0.jar;/o2server/store/jars/x_base_core_project-4.0.0.jar;/o2server/store/jars/x_organization_core_entity-4.0.0.jar</Set>
+	<Set name="tempDirectory">/o2server/servers/applicationServer/work/x_okr_assemble_control</Set>
+</Configure>

+ 20 - 0
x_tools/deploy_o2server.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="main" default="default">
+	<basename property="project" file="${basedir}" />
+	<dirname property="root.dir" file="${basedir}../" />
+	<property file="${root.dir}/building/build.properties" />
+	<include file="${root.dir}/building/build_common.xml" as="common" />
+
+
+	<tstamp>
+		<format property="TODAY" pattern="yyyyMMdd" locale="zh-cn" />
+	</tstamp>
+
+	<target name="default">
+		<copy todir="D:/o2server/store">
+			<fileset dir="${root.dir}/store">
+			</fileset>
+		</copy>
+		<copy file="${root.dir}/x_server_console/console.jar" tofile="D:/o2server/console.jar" />
+	</target>
+</project>

+ 26 - 0
x_tools/jest/common.js

@@ -0,0 +1,26 @@
+function failure(data) {
+    console.log(data);
+    alert(data.message);
+}
+
+function splitValue(str) {
+    if (str) {
+	if (str.length > 0) {
+	    return str.split(',');
+	}
+    }
+    return [];
+}
+
+function joinValue(o, split) {
+    var s = ',';
+    if (split) {
+	s = '' + split;
+    }
+    if (o) {
+	if (toString.apply(o) === '[object Array]') {
+	    return o.join(s);
+	}
+    }
+    return o;
+}

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
x_tools/jest/jquery.js


+ 105 - 0
x_tools/jest/logger.js

@@ -0,0 +1,105 @@
+logger_parameter = {};
+
+function logger_init() {
+    $('#result').html('');
+    $('#content').html('');
+    var str = '<table border="1" width="100%">';
+    str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp<a href="#" id="trace">trace</a>&nbsp;<a href="#" id="debug">debug</a>&nbsp;<a href="#" id="info">info</a>&nbsp;<a href="#" id="warn">warn</a></td></tr>';
+    str += '<tr><td>debug:</td><td id="level">&nbsp;</td></tr>';
+    str += '</table>';
+    $('#content').html(str);
+    $('#get').click(function() {
+	logger_get();
+    });
+    $('#trace').click(function() {
+	logger_trace();
+    });
+    $('#debug').click(function() {
+	logger_debug();
+    });
+    $('#info').click(function() {
+	logger_info();
+    });
+    $('#warn').click(function() {
+	logger_warn();
+    });
+}
+
+function logger_get() {
+    $.ajax({
+	type : 'get',
+	dataType : 'json',
+	url : '../jaxrs/logger',
+	contentType : 'application/json; charset=utf-8',
+	xhrFields : {
+	    'withCredentials' : true
+	},
+	crossDomain : true
+    }).done(function(json) {
+	if (json.type == 'success') {
+	    $('#level').html(json.data.value);
+	}
+    }).always(function(json) {
+	$('#result').html(JSON.stringify(json, null, 4));
+    });
+}
+
+function debug_trace() {
+    $.ajax({
+	type : 'get',
+	dataType : 'json',
+	url : '../jaxrs/logger/trace',
+	contentType : 'application/json; charset=utf-8',
+	xhrFields : {
+	    'withCredentials' : true
+	},
+	crossDomain : true
+    }).always(function(json) {
+	$('#result').html(JSON.stringify(json, null, 4));
+    });
+}
+
+function debug_debug() {
+    $.ajax({
+	type : 'get',
+	dataType : 'json',
+	url : '../jaxrs/logger/debug',
+	contentType : 'application/json; charset=utf-8',
+	xhrFields : {
+	    'withCredentials' : true
+	},
+	crossDomain : true
+    }).always(function(json) {
+	$('#result').html(JSON.stringify(json, null, 4));
+    });
+}
+
+function debug_info() {
+    $.ajax({
+	type : 'get',
+	dataType : 'json',
+	url : '../jaxrs/logger/info',
+	contentType : 'application/json; charset=utf-8',
+	xhrFields : {
+	    'withCredentials' : true
+	},
+	crossDomain : true
+    }).always(function(json) {
+	$('#result').html(JSON.stringify(json, null, 4));
+    });
+}
+
+function debug_warn() {
+    $.ajax({
+	type : 'get',
+	dataType : 'json',
+	url : '../jaxrs/logger/warn',
+	contentType : 'application/json; charset=utf-8',
+	xhrFields : {
+	    'withCredentials' : true
+	},
+	crossDomain : true
+    }).always(function(json) {
+	$('#result').html(JSON.stringify(json, null, 4));
+    });
+}

+ 62 - 0
x_tools/publish_version_aix.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="main" default="default">
+	<basename property="project" file="${basedir}" />
+	<dirname property="root.dir" file="${basedir}../" />
+	<property file="${root.dir}/building/build.properties" />
+	<include file="${root.dir}/building/build_common.xml" as="common" />
+
+
+	<tstamp>
+		<format property="TODAY" pattern="yyyyMMdd" locale="zh-cn" />
+	</tstamp>
+
+	<target name="default">
+		<mkdir dir="dist/o2server" />
+		<mkdir dir="versions" />
+		<delete includeemptydirs="true">
+			<fileset dir="dist/o2server" includes="**/*" />
+		</delete>
+		<copy todir="dist/o2server/commons/">
+			<fileset dir="D:/o2server/commons/" />
+		</copy>
+		<copy todir="dist/o2server/config/sample">
+			<fileset dir="D:/o2server/config/sample" />
+		</copy>
+		<mkdir dir="dist/o2server/jvm" />
+		<copy todir="dist/o2server/jvm/aix">
+			<fileset dir="D:/o2server/jvm/aix" />
+		</copy>
+		<copy todir="dist/o2server/local/sample">
+			<fileset dir="D:/o2server/local/sample" />
+		</copy>
+		<mkdir dir="dist/o2server/logs" />
+		<mkdir dir="dist/o2server/servers/centerServer/webapps" />
+		<mkdir dir="dist/o2server/servers/centerServer/work" />
+		<mkdir dir="dist/o2server/servers/applicationServer/webapps" />
+		<mkdir dir="dist/o2server/servers/applicationServer/work" />
+		<copy todir="dist/o2server/servers/webServer/">
+			<fileset dir="D:/o2server/servers/webServer/">
+				<exclude name="**/.svn/" />
+				<exclude name="**/Thumbs.db" />
+				<exclude name="**/*.bak" />
+				<exclude name="**/*.temp" />
+				<exclude name="**/*.tmp" />
+				<exclude name="**/~*" />
+			</fileset>
+		</copy>
+		<copy todir="dist/o2server/store/">
+			<fileset dir="D:/o2server/store/" />
+		</copy>
+		<copy todir="dist/o2server">
+			<fileset dir="D:/o2server/">
+				<include name="console.jar" />
+				<include name="start_aix.sh" />
+			</fileset>
+		</copy>
+		<echo file="dist/o2server/version.o2" append="false">4${TODAY}</echo>
+		<mkdir dir="${root.dir}/versions" />
+		<zip encoding="utf-8" destfile="${root.dir}/versions/o2server${TODAY}_aix.zip" update="false">
+			<zipfileset dir="dist/o2server/" filemode="777" dirmode="777" encoding="utf-8" />
+		</zip>
+	</target>
+</project>

+ 61 - 0
x_tools/publish_version_macos.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="main" default="default">
+	<basename property="project" file="${basedir}" />
+	<dirname property="root.dir" file="${basedir}../" />
+	<property file="${root.dir}/building/build.properties" />
+	<include file="${root.dir}/building/build_common.xml" as="common" />
+
+	<tstamp>
+		<format property="TODAY" pattern="yyyyMMdd" locale="zh-cn" />
+	</tstamp>
+
+	<target name="default">
+		<mkdir dir="dist/o2server" />
+		<mkdir dir="versions" />
+		<delete includeemptydirs="true">
+			<fileset dir="dist/o2server" includes="**/*" />
+		</delete>
+		<copy todir="dist/o2server/commons/">
+			<fileset dir="D:/o2server/commons/" />
+		</copy>
+		<copy todir="dist/o2server/config/sample">
+			<fileset dir="D:/o2server/config/sample" />
+		</copy>
+		<mkdir dir="dist/o2server/jvm" />
+		<copy todir="dist/o2server/jvm/macos">
+			<fileset dir="D:/o2server/jvm/macos" />
+		</copy>
+		<copy todir="dist/o2server/local/sample">
+			<fileset dir="D:/o2server/local/sample" />
+		</copy>
+		<mkdir dir="dist/o2server/logs" />
+		<mkdir dir="dist/o2server/servers/centerServer/webapps" />
+		<mkdir dir="dist/o2server/servers/centerServer/work" />
+		<mkdir dir="dist/o2server/servers/applicationServer/webapps" />
+		<mkdir dir="dist/o2server/servers/applicationServer/work" />
+		<copy todir="dist/o2server/servers/webServer/">
+			<fileset dir="D:/o2server/servers/webServer/">
+				<exclude name="**/.svn/" />
+				<exclude name="**/Thumbs.db" />
+				<exclude name="**/*.bak" />
+				<exclude name="**/*.temp" />
+				<exclude name="**/*.tmp" />
+				<exclude name="**/~*" />
+			</fileset>
+		</copy>
+		<copy todir="dist/o2server/store/">
+			<fileset dir="D:/o2server/store/" />
+		</copy>
+		<copy todir="dist/o2server">
+			<fileset dir="D:/o2server/">
+				<include name="console.jar" />
+				<include name="start_macos.sh" />
+			</fileset>
+		</copy>
+		<echo file="dist/o2server/version.o2" append="false">4${TODAY}</echo>
+		<mkdir dir="${root.dir}/versions" />
+		<zip encoding="utf-8" destfile="${root.dir}/versions/o2server${TODAY}_macos.zip" update="false">
+			<zipfileset dir="dist/o2server/" filemode="777" dirmode="777" encoding="utf-8" />
+		</zip>
+	</target>
+</project>

+ 105 - 0
x_tools/src/main/java/com/x/tools/jest/CopyJest.java

@@ -0,0 +1,105 @@
+package com.x.tools.jest;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.junit.Test;
+
+import com.x.base.core.Packages;
+import com.x.base.core.project.Assemble;
+import com.x.base.core.project.Service;
+
+import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
+import io.github.lukehutch.fastclasspathscanner.scanner.ScanResult;
+
+public class CopyJest {
+
+	@Test
+	public void copyDebugJs() throws Exception {
+		File root = new File(new File("").getAbsolutePath());
+		File template = new File(root, "jest/debug.js");
+		for (String str : this.listAssemble()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/debug.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+		for (String str : this.listService()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/debug.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+	}
+
+	@Test
+	public void copyCommonJs() throws Exception {
+		File root = new File(new File("").getAbsolutePath());
+		File template = new File(root, "jest/common.js");
+		for (String str : this.listAssemble()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/common.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+		for (String str : this.listService()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/common.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+	}
+
+	@Test
+	public void copyJQueryJs() throws Exception {
+		File root = new File(new File("").getAbsolutePath());
+		File template = new File(root, "jest/jquery.js");
+		for (String str : this.listAssemble()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/jquery.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+		for (String str : this.listService()) {
+			File dir = new File(root.getParent(), str);
+			File dest = new File(dir, "jest/jquery.js");
+			System.out.println("copy to:" + dest.getAbsolutePath());
+			FileUtils.copyFile(template, dest);
+		}
+	}
+
+	private List<String> listAssemble() throws Exception {
+		ScanResult scanResult = new FastClasspathScanner(Packages.PREFIX).scan();
+		List<String> list = new ArrayList<>();
+		for (String str : scanResult.getNamesOfSubclassesOf(Assemble.class)) {
+			Class<?> clz = Class.forName(str);
+			list.add(clz.getSimpleName());
+		}
+		Collections.sort(list, new Comparator<String>() {
+			public int compare(String s1, String s2) {
+				return s1.compareTo(s2);
+			}
+		});
+		return list;
+	}
+
+	private List<String> listService() throws Exception {
+		ScanResult scanResult = new FastClasspathScanner(Packages.PREFIX).scan();
+		List<String> list = new ArrayList<>();
+		for (String str : scanResult.getNamesOfSubclassesOf(Service.class)) {
+			Class<?> clz = Class.forName(str);
+			list.add(clz.getSimpleName());
+		}
+		Collections.sort(list, new Comparator<String>() {
+			public int compare(String s1, String s2) {
+				return s1.compareTo(s2);
+			}
+		});
+		return list;
+	}
+
+}

+ 35 - 0
x_tools/src/main/java/com/x/tools/manifest/Store.java

@@ -0,0 +1,35 @@
+package com.x.tools.manifest;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.junit.Test;
+
+public class Store {
+
+	@Test
+	public void run() throws Exception {
+		File dir = new File("d:/o2server/store");
+		if ((!dir.exists()) || (!dir.isDirectory())) {
+			throw new Exception("error");
+		}
+		List<String> names = new ArrayList<>();
+		for (File o : dir.listFiles()) {
+			if (o.isDirectory() && o.getName().equals("jars")) {
+				continue;
+			}
+			if (!StringUtils.equals(o.getName(), "manifest.cfg")) {
+				continue;
+			}
+			if (StringUtils.isNotEmpty(o.getName())) {
+				names.add(o.getName());
+			}
+		}
+		File file = new File(dir, "manifest.cfg");
+		FileUtils.writeLines(file, names);
+	}
+
+}

+ 55 - 0
x_tools/update_version.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." name="main" default="default">
+	<basename property="project" file="${basedir}" />
+	<dirname property="root.dir" file="${basedir}../" />
+	<property file="${root.dir}/building/build.properties" />
+	<include file="${root.dir}/building/build_common.xml" as="common" />
+
+
+	<tstamp>
+		<format property="TODAY" pattern="yyyyMMdd" locale="zh-cn" />
+	</tstamp>
+
+	<!--不需要拷贝config配置文件,也不创建node.cfg,不创建local目录和log目录,不拷贝jvm-->
+	<target name="default">
+		<mkdir dir="versions/4${TODAY}01" />
+		<delete includeemptydirs="true">
+			<fileset dir="versions/4${TODAY}01" includes="**/*" />
+		</delete>
+		<copy todir="versions/4${TODAY}01/commons/ext">
+			<fileset dir="D:/o2server/commons/ext" />
+		</copy>
+		<copy todir="versions/4${TODAY}01/commons">
+			<fileset dir="D:/o2server/commons">
+				<include name="initialScriptText.js" />
+				<include name="mime.types" />
+				<include name="webdefault.xml" />
+			</fileset>
+		</copy>
+		<mkdir dir="versions/4${TODAY}01/servers/centerServer/webapps" />
+		<mkdir dir="versions/4${TODAY}01/servers/centerServer/work" />
+		<mkdir dir="versions/4${TODAY}01/servers/applicationServer/webapps" />
+		<mkdir dir="versions/4${TODAY}01/servers/applicationServer/work" />
+		<copy todir="versions/4${TODAY}01/servers/webServer/">
+			<fileset dir="D:/o2server/servers/webServer/">
+				<exclude name="**/.svn/" />
+				<exclude name="**/Thumbs.db" />
+				<exclude name="**/*.bak" />
+				<exclude name="**/~*" />
+			</fileset>
+		</copy>
+		<copy todir="versions/4${TODAY}01/store/">
+			<fileset dir="D:/o2server/store/" />
+		</copy>
+		<copy todir="versions/4${TODAY}01">
+			<fileset dir="D:/o2server/">
+				<include name="console.jar" />
+				<include name="start.bat" />
+				<include name="start.sh" />
+				<!--include name="version.o2" /-->
+			</fileset>
+		</copy>
+		<echo file="versions/4${TODAY}01/version.o2" append="false">4${TODAY}01</echo>
+		<touch file="versions/4${TODAY}01/description.txt" />
+	</target>
+</project>

+ 6 - 0
x_updates/classes/20161211以后

@@ -0,0 +1,6 @@
+1.修改webdefault.xml位置
+2.修改initialScriptText.js位置
+3.config/personTemplate.json 改为 config/person.json
+4.mimeType改为使用jetty
+5.OpenMeetingJunction改为Meeting
+6.jvm移动到根目录下

+ 6 - 0
x_updates/src/main/resources/20161211以后

@@ -0,0 +1,6 @@
+1.修改webdefault.xml位置
+2.修改initialScriptText.js位置
+3.config/personTemplate.json 改为 config/person.json
+4.mimeType改为使用jetty
+5.OpenMeetingJunction改为Meeting
+6.jvm移动到根目录下

Некоторые файлы не были показаны из-за большого количества измененных файлов