aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-09-10 07:11:52 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2010-09-10 07:11:52 +0000
commitb9f8d008543341da7c46d3cf6184e3a68092c405 (patch)
tree56a87d55c84ac9bf3a438341be80b48b1c6305ce /src/net/java/sip/communicator
parentcebbe2bd5518b0f9aa1b776ea77080478fc5f98b (diff)
downloadjitsi-b9f8d008543341da7c46d3cf6184e3a68092c405.zip
jitsi-b9f8d008543341da7c46d3cf6184e3a68092c405.tar.gz
jitsi-b9f8d008543341da7c46d3cf6184e3a68092c405.tar.bz2
Adds javadocs, fixes warnings.
Diffstat (limited to 'src/net/java/sip/communicator')
-rw-r--r--src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java14
-rw-r--r--src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java4
-rw-r--r--src/net/java/sip/communicator/impl/callhistory/CallHistoryActivator.java33
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java120
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java21
-rw-r--r--src/net/java/sip/communicator/impl/configuration/ConfigurationStore.java114
-rw-r--r--src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java116
-rw-r--r--src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java108
8 files changed, 321 insertions, 209 deletions
diff --git a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java
index be9ed52..49fbd96 100644
--- a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java
+++ b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationActivator.java
@@ -7,6 +7,7 @@
package net.java.sip.communicator.impl.argdelegation;
import net.java.sip.communicator.service.gui.*;
+import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.launchutils.*;
import org.osgi.framework.*;
@@ -43,6 +44,8 @@ public class ArgDelegationActivator
* the util package URI manager.
*
* @param bc a reference to the currently active bundle context.
+ * @throws Exception if starting the arg delegation bundle and registering
+ * the delegationPeer with the util package URI manager fails
*/
public void start(BundleContext bc) throws Exception
{
@@ -52,7 +55,6 @@ public class ArgDelegationActivator
//register our instance of delegation peer.
LaunchArgHandler.getInstance().setDelegationPeer(delegationPeer);
-
}
/**
@@ -60,6 +62,8 @@ public class ArgDelegationActivator
* bundle.
*
* @param bc an instance of the currently valid bundle context.
+ * @throws Exception if unsetting the delegation peer instance that we set
+ * when we start this bundle fails
*/
public void stop(BundleContext bc) throws Exception
{
@@ -79,13 +83,7 @@ public class ArgDelegationActivator
public static UIService getUIService()
{
if(uiService == null)
- {
- ServiceReference versionServiceReference
- = bundleContext.getServiceReference(
- UIService.class.getName());
- uiService = (UIService)bundleContext
- .getService(versionServiceReference);
- }
+ uiService = ServiceUtils.getService(bundleContext, UIService.class);
return uiService;
}
}
diff --git a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java
index 6256632..995e712 100644
--- a/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java
+++ b/src/net/java/sip/communicator/impl/argdelegation/ArgDelegationPeerImpl.java
@@ -26,6 +26,10 @@ public class ArgDelegationPeerImpl
implements ArgDelegationPeer,
ServiceListener
{
+ /**
+ * The <tt>Logger</tt> used by the <tt>ArgDelegationPeerImpl</tt> class and
+ * its instances for logging output.
+ */
private static final Logger logger
= Logger.getLogger(ArgDelegationPeerImpl.class);
diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryActivator.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryActivator.java
index 6956eb9..2195759 100644
--- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryActivator.java
+++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryActivator.java
@@ -26,8 +26,12 @@ import net.java.sip.communicator.service.contactsource.*;
public class CallHistoryActivator
implements BundleActivator
{
- private static Logger logger =
- Logger.getLogger(CallHistoryActivator.class);
+ /**
+ * The <tt>Logger</tt> used by the <tt>CallHistoryActivator</tt> class and
+ * its instances for logging output.
+ */
+ private static final Logger logger
+ = Logger.getLogger(CallHistoryActivator.class);
/**
* The bundle context.
@@ -55,7 +59,7 @@ public class CallHistoryActivator
* Initialize and start call history
*
* @param bc the <tt>BundleContext</tt>
- * @throws Exception
+ * @throws Exception if initializing and starting call history fails
*/
public void start(BundleContext bc) throws Exception
{
@@ -128,14 +132,10 @@ public class CallHistoryActivator
{
if (resourcesService == null)
{
- ServiceReference serviceReference = bundleContext
- .getServiceReference(ResourceManagementService.class.getName());
-
- if(serviceReference == null)
- return null;
-
- resourcesService = (ResourceManagementService) bundleContext
- .getService(serviceReference);
+ resourcesService
+ = ServiceUtils.getService(
+ bundleContext,
+ ResourceManagementService.class);
}
return resourcesService;
}
@@ -166,15 +166,14 @@ public class CallHistoryActivator
if (serRefs != null)
{
- for (int i = 0; i < serRefs.length; i++)
+ for (ServiceReference serRef : serRefs)
{
-
ProtocolProviderFactory providerFactory
- = (ProtocolProviderFactory) bundleContext
- .getService(serRefs[i]);
+ = (ProtocolProviderFactory)
+ bundleContext.getService(serRef);
- providerFactoriesMap.put(serRefs[i]
- .getProperty(ProtocolProviderFactory.PROTOCOL),
+ providerFactoriesMap.put(
+ serRef.getProperty(ProtocolProviderFactory.PROTOCOL),
providerFactory);
}
}
diff --git a/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java b/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java
index f9f22d7..e176d5a 100644
--- a/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java
+++ b/src/net/java/sip/communicator/impl/configuration/ChangeEventDispatcher.java
@@ -46,7 +46,7 @@ public class ChangeEventDispatcher
/**
* The object to be provided as the "source" for any generated events.
*/
- private Object source;
+ private final Object source;
/**
* Constructs a <tt>VetoableChangeSupport</tt> object.
@@ -56,9 +56,8 @@ public class ChangeEventDispatcher
public ChangeEventDispatcher(Object sourceObject)
{
if (sourceObject == null)
- {
- throw new NullPointerException();
- }
+ throw new NullPointerException("sourceObject");
+
source = sourceObject;
}
@@ -72,9 +71,7 @@ public class ChangeEventDispatcher
PropertyChangeListener listener)
{
if (propertyChangeListeners == null)
- {
propertyChangeListeners = new Vector<PropertyChangeListener>();
- }
propertyChangeListeners.add(listener);
}
@@ -87,7 +84,6 @@ public class ChangeEventDispatcher
* @param propertyName The name of the property to listen on.
* @param listener The ConfigurationChangeListener to be added
*/
-
public synchronized void addPropertyChangeListener(
String propertyName,
PropertyChangeListener listener)
@@ -118,9 +114,7 @@ public class ChangeEventDispatcher
PropertyChangeListener listener)
{
if (propertyChangeListeners != null)
- {
propertyChangeListeners.remove(listener);
- }
}
/**
@@ -133,17 +127,14 @@ public class ChangeEventDispatcher
String propertyName,
PropertyChangeListener listener)
{
- if (propertyChangeChildren == null)
+ if (propertyChangeChildren != null)
{
- return;
- }
- ChangeEventDispatcher child = propertyChangeChildren.get(propertyName);
+ ChangeEventDispatcher child
+ = propertyChangeChildren.get(propertyName);
- if (child == null)
- {
- return;
+ if (child != null)
+ child.removePropertyChangeListener(listener);
}
- child.removePropertyChangeListener(listener);
}
/**
@@ -157,7 +148,8 @@ public class ChangeEventDispatcher
{
if (vetoableChangeListeners == null)
{
- vetoableChangeListeners = new Vector<ConfigVetoableChangeListener>();
+ vetoableChangeListeners
+ = new Vector<ConfigVetoableChangeListener>();
}
vetoableChangeListeners.add(listener);
@@ -174,9 +166,7 @@ public class ChangeEventDispatcher
ConfigVetoableChangeListener listener)
{
if (vetoableChangeListeners != null)
- {
vetoableChangeListeners.remove(listener);
- }
}
/**
@@ -194,7 +184,8 @@ public class ChangeEventDispatcher
{
if (vetoableChangeChildren == null)
{
- vetoableChangeChildren = new Hashtable<String, ChangeEventDispatcher>();
+ vetoableChangeChildren
+ = new Hashtable<String, ChangeEventDispatcher>();
}
ChangeEventDispatcher child = vetoableChangeChildren.get(propertyName);
if (child == null)
@@ -215,24 +206,21 @@ public class ChangeEventDispatcher
String propertyName,
ConfigVetoableChangeListener listener)
{
- if (vetoableChangeChildren == null)
+ if (vetoableChangeChildren != null)
{
- return;
- }
- ChangeEventDispatcher child = vetoableChangeChildren.get( propertyName );
+ ChangeEventDispatcher child
+ = vetoableChangeChildren.get( propertyName );
- if (child == null)
- {
- return;
+ if (child != null)
+ child.removeVetoableChangeListener(listener);
}
- child.removeVetoableChangeListener(listener);
}
/**
* Report a vetoable property update to any registered listeners. If
* no one vetos the change, then fire a new ConfigurationChangeEvent
* indicating that the change has been accepted. In the case of a
- * PropertyVetoException, end eventdispatch and rethrow the eception
+ * PropertyVetoException, end eventdispatch and rethrow the exception
* <p>
* No event is fired if old and new are equal and non-null.
*
@@ -247,20 +235,19 @@ public class ChangeEventDispatcher
Object oldValue, Object newValue)
//throws PropertyVetoException
{
- if (vetoableChangeListeners == null && vetoableChangeChildren == null)
+ if (vetoableChangeListeners != null || vetoableChangeChildren != null)
{
- return;
+ fireVetoableChange(
+ new PropertyChangeEvent(
+ source,
+ propertyName,
+ oldValue, newValue));
}
-
- PropertyChangeEvent evt = new PropertyChangeEvent(source,
- propertyName, oldValue, newValue);
- fireVetoableChange(evt);
}
/**
- * Fire a vetoable property update to any registered listeners. If
- * anyone vetos the change, then the excption will be rethrown by this
- * method.
+ * Fire a vetoable property update to any registered listeners. If anyone
+ * vetos the change, then the exception will be rethrown by this method.
* <p>
* No event is fired if old and new are equal and non-null.
*
@@ -271,14 +258,11 @@ public class ChangeEventDispatcher
public void fireVetoableChange(PropertyChangeEvent evt)
// throws PropertyVetoException
{
-
Object oldValue = evt.getOldValue();
Object newValue = evt.getNewValue();
String propertyName = evt.getPropertyName();
if (oldValue != null && newValue != null && oldValue.equals(newValue))
- {
return;
- }
ConfigVetoableChangeListener[] targets = null;
ChangeEventDispatcher child = null;
@@ -286,30 +270,23 @@ public class ChangeEventDispatcher
{
if (vetoableChangeListeners != null)
{
- targets =
- vetoableChangeListeners
- .toArray(new ConfigVetoableChangeListener[vetoableChangeListeners
- .size()]);
+ targets
+ = vetoableChangeListeners.toArray(
+ new ConfigVetoableChangeListener[
+ vetoableChangeListeners.size()]);
}
if (vetoableChangeChildren != null && propertyName != null)
- {
child = vetoableChangeChildren.get(propertyName);
- }
}
if (vetoableChangeListeners != null && targets != null)
{
- for (int i = 0; i < targets.length; i++)
- {
- ConfigVetoableChangeListener target = targets[i];
+ for (ConfigVetoableChangeListener target : targets)
target.vetoableChange(evt);
- }
}
if (child != null)
- {
child.fireVetoableChange(evt);
- }
}
@@ -325,12 +302,14 @@ public class ChangeEventDispatcher
public void firePropertyChange(String propertyName,
Object oldValue, Object newValue)
{
- if (oldValue != null && newValue != null && oldValue.equals(newValue))
+ if (oldValue == null || newValue == null || !oldValue.equals(newValue))
{
- return;
+ firePropertyChange(
+ new PropertyChangeEvent(
+ source,
+ propertyName,
+ oldValue, newValue));
}
- firePropertyChange(new PropertyChangeEvent(source, propertyName,
- oldValue, newValue));
}
/**
@@ -345,26 +324,21 @@ public class ChangeEventDispatcher
Object newValue = evt.getNewValue();
String propertyName = evt.getPropertyName();
if (oldValue != null && newValue != null && oldValue.equals(newValue))
- {
return;
- }
if (propertyChangeListeners != null)
{
for (PropertyChangeListener target : propertyChangeListeners)
- {
target.propertyChange(evt);
- }
}
if (propertyChangeChildren != null && propertyName != null)
{
- ChangeEventDispatcher child =
- propertyChangeChildren.get(propertyName);
+ ChangeEventDispatcher child
+ = propertyChangeChildren.get(propertyName);
+
if (child != null)
- {
child.firePropertyChange(evt);
- }
}
}
@@ -384,12 +358,11 @@ public class ChangeEventDispatcher
}
if (propertyChangeChildren != null)
{
- ChangeEventDispatcher child =
- propertyChangeChildren.get(propertyName);
+ ChangeEventDispatcher child
+ = propertyChangeChildren.get(propertyName);
+
if (child != null && child.propertyChangeListeners != null)
- {
return!child.propertyChangeListeners.isEmpty();
- }
}
return false;
}
@@ -410,15 +383,12 @@ public class ChangeEventDispatcher
}
if (vetoableChangeChildren != null)
{
- ChangeEventDispatcher child =
- vetoableChangeChildren.get(propertyName);
+ ChangeEventDispatcher child
+ = vetoableChangeChildren.get(propertyName);
if (child != null && child.vetoableChangeListeners != null)
- {
return!child.vetoableChangeListeners.isEmpty();
- }
}
return false;
}
-
}
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
index ef98a21..27ce711 100644
--- a/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
+++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationActivator.java
@@ -18,19 +18,26 @@ import net.java.sip.communicator.util.*;
public class ConfigurationActivator
implements BundleActivator
{
+ /**
+ * The <tt>Logger</tt> used by this <tt>ConfigurationActivator</tt> instance
+ * for logging output.
+ */
private final Logger logger
= Logger.getLogger(ConfigurationServiceImpl.class);
+ /**
+ * The <tt>ConfigurationService</tt> implementation provided by the bundle
+ * represented by this <tt>ConfigurationActivator</tt>.
+ */
private final ConfigurationServiceImpl impl
= new ConfigurationServiceImpl();
/**
* Starts the configuration service
*
- * @param bundleContext
- * the BundleContext as provided from the OSGi framework.
- * @throws Exception
- * if anything goes wrong
+ * @param bundleContext the <tt>BundleContext</tt> as provided by the OSGi
+ * framework.
+ * @throws Exception if anything goes wrong
*/
public void start(BundleContext bundleContext)
throws Exception
@@ -52,8 +59,10 @@ public class ConfigurationActivator
* Causes the configuration service to store the properties object and
* unregisters the configuration service.
*
- * @param bundleContext BundleContext
- * @throws Exception
+ * @param bundleContext <tt>BundleContext</tt>
+ * @throws Exception if anything goes wrong while storing the properties
+ * managed by the <tt>ConfigurationService</tt> implementation provided by
+ * this bundle and while unregistering the service in question
*/
public void stop(BundleContext bundleContext)
throws Exception
diff --git a/src/net/java/sip/communicator/impl/configuration/ConfigurationStore.java b/src/net/java/sip/communicator/impl/configuration/ConfigurationStore.java
index 9b1b576..14f2085 100644
--- a/src/net/java/sip/communicator/impl/configuration/ConfigurationStore.java
+++ b/src/net/java/sip/communicator/impl/configuration/ConfigurationStore.java
@@ -13,113 +13,109 @@ import net.java.sip.communicator.util.xml.*;
/**
* Abstracts the runtime storage, the serialization and deserialization of the
* configuration properties and their associated values of
- * <code>ConfigurationServiceImpl</code> and the format of the configuration
- * file. Thus <code>ConfigurationServiceImpl</code> can operate regardless of
- * these specifics and takes care of asking the
- * <code>VetoableChangeListener</code>s, converting the property values to the
- * requested types and notifying the <code>PropertyChangeListener</code>s.
- *
+ * <tt>ConfigurationServiceImpl</tt> and the format of the configuration file.
+ * Thus <tt>ConfigurationServiceImpl</tt> can operate regardless of these
+ * specifics and takes care of asking the <tt>VetoableChangeListener</tt>s,
+ * converting the property values to the requested types and notifying the
+ * <tt>PropertyChangeListener</tt>s.
+ *
* @author Lubomir Marinov
*/
public interface ConfigurationStore
{
/**
- * Gets the value in this <code>ConfigurationStore</code> of a property with
- * a specific name.
- *
- * @param name
- * the name of the property to get the value of
- * @return the value in this <code>ConfigurationStore</code> of the property
- * with the specified name; <tt>null</tt> if the property with the
- * specified name does not have an association with a value in this
- * <code>ConfigurationStore</code>
+ * Gets the value in this <tt>ConfigurationStore</tt> of a property with a
+ * specific name.
+ *
+ * @param name the name of the property to get the value of
+ * @return the value in this <tt>ConfigurationStore</tt> of the property
+ * with the specified name; <tt>null</tt> if the property with the specified
+ * name does not have an association with a value in this
+ * <tt>ConfigurationStore</tt>
*/
public Object getProperty(String name);
/**
* Gets the names of the properties which have values associated in this
- * <code>ConfigurationStore</code>.
- *
- * @return an array of <code>String</code>s which specify the names of the
- * properties that have values associated in this
- * <code>ConfigurationStore</code>; an empty array if this instance
- * contains no property values
+ * <tt>ConfigurationStore</tt>.
+ *
+ * @return an array of <tt>String</tt>s which specify the names of the
+ * properties that have values associated in this
+ * <tt>ConfigurationStore</tt>; an empty array if this instance contains no
+ * property values
*/
public String[] getPropertyNames();
/**
* Determines whether a specific name stands for a system property.
*
- * @param name
- * the name of a property which is to be determined whether it is
- * a system property
+ * @param name the name of a property which is to be determined whether it
+ * is a system property
* @return <tt>true</tt> if the specified name stands for a system property;
- * <tt>false</tt>, otherwise
+ * <tt>false</tt>, otherwise
*/
public boolean isSystemProperty(String name);
/**
* Removes all property name-value associations currently present in this
- * <code>ConfigurationStore</code> and deserializes new property name-value
- * associations from a specific <code>File</code> which presumably is in the
+ * <tt>ConfigurationStore</tt> and deserializes new property name-value
+ * associations from a specific <tt>File</tt> which presumably is in the
* format represented by this instance.
*
- * @param file
- * the <code>File</code> to be read and to deserialize new
- * property name-value associations from into this instance
- * @throws IOException
- * @throws XMLException
+ * @param file the <tt>File</tt> to be read and to deserialize new property
+ * name-value associations from into this instance
+ * @throws IOException if there is an input error while reading from the
+ * specified <tt>file</tt>
+ * @throws XMLException if parsing the contents of the specified
+ * <tt>file</tt> fails
*/
public void reloadConfiguration(File file)
throws IOException,
XMLException;
/**
- * Removes the value association in this <code>ConfigurationStore</code> of
- * the property with a specific name. If the property with the specified
- * name is not associated with a value in this
- * <code>ConfigurationStore</code>, does nothing.
+ * Removes the value association in this <tt>ConfigurationStore</tt> of the
+ * property with a specific name. If the property with the specified name is
+ * not associated with a value in this <tt>ConfigurationStore</tt>, does
+ * nothing.
*
- * @param name
- * the name of the property which is to have its value
- * association in this <code>ConfigurationStore</code> removed
+ * @param name the name of the property which is to have its value
+ * association in this <tt>ConfigurationStore</tt> removed
*/
public void removeProperty(String name);
/**
* Sets the value of a non-system property with a specific name to a
- * specific value in this <code>ConfigurationStore</code>.
- *
- * @param name
- * the name of the non-system property to be set to the specified
- * value in this <code>ConfigurationStore</code>
- * @param value
- * the value to be assigned to the non-system property with the
- * specified name in this <code>ConfigurationStore</code>
+ * specific value in this <tt>ConfigurationStore</tt>.
+ *
+ * @param name the name of the non-system property to be set to the
+ * specified value in this <tt>ConfigurationStore</tt>
+ * @param value the value to be assigned to the non-system property with the
+ * specified name in this <tt>ConfigurationStore</tt>
*/
public void setNonSystemProperty(String name, Object value);
/**
* Sets a property with a specific name to be considered a system property
- * by the <code>ConfigurationStore</code>.
- *
- * @param name
- * the name of the property to be set as a system property in
- * this <code>ConfigurationStore</code>
+ * by the <tt>ConfigurationStore</tt>.
+ *
+ * @param name the name of the property to be set as a system property in
+ * this <tt>ConfigurationStore</tt>
*/
public void setSystemProperty(String name);
/**
* Stores/serializes the property name-value associations currently present
- * in this <code>ConfigurationStore</code> into a specific
- * <code>OutputStream</code> in the format represented by this instance.
+ * in this <tt>ConfigurationStore</tt> into a specific <tt>OutputStream</tt>
+ * in the format represented by this instance.
*
- * @param out
- * the <code>OutputStream</code> to receive the serialized form
- * of the property name-value associations currently present in
- * this <code>ConfigurationStore</code>
- * @throws IOException
+ * @param out the <tt>OutputStream</tt> to receive the serialized form of
+ * the property name-value associations currently present in this
+ * <tt>ConfigurationStore</tt>
+ * @throws IOException if there is an output error while storing the
+ * properties managed by this <tt>ConfigurationStore</tt> into the specified
+ * <tt>file</tt>
*/
public void storeConfiguration(OutputStream out)
throws IOException;
diff --git a/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java b/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java
index d4cdcae..5a15e68 100644
--- a/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java
+++ b/src/net/java/sip/communicator/impl/configuration/PropertyConfigurationStore.java
@@ -32,11 +32,18 @@ public class PropertyConfigurationStore
*/
private final Properties properties = new Properties();
- /*
- * Implements ConfigurationStore#getProperty(String). If this
- * ConfigurationStore contains a value associated with the specified
- * property name, returns it. Otherwise, searches for a system property with
- * the specified name and returns its value.
+ /**
+ * Implements {@link ConfigurationStore#getProperty(String)}. If this
+ * <tt>ConfigurationStore</tt> contains a value associated with the
+ * specified property name, returns it. Otherwise, searches for a system
+ * property with the specified name and returns its value.
+ *
+ * @param name the name of the property to get the value of
+ * @return the value in this <tt>ConfigurationStore</tt> of the property
+ * with the specified name; <tt>null</tt> if the property with the specified
+ * name does not have an association with a value in this
+ * <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#getProperty(String)
*/
public Object getProperty(String name)
{
@@ -45,8 +52,16 @@ public class PropertyConfigurationStore
return (value != null) ? value : System.getProperty(name);
}
- /*
- * Implements ConfigurationStore#getPropertyNames().
+ /**
+ * Implements {@link ConfigurationStore#getPropertyNames()}. Gets the names
+ * of the properties which have values associated in this
+ * <tt>ConfigurationStore</tt>.
+ *
+ * @return an array of <tt>String</tt>s which specify the names of the
+ * properties that have values associated in this
+ * <tt>ConfigurationStore</tt>; an empty array if this instance contains no
+ * property values
+ * @see ConfigurationStore#getPropertyNames()
*/
public String[] getPropertyNames()
{
@@ -57,18 +72,34 @@ public class PropertyConfigurationStore
}
}
- /*
- * Implements ConfigurationStore#isSystemProperty(String). Considers a
- * property to be system if the system properties contain a value associated
- * with its name.
+ /**
+ * Implements {@link ConfigurationStore#isSystemProperty(String)}. Considers
+ * a property to be system if the system properties contain a value
+ * associated with its name.
+ *
+ * @param name the name of a property which is to be determined whether it
+ * is a system property
+ * @return <tt>true</tt> if the specified name stands for a system property;
+ * <tt>false</tt>, otherwise
+ * @see ConfigurationStore#isSystemProperty(String)
*/
public boolean isSystemProperty(String name)
{
return (System.getProperty(name) != null);
}
- /*
- * Implements ConfigurationStore#reloadConfiguration(File).
+ /**
+ * Implements {@link ConfigurationStore#reloadConfiguration(File)}. Removes
+ * all property name-value associations currently present in this
+ * <tt>ConfigurationStore</tt> and deserializes new property name-value
+ * associations from a specific <tt>File</tt> which presumably is in the
+ * format represented by this instance.
+ *
+ * @param file the <tt>File</tt> to be read and to deserialize new property
+ * name-value associations from into this instance
+ * @throws IOException if there is an input error while reading from the
+ * specified <tt>file</tt>
+ * @see ConfigurationStore#reloadConfiguration(File)
*/
public void reloadConfiguration(File file)
throws IOException
@@ -86,38 +117,69 @@ public class PropertyConfigurationStore
}
}
- /*
- * Implements ConfigurationStore#removeProperty(String).
+ /**
+ * Implements {@link ConfigurationStore#removeProperty(String)}. Removes the
+ * value association in this <tt>ConfigurationStore</tt> of the property
+ * with a specific name. If the property with the specified name is not
+ * associated with a value in this <tt>ConfigurationStore</tt>, does
+ * nothing.
+ *
+ * @param name the name of the property which is to have its value
+ * association in this <tt>ConfigurationStore</tt> removed
+ * @see ConfigurationStore#removeProperty(String)
*/
public void removeProperty(String name)
{
properties.remove(name);
}
- /*
- * Implements ConfigurationStore#setNonSystemProperty(String, Object). As
- * the backend of this instance is a Properties instance, it can only store
- * String values and the specified value to be associated with the specified
- * property name is converted to a String.
+ /**
+ * Implements
+ * {@link ConfigurationStore#setNonSystemProperty(String, Object)}. As the
+ * backend of this instance is a <tt>Properties</tt> instance, it can only
+ * store <tt>String</tt> values and the specified value to be associated
+ * with the specified property name is converted to a <tt>String</tt>.
+ *
+ * @param name the name of the non-system property to be set to the
+ * specified value in this <tt>ConfigurationStore</tt>
+ * @param value the value to be assigned to the non-system property with the
+ * specified name in this <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#setNonSystemProperty(String, Object)
*/
public void setNonSystemProperty(String name, Object value)
{
properties.setProperty(name, value.toString());
}
- /*
- * Implements ConfigurationStore#setSystemProperty(String). Since system
- * properties are managed through the System class, setting a property as
- * system in this ConfigurationStore effectively removes any existing value
- * associated with the specified property name from this instance.
+ /**
+ * Implements {@link ConfigurationStore#setSystemProperty(String)}. Since
+ * system properties are managed through the <tt>System</tt> class, setting
+ * a property as system in this <tt>ConfigurationStore</tt> effectively
+ * removes any existing value associated with the specified property name
+ * from this instance.
+ *
+ * @param name the name of the property to be set as a system property in
+ * this <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#setSystemProperty(String)
*/
public void setSystemProperty(String name)
{
removeProperty(name);
}
- /*
- * Implements ConfigurationStore#storeConfiguration(OutputStream).
+ /**
+ * Implements {@link ConfigurationStore#storeConfiguration(OutputStream)}.
+ * Stores/serializes the property name-value associations currently present
+ * in this <tt>ConfigurationStore</tt> into a specific <tt>OutputStream</tt>
+ * in the format represented by this instance.
+ *
+ * @param out the <tt>OutputStream</tt> to receive the serialized form of
+ * the property name-value associations currently present in this
+ * <tt>ConfigurationStore</tt>
+ * @throws IOException if there is an output error while storing the
+ * properties managed by this <tt>ConfigurationStore</tt> into the specified
+ * <tt>file</tt>
+ * @see ConfigurationStore#storeConfiguration(OutputStream)
*/
public void storeConfiguration(OutputStream out)
throws IOException
diff --git a/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java b/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java
index ad075a3..a16d505 100644
--- a/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java
+++ b/src/net/java/sip/communicator/impl/configuration/xml/XMLConfigurationStore.java
@@ -79,6 +79,13 @@ public class XMLConfigurationStore
return (Map<String, Object>) properties.clone();
}
+ /**
+ * Creates a new runtime XML document which is to contain the properties
+ * managed by this <tt>ConfigurationStore</tt>.
+ *
+ * @return a new runtime XML <tt>Document</tt> which is to contain the
+ * properties managed by this <tt>ConfigurationStore</tt>
+ */
private Document createPropertiesDocument()
{
if (propertiesDocument == null)
@@ -102,8 +109,17 @@ public class XMLConfigurationStore
return propertiesDocument;
}
- /*
- * Implements ConfigurationStore#getProperty(String).
+ /**
+ * Implements {@link ConfigurationStore#getProperty(String)}. Gets the value
+ * in this <code>ConfigurationStore</code> of a property with a specific
+ * name.
+ *
+ * @param propertyName the name of the property to get the value of
+ * @return the value in this <tt>ConfigurationStore</tt> of the property
+ * with the specified name; <tt>null</tt> if the property with the specified
+ * name does not have an association with a value in this
+ * <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#getProperty(String)
*/
public Object getProperty(String propertyName)
{
@@ -117,8 +133,16 @@ public class XMLConfigurationStore
return value;
}
- /*
- * Implements ConfigurationStore#getPropertyNames().
+ /**
+ * Implements {ConfigurationStore#getPropertyNames()}. Gets the names of the
+ * properties which have values associated in this
+ * <tt>ConfigurationStore</tt>.
+ *
+ * @return an array of <tt>String</tt>s which specify the names of the
+ * properties that have values associated in this
+ * <tt>ConfigurationStore</tt>; an empty array if this instance contains no
+ * property values
+ * @see ConfigurationStore#getPropertyNames()
*/
public String[] getPropertyNames()
{
@@ -126,8 +150,15 @@ public class XMLConfigurationStore
return propertyNames.toArray(new String[propertyNames.size()]);
}
- /*
- * Implements ConfigurationStore#isSystemProperty(String).
+ /**
+ * Implements {ConfigurationStore#isSystemProperty(String)}. Determines
+ * whether a specific name stands for a system property.
+ *
+ * @param propertyName the name of a property which is to be determined
+ * whether it is a system property
+ * @return <tt>true</tt> if the specified name stands for a system property;
+ * <tt>false</tt>, otherwise
+ * @see ConfigurationStore#isSystemProperty(String)
*/
public boolean isSystemProperty(String propertyName)
{
@@ -137,10 +168,10 @@ public class XMLConfigurationStore
/**
* Loads the contents of the specified configuration file into the local
* properties object.
+ *
* @param file a reference to the configuration file to load.
* @return a hashtable containing all properties extracted from the
* specified file.
- *
* @throws IOException if the specified file does not exist
* @throws XMLException if there is a problem with the file syntax.
*/
@@ -315,8 +346,20 @@ public class XMLConfigurationStore
newNode.setAttribute(SYSTEM_ATTRIBUTE_NAME, SYSTEM_ATTRIBUTE_TRUE);
}
- /*
- * Implements ConfigurationStore#reloadConfiguration(File).
+ /**
+ * Implements {@link ConfigurationStore#reloadConfiguration(File)}. Removes
+ * all property name-value associations currently present in this
+ * <tt>ConfigurationStore</tt> and deserializes new property name-value
+ * associations from a specific <tt>File</tt> which presumably is in the
+ * format represented by this instance.
+ *
+ * @param file the <tt>File</tt> to be read and to deserialize new property
+ * name-value associations from into this instance
+ * @throws IOException if there is an input error while reading from the
+ * specified <tt>file</tt>
+ * @throws XMLException if parsing the contents of the specified
+ * <tt>file</tt> fails
+ * @see ConfigurationStore#reloadConfiguration(File)
*/
public void reloadConfiguration(File file)
throws IOException,
@@ -328,8 +371,16 @@ public class XMLConfigurationStore
properties.putAll(fileExtractedProperties);
}
- /*
- * Implements ConfigurationStore#removeProperty(String).
+ /**
+ * Implements {@link ConfigurationStore#removeProperty(String)}. Removes the
+ * value association in this <tt>ConfigurationStore</tt> of the property
+ * with a specific name. If the property with the specified name is not
+ * associated with a value in this <tt>ConfigurationStore</tt>, does
+ * nothing.
+ *
+ * @param propertyName the name of the property which is to have its value
+ * association in this <tt>ConfigurationStore</tt> removed
+ * @see ConfigurationStore#removeProperty(String)
*/
public void removeProperty(String propertyName)
{
@@ -338,24 +389,47 @@ public class XMLConfigurationStore
fileExtractedProperties.remove(propertyName);
}
- /*
- * Implements ConfigurationStore#setNonSystemProperty(String, Object).
+ /**
+ * Implements
+ * {@link ConfigurationStore#setNonSystemProperty(String, Object)}. Sets the
+ * value of a non-system property with a specific name to a specific value
+ * in this <tt>ConfigurationStore</tt>.
+ *
+ * @param propertyName the name of the non-system property to be set to the
+ * specified value in this <tt>ConfigurationStore</tt>
+ * @param property the value to be assigned to the non-system property with the
+ * specified name in this <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#setNonSystemProperty(String, Object)
*/
public void setNonSystemProperty(String propertyName, Object property)
{
properties.put(propertyName, property);
}
- /*
- * Implements ConfigurationStore#setSystemProperty(String).
+ /**
+ * Implements {@link ConfigurationStore#setSystemProperty(String)}. Sets a
+ * property with a specific name to be considered a system property by the
+ * <tt>ConfigurationStore</tt>.
+ *
+ * @param propertyName the name of the property to be set as a system
+ * property in this <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#setSystemProperty(String)
*/
public void setSystemProperty(String propertyName)
{
setNonSystemProperty(propertyName, new PropertyReference(propertyName));
}
- /*
- * Implements ConfigurationStore#storeConfiguration(OutputStream).
+ /**
+ * Implements {@link ConfigurationStore#storeConfiguration(OutputStream)}.
+ * Stores/serializes the property name-value associations currently present
+ * in this <tt>ConfigurationStore</tt> into a specific <tt>OutputStream</tt>
+ * in the format represented by this instance.
+ *
+ * @param out the <tt>OutputStream</tt> to receive the serialized form of
+ * the property name-value associations currently present in this
+ * <tt>ConfigurationStore</tt>
+ * @see ConfigurationStore#storeConfiguration(OutputStream)
*/
public void storeConfiguration(OutputStream out)
{