tauZaman
v0.1

tauzaman.property
Class PropertyManager

java.lang.Object
  |
  +--tauzaman.property.PropertyManager

public class PropertyManager
extends java.lang.Object

PropertyManager class manages user specific set of Properties. Each TauZaman user (remote or local) will have his/her own PropertyManager.

See Also:
Property, PropertyStackService
Status:
design complete, implementation complete

Field Summary
private  java.net.URL defaultPropertyListUrl
          Url of default property list.
private  PropertyRepository pr
          Unique PropertyRepository of this TauZaman system
private  PropertyStackService propertyStackService
          Service that provides operations on active properties
 
Constructor Summary
PropertyManager(PropertyRepository pr, java.net.URL url)
          Constructs a PropertyManager object and initializes the default property list.
 
Method Summary
 Property getProperty(java.lang.String name)
          Returns the active Property given its name.
 Property getProperty(java.net.URL url, java.lang.String name)
          Loads Properties without activating it.
 java.lang.String getPropertyImage(java.lang.String name)
          Gets all the current Property information of a specific Property name in a String.
 void propertyActivate(java.net.URL url, java.lang.String[] names)
          Inserts a new Property(possibly Properties, given by url) to property structure, which is handled by PropertyStackService and activates it.
 void propertyDeactivate(java.lang.String name)
          Deactivates a Property (given by its name) and removes it from property list, which is managed by PropertyStackService.
 void propertyDeactivateAll()
          Deactivates any active properties and removes them from PropertyStackService.
private  void propertyDefaultListInit()
          Initializes this PropertyManager with a default property list.
 void propertySetDefault(java.lang.String name)
          Sets Property (given by its name) to its default value.
 void propertySetDefaultAll()
          Sets all active Properties to their default values.
 java.lang.String toString()
          Returns this PropertyManager's default property list URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

propertyStackService

private PropertyStackService propertyStackService
Service that provides operations on active properties


defaultPropertyListUrl

private java.net.URL defaultPropertyListUrl
Url of default property list.


pr

private PropertyRepository pr
Unique PropertyRepository of this TauZaman system

Constructor Detail

PropertyManager

public PropertyManager(PropertyRepository pr,
                       java.net.URL url)
                throws PropertyFormationException
Constructs a PropertyManager object and initializes the default property list.

Parameters:
url - url of a default Property table, which this manager starts with
Throws:
PropertyFormationException - if any problem occurs when parsing the property specification file
Method Detail

propertyDefaultListInit

private void propertyDefaultListInit()
                              throws PropertyFormationException
Initializes this PropertyManager with a default property list.

Throws:
PropertyFormationException - if any problem occurs when parsing the property specification file

getProperty

public Property getProperty(java.net.URL url,
                            java.lang.String name)
                     throws PropertyFormationException,
                            PropertyServiceException
Loads Properties without activating it. This method is unique to Input and Output.

Parameters:
url - URL of Property Specification file
name - string name of Property to be loaded.
Throws:
PropertyFormationException - if any problem occurs when parsing the property specification file
PropertyServiceException

propertyActivate

public void propertyActivate(java.net.URL url,
                             java.lang.String[] names)
                      throws PropertyFormationException
Inserts a new Property(possibly Properties, given by url) to property structure, which is handled by PropertyStackService and activates it. First property with the given names in the file pointed by given url will be activated. If all Properties in the file pointed by URL will be activated, then pass null as names.

Parameters:
url - URL of Property Specification file
names - array of Property names to be activated
Throws:
PropertyFormationException - if any problem occurs when parsing the property specification file

propertyDeactivateAll

public void propertyDeactivateAll()
Deactivates any active properties and removes them from PropertyStackService. With an exception: It will not deactivate or remove any default property, so any attempt will only succeed to deactivate and remove only non-default active properties.


propertyDeactivate

public void propertyDeactivate(java.lang.String name)
                        throws PropertyServiceException
Deactivates a Property (given by its name) and removes it from property list, which is managed by PropertyStackService. If the active Property is the default Property, then keep silent.

Parameters:
name - name of a Property
Throws:
PropertyServiceException - if any abnormal condition occurs when deactivating active Property with given name

propertySetDefaultAll

public void propertySetDefaultAll()
Sets all active Properties to their default values.


propertySetDefault

public void propertySetDefault(java.lang.String name)
                        throws PropertyServiceException
Sets Property (given by its name) to its default value. If the Property already has its default value active, then keep silent.

Parameters:
name - name of the Property
Throws:
PropertyServiceException - if any abnormal condition occurs when setting active Property, with given name, to its default value

getProperty

public Property getProperty(java.lang.String name)
                     throws PropertyServiceException
Returns the active Property given its name.

Parameters:
name - String name of a Property
Returns:
Property with the given name.
Throws:
PropertyServiceException - if any abnormal condition occurs when setting active Property, with given name, to its default value

getPropertyImage

public java.lang.String getPropertyImage(java.lang.String name)
                                  throws PropertyServiceException
Gets all the current Property information of a specific Property name in a String. Format of the return string is; {urlOfProperty}%{urOfProperty}%....%{urlOfProperty} order is same as of Property stack from bottom to top.

Parameters:
name - String name of a Property
Returns:
a String containing current Properties activated for a specific Property name
Throws:
PropertyServiceException - if any abnormal condition occurs when getting the image of Property stack given its name

toString

public java.lang.String toString()
Returns this PropertyManager's default property list URL.

Overrides:
toString in class java.lang.Object
Returns:
String representations of default URL

tauZaman
v0.1

Submit a bug or feature

tauZaman is an open-source, publicly avaliable project