diff --git a/README.md b/README.md
index 70e941b94abc8386dc984ac9dc5089e44c378e40..da6791603733f52677e430332d76204ec9eb95b6 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ O2OA
==========
## 简介
-O2OA 是一套现代企业级的办公平台。有以下特点:
+O2OA 是一套现代企业级的办公平台。有以下特点\:
1. 核心代码开源
diff --git a/o2server/x_program_center/src/test/java/aaa.xml b/o2server/x_program_center/src/test/java/aaa.xml
deleted file mode 100644
index 063b19d02e240f200dd9c33430c1ad89fbc7eb67..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/aaa.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- x_program_center
-
-
\ No newline at end of file
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/A.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/A.java
deleted file mode 100644
index 5693a66cfa3e3444495dddf54e43e481331e45f6..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/A.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.x.program.center.test;
-
-import java.util.Random;
-
-import org.junit.Test;
-
-public class A {
- public static String sss = "aaaaa";
-
- @Test
- public void test1() {
- Random random = new Random();
- System.out.println(random.nextInt());
-
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/ATimerTask.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/ATimerTask.java
deleted file mode 100644
index dbb4a83755aa2fe998e9056e859a7bd90326845b..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/ATimerTask.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.x.program.center.test;
-
-import java.util.TimerTask;
-
-import org.apache.commons.lang3.math.NumberUtils;
-import org.junit.Test;
-
-public class ATimerTask extends TimerTask {
-
- @Test
- public void run() {
- System.out.println(NumberUtils.isNumber(null));
- // TODO Auto-generated method stub
-
- }
-
- @Test
- public void test1() {
-
-
-
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/B.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/B.java
deleted file mode 100644
index 7500946d4626ab52d906eafb65379b27b6f7c5ac..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/B.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.x.program.center.test;
-
-public class B extends A {
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/BTimerTask.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/BTimerTask.java
deleted file mode 100644
index efe885bbbc5a3f92f4828a090531ac2ec1bab5fc..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/BTimerTask.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.x.program.center.test;
-
-import java.util.TimerTask;
-
-public class BTimerTask extends TimerTask {
-
- @Override
- public void run() {
- System.out.println("BBBBBBBBBBBBBBBBB");
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/TEST.json b/o2server/x_program_center/src/test/java/com/x/program/center/test/TEST.json
deleted file mode 100644
index c877ead35ad4ff60a0f3c514899ca148c5424280..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/TEST.json
+++ /dev/null
@@ -1,11 +0,0 @@
-[
- {
- "containerType": "tomcat8",
- "host": "127.0.0.1",
- "port": 80,
- "username": "xadmin",
- "password": "xpfadmin",
- "order": 0,
- "name": "xw01"
- }
-]
\ No newline at end of file
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/TestClient.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/TestClient.java
deleted file mode 100644
index 01cf017810fbb31a2473f8d0477aee624f08138a..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/TestClient.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.x.program.center.test;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-
-import com.x.base.core.project.gson.XGsonBuilder;
-
-import jdk.nashorn.api.scripting.ScriptObjectMirror;
-
-public class TestClient {
-
- @Test
- public void test7() throws Exception {
- ScriptEngineManager factory = new ScriptEngineManager();
- ScriptEngine engine = factory.getEngineByName("javascript");
- String str = "function aaa(){";
- str += StringUtils.LF;
- str += "var list = [{},{}]";
- str += StringUtils.LF;
- str += "return list";
- str += StringUtils.LF;
- str += "}";
- str += StringUtils.LF;
- str += "aaa()";
- Object obj = engine.eval(str);
- System.out.println(obj);
- System.out.println(obj.getClass().getName());
- ScriptObjectMirror som = (ScriptObjectMirror) obj;
- System.out.println(som.isArray());
-
- Object[] os = new Object[] {};
- ScriptObjectMirror.unwrapArray(os, som);
- System.out.println(os);
- for (Object o : os) {
- System.out.println(o);
- }
- }
-
- @Test
- public void test3() {
-
- Pattern REGEX = Pattern.compile("^\\/\\*(\\s|.)*?\\*\\/");
-
- String COMMENT = "/*" + StringUtils.LF;
- COMMENT += "* resources.getEntityManagerContainer(); // 实体管理容器." + StringUtils.LF;
- COMMENT += "* resources.getContext(); //上下文根." + StringUtils.LF;
- COMMENT += "* resources.getOrganization(); //组织访问接口." + StringUtils.LF;
- COMMENT += "* requestText //请求内容." + StringUtils.LF;
- COMMENT += "* request //请求对象." + StringUtils.LF;
- COMMENT += "*/adfasdfasdfasdf";
- Matcher m = REGEX.matcher(COMMENT);
- System.out.println(m.find());
- System.out.println(m.replaceFirst(""));
- }
-
- @Test
- public void test4() {
-
- List list = new ArrayList<>();
- list.add(5);
- list.add(4);
- list.add(8);
- list.add(5);
- list.add(5);
- list.add(9);
- list = list.stream()
- .sorted(Comparator.comparing(Integer::intValue, Comparator.nullsLast(Integer::compareTo)).reversed())
- .collect(Collectors.toList());
- System.out.println(XGsonBuilder.toJson(list));
-
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/appstyle/TestClient.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/appstyle/TestClient.java
deleted file mode 100644
index 24019e08ddd2819363e863dce5d4f78587071027..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/appstyle/TestClient.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package com.x.program.center.test.appstyle;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.io.FileUtils;
-import org.junit.Test;
-
-public class TestClient {
-
- @Test
- public void test_bas64_launch_logo() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("launch_logo.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_login_avatar() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("login_avatar.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_index_bottom_menu_logo_blur() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("index_bottom_menu_logo_blur.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_index_bottom_menu_logo_focus() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("index_bottom_menu_logo_focus.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_people_avatar_default() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("people_avatar_default.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_process_default() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("process_default.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
- @Test
- public void test_bas64_index_setup_about_logo() throws IOException {
- URL url = this.getClass().getClassLoader().getResource("setup_about_logo.png");
- File file = FileUtils.toFile(url);
- String icon = Base64.encodeBase64String(FileUtils.readFileToByteArray(file));
- System.out.print(icon);
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/TestClient.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/TestClient.java
deleted file mode 100644
index 31b48cef8837f9d02ddc7cb72c8ea889720104db..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/TestClient.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.x.program.center.test.ca;
-
-import org.apache.commons.io.FilenameUtils;
-import org.junit.Test;
-
-public class TestClient {
- @Test
- public void test1() {
- System.out.println(FilenameUtils.getExtension("hh"));
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/package-info.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/package-info.java
deleted file mode 100644
index bff7d0380ae31346e9dab593c40b894aee11f476..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/ca/package-info.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- *
- */
-/**
- * @author zhour
- *
- */
-package com.x.program.center.test.ca;
\ No newline at end of file
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/CpuInfo.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/CpuInfo.java
deleted file mode 100644
index d8842750ae2a4972e8dfa0e9ce21c055f5371e6e..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/CpuInfo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2006-2008 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import org.hyperic.sigar.CpuPerc;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.SigarLoader;
-
-/**
- * Display cpu information for each cpu found on the system.
- */
-public class CpuInfo extends SigarCommandBase {
-
- public boolean displayTimes = true;
-
- public CpuInfo(Shell shell) {
- super(shell);
- }
-
- public CpuInfo() {
- super();
- }
-
- public String getUsageShort() {
- return "Display cpu information";
- }
-
- private void output(CpuPerc cpu) {
- println("User Time....." + CpuPerc.format(cpu.getUser()));
- println("Sys Time......" + CpuPerc.format(cpu.getSys()));
- println("Idle Time....." + CpuPerc.format(cpu.getIdle()));
- println("Wait Time....." + CpuPerc.format(cpu.getWait()));
- println("Nice Time....." + CpuPerc.format(cpu.getNice()));
- println("Combined......" + CpuPerc.format(cpu.getCombined()));
- println("Irq Time......" + CpuPerc.format(cpu.getIrq()));
- if (SigarLoader.IS_LINUX) {
- println("SoftIrq Time.." + CpuPerc.format(cpu.getSoftIrq()));
- println("Stolen Time...." + CpuPerc.format(cpu.getStolen()));
- }
- println("");
- }
-
- public void output(String[] args) throws SigarException {
- org.hyperic.sigar.CpuInfo[] infos = this.sigar.getCpuInfoList();
-
- CpuPerc[] cpus = this.sigar.getCpuPercList();
-
- org.hyperic.sigar.CpuInfo info = infos[0];
- long cacheSize = info.getCacheSize();
- println("Vendor........." + info.getVendor());
- println("Model.........." + info.getModel());
- println("Mhz............" + info.getMhz());
- println("Total CPUs....." + info.getTotalCores());
- if ((info.getTotalCores() != info.getTotalSockets()) || (info.getCoresPerSocket() > info.getTotalCores())) {
- println("Physical CPUs.." + info.getTotalSockets());
- println("Cores per CPU.." + info.getCoresPerSocket());
- }
-
- if (cacheSize != Sigar.FIELD_NOTIMPL) {
- println("Cache size...." + cacheSize);
- }
- println("");
-
- if (!this.displayTimes) {
- return;
- }
-
- for (int i = 0; i < cpus.length; i++) {
- println("CPU " + i + ".........");
- output(cpus[i]);
- }
-
- println("Totals........");
- output(this.sigar.getCpuPerc());
- }
-
- public static void main(String[] args) throws Exception {
- System.out.println(System.getProperty("java.library.path"));
- new CpuInfo().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Df.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Df.java
deleted file mode 100644
index a4027d47c9c6b9034514d6f57d03cbfd11c85d73..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Df.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- * Copyright (c) 2010 VMware, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.util.ArrayList;
-
-import org.hyperic.sigar.FileSystem;
-import org.hyperic.sigar.FileSystemMap;
-import org.hyperic.sigar.FileSystemUsage;
-import org.hyperic.sigar.NfsFileSystem;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.shell.FileCompleter;
-import org.hyperic.sigar.util.GetlineCompleter;
-
-/**
- * Report filesytem disk space usage.
- */
-public class Df extends SigarCommandBase {
-
- private static final String OUTPUT_FORMAT =
- "%-15s %4s %4s %5s %4s %-15s %s";
-
- //like df -h -a
- private static final String[] HEADER = new String[] {
- "Filesystem",
- "Size",
- "Used",
- "Avail",
- "Use%",
- "Mounted on",
- "Type"
- };
- //df -i
- private static final String[] IHEADER = new String[] {
- "Filesystem",
- "Inodes",
- "IUsed",
- "IFree",
- "IUse%",
- "Mounted on",
- "Type"
- };
-
- private GetlineCompleter completer;
- private boolean opt_i;
-
- public Df(Shell shell) {
- super(shell);
- setOutputFormat(OUTPUT_FORMAT);
- this.completer = new FileCompleter(shell);
- }
-
- public Df() {
- super();
- setOutputFormat(OUTPUT_FORMAT);
- }
-
- public GetlineCompleter getCompleter() {
- return this.completer;
- }
-
- protected boolean validateArgs(String[] args) {
- return true;
- }
-
- public String getSyntaxArgs() {
- return "[filesystem]";
- }
-
- public String getUsageShort() {
- return "Report filesystem disk space usage";
- }
-
- public void printHeader() {
- printf(this.opt_i ? IHEADER : HEADER);
- }
-
- public void output(String[] args) throws SigarException {
- this.opt_i = false;
- ArrayList sys = new ArrayList();
-
- if (args.length > 0) {
- FileSystemMap mounts = this.proxy.getFileSystemMap();
- for (int i=0; i= 1;
- }
-
- public String getUsageShort() {
- return "Display file version info";
- }
-
- public void output(String[] args) throws SigarException {
- for (int i=0; i 0) {
- sb.append('.');
- }
- sb.append(val);
- println(sb.toString());
- }
-
- public void output(String exe) throws SigarException {
- FileVersion info = Win32.getFileVersion(exe);
- if (info == null) {
- return;
- }
- println("Version info for file '" + exe + "':");
- output("FileVersion", info.getFileVersion());
- output("ProductVersion", info.getProductVersion());
- for (Iterator it = info.getInfo().entrySet().iterator();
- it.hasNext();)
- {
- Map.Entry entry = (Map.Entry)it.next();
- output((String)entry.getKey(), (String)entry.getValue());
- }
- }
-
- public static void main(String[] args) throws Exception {
- new FileVersionInfo().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Free.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Free.java
deleted file mode 100644
index 274b4bc003d23f96b3798310cd8aff3f12c3705c..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Free.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import org.hyperic.sigar.Mem;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.Swap;
-
-/**
- * Display amount of free and used memory in the system.
- */
-public class Free extends SigarCommandBase {
-
- public Free(Shell shell) {
- super(shell);
- }
-
- public Free() {
- super();
- }
-
- public String getUsageShort() {
- return "Display information about free and used memory";
- }
-
- private static Long format(long value) {
- return new Long(value / 1024);
- }
-
- public void output(String[] args) throws SigarException {
- Mem mem = this.sigar.getMem();
- Swap swap = this.sigar.getSwap();
-
- Object[] header = new Object[] { "total", "used", "free" };
-
- Object[] memRow = new Object[] {
- format(mem.getTotal()),
- format(mem.getUsed()),
- format(mem.getFree())
- };
-
- Object[] actualRow = new Object[] {
- format(mem.getActualUsed()),
- format(mem.getActualFree())
- };
-
- Object[] swapRow = new Object[] {
- format(swap.getTotal()),
- format(swap.getUsed()),
- format(swap.getFree())
- };
-
- printf("%18s %10s %10s", header);
-
- printf("Mem: %10ld %10ld %10ld", memRow);
-
- //e.g. linux
- if ((mem.getUsed() != mem.getActualUsed()) ||
- (mem.getFree() != mem.getActualFree()))
- {
- printf("-/+ buffers/cache: " + "%10ld %10d", actualRow);
- }
-
- printf("Swap: %10ld %10ld %10ld", swapRow);
-
- printf("RAM: %10ls", new Object[] { mem.getRam() + "MB" });
- }
-
- public static void main(String[] args) throws Exception {
- new Free().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Ifconfig.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Ifconfig.java
deleted file mode 100644
index 3a7fd586f3cf13dad692423d780d7ae8fe2735ff..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Ifconfig.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.hyperic.sigar.NetFlags;
-import org.hyperic.sigar.NetInterfaceConfig;
-import org.hyperic.sigar.NetInterfaceStat;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-
-/**
- * Display network interface configuration and metrics.
- */
-public class Ifconfig extends SigarCommandBase {
-
- public Ifconfig(Shell shell) {
- super(shell);
- }
-
- public Ifconfig() {
- super();
- }
-
- protected boolean validateArgs(String[] args) {
- return args.length <= 1;
- }
-
- public String getSyntaxArgs() {
- return "[interface]";
- }
-
- public String getUsageShort() {
- return "Network interface information";
- }
-
- public Collection getCompletions() {
- String[] ifNames;
-
- try {
- ifNames = this.proxy.getNetInterfaceList();
- } catch (SigarException e) {
- return super.getCompletions();
- }
-
- return Arrays.asList(ifNames);
- }
-
- public void output(String[] args) throws SigarException {
- String[] ifNames;
-
- if (args.length == 1) {
- ifNames = args;
- }
- else {
- ifNames = this.proxy.getNetInterfaceList();
- }
-
- for (int i=0; i 0) {
- ptp = " P-t-P:" + ifconfig.getDestination();
- }
-
- String bcast = "";
- if ((flags & NetFlags.IFF_BROADCAST) > 0) {
- bcast = " Bcast:" + ifconfig.getBroadcast();
- }
-
- println("\t" +
- "inet addr:" + ifconfig.getAddress() +
- ptp + //unlikely
- bcast +
- " Mask:" + ifconfig.getNetmask());
-
- println("\t" +
- NetFlags.getIfFlagsString(flags) +
- " MTU:" + ifconfig.getMtu() +
- " Metric:" + ifconfig.getMetric());
- try {
- NetInterfaceStat ifstat =
- this.sigar.getNetInterfaceStat(name);
-
- println("\t" +
- "RX packets:" + ifstat.getRxPackets() +
- " errors:" + ifstat.getRxErrors() +
- " dropped:" + ifstat.getRxDropped() +
- " overruns:" + ifstat.getRxOverruns() +
- " frame:" + ifstat.getRxFrame());
-
- println("\t" +
- "TX packets:" + ifstat.getTxPackets() +
- " errors:" + ifstat.getTxErrors() +
- " dropped:" + ifstat.getTxDropped() +
- " overruns:" + ifstat.getTxOverruns() +
- " carrier:" + ifstat.getTxCarrier());
- println("\t" + "collisions:" +
- ifstat.getTxCollisions());
-
- long rxBytes = ifstat.getRxBytes();
- long txBytes = ifstat.getTxBytes();
-
- println("\t" +
- "RX bytes:" + rxBytes +
- " (" + Sigar.formatSize(rxBytes) + ")" +
- " " +
- "TX bytes:" + txBytes +
- " (" + Sigar.formatSize(txBytes) + ")");
- } catch (SigarException e) {
- }
-
- println("");
- }
-
- public static void main(String[] args) throws Exception {
- new Ifconfig().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Iostat.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Iostat.java
deleted file mode 100644
index dabe4e6a523ecc3fc3392d024e413b6548588258..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Iostat.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2006-2008 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.util.ArrayList;
-
-import org.hyperic.sigar.DiskUsage;
-import org.hyperic.sigar.FileSystem;
-import org.hyperic.sigar.FileSystemMap;
-import org.hyperic.sigar.FileSystemUsage;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.shell.FileCompleter;
-import org.hyperic.sigar.util.GetlineCompleter;
-
-/**
- * Report filesytem disk space usage.
- */
-public class Iostat extends SigarCommandBase {
-
- private static final String OUTPUT_FORMAT =
- "%-15s %-15s %10s %10s %7s %7s %5s %5s";
-
- private static final String[] HEADER = new String[] {
- "Filesystem",
- "Mounted on",
- "Reads",
- "Writes",
- "R-bytes",
- "W-bytes",
- "Queue",
- "Svctm",
- };
-
- private GetlineCompleter completer;
-
- public Iostat(Shell shell) {
- super(shell);
- setOutputFormat(OUTPUT_FORMAT);
- this.completer = new FileCompleter(shell);
- }
-
- public Iostat() {
- super();
- setOutputFormat(OUTPUT_FORMAT);
- }
-
- public GetlineCompleter getCompleter() {
- return this.completer;
- }
-
- protected boolean validateArgs(String[] args) {
- return args.length <= 1;
- }
-
- public String getSyntaxArgs() {
- return "[filesystem]";
- }
-
- public String getUsageShort() {
- return "Report filesystem disk i/o";
- }
-
- public void printHeader() {
- printf(HEADER);
- }
-
- private String svctm(double val) {
- return sprintf("%3.2f", new Object[] { new Double(val) });
- }
-
- public void output(String[] args) throws SigarException {
- if (args.length == 1) {
- String arg = args[0];
- if ((arg.indexOf('/') != -1) || (arg.indexOf('\\') != -1)) {
- outputFileSystem(arg);
- }
- else {
- outputDisk(arg);
- }
- }
- else {
- FileSystem[] fslist = this.proxy.getFileSystemList();
- printHeader();
- for (int i=0; i";
- }
-
- public String getUsageShort() {
- return "Send signal to a process";
- }
-
- public boolean isPidCompleter() {
- return true;
- }
-
- public void output(String[] args) throws SigarException {
- String signal = "SIGTERM";
- long[] pids;
- String query;
-
- if (args.length == 2) {
- signal = args[0];
- query = args[1];
- }
- else {
- query = args[0];
- }
-
- pids = this.shell.findPids(new String[] { query });
-
- for (int i=0; i " + new File(file).getCanonicalPath();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- println(link.getTypeChar() +
- info.getPermissionsString() + "\t" +
- info.getUid() + "\t" + info.getGid() + "\t" +
- info.getSize() + "\t" +
- getDate(info.getMtime()) + "\t" +
- file);
- }
-
- public static void main(String[] args) throws Exception {
- new Ls().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MemWatch.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MemWatch.java
deleted file mode 100644
index 576f2e12c35d33e1a2d9ae082164df9a19ed0506..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MemWatch.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import org.hyperic.sigar.ProcMem;
-import org.hyperic.sigar.Sigar;
-
-/**
- * Watch for changes in program memory usage.
- */
-public class MemWatch {
-
- static final int SLEEP_TIME = 1000 * 10;
-
- public static void main(String[] args) throws Exception {
- Sigar sigar = new Sigar();
-
- if (args.length != 1) {
- throw new Exception("Usage: MemWatch pid");
- }
-
- long pid = Long.parseLong(args[0]);
-
- long lastTime = System.currentTimeMillis();
-
- ProcMem last = sigar.getProcMem(pid);
-
- while (true) {
- ProcMem cur = sigar.getProcMem(pid);
-
- StringBuffer diff = diff(last, cur);
-
- if (diff.length() == 0) {
- System.out.println("no change " +
- "(size=" +
- Sigar.formatSize(cur.getSize()) +
- ")");
- }
- else {
- long curTime = System.currentTimeMillis();
- long timeDiff = curTime - lastTime;
- lastTime = curTime;
- diff.append(" after " + timeDiff + "ms");
- System.out.println(diff);
- }
-
- last = cur;
- Thread.sleep(SLEEP_TIME);
- }
- }
-
- private static StringBuffer diff(ProcMem last, ProcMem cur) {
- StringBuffer buf = new StringBuffer();
-
- long diff;
-
- diff = cur.getSize() - last.getSize();
- if (diff != 0) {
- buf.append("size=" + diff);
- }
-
- diff = cur.getResident() - last.getResident();
- if (diff != 0) {
- buf.append(", resident=" + diff);
- }
-
- diff = cur.getShare() - last.getShare();
- if (diff != 0) {
- buf.append(", share=" + diff);
- }
-
- return buf;
- }
-}
-
-
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MultiPs.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MultiPs.java
deleted file mode 100644
index 49777f14ec2d165477c26b3898c8393ba4b6e606..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/MultiPs.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import org.hyperic.sigar.CpuPerc;
-import org.hyperic.sigar.MultiProcCpu;
-import org.hyperic.sigar.ProcMem;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-
-/**
- * Show multi process status.
- */
-public class MultiPs extends SigarCommandBase {
-
- public MultiPs(Shell shell) {
- super(shell);
- }
-
- public MultiPs() {
- super();
- }
-
- protected boolean validateArgs(String[] args) {
- return args.length == 1;
- }
-
- public String getSyntaxArgs() {
- return "query";
- }
-
- public String getUsageShort() {
- return "Show multi process status";
- }
-
- public boolean isPidCompleter() {
- return true;
- }
-
- public void output(String[] args) throws SigarException {
- String query = args[0];
- MultiProcCpu cpu = this.proxy.getMultiProcCpu(query);
- println("Number of processes: " + cpu.getProcesses());
- println("Cpu usage: " + CpuPerc.format(cpu.getPercent()));
- println("Cpu time: " + Ps.getCpuTime(cpu.getTotal()));
-
- ProcMem mem = this.proxy.getMultiProcMem(query);
- println("Size: " + Sigar.formatSize(mem.getSize()));
- println("Resident: " + Sigar.formatSize(mem.getResident()));
- println("Share: " + Sigar.formatSize(mem.getShare()));
- }
-
- public static void main(String[] args) throws Exception {
- new MultiPs().processCommand(args);
- }
-}
-
-
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/NetInfo.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/NetInfo.java
deleted file mode 100644
index febcc187c04a8ba720b0daf5505b612c1e209f4e..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/NetInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import org.hyperic.sigar.NetInterfaceConfig;
-import org.hyperic.sigar.SigarException;
-
-/**
- * Display network info.
- */
-public class NetInfo extends SigarCommandBase {
-
- public NetInfo(Shell shell) {
- super(shell);
- }
-
- public NetInfo() {
- super();
- }
-
- public String getUsageShort() {
- return "Display network info";
- }
-
- public void output(String[] args) throws SigarException {
- NetInterfaceConfig config = this.sigar.getNetInterfaceConfig(null);
- println("primary interface....." +
- config.getName());
-
- println("primary ip address...." +
- config.getAddress());
-
- println("primary mac address..." +
- config.getHwaddr());
-
- println("primary netmask......." +
- config.getNetmask());
-
- org.hyperic.sigar.NetInfo info =
- this.sigar.getNetInfo();
-
- println("host name............." +
- info.getHostName());
-
- println("domain name..........." +
- info.getDomainName());
-
- println("default gateway......." +
- info.getDefaultGateway());
-
- println("primary dns..........." +
- info.getPrimaryDns());
-
- println("secondary dns........." +
- info.getSecondaryDns());
- }
-
- public static void main(String[] args) throws Exception {
- new NetInfo().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Netstat.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Netstat.java
deleted file mode 100644
index fcb8bfdea65e924bc920035c2e825983dc0dd7fc..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Netstat.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-
-import org.hyperic.sigar.NetConnection;
-import org.hyperic.sigar.NetFlags;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.Tcp;
-
-/**
- * Display network connections.
- */
-public class Netstat extends SigarCommandBase {
-
- private static final int LADDR_LEN = 20;
- private static final int RADDR_LEN = 35;
-
- private static final String[] HEADER = new String[] {
- "Proto",
- "Local Address",
- "Foreign Address",
- "State",
- ""
- };
-
- private static boolean isNumeric, wantPid, isStat;
-
- public Netstat(Shell shell) {
- super(shell);
- }
-
- public Netstat() {
- super();
- }
-
- protected boolean validateArgs(String[] args) {
- return true;
- }
-
- public String getUsageShort() {
- return "Display network connections";
- }
-
- //poor mans getopt.
- public static int getFlags(String[] args, int flags) {
- int proto_flags = 0;
- isNumeric = false;
- wantPid = false;
- isStat = false;
-
- for (int i=0; i max) {
- address = address.substring(0, max);
- }
-
- return address + ":" + port;
- }
-
- private void outputTcpStats() throws SigarException {
- Tcp stat = this.sigar.getTcp();
- final String dnt = " ";
- println(dnt + stat.getActiveOpens() + " active connections openings");
- println(dnt + stat.getPassiveOpens() + " passive connection openings");
- println(dnt + stat.getAttemptFails() + " failed connection attempts");
- println(dnt + stat.getEstabResets() + " connection resets received");
- println(dnt + stat.getCurrEstab() + " connections established");
- println(dnt + stat.getInSegs() + " segments received");
- println(dnt + stat.getOutSegs() + " segments send out");
- println(dnt + stat.getRetransSegs() + " segments retransmited");
- println(dnt + stat.getInErrs() + " bad segments received.");
- println(dnt + stat.getOutRsts() + " resets sent");
- }
-
- private void outputStats(int flags) throws SigarException {
- if ((flags & NetFlags.CONN_TCP) != 0) {
- println("Tcp:");
- try {
- outputTcpStats();
- } catch (SigarException e) {
- println(" " + e);
- }
- }
- }
-
- //XXX currently weak sauce. should end up like netstat command.
- public void output(String[] args) throws SigarException {
- //default
- int flags = NetFlags.CONN_CLIENT | NetFlags.CONN_PROTOCOLS;
-
- if (args.length > 0) {
- flags = getFlags(args, flags);
- if (isStat) {
- outputStats(flags);
- return;
- }
- }
-
- NetConnection[] connections = this.sigar.getNetConnectionList(flags);
- printf(HEADER);
-
- for (int i=0; i 0;
- }
-
- public String getSyntaxArgs() {
- return "query";
- }
-
- public String getUsageShort() {
- return "Find the process ID of a running program";
- }
-
- public void output(String[] args) throws SigarException {
- long[] pids = this.shell.findPids(args);
-
- for (int i=0; i 0) {
- pids = ProcessFinder.find(sigar, args[0]);
- }
- else if (args[0].equals("$$")) {
- pids = new long[] { sigar.getPid() };
- }
- else {
- pids = new long[] {
- Long.parseLong(args[0])
- };
- }
- break;
- default:
- pids = new long[args.length];
- for (int i=0; i" + argv[i] + "<=");
- }
- }
-
- public static void main(String[] args) throws Exception {
- new ShowArgs().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/ShowEnv.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/ShowEnv.java
deleted file mode 100644
index 65882b558492534ded7b989d1ea3ab47ba360a6f..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/ShowEnv.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.hyperic.sigar.SigarException;
-
-/**
- * Show process environment.
- */
-public class ShowEnv extends SigarCommandBase {
-
- public ShowEnv(Shell shell) {
- super(shell);
- }
-
- public ShowEnv() {
- super();
- }
-
- protected boolean validateArgs(String[] args) {
- return true;
- }
-
- public String getUsageShort() {
- return "Show process environment";
- }
-
- public boolean isPidCompleter() {
- return true;
- }
-
- public void output(String[] args) throws SigarException {
- long[] pids = this.shell.findPids(args);
-
- for (int i=0; i max[i]) {
- max[i] = len;
- }
- }
- }
-
- StringBuffer format = new StringBuffer();
- for (int i=0; i= 1) &&
- Character.isDigit(line.charAt(0)))
- {
- return line;
- }
-
- return this.ptqlCompleter.complete(line);
- }
-
- public String complete(String line) {
- if (isPidCompleter()) {
- return completePid(line);
- }
- GetlineCompleter c = getCompleter();
- if (c != null) {
- return c.complete(line);
- }
-
- this.completer.setCollection(getCompletions());
- return this.completer.complete(line);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/SysInfo.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/SysInfo.java
deleted file mode 100644
index 862127ea1e29f91b5321add16e5eaaaf9992a323..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/SysInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2006 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.util.Arrays;
-
-import org.hyperic.sigar.SigarException;
-
-/**
- * Display System Information
- */
-public class SysInfo extends SigarCommandBase {
-
- public SysInfo(Shell shell) {
- super(shell);
- }
-
- public SysInfo() {
- super();
- }
-
- public String getUsageShort() {
- return "Display system information";
- }
-
- public void output(String[] args) throws SigarException {
- //sigar/os info
- Version.printInfo(this.out);
- println("");
-
- //uptime
- new Uptime(this.shell).output(args);
- println("");
-
- //cpu info
- CpuInfo cpuinfo = new CpuInfo(this.shell);
- cpuinfo.displayTimes = false;
- cpuinfo.output(args);
- println("");
-
- //memory info
- new Free(this.shell).output(args);
- println("");
-
- println("File Systems........." +
- Arrays.asList(this.sigar.getFileSystemList()));
- println("");
-
- println("Network Interfaces..." +
- Arrays.asList(this.sigar.getNetInterfaceList()));
- println("");
-
- //system resource limits
- println("System resource limits:");
- new Ulimit(this.shell).output(args);
- }
-
- public static void main(String[] args) throws Exception {
- new SysInfo().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Tail.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Tail.java
deleted file mode 100644
index 2099fc9fbd9cfa24d8d5545368ea4b199f29f451..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Tail.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hyperic.sigar.FileInfo;
-import org.hyperic.sigar.FileTail;
-import org.hyperic.sigar.FileWatcherThread;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-
-/**
- * Display the last part of files to the standard output.
- */
-public class Tail {
-
- public boolean follow;
- public int number = 10;
- public List files = new ArrayList();
-
- public void parseArgs(String args[]) throws SigarException {
- for (int i=0; i 1) {
- System.out.println("==> " +
- info.getName() +
- " <==");
- }
-
- try {
- while ((line = buffer.readLine()) != null) {
- System.out.println(line);
- }
- } catch (IOException e) {
- System.out.println(e);
- }
- }
- };
-
- for (int i=0; i= 1;
- }
-
- public String getSyntaxArgs() {
- return "[command] [...]";
- }
-
- public String getUsageShort() {
- return "Time command";
- }
-
- public void output(String[] args) throws SigarException {
- boolean isInteractive = this.shell.isInteractive();
- //turn off paging.
- this.shell.setInteractive(false);
- CpuTimer cpu = new CpuTimer(this.sigar);
-
- int num;
-
- if (Character.isDigit(args[0].charAt(0))) {
- num = Integer.parseInt(args[0]);
- String[] xargs = new String[args.length-1];
- System.arraycopy(args, 1, xargs, 0, xargs.length);
- args = xargs;
- }
- else {
- num = 1;
- }
-
- cpu.start();
-
- try {
- for (int i=0; i
- * This version of the top command requires a ptql query to select which
- * processes to display.
- *
- * Example to display java processes only:
- * % java -jar sigar-bin/lib/sigar.jar Top State.Name.eq=java
- */
-
-public class Top {
- private static final int SLEEP_TIME = 1000 * 5;
-
- private static final String HEADER =
- "PID\tUSER\tSTIME\tSIZE\tRSS\tSHARE\tSTATE\tTIME\t%CPU\tCOMMAND";
-
- private static String toString(ProcStat stat) {
- return
- stat.getTotal() + " processes: " +
- stat.getSleeping() + " sleeping, " +
- stat.getRunning() + " running, " +
- stat.getZombie() + " zombie, " +
- stat.getStopped() + " stopped... " + stat.getThreads() + " threads";
- }
-
- public static void main(String[] args) throws Exception {
- Sigar sigarImpl = new Sigar();
-
- SigarProxy sigar =
- SigarProxyCache.newInstance(sigarImpl, SLEEP_TIME);
-
- while (true) {
- Shell.clearScreen();
-
- System.out.println(Uptime.getInfo(sigar));
-
- System.out.println(toString(sigar.getProcStat()));
-
- System.out.println(sigar.getCpuPerc());
-
- System.out.println(sigar.getMem());
-
- System.out.println(sigar.getSwap());
-
- System.out.println();
-
- System.out.println(HEADER);
-
- long[] pids = Shell.getPids(sigar, args);
-
- for (int i=0; i 1) ? "days" : "day") + ", ";
- }
-
- minutes = (int)uptime / 60;
- hours = minutes / 60;
- hours %= 24;
- minutes %= 60;
-
- if (hours != 0) {
- retval += hours + ":" + minutes;
- }
- else {
- retval += minutes + " min";
- }
-
- return retval;
- }
-
- private static String getCurrentTime() {
- return new SimpleDateFormat("h:mm a").format(new Date());
- }
-
- //pretty close to uptime command, but we don't output number of users yet
- public static void main(String[] args) throws Exception {
- new Uptime().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Version.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Version.java
deleted file mode 100644
index c2b9740a0887024f3abac9c5e4b5785614ab650c..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Version.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2006-2009 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.hyperic.sigar.OperatingSystem;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-import org.hyperic.sigar.SigarLoader;
-import org.hyperic.sigar.win32.LocaleInfo;
-
-/**
- * Display Sigar, java and system version information.
- */
-public class Version extends SigarCommandBase {
-
- public Version(Shell shell) {
- super(shell);
- }
-
- public Version() {
- super();
- }
-
- public String getUsageShort() {
- return "Display sigar and system version info";
- }
-
- private static String getHostName() {
- try {
- return InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- return "unknown";
- }
- }
-
- private static void printNativeInfo(PrintStream os) {
- String version =
- "java=" + Sigar.VERSION_STRING +
- ", native=" + Sigar.NATIVE_VERSION_STRING;
- String build =
- "java=" + Sigar.BUILD_DATE +
- ", native=" + Sigar.NATIVE_BUILD_DATE;
- String scm =
- "java=" + Sigar.SCM_REVISION +
- ", native=" + Sigar.NATIVE_SCM_REVISION;
- String archlib =
- SigarLoader.getNativeLibraryName();
-
- os.println("Sigar version......." + version);
- os.println("Build date.........." + build);
- os.println("SCM rev............." + scm);
- String host = getHostName();
- String fqdn;
- Sigar sigar = new Sigar();
- try {
- File lib = sigar.getNativeLibrary();
- if (lib != null) {
- archlib = lib.getName();
- }
- fqdn = sigar.getFQDN();
- } catch (SigarException e) {
- fqdn = "unknown";
- } finally {
- sigar.close();
- }
-
- os.println("Archlib............." + archlib);
-
- os.println("Current fqdn........" + fqdn);
- if (!fqdn.equals(host)) {
- os.println("Hostname............" + host);
- }
-
- if (SigarLoader.IS_WIN32) {
- LocaleInfo info = new LocaleInfo();
- os.println("Language............" + info);
- os.println("Perflib lang id....." +
- info.getPerflibLangId());
- }
- }
-
- public static void printInfo(PrintStream os) {
- try {
- printNativeInfo(os);
- } catch (UnsatisfiedLinkError e) {
- os.println("*******ERROR******* " + e);
- }
-
- os.println("Current user........" +
- System.getProperty("user.name"));
- os.println("");
-
- OperatingSystem sys = OperatingSystem.getInstance();
- os.println("OS description......" + sys.getDescription());
- os.println("OS name............." + sys.getName());
- os.println("OS arch............." + sys.getArch());
- os.println("OS machine.........." + sys.getMachine());
- os.println("OS version.........." + sys.getVersion());
- os.println("OS patch level......" + sys.getPatchLevel());
- os.println("OS vendor..........." + sys.getVendor());
- os.println("OS vendor version..." + sys.getVendorVersion());
- if (sys.getVendorCodeName() != null) {
- os.println("OS code name........" + sys.getVendorCodeName());
- }
- os.println("OS data model......." + sys.getDataModel());
- os.println("OS cpu endian......." + sys.getCpuEndian());
-
- os.println("Java vm version....." +
- System.getProperty("java.vm.version"));
- os.println("Java vm vendor......" +
- System.getProperty("java.vm.vendor"));
- os.println("Java home..........." +
- System.getProperty("java.home"));
- }
-
- public void output(String[] args) {
- printInfo(this.out);
- }
-
- public static void main(String[] args) throws Exception {
- new Version().processCommand(args);
- }
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Watch.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Watch.java
deleted file mode 100644
index 320c80f3349652863ab3d53482e891956f715a6a..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/examples/Watch.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Hyperic, Inc.
- *
- * 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 com.x.program.center.test.examples;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.IOException;
-import java.util.Date;
-
-import org.hyperic.sigar.DirStat;
-import org.hyperic.sigar.FileInfo;
-import org.hyperic.sigar.FileWatcher;
-import org.hyperic.sigar.FileWatcherThread;
-import org.hyperic.sigar.ProcFileMirror;
-import org.hyperic.sigar.Sigar;
-import org.hyperic.sigar.SigarException;
-
-/**
- * Watch a file or directory displaying attribute changes.
- */
-public class Watch {
-
- private static void printHeader(Sigar sigar, FileInfo info)
- throws SigarException {
-
- String file = info.getName();
- FileInfo link = sigar.getLinkInfo(file);
-
- if (link.getType() == FileInfo.TYPE_LNK) {
- try {
- System.out.println(file + " -> " +
- new File(file).getCanonicalPath());
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- System.out.println(link.getTypeChar() +
- info.getPermissionsString() + "\t" +
- info.getUid() + "\t" + info.getGid() + "\t" +
- info.getSize() + "\t" +
- new Date(info.getMtime()) + "\t" +
- file);
-
- if (info.getType() == FileInfo.TYPE_DIR) {
- info.enableDirStat(true);
-
- DirStat stats = sigar.getDirStat(file);
- System.out.println(" Files......." + stats.getFiles());
- System.out.println(" Subdirs....." + stats.getSubdirs());
- System.out.println(" Symlinks...." + stats.getSymlinks());
- System.out.println(" Chrdevs....." + stats.getChrdevs());
- System.out.println(" Blkdevs....." + stats.getBlkdevs());
- System.out.println(" Sockets....." + stats.getSockets());
- System.out.println(" Total......." + stats.getTotal());
- System.out.println(" Disk Usage.." + stats.getDiskUsage());
- }
- }
-
- private static void add(Sigar sigar,
- FileWatcher watcher,
- String file,
- boolean recurse)
- throws SigarException {
-
- FileInfo info = watcher.add(file);
- printHeader(sigar, info);
-
- if (!recurse) {
- return;
- }
-
- if (info.getType() == FileInfo.TYPE_DIR) {
- File[] dirs =
- new File(info.getName()).listFiles(new FileFilter() {
- public boolean accept(File file) {
- return file.isDirectory() && file.canRead();
- }
- });
-
- for (int i=0; i 请注册账号后,向管理员申请权限, :-)
- json.addProperty("password", "1234abcd");// 固定测试参数
- json.addProperty("biz_type", "show");// 固定参数
- json.addProperty("mode", "advanced");// 固定参数
- // json.put("is_return_sentence",true);// 是否返回句子 , 具体说明,可以参考文档。
- json.addProperty("user_channel", "api.cuobiezi.net"); // 固定参数
- // json.put("check_sensitive_word",true); // 敏感词检测
- List heads = new ArrayList<>();
- heads.add(new NameValuePair("", ""));
- System.out.println(json.toString());
- String str = null;
- try {
- str = HttpConnection.postAsString(url, null, json.toString());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- System.out.println(str);
-
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/nlp/package-info.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/nlp/package-info.java
deleted file mode 100644
index 56ac729aa92fb718c94d380f4a1537ff5c2584b9..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/nlp/package-info.java
+++ /dev/null
@@ -1,8 +0,0 @@
-/**
- *
- */
-/**
- * @author zhour
- *
- */
-package com.x.program.center.test.nlp;
\ No newline at end of file
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/HelloJob.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/HelloJob.java
deleted file mode 100644
index 50f4f71db6459fa83fab5d204bf22923c37d09c2..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/HelloJob.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.x.program.center.test.quartz;
-
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
-
-public class HelloJob implements Job {
-
-
- public void execute(JobExecutionContext arg0) throws JobExecutionException {
- // TODO Auto-generated method stub
- System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- }
-
-}
diff --git a/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/TestClient.java b/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/TestClient.java
deleted file mode 100644
index 5015c5f52a5df6cbc1598f345817c5ec45e5040d..0000000000000000000000000000000000000000
--- a/o2server/x_program_center/src/test/java/com/x/program/center/test/quartz/TestClient.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.x.program.center.test.quartz;
-
-import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
-import static org.quartz.TriggerBuilder.newTrigger;
-
-import org.junit.Test;
-import org.quartz.JobBuilder;
-import org.quartz.JobDetail;
-import org.quartz.Scheduler;
-import org.quartz.SchedulerFactory;
-import org.quartz.Trigger;
-
-public class TestClient {
-
- @Test
- public void test() throws Exception {
- SchedulerFactory schedFact = new org.quartz.impl.StdSchedulerFactory();
-
- Scheduler sched = schedFact.getScheduler();
- // sched.getListenerManager().addJobListener(arg0);
- sched.start();
- // define the job and tie it to our
- JobDetail job = JobBuilder.newJob(HelloJob.class).withIdentity("myJob", "group1").build();
- // Trigger the job to run now, andthen every 40 seconds
- Trigger trigger = newTrigger().withIdentity("myTrigger", "group2").startNow()
- .withSchedule(simpleSchedule().withIntervalInSeconds(1).repeatForever()).build();
- // Tell quartz to schedule the job using our trigger
- sched.scheduleJob(job, trigger);
- Thread.sleep(2000);
- }
-}
diff --git a/o2web/source/o2_core/compatible.js b/o2web/source/o2_core/compatible.js
index c87caa2debc5ffe8ec252ad6eaf8059e6f78d1c3..9ce47bd228d74f3f8e998a9e60a8c3e2b66be201 100644
--- a/o2web/source/o2_core/compatible.js
+++ b/o2web/source/o2_core/compatible.js
@@ -3,7 +3,7 @@ o2.addReady(function(){
"setContentPath": function(path){
COMMON.contentPath = path;
},
- "JSON": o2.JSON,
+ "JSON": o2.json,
"Browser": Browser,
"Class": o2.Class,
"XML": o2.xml,
@@ -25,4 +25,4 @@ o2.addReady(function(){
MWF.getJSON = o2.JSON.get;
MWF.getJSONP = o2.JSON.getJsonp;
MWF.defaultPath = o2.session.path;
-});
\ No newline at end of file
+});