更新部分代码

master
星期八 6 years ago
parent 1e56db8fe6
commit 2804447ced
  1. 2
      panda-aop/src/main/java/org/panda/aop/proxy/ProxyChain.java
  2. 11
      panda-aop/src/test/java/org/panda/aop/service/HelloService.java
  3. 4
      panda-aop/src/test/java/org/panda/aop/util/InterfaceProxyFactoryUtilTest.java
  4. 2
      panda-beans/src/main/java/org/panda/beans/adapter/BeanAdapter.java
  5. 14
      panda-beans/src/main/java/org/panda/beans/util/BeanUtil.java
  6. 2
      panda-code/src/main/java/org/panda/code/uitl/file/FileUtil.java
  7. 1
      panda-code/src/main/java/org/panda/code/uitl/os/JvmUtil.java
  8. 13
      panda-code/src/main/java/org/panda/code/uitl/os/mode/JvmInfo.java
  9. 13
      panda-code/src/main/java/org/panda/code/uitl/os/mode/OsInfo.java
  10. 1
      panda-jdbc/src/main/java/org/panda/jdbc/proxy/TransactionProxy.java
  11. 8
      panda-web/panda-web.iml
  12. 4
      panda-web/src/main/java/org/panda/web/helper/AopHelper.java
  13. 1
      panda-web/src/main/java/org/panda/web/servlet/DispatcherServlet.java

@ -35,7 +35,7 @@ public class ProxyChain {
/** /**
*代理集合 *代理集合
*/ */
private List<Proxy> proxyList = new ArrayList(); private List<Proxy> proxyList ;
/** /**
* 代理索引 * 代理索引
*/ */

@ -0,0 +1,11 @@
package org.panda.aop.service;
/**
* @Author: qi
* @Description:
* @Date: Create in 4:24 PM 2019/5/20
*/
public interface HelloService {
String sayHello(String name);
}

@ -1,5 +1,7 @@
package org.panda.aop.util; package org.panda.aop.util;
import org.panda.aop.service.HelloService;
import static org.junit.Assert.*; import static org.junit.Assert.*;
public class InterfaceProxyFactoryUtilTest { public class InterfaceProxyFactoryUtilTest {
@ -10,5 +12,7 @@ public class InterfaceProxyFactoryUtilTest {
@org.junit.Test @org.junit.Test
public void invoke() { public void invoke() {
HelloService helloService = InterfaceProxyFactoryUtil.newMapperProxy(HelloService.class);
helloService.sayHello("nihoa");
} }
} }

@ -2,7 +2,7 @@ package org.panda.beans.adapter;
/** /**
* @Author: qi * @Author: qi
* @Description: * @Description: 实体类适配器
* @Date: Create in 9:29 AM 2019/2/23 * @Date: Create in 9:29 AM 2019/2/23
*/ */
public interface BeanAdapter { public interface BeanAdapter {

@ -14,6 +14,7 @@ import java.util.*;
/** /**
* @author qi * @author qi
* 实体类工具
* Created by qi_liang on 2018/1/29. * Created by qi_liang on 2018/1/29.
*/ */
public class BeanUtil { public class BeanUtil {
@ -207,17 +208,4 @@ public class BeanUtil {
return fieldObjectMap; return fieldObjectMap;
} }
/**
* 判断对象是否为空 ,为空返回true
* @param object
* @return
*/
public boolean isNull(Object object){
return object==null;
}
} }

@ -12,7 +12,7 @@ import java.util.List;
/** /**
* @author qi * @author qi
* * 文件工具类
*/ */
public class FileUtil { public class FileUtil {

@ -8,6 +8,7 @@ import java.util.Set;
/** /**
* @author qi * @author qi
* JVM工具类
* Created by qi_liang on 2018/6/9. * Created by qi_liang on 2018/6/9.
*/ */
public class JvmUtil { public class JvmUtil {

@ -2,14 +2,21 @@ package org.panda.code.uitl.os.mode;
/** /**
* @author qi * @author qi
* JVM实体详情实体类
* Created by qi_liang on 2018/6/10. * Created by qi_liang on 2018/6/10.
*/ */
public class JvmInfo { public class JvmInfo {
//版本号 /**
* 版本号
*/
private String version; private String version;
//总内存 /**
* 总内存
*/
private Long totalMemory; private Long totalMemory;
//可以使用处理器个数 /**
* 处理器个数
*/
private Integer cupNum; private Integer cupNum;
public String getVersion() { public String getVersion() {

@ -2,15 +2,22 @@ package org.panda.code.uitl.os.mode;
/** /**
* @author qi * @author qi
* 系统详情实体类
* Created by qi_liang on 2018/6/10. * Created by qi_liang on 2018/6/10.
*/ */
public class OsInfo { public class OsInfo {
//操作系统名称 /**
* 操作系统名称
*/
private String osName; private String osName;
//操作系统版本号 /**
* 操作系统版本号
*/
private String osVersion; private String osVersion;
//操作系统架构 /**
* 操作系统架构
*/
private String arch; private String arch;
public String getOsName() { public String getOsName() {

@ -39,6 +39,7 @@ public class TransactionProxy implements Proxy {
DataBaseHelper.commitTransaction(); DataBaseHelper.commitTransaction();
LOGGER.debug("commit transaction"); LOGGER.debug("commit transaction");
}catch (Exception e){ }catch (Exception e){
//事务回滚
DataBaseHelper.rollbackTransation(); DataBaseHelper.rollbackTransation();
LOGGER.debug("rollback transaction"); LOGGER.debug("rollback transaction");
throw e; throw e;

@ -17,12 +17,17 @@
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.6" level="project" /> <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.6" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:1.3.2" level="project" /> <orderEntry type="library" name="Maven: commons-io:commons-io:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.4" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.40" level="project" />
<orderEntry type="module" module-name="panda-beans" /> <orderEntry type="module" module-name="panda-beans" />
<orderEntry type="module" module-name="panda-aop" /> <orderEntry type="module" module-name="panda-aop" />
<orderEntry type="module" module-name="panda-jdbc" /> <orderEntry type="module" module-name="panda-jdbc" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-dbcp2:2.5.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-dbcp2:2.5.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.0" level="project" /> <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.0" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-dbutils:commons-dbutils:1.7" level="project" /> <orderEntry type="library" name="Maven: commons-dbutils:commons-dbutils:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet.jsp:jsp-api:2.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet.jsp:jsp-api:2.2" level="project" />
@ -39,5 +44,6 @@
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.30" level="project" /> <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.30" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.github.jsonzou:jmockdata:3.0.1" level="project" />
</component> </component>
</module> </module>

@ -116,6 +116,10 @@ public final class AopHelper {
}); });
} }
/**
* 加入事务代理
* @param proxyMap
*/
private static void addTransactionProxy(Map<Class, Set<Class>> proxyMap) { private static void addTransactionProxy(Map<Class, Set<Class>> proxyMap) {
Set<Class> serviceClassSet = ClassHelper.getClassSetByAnnotation(Service.class); Set<Class> serviceClassSet = ClassHelper.getClassSetByAnnotation(Service.class);
proxyMap.put(TransactionProxy.class, serviceClassSet); proxyMap.put(TransactionProxy.class, serviceClassSet);

@ -60,7 +60,6 @@ public class DispatcherServlet extends HttpServlet{
@Override @Override
protected void service(HttpServletRequest req, HttpServletResponse resp){ protected void service(HttpServletRequest req, HttpServletResponse resp){
// super.service(req, resp);
ServletHelper.init(req,resp); ServletHelper.init(req,resp);
try { try {
//获取请求的方法类型:(Post,Get...) //获取请求的方法类型:(Post,Get...)

Loading…
Cancel
Save