001: /* Copyright 2004 The JA-SIG Collaborative. All rights reserved.
002: * See license distributed with this file and
003: * available online at http://www.uportal.org/license.html
004: */
005:
006: package org.jasig.portal;
007:
008: import org.jasig.portal.properties.BadPropertyException;
009: import org.jasig.portal.properties.MissingPropertyException;
010:
011: /**
012: * Deprecated PropertiesManager.
013: * This class still exists here at org.jasig.portal.PropertiesManager in order to delegate all requests to the
014: * real PropertiesManager at org.jasig.portal.properties.PropertiesManager so as not to break backwards compatibility.
015: * Pre 2.4 code which imports this old PropertiesManager should still work great.
016: * However, note that there is new functionality to be had from the new PropertiesManager in the form of reporting
017: * of missing properties and methods which take default values.
018: * Please change your imports to import the new PropertiesManager.
019: * Presumably this deprecated class will disappear in a future uPortal release.
020: * @author andrew.petro@yale.edu - deprecated and moved. see org.jasig.portal.properties.PropertiesManager
021: * @version $Revision: 34814 $ $Date: 2004-10-17 14:40:26 -0700 (Sun, 17 Oct 2004) $
022: * @since uPortal 2.0
023: * @deprecated since uPortal 2.4, this class has moved to org.jasig.portal.properties
024: */
025: public class PropertiesManager {
026:
027: /**
028: * Returns the value of a property for a given name.
029: * @param name the name of the requested property
030: * @return value the value of the property matching the requested name
031: * @throws MissingPropertyException - if the requested property cannot be found
032: */
033: public static String getProperty(String name)
034: throws MissingPropertyException {
035: return org.jasig.portal.properties.PropertiesManager
036: .getProperty(name);
037: }
038:
039: /**
040: * Returns the value of a property for a given name
041: * including whitespace trailing the property value, but not including
042: * whitespace leading the property value.
043: * @param name the name of the requested property
044: * @return value the value of the property matching the requested name
045: * @throws MissingPropertyException - (undeclared) if the requested property is not found
046: */
047: public static String getPropertyUntrimmed(String name)
048: throws MissingPropertyException {
049: return org.jasig.portal.properties.PropertiesManager
050: .getPropertyUntrimmed(name);
051: }
052:
053: /**
054: * Returns the value of a property for a given name.
055: * This method can be used if the property is boolean in
056: * nature and you want to make sure that <code>true</code> is
057: * returned if the property is set to "true", "yes", "y", or "on"
058: * (regardless of case),
059: * and <code>false</code> is returned in all other cases.
060: * @param name the name of the requested property
061: * @return value <code>true</code> if property is set to "true", "yes", "y", or "on" regardless of case, otherwise <code>false</code>
062: * @throws MissingPropertyException - when no property of the given name is declared.
063: */
064: public static boolean getPropertyAsBoolean(String name)
065: throws MissingPropertyException {
066: return org.jasig.portal.properties.PropertiesManager
067: .getPropertyAsBoolean(name);
068: }
069:
070: /**
071: * Returns the value of a property for a given name as a <code>byte</code>
072: * @param name the name of the requested property
073: * @return value the property's value as a <code>byte</code>
074: * @throws MissingPropertyException - if the property is not set
075: * @throws BadPropertyException - if the property cannot be parsed as a byte
076: */
077: public static byte getPropertyAsByte(String name)
078: throws MissingPropertyException, BadPropertyException {
079: return org.jasig.portal.properties.PropertiesManager
080: .getPropertyAsByte(name);
081: }
082:
083: /**
084: * Returns the value of a property for a given name as a <code>short</code>
085: * @param name the name of the requested property
086: * @return value the property's value as a <code>short</code>
087: * @throws MissingPropertyException - if the property is not set
088: * @throws BadPropertyException - if the property cannot be parsed as a short or is not set.
089: */
090: public static short getPropertyAsShort(String name)
091: throws MissingPropertyException, BadPropertyException {
092: return org.jasig.portal.properties.PropertiesManager
093: .getPropertyAsShort(name);
094: }
095:
096: /**
097: * Returns the value of a property for a given name as an <code>int</code>
098: * @param name the name of the requested property
099: * @return value the property's value as an <code>int</code>
100: * @throws MissingPropertyException - if the property is not set
101: * @throws BadPropertyException - if the property cannot be parsed as an int
102: */
103: public static int getPropertyAsInt(String name)
104: throws MissingPropertyException, BadPropertyException {
105: return org.jasig.portal.properties.PropertiesManager
106: .getPropertyAsInt(name);
107: }
108:
109: /**
110: * Returns the value of a property for a given name as a <code>long</code>
111: * @param name the name of the requested property
112: * @return value the property's value as a <code>long</code>
113: * @throws MissingPropertyException - if the property is not set
114: * @throws BadPropertyException - if the property cannot be parsed as a long
115: */
116: public static long getPropertyAsLong(String name)
117: throws MissingPropertyException, BadPropertyException {
118: return org.jasig.portal.properties.PropertiesManager
119: .getPropertyAsLong(name);
120: }
121:
122: /**
123: * Returns the value of a property for a given name as a <code>float</code>
124: * @param name the name of the requested property
125: * @return value the property's value as a <code>float</code>
126: * @throws MissingPropertyException - if the property is not set
127: * @throws BadPropertyException - if the property cannot be parsed as a float
128: */
129: public static float getPropertyAsFloat(String name)
130: throws MissingPropertyException, BadPropertyException {
131: return org.jasig.portal.properties.PropertiesManager
132: .getPropertyAsFloat(name);
133: }
134:
135: /**
136: * Returns the value of a property for a given name as a <code>long</code>
137: * @param name the name of the requested property
138: * @return value the property's value as a <code>double</code>
139: * @throws MissingPropertyException - if the property has not been set
140: * @throws BadPropertyException - if the property cannot be parsed as a double or is not set.
141: */
142: public static double getPropertyAsDouble(String name)
143: throws MissingPropertyException, BadPropertyException {
144: return org.jasig.portal.properties.PropertiesManager
145: .getPropertyAsDouble(name);
146: }
147: }
|