[Comsuite-svn] SF.net SVN: comsuite: [130] trunk/code
Brought to you by:
zduniak
|
From: <ma...@us...> - 2006-09-10 11:07:48
|
Revision: 130
http://svn.sourceforge.net/comsuite/?rev=130&view=rev
Author: marasm
Date: 2006-09-10 04:07:11 -0700 (Sun, 10 Sep 2006)
Log Message:
-----------
SpringAOP added to project
Modified Paths:
--------------
trunk/code/CSAdminPanel/JavaSource/log4j.properties
trunk/code/CSMiddleware/.springBeans
trunk/code/CSMiddleware/import.sql
trunk/code/CSMiddleware/src/org/commsuite/messaging/ExDevRegister.java
trunk/code/CSMiddleware/src/org/commsuite/messaging/MOutRouter.java
trunk/code/CSMiddleware/war/WEB-INF/web.xml
Added Paths:
-----------
trunk/code/CSCommon/src/aop.properties
trunk/code/CSCommon/src/org/commsuite/aop/
trunk/code/CSCommon/src/org/commsuite/aop/CsMethodsDebuggerInterceptor.java
trunk/code/CSMiddleware/src/aopContext.xml
Modified: trunk/code/CSAdminPanel/JavaSource/log4j.properties
===================================================================
--- trunk/code/CSAdminPanel/JavaSource/log4j.properties 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSAdminPanel/JavaSource/log4j.properties 2006-09-10 11:07:11 UTC (rev 130)
@@ -19,3 +19,5 @@
log4j.logger.org.commsuite=debug
log4j.logger.org.apache.myfaces=warn
+
+log4j.logger.org.commsuite.aop=DEBUG
Added: trunk/code/CSCommon/src/aop.properties
===================================================================
--- trunk/code/CSCommon/src/aop.properties (rev 0)
+++ trunk/code/CSCommon/src/aop.properties 2006-09-10 11:07:11 UTC (rev 130)
@@ -0,0 +1,4 @@
+dao.times.debug.interceptor.debug.daos.times = true
+dao.times.debug.interceptor.debug.methods.parameters = true
+dao.times.debug.interceptor.debug.returned.values = true
+dao.times.debug.interceptor.omited.methods =
Added: trunk/code/CSCommon/src/org/commsuite/aop/CsMethodsDebuggerInterceptor.java
===================================================================
--- trunk/code/CSCommon/src/org/commsuite/aop/CsMethodsDebuggerInterceptor.java (rev 0)
+++ trunk/code/CSCommon/src/org/commsuite/aop/CsMethodsDebuggerInterceptor.java 2006-09-10 11:07:11 UTC (rev 130)
@@ -0,0 +1,94 @@
+package org.commsuite.aop;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+
+public class CsMethodsDebuggerInterceptor implements MethodInterceptor {
+
+ private final static Logger logger = Logger.getLogger(CsMethodsDebuggerInterceptor.class);
+
+ private boolean debugDaosTimes;
+
+ private boolean debugMethodsParameters;
+
+ private boolean debugReturnedValues;
+
+ private List<String> omitedMethods;
+
+ public Object invoke(MethodInvocation invocation) throws Throwable {
+
+ if (!debugDaosTimes) {
+ return invocation.proceed();
+ }
+
+ String methodName = invocation.getMethod().getName();
+
+ if (omitedMethods.contains(methodName)) {
+ return invocation.proceed();
+ }
+
+ Object[] arguments = invocation.getArguments();
+
+ StringBuilder sb = new StringBuilder( //
+ invocation.getThis().getClass().getCanonicalName() + "."
+ + methodName + "(");
+
+ if (debugMethodsParameters) {
+ for (int i = 0; i < arguments.length; i++) {
+ if (0 != i) {
+ sb.append(", ");
+ }
+ sb.append(arguments[i]);
+ }
+ }
+
+ sb.append(")");
+
+ logger.debug("START " + sb.toString());
+ long time = System.currentTimeMillis();
+ Object rval = invocation.proceed();
+ time = System.currentTimeMillis() - time;
+
+ sb = new StringBuilder("END "
+ + invocation.getThis().getClass().getCanonicalName() + "."
+ + methodName + "()" + " ms" + time);
+
+ if (debugReturnedValues) {
+ sb.append(" " + rval);
+ }
+
+ logger.debug(sb.toString());
+
+ return rval;
+ }
+
+ public void setOmitedMethods(String omitedMethodsString) {
+ List<String> methodsNames = new ArrayList<String>();
+ if (omitedMethodsString != null) {
+ for (String string : omitedMethodsString.split(";")) {
+ methodsNames.add(string);
+ }
+ }
+ this.omitedMethods = methodsNames;
+ }
+
+ public void setDebugProperties(Properties debugProperties) {
+ this.debugDaosTimes = "true".equals(debugProperties
+ .getProperty("dao.times.debug.interceptor.debug.daos.times"));
+ this.debugMethodsParameters = "true"
+ .equals(debugProperties
+ .getProperty("dao.times.debug.interceptor.debug.methods.parameters"));
+ this.debugReturnedValues = "true"
+ .equals(debugProperties
+ .getProperty("dao.times.debug.interceptor.debug.returned.values"));
+ this.setOmitedMethods(debugProperties
+ .getProperty("dao.times.debug.interceptor.omited.methods"));
+ }
+}
Modified: trunk/code/CSMiddleware/.springBeans
===================================================================
--- trunk/code/CSMiddleware/.springBeans 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSMiddleware/.springBeans 2006-09-10 11:07:11 UTC (rev 130)
@@ -12,6 +12,7 @@
<config>src/filtersContext.xml</config>
<config>src/datasourceContext.xml</config>
<config>src/activeMQContext.xml</config>
+ <config>src/aopContext.xml</config>
<config>war/WEB-INF/ws-public-servlet.xml</config>
</configs>
<configSets>
@@ -21,6 +22,7 @@
<incomplete>true</incomplete>
<configs>
<config>src/activeMQContext.xml</config>
+ <config>src/aopContext.xml</config>
<config>src/applicationContext.xml</config>
<config>src/converterBuilderContext.xml</config>
<config>src/datasourceContext.xml</config>
Modified: trunk/code/CSMiddleware/import.sql
===================================================================
--- trunk/code/CSMiddleware/import.sql 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSMiddleware/import.sql 2006-09-10 11:07:11 UTC (rev 130)
@@ -1,5 +1,5 @@
--DO NOT ADD ROWS WITH ID GREATER THEN 99
-INSERT INTO cs_sap_servers (id, active_instance, adm_email, client, gw_host, gw_Serv, host, load_balancing, name, user_password, prog_id, system_number, unicode, user_name, default_instance, max_connections_in_pool, group_name, r3_name) VALUES (123456, 'true', 'mar...@bc...','100','bcz.bcc.com.pl','sapgw44','bcz.bcc.com.pl',FALSE,'BCC_BCZ_100_DB','changeme','ZTESTJCO','44',FALSE,'cstest',TRUE,5,'','');
+INSERT INTO cs_sap_servers (id, active_instance, adm_email, client, gw_host, gw_Serv, host, load_balancing, name, user_password, prog_id, system_number, unicode, user_name, default_instance, max_connections_in_pool, group_name, r3_name) VALUES (123456, 'true', 'zc...@bc...','100', 'bcz.bcc.com.pl','sapgw44','bcz.bcc.com.pl',FALSE, 'BCC_BCZ_100_DB','nowehaslo','ZTESTJCO', '44', FALSE, 'zcomm', TRUE,5,'','');
INSERT INTO cs_actions (id, name, description) VALUES (1, 'Action_JMX_UseJmx', 'Using JMX');
INSERT INTO cs_actions (id, name, description) VALUES (2, 'Action_RemoteClient_UseRemoteClient', 'Using RemoteClient');
Added: trunk/code/CSMiddleware/src/aopContext.xml
===================================================================
--- trunk/code/CSMiddleware/src/aopContext.xml (rev 0)
+++ trunk/code/CSMiddleware/src/aopContext.xml 2006-09-10 11:07:11 UTC (rev 130)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+ <bean id="debugProperties"
+ class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="location" value="classpath:aop.properties" />
+ </bean>
+
+ <bean id="csMethodsDebuggerInterceptor" class="org.commsuite.aop.CsMethodsDebuggerInterceptor">
+ <property name="debugProperties" ref="debugProperties" />
+ </bean>
+
+ <bean id="proxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
+ <property name="beanNames">
+ <value>*Target,*Dao,converterBuilder,exDevRegister,mOutRouter,mSAPIn,filterManager,sapCommManager</value>
+ </property>
+ <property name="interceptorNames">
+ <list>
+ <value>csMethodsDebuggerInterceptor</value>
+ </list>
+ </property>
+ </bean>
+
+</beans>
\ No newline at end of file
Modified: trunk/code/CSMiddleware/src/org/commsuite/messaging/ExDevRegister.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/messaging/ExDevRegister.java 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSMiddleware/src/org/commsuite/messaging/ExDevRegister.java 2006-09-10 11:07:11 UTC (rev 130)
@@ -131,6 +131,7 @@
if (deviceQueueName.contains(deviceName)) {
deviceQueuesList.remove(deviceQueueName);
deviceQueuesList.add(deviceQueueName);
+ logger.debug("FOUND QUEUE NAME " + deviceQueueName);
return deviceQueueName;
}
}
Modified: trunk/code/CSMiddleware/src/org/commsuite/messaging/MOutRouter.java
===================================================================
--- trunk/code/CSMiddleware/src/org/commsuite/messaging/MOutRouter.java 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSMiddleware/src/org/commsuite/messaging/MOutRouter.java 2006-09-10 11:07:11 UTC (rev 130)
@@ -70,6 +70,7 @@
final String destinationQueueName = deviceRegister.chooseQueue(msg.getFormatType());
if (null == destinationQueueName) {
+ logger.error("Couldn't find queue for serving " + msg.getFormatType() + " messages");
throw new RuntimeException("Couldn't find queue for serving " + msg.getFormatType() + " messages");
}
Modified: trunk/code/CSMiddleware/war/WEB-INF/web.xml
===================================================================
--- trunk/code/CSMiddleware/war/WEB-INF/web.xml 2006-09-04 23:19:25 UTC (rev 129)
+++ trunk/code/CSMiddleware/war/WEB-INF/web.xml 2006-09-10 11:07:11 UTC (rev 130)
@@ -49,6 +49,7 @@
classpath:/applicationContext.xml,
classpath:/datasourceContext.xml,
classpath:/activeMQContext.xml,
+ classpath:/aopContext.xml,
classpath:/hibernateContext.xml, classpath:/sapContext.xml
classpath:/deviceContext.xml, classpath:/jmxContext.xml,
classpath:/converterBuilderContext.xml,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|