From 19f509b6524fea5b253e1166841c7e0947b06573 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Tue, 4 Aug 2009 16:34:22 +0000 Subject: - Provides an alternative storage backend to XML in the ConfigurationService implementation which uses Properties for the sake for better execution speed and garbage collection behavior. - Implements batch configuration property modifications which allow a caller to modify a set of properties with a single saving of the configuration file. --- .../impl/notification/NotificationServiceImpl.java | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'src/net/java/sip/communicator/impl/notification') diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index 5d25742..7ffdb7b 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -491,7 +491,6 @@ public class NotificationServiceImpl configService.setProperty( eventTypeNodeName + ".active", Boolean.toString(isActive)); - return; } @@ -510,6 +509,8 @@ public class NotificationServiceImpl actionTypeNodeName = actionTypeRootPropName; } + Map configProperties = new HashMap(); + // If we didn't find the given actionType in the configuration we save // it here. if(actionTypeNodeName == null) @@ -518,7 +519,7 @@ public class NotificationServiceImpl + ".actionType" + Long.toString(System.currentTimeMillis()); - configService.setProperty(actionTypeNodeName, actionType); + configProperties.put(actionTypeNodeName, actionType); } if(actionHandler instanceof SoundNotificationHandler) @@ -526,19 +527,19 @@ public class NotificationServiceImpl SoundNotificationHandler soundHandler = (SoundNotificationHandler) actionHandler; - configService.setProperty( + configProperties.put( actionTypeNodeName + ".soundFileDescriptor", soundHandler.getDescriptor()); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".loopInterval", soundHandler.getLoopInterval()); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".enabled", Boolean.toString(isActive)); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".default", Boolean.toString(isDefault)); } @@ -547,15 +548,15 @@ public class NotificationServiceImpl PopupMessageNotificationHandler messageHandler = (PopupMessageNotificationHandler) actionHandler; - configService.setProperty( + configProperties.put( actionTypeNodeName + ".defaultMessage", messageHandler.getDefaultMessage()); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".enabled", Boolean.toString(isActive)); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".default", Boolean.toString(isDefault)); } @@ -564,15 +565,15 @@ public class NotificationServiceImpl LogMessageNotificationHandler logMessageHandler = (LogMessageNotificationHandler) actionHandler; - configService.setProperty( + configProperties.put( actionTypeNodeName + ".logType", logMessageHandler.getLogType()); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".enabled", Boolean.toString(isActive)); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".default", Boolean.toString(isDefault)); } @@ -581,18 +582,21 @@ public class NotificationServiceImpl CommandNotificationHandler commandHandler = (CommandNotificationHandler) actionHandler; - configService.setProperty( + configProperties.put( actionTypeNodeName + ".commandDescriptor", commandHandler.getDescriptor()); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".enabled", Boolean.toString(isActive)); - configService.setProperty( + configProperties.put( actionTypeNodeName + ".default", Boolean.toString(isDefault)); } + + if (configProperties.size() > 0) + configService.setProperties(configProperties); } /** -- cgit v1.1