Skip to content

Commit d1f6085

Browse files
committed
s
1 parent 3c80858 commit d1f6085

File tree

562 files changed

+45842
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

562 files changed

+45842
-0
lines changed

tool/.metadata/.lock

Whitespace-only changes.

tool/.metadata/.log

+231
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package com.log.template;
2+
3+
import org.apache.log4j.Logger;
4+
5+
import com.log.annotation.Column;
6+
import com.log.annotation.Template;
7+
8+
@Template(necessaryFields = "accountId,account,createServerId")
9+
public abstract class PlayerLogTemplate extends BaseLog {
10+
Logger logger = Logger.getLogger(PlayerLogTemplate.class);
11+
public String roleId;
12+
public String roleName;
13+
public String accountId;
14+
public String account;
15+
public Integer createServerId;
16+
public Integer currentServerId;
17+
public Integer level;
18+
public String actionId;
19+
20+
@Column(fieldType = "varchar(50)", remark = "角色ID")
21+
public String getRoleId() {
22+
return this.roleId;
23+
}
24+
25+
@Column(fieldType = "varchar(50)", remark = "角色名")
26+
public String getRoleName() {
27+
return this.roleName;
28+
}
29+
30+
@Column(fieldType = "varchar(50)", remark = "账号ID")
31+
public String getAccountId() {
32+
return this.accountId;
33+
}
34+
35+
@Column(fieldType = "varchar(50)", remark = "账号名")
36+
public String getAccount() {
37+
return this.account;
38+
}
39+
40+
@Column(fieldType = "int", remark = "创建服ID")
41+
public Integer getCreateServerId() {
42+
return this.createServerId;
43+
}
44+
45+
@Column(fieldType = "int", remark = "当前服ID")
46+
public Integer getCurrentServerId() {
47+
return this.currentServerId;
48+
}
49+
50+
@Column(fieldType = "int", remark = "等级")
51+
public Integer getLevel() {
52+
return this.level;
53+
}
54+
55+
@Column(fieldType = "varchar(50)", remark = "玩家行为唯一ID")
56+
public String getActionId() {
57+
return this.actionId;
58+
}
59+
60+
public void setRoleId(String roleId) {
61+
this.roleId = roleId;
62+
}
63+
64+
public void setRoleName(String roleName) {
65+
this.roleName = roleName;
66+
}
67+
68+
public void setAccountId(String accountId) {
69+
this.accountId = accountId;
70+
}
71+
72+
public void setAccount(String account) {
73+
this.account = account;
74+
}
75+
76+
public void setCreateServerId(Integer createServerId) {
77+
this.createServerId = createServerId;
78+
}
79+
80+
public void setCurrentServerId(Integer currentServerId) {
81+
this.currentServerId = currentServerId;
82+
}
83+
84+
public void setLevel(Integer level) {
85+
this.level = level;
86+
}
87+
88+
public void setActionId(String actionId) {
89+
this.actionId = actionId;
90+
}
91+
92+
public void fullByPlayer(IPlayerTemplate player, String actionId) {
93+
setAccount(player.getAccount4Log());
94+
setAccountId(player.getAccountId4Log());
95+
setRoleId(player.getRoleId4Log());
96+
setRoleName(player.getRoleName4Log());
97+
setCreateServerId(player.getCreateServerId4Log());
98+
setCurrentServerId(player.getCurrentServerId4Log());
99+
setLevel(player.getLevel4Log());
100+
setActionId(actionId);
101+
}
102+
103+
public void logToFile() {
104+
this.logger.error("");
105+
}
106+
}
107+
108+
/*
109+
* Location: C:\Users\ye.yuan\Desktop\common-gamelog2-2.0.5-SNAPSHOT.jar
110+
* Qualified Name: com.moloong.game.log.template.v2.PlayerLogTemplate JD-Core
111+
* Version: 0.6.2
112+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
package com.log.util;
2+
3+
import java.io.File;
4+
import java.io.FileFilter;
5+
import java.io.IOException;
6+
import java.net.JarURLConnection;
7+
import java.net.URL;
8+
import java.net.URLDecoder;
9+
import java.util.Enumeration;
10+
import java.util.LinkedHashSet;
11+
import java.util.Set;
12+
import java.util.jar.JarEntry;
13+
import java.util.jar.JarFile;
14+
import org.apache.log4j.Logger;
15+
16+
/**
17+
* 类加载器
18+
*
19+
* @author ye.yuan
20+
* @date 2014/10/12 10:22:38
21+
*/
22+
public class ClassUtil {
23+
private static final Logger logger = Logger.getLogger(ClassUtil.class);
24+
25+
public static <T> Set<Class<T>> getSubClasses(String packageName,
26+
Class<T> parentClass) {
27+
Set<Class<T>> classes = new LinkedHashSet<>();
28+
29+
boolean recursive = true;
30+
31+
String packageDirName = packageName.replace('.', '/');
32+
try {
33+
Enumeration<URL> dirs = Thread.currentThread().getContextClassLoader()
34+
.getResources(packageDirName);
35+
36+
while (dirs.hasMoreElements()) {
37+
URL url = (URL) dirs.nextElement();
38+
39+
String protocol = url.getProtocol();
40+
41+
if ("file".equals(protocol)) {
42+
String filePath = URLDecoder.decode(url.getFile(), "UTF-8");
43+
44+
findAndAddClassesInPackageByFile(packageName, filePath,
45+
recursive, classes, parentClass);
46+
} else if ("jar".equals(protocol)) {
47+
try {
48+
JarFile jar = ((JarURLConnection) url.openConnection())
49+
.getJarFile();
50+
51+
Enumeration<JarEntry> entries = jar.entries();
52+
53+
while (entries.hasMoreElements()) {
54+
JarEntry entry = (JarEntry) entries.nextElement();
55+
String name = entry.getName();
56+
57+
if (name.charAt(0) == '/') {
58+
name = name.substring(1);
59+
}
60+
String packageNameNew = packageName;
61+
62+
if (name.startsWith(packageDirName)) {
63+
int idx = name.lastIndexOf('/');
64+
65+
if (idx != -1) {
66+
packageNameNew = name.substring(0, idx)
67+
.replace('/', '.');
68+
}
69+
70+
if ((idx != -1) || (recursive)) {
71+
if ((name.endsWith(".class"))
72+
&& (!entry.isDirectory())) {
73+
String className = name.substring(
74+
packageNameNew.length() + 1,
75+
name.length() - 6);
76+
try {
77+
Class loadClass = Thread
78+
.currentThread()
79+
.getContextClassLoader()
80+
.loadClass(
81+
packageNameNew
82+
+ '.'
83+
+ className);
84+
if ((parentClass
85+
.isAssignableFrom(loadClass))
86+
&& (!parentClass
87+
.equals(loadClass))) {
88+
Class result = loadClass;
89+
classes.add(result);
90+
}
91+
} catch (ClassNotFoundException e) {
92+
logger.error("添加用户自定义视图类错误 找不到此类的.class文件");
93+
e.printStackTrace();
94+
}
95+
}
96+
}
97+
}
98+
}
99+
} catch (IOException e) {
100+
logger.error("鍦ㄦ壂鎻忕敤鎴峰畾涔夎鍥炬椂浠巎ar鍖呰幏鍙栨枃浠跺嚭閿�");
101+
e.printStackTrace();
102+
}
103+
}
104+
}
105+
} catch (IOException e) {
106+
e.printStackTrace();
107+
}
108+
109+
return classes;
110+
}
111+
112+
public static <T> void findAndAddClassesInPackageByFile(String packageName,
113+
String packagePath, boolean recursive, Set<Class<T>> classes,
114+
Class<T> parentClass) {
115+
File dir = new File(packagePath);
116+
117+
if ((!dir.exists()) || (!dir.isDirectory())) {
118+
return;
119+
}
120+
121+
File[] dirfiles = dir.listFiles(new FileFilter() {
122+
public boolean accept(File file) {
123+
return ((this.val$recursive) && (file.isDirectory()))
124+
|| (file.getName().endsWith(".class"));
125+
}
126+
});
127+
for (File file : dirfiles) {
128+
if (file.isDirectory()) {
129+
findAndAddClassesInPackageByFile(
130+
packageName + "." + file.getName(),
131+
file.getAbsolutePath(), recursive, classes, parentClass);
132+
} else {
133+
String className = file.getName().substring(0,
134+
file.getName().length() - 6);
135+
try {
136+
Class loadClass = Thread.currentThread()
137+
.getContextClassLoader()
138+
.loadClass(packageName + '.' + className);
139+
if ((parentClass.isAssignableFrom(loadClass))
140+
&& (!parentClass.equals(loadClass))) {
141+
Class result = loadClass;
142+
classes.add(result);
143+
}
144+
} catch (ClassNotFoundException e) {
145+
e.printStackTrace();
146+
}
147+
}
148+
}
149+
}
150+
151+
public static void main(String[] args) {
152+
getSubClasses("com.mchange", Object.class);
153+
}
154+
155+
}
156+
157+
/*
158+
* Location: C:\Users\ye.yuan\Desktop\common-gamelog2-2.0.5-SNAPSHOT.jar
159+
* Qualified Name: com.moloong.game.log.util.ClassUtil JD-Core Version: 0.6.2
160+
*/

0 commit comments

Comments
 (0)