dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24231
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11834: SMS config, using standard logging
------------------------------------------------------------
revno: 11834
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-08-29 19:10:32 +0200
message:
SMS config, using standard logging
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/AdvanceHttpPostGateWay.java 2013-08-29 17:10:32 +0000
@@ -38,16 +38,20 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
+
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.smslib.AGateway;
import org.smslib.GatewayException;
import org.smslib.OutboundMessage;
import org.smslib.TimeoutException;
-import org.smslib.helper.Logger;
public class AdvanceHttpPostGateWay
extends AGateway
{
+ private static final Log log = LogFactory.getLog( AdvanceHttpPostGateWay.class );
+
private static final String SENDER = "sender";
private static final String RECIPIENT = "recipient";
@@ -70,6 +74,7 @@
throws TimeoutException, GatewayException, IOException, InterruptedException
{
Map<String, String> requestParameters = new HashMap<String, String>( parameters );
+
for ( OutboundMessage outboundMessage : outboundMessages )
{
requestParameters.put( RECIPIENT, outboundMessage.getRecipient() );
@@ -78,12 +83,13 @@
String sender = outboundMessage.getFrom();
if ( sender != null )
{
- Logger.getInstance().logDebug( "Adding sender " + sender, null, getGatewayId() );
+ log.debug( "Adding sender " + sender + " " + getGatewayId() );
requestParameters.put( SENDER, sender );
}
try
{
String urlString = urlTemplate;
+
for ( String key : requestParameters.keySet() )
{
if ( requestParameters.get( key ) != null )
@@ -92,7 +98,8 @@
URLEncoder.encode( requestParameters.get( key ), "UTF-8" ) );
}
}
- Logger.getInstance().logInfo( "RequestURL: " + urlString, null, getGatewayId() );
+
+ log.info( "RequestURL: " + urlString + " " + getGatewayId() );
URL requestURL = new URL( urlString );
URLConnection conn = requestURL.openConnection();
BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
@@ -105,8 +112,7 @@
HttpURLConnection httpConnection = (HttpURLConnection) conn;
if ( httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK )
{
- Logger.getInstance().logWarn( "Couldn't send message, got response " + response, null,
- getGatewayId() );
+ log.warn( "Couldn't send message, got response " + response + " " + getGatewayId() );
return 0;
}
@@ -115,7 +121,7 @@
}
catch ( Exception e )
{
- Logger.getInstance().logWarn( "Couldn't send message " + outboundMessage, e, getGatewayId() );
+ log.warn( "Couldn't send message " + outboundMessage + " " + getGatewayId() );
return 0;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/DefaultSmsConfigurationManager.java 2013-08-29 17:10:32 +0000
@@ -110,7 +110,7 @@
public void updateSmsConfiguration( SmsConfiguration config )
{
systemSettingManager.saveSystemSetting( SystemSettingManager.KEY_SMS_CONFIG, config );
- // Reinitialize components relying on sms config.
+
initializeSmsConfigurables();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/config/SimplisticHttpGetGateWay.java 2013-08-29 17:10:32 +0000
@@ -39,11 +39,12 @@
import java.util.Map;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.smslib.AGateway;
import org.smslib.GatewayException;
import org.smslib.OutboundMessage;
import org.smslib.TimeoutException;
-import org.smslib.helper.Logger;
/**
* Simplistic http gateway sending smses through a get to a url constructed from
@@ -75,6 +76,8 @@
public class SimplisticHttpGetGateWay
extends AGateway
{
+ private static final Log log = LogFactory.getLog( SimplisticHttpGetGateWay.class );
+
private static final String SENDER = "sender";
private static final String RECIPIENT = "recipient";
@@ -99,7 +102,7 @@
public void startGateway()
throws TimeoutException, GatewayException, IOException, InterruptedException
{
- Logger.getInstance().logDebug( "Starting gateway.", null, getGatewayId() );
+ log.debug( "Starting gateway. " + getGatewayId() );
super.startGateway();
}
@@ -107,7 +110,7 @@
public void stopGateway()
throws TimeoutException, GatewayException, IOException, InterruptedException
{
- Logger.getInstance().logDebug( "Stopping gateway.", null, getGatewayId() );
+ log.debug( "Stopping gateway. " + getGatewayId() );
super.stopGateway();
}
@@ -115,7 +118,7 @@
public boolean sendMessage( OutboundMessage msg )
throws TimeoutException, GatewayException, IOException, InterruptedException
{
- Logger.getInstance().logDebug( "Sending message " + msg, null, getGatewayId() );
+ log.debug( "Sending message " + msg + " " + getGatewayId() );
Map<String, String> requestParameters = new HashMap<String, String>( parameters );
@@ -126,7 +129,7 @@
if ( sender != null )
{
- Logger.getInstance().logDebug( "Adding sender " + sender, null, getGatewayId() );
+ log.debug( "Adding sender " + sender + " " + getGatewayId() );
requestParameters.put( SENDER, sender );
}
try
@@ -142,7 +145,7 @@
}
}
- Logger.getInstance().logInfo( "RequestURL: " + urlString, null, getGatewayId() );
+ log.info( "RequestURL: " + urlString + " " + getGatewayId() );
URL requestURL = new URL( urlString );
URLConnection conn = requestURL.openConnection();
BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) );
@@ -156,7 +159,7 @@
HttpURLConnection httpConnection = (HttpURLConnection) conn;
if ( httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK )
{
- Logger.getInstance().logWarn( "Couldn't send message, got response " + response, null, getGatewayId() );
+ log.warn( "Couldn't send message, got response " + response + " " + getGatewayId() );
return false;
}
@@ -165,7 +168,7 @@
}
catch ( Exception e )
{
- Logger.getInstance().logWarn( "Couldn't send message " + msg, e, getGatewayId() );
+ log.warn( "Couldn't send message " + getGatewayId() );
return false;
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2012-11-03 20:54:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/interpretation/hibernate/Interpretation.hbm.xml 2013-08-29 17:10:32 +0000
@@ -6,8 +6,6 @@
<hibernate-mapping>
<class name="org.hisp.dhis.interpretation.Interpretation" table="interpretation">
- <cache usage="read-write" />
-
<id name="id" column="interpretationid">
<generator class="native" />
</id>