0001: package com.salmonllc.properties;
0002:
0003: /////////////////////////
0004: //$Archive: /SOFIA/SourceCode/com/salmonllc/properties/Props.java $
0005: //$Author: Dan $
0006: //$Revision: 130 $
0007: //$Modtime: 11/08/04 1:39p $
0008: /////////////////////////
0009:
0010: import java.util.*;
0011: import java.io.*;
0012: import java.awt.*;
0013:
0014: import com.salmonllc.util.*;
0015:
0016: /**
0017: * This object is used to get properties from files that describe the attributes of the system. <BR>
0018: * There are three types of properties files. <BR>
0019: * The System properties file is called System.properties and contains the default properties for every application on the server.<BR><BR>
0020: * Application property files follow the naming convention [application name].properties. They contain default properties for particular applications which override the System properties<BR><BR>
0021: * Unit property files follow the naming convention [application name]_[unitname].properties. They contain default properties for particular units (html pages) for particular application. These override both the application properties and the System properties.<BR><BR>
0022:
0023: */
0024:
0025: public class Props {
0026: //private static PropsDescriptor _systemProps;
0027: private static HashMap _appProps = new HashMap();
0028:
0029: private Properties _system;
0030: private Properties _application;
0031: private Properties _unit;
0032: private static boolean _displayBanner = (System
0033: .getProperty("salmon.mode.silent") == null);
0034: //private static boolean _displayBanner = true;
0035:
0036: private static String PROPS_DIR;
0037: public static final String SYS_PROPS_DIR_PROPERTY = "salmon.props.path";
0038: public static final String SYS_APP_PACKAGE = "ApplicationPackage";
0039: public static final String SYS_DEFAULT_APP = "DefaultApplication";
0040: public static final String SYS_DEFAULT_PAGE = "DefaultPage";
0041: public static final String SYS_OBJECTSTORE_PATH = "ObjectStorePath";
0042: public static final String SYS_OBJECTSTORE_URL = "ObjectStoreURL";
0043: public static final String SYS_HISTORY_FIX = "HistoryFix";
0044: public static final String SYS_SCHEDULE_OBJECT = "ScheduleObject";
0045: public static final String SYS_SCHEDULE_INTERVAL = "ScheduleIntervalMinutes";
0046: public static final String SYS_SCHEDULER_MAX_OBJECTS = "SchedulerMaxObjects";
0047: public static final String SYS_SCHEDULE_APPLICATION = "ScheduleApplication";
0048:
0049: public static final String SYS_DATASERVER_SECURITY = "DataServerSecurity";
0050: public static final String SYS_REMOTEREFLECTOR_SECURITY_MANAGER = "RemoteReflectorSecurityManager";
0051: public static final String SYS_OBJECTSTORE_CACHE_SIZE = "ObjectStoreCacheSize";
0052: public static final String SYS_OBJECTSTORE_CACHE_IDLE_TIME_OUT = "ObjectStoreCacheIdleTimeOut";
0053: public static final String SYS_OBJECTSTORE_USE_CACHE = "ObjectStoreUseCache";
0054: public static final String SYS_SECURE_SCHEME = "SecureScheme";
0055: public static final String SYS_SECURE_PORT = "SecurePort";
0056: public static final String SYS_UNSECURE_SCHEME = "UnSecureScheme";
0057: public static final String SYS_UNSECURE_PORT = "UnSecurePort";
0058: public static final String SYS_LOCALHOST = "LocalHost";
0059: public static final String SYS_CACHE_CONTROLLERS = "CacheJSPControllers";
0060: public static final String SYS_REPLACE_JSP_FACTORY = "ReplaceJSPFactory";
0061: public static final String SYS_INFO_SERVLETS = "ViewInfoServlets";
0062: public static final String SYS_RECORD_PAGE_TIMERS = "RecordPageTimers";
0063: public static final String SYS_ABSOLUTE_URLS_TO_RELATIVE_ON_REDIRECT = "AbsoluteURLSToRelativeOnRedirect";
0064: public static final String SYS_MESSAGELOG_LOGGER_CLASS = "MessageLogLoggerClass";
0065: public static final String SYS_MESSAGELOG_LOGGER_CONFIG_FILE = "MessageLogLoggerConfigFile";
0066: public static final String SYS_ENABLE_CODE_GENERATION = "EnableCodeGeneration";
0067: public static final String SYS_SESSION_KEEP_ALIVE_MINUTES = "SessionKeepAliveMinutes";
0068: public static final String SYS_INCLUDE_ID_AFTER_POST = "IncludeIDAfterPost";
0069:
0070: public static final String DB_POOL = "DBPool";
0071: public static final String DB_DRIVER = "DBDriver";
0072: public static final String DB_URL = "DBURL";
0073: public static final String DB_USER = "DBUser";
0074: public static final String DB_PASSWORD = "DBPassword";
0075: public static final String DB_DEFAULT = "DBDefaultProfile";
0076: public static final String DB_DBMS = "DBDBMS";
0077: public static final String DB_MAX_CONNECTIONS = "MaxConnections";
0078: public static final String DB_WAIT_TIME_OUT = "WaitTimeOut";
0079: public static final String DB_IDLE_TIME_OUT = "IdleTimeOut";
0080: public static final String DB_NAME = "DBName";
0081: public static final String DB_VERIFY_CONNECTION = "DBVerifyConnection";
0082: public static final String DB_VERIFY_CONNECTION_STATEMENT = "DBVerifyConnectionStatement";
0083: public static final String DB_VERIFY_CONNECTION_MAXAGE = "DBVerifyConnectionMaxAge";
0084: public static final String DB_PARMS = "DBParms";
0085:
0086: public static final String DBMSTYPE_SYBASE = "Sybase";
0087: public static final String DBMSTYPE_SQLANYWHERE = "SQLAnywhere";
0088: public static final String DBMSTYPE_MSSQLSERVER = "MSSQLServer";
0089: public static final String DBMSTYPE_DB2 = "DB2";
0090: public static final String DBMSTYPE_DB2VSE = "DB2VSE";
0091: public static final String DBMSTYPE_DB2MVS = "DB2MVS";
0092: public static final String DBMSTYPE_DB2400 = "DB2400";
0093: public static final String DBMSTYPE_ORACLE = "ORACLE";
0094: public static final String DBMSTYPE_MYSQL = "MYSQL";
0095: public static final String DBMSTYPE_INGRES = "INGRES";
0096: public static final String DBMSTYPE_FIREBIRDSQL = "FireBirdSQL";
0097: public static final String DBMSTYPE_POSTGRES = "POSTGRES";
0098: public static final String DBMSTYPE_ANSISQL92 = "ANSISQL92";
0099: public static final String DBMSTYPE_HIBERNATE = "HIBERNATE";
0100:
0101: public static final String TABLE_BORDER = "TableBorder";
0102: public static final String TABLE_CELLSPACING = "TableCellSpacing";
0103: public static final String TABLE_CELLPADDING = "TableCellPadding";
0104: public static final String TABLE_BACKGROUND_COLOR = "TableBackgroundColor";
0105:
0106: public static final String DATA_TABLE_BORDER = "DataTableBorder";
0107: public static final String DATA_TABLE_CELLSPACING = "DataTableCellSpacing";
0108: public static final String DATA_TABLE_CELLPADDING = "DataTableCellPadding";
0109: public static final String DATA_TABLE_BACKGROUND_COLOR = "DataTableBackgroundColor";
0110: public static final String DATA_TABLE_HEADING_BACKGROUND_COLOR = "DataTableHeadingBackgroundColor";
0111: public static final String DATA_TABLE_ROW_BACKGROUND_COLOR_1 = "DataTableRowBackgroundColor1";
0112: public static final String DATA_TABLE_ROW_BACKGROUND_COLOR_2 = "DataTableRowBackgroundColor2";
0113: public static final String DATA_TABLE_ROWS_PER_PAGE = "DataTableRowPerPage";
0114: public static final String DATA_TABLE_MAX_PAGE_BUTTONS = "DataTableMaxPageButtons";
0115: public static final String DATA_TABLE_CLICK_SORT = "DataTableClickSort";
0116: public static final String DATA_TABLE_SCROLL_ON_CLICK_SORT = "DataTableScrollOnClickSort";
0117: public static final String DATA_TABLE_PAGE_SELECT_RENDERER = "DataTablePageSelectRenderer";
0118: public static final String DATA_TABLE_ROWS_PER_PAGE_RENDERER = "DataTableRowsPerPageRenderer";
0119:
0120: public static final String BOX_LINE_WIDTH = "BoxLineWidth";
0121: public static final String BOX_LINE_COLOR = "BoxLineColor";
0122: public static final String BOX_BG_COLOR = "BoxBgColor";
0123: public static final String BOX_MARGIN = "BoxMargin";
0124:
0125: public static final String CONTAINER_CLASS = "ContainerClass";
0126:
0127: public static final String DISPLAY_BOX_BORDER = "DisplayBoxBorder";
0128: public static final String DISPLAY_BOX_BACKGROUND_COLOR = "DisplayBoxBackgroundColor";
0129: public static final String DISPLAY_BOX_HEADING_BACKGROUND_COLOR = "DisplayBoxHeadingBackgroundColor";
0130: public static final String DISPLAY_BOX_CELLSPACING = "DisplayBoxCellSpacing";
0131: public static final String DISPLAY_BOX_CELLPADDING = "DisplayBoxCellPadding";
0132:
0133: public static final String DATE_COMPONENT_DISPLAY_FORMAT = "DateComponentDisplayFormat";
0134:
0135: public static final String FONT_DEFAULT = "DefaultFont";
0136: public static final String FONT_TEXT_EDIT = "TextEditFont";
0137: public static final String FONT_DDLB = "DDLBFont";
0138: public static final String FONT_BUTTON = "ButtonFont";
0139: public static final String FONT_PAGE_HEADING = "PageHeadingFont";
0140: public static final String FONT_SECTION_HEADING = "SectionHeadingFont";
0141: public static final String FONT_TABLE_HEADING = "TableHeadingFont";
0142: public static final String FONT_COLUMN_CAPTION = "ColumnCaptionFont";
0143: public static final String FONT_EMPHASIS = "EmphasisFont";
0144: public static final String FONT_DISPLAY_BOX_HEADING = "DisplayBoxHeadingFont";
0145: public static final String FONT_LINK = "LinkFont";
0146: public static final String FONT_LARGE_LINK = "LargeLinkFont";
0147: public static final String FONT_ERROR = "ErrorFont";
0148: public static final String FONT_SMALL = "SmallFont";
0149: public static final String FONT_DEFAULT_LABEL_TEXT = "DefaultLabelTextFont";
0150: public static final String FONT_DEFAULT_DISPLAY_DATA = "DefaultDisplayDataFont";
0151:
0152: public static final String TAG_START = ".StartTag";
0153: public static final String TAG_END = ".EndTag";
0154:
0155: public static final String PAGE_BACKGROUND_COLOR = "PageBackgroundColor";
0156: public static final String PAGE_BACKGROUND = "PageBackground";
0157: public static final String PAGE_TEXT_COLOR = "PageTextColor";
0158: public static final String PAGE_LINK_COLOR = "PageLinkColor";
0159: public static final String PAGE_HOVER_LINK_COLOR = "PageHoverLinkColor";
0160: public static final String PAGE_VISITED_LINK_COLOR = "PageVisitedLinkColor";
0161: public static final String PAGE_ACTIVE_LINK_COLOR = "PageActiveLinkColor";
0162: public static final String PAGE_MARGINWIDTH = "PageMarginWidth";
0163: public static final String PAGE_MARGINHEIGHT = "PageMarginHeight";
0164: public static final String PAGE_LEFTMARGIN = "PageLeftMargin";
0165: public static final String PAGE_TOPMARGIN = "PageTopMargin";
0166: public static final String PAGE_RIGHTMARGIN = "PageRightMargin";
0167:
0168: public static final String DATE_FORMAT = "DateFormat";
0169: public static final String TIME_FORMAT = "TimeFormat";
0170: public static final String DATETIME_FORMAT = "DateTimeFormat";
0171: public static final String CURRENCY_FORMAT = "CurrencyFormat";
0172: public static final String EMAIL_SMTP_SERVER = "EMailSMTPServer";
0173: public static final String EMAIL_SMTP_PORT = "EMailSMTPPort";
0174:
0175: public static final String LOG_ERRORS = "LogErrors";
0176: public static final String LOG_ASSERTIONS = "LogAssertions";
0177: public static final String LOG_INFO = "LogInfoMessages";
0178: public static final String LOG_DEBUG = "LogDebugMessages";
0179: public static final String LOG_SQL = "LogSQLStatements";
0180: public static final String LOG_ERRORS_TO_CONSOLE = "LogErrorsToConsole";
0181: public static final String LOG_ASSERTIONS_TO_CONSOLE = "LogAssertionsToConsole";
0182: public static final String LOG_INFO_TO_CONSOLE = "LogInfoMessagesToConsole";
0183: public static final String LOG_DEBUG_TO_CONSOLE = "LogDebugMessagesToConsole";
0184: public static final String LOG_SQL_TO_CONSOLE = "LogSQLStatementsToConsole";
0185: public static final String LOG_FILE_NAME = "LogFileName";
0186: public static final String LOG_FILE_SIZE_LIMIT = "LogFileSizeLimit";
0187: public static final String LOG_FILE_EXT = "LogFileExt";
0188: public static final String LOG_FILE_APPEND_DATE = "LogFileAppendDate";
0189: public static final String LOG_HIDE_THREAD = "LogHideThread";
0190: public static final String LOG_HIDE_TIME = "LogHideTime";
0191:
0192: public static final int LOG_LEVEL_1 = 1;
0193: public static final int LOG_LEVEL_2 = 2;
0194: public static final int LOG_LEVEL_3 = 3;
0195: public static final int LOG_LEVEL_4 = 4;
0196: public static final int LOG_LEVEL_5 = 5;
0197: public static final int LOG_LEVEL_6 = 6;
0198: public static final int LOG_LEVEL_7 = 7;
0199: public static final int LOG_LEVEL_8 = 8;
0200: public static final int LOG_LEVEL_9 = 9;
0201: public static final int LOG_LEVEL_10 = 10;
0202:
0203: public static final String TAB_COLOR = "TabColor";
0204: public static final String TAB_ACTIVE_COLOR = "TabActiveColor";
0205: public static final String TAB_FONT_START_TAG = "TabFont.StartTag";
0206: public static final String TAB_FONT_END_TAG = "TabFont.EndTag";
0207: public static final String TAB_ACTIVE_FONT_START_TAG = "TabActiveFont.StartTag";
0208: public static final String TAB_ACTIVE_FONT_END_TAG = "TabActiveFont.EndTag";
0209: public static final String TAB_LEFT_IMAGE = "TabLeftImage";
0210: public static final String TAB_RIGHT_IMAGE = "TabRightImage";
0211: public static final String TAB_BORDER_IMAGE = "TabBorderImage";
0212: public static final String TAB_HEIGHT = "TabHeight";
0213: public static final String ALL_TAB_WIDTH = "TotalWidth";
0214: public static final String TAB_SHOW_STRIPE = "TabShowStripe";
0215:
0216: public static final String CAL_HEADING_BACKGROUND_COLOR = "CalendarHeadingBackgroundColor";
0217: public static final String CAL_HEADING_FOREGROUND_COLOR = "CalendarHeadingForegroundColor";
0218: public static final String CAL_WEEK_BACKGROUND_COLOR = "CalendarWeekBackgroundColor";
0219: public static final String CAL_WEEK_FOREGROUND_COLOR = "CalendarWeekForegroundColor";
0220: public static final String CAL_DAY_BACKGROUND_COLOR = "CalendarDayBackgroundColor";
0221: public static final String CAL_DAY_FOREGROUND_DEEMPHISIS = "CalendarDayForegroundDeEmphisis";
0222: public static final String CAL_DAY_FOREGROUND_NORMAL = "CalendarDayForegroundNormal";
0223: public static final String CAL_DAY_FOREGROUND_CURRENT = "CalendarDayForegroundCurrent";
0224: public static final String CAL_FONT_FACE = "CalendarFontFace";
0225: public static final String CAL_FONT_LARGE = "CalendarLargeFontSize";
0226: public static final String CAL_FONT_SMALL = "CalendarSmallFontSize";
0227:
0228: public static final String RADIOBUTTON_IMAGE_ON = "RadioButtonImageOn";
0229: public static final String RADIOBUTTON_IMAGE_OFF = "RadioButtonImageOff";
0230: public static final String CHECKBOX_IMAGE_ON = "CheckBoxImageOn";
0231: public static final String CHECKBOX_IMAGE_OFF = "CheckBoxImageOff";
0232: public static final String TRISTATECHECKBOX_DISABLED_IMAGE_CHECKED = "TriStateCheckBoxDisabledImageChecked";
0233: public static final String TRISTATECHECKBOX_DISABLED_IMAGE_UNCHECKED = "TriStateCheckBoxDisabledImageUnChecked";
0234: public static final String TRISTATECHECKBOX_DISABLED_IMAGE_MIXED = "TriStateCheckBoxDisabledImageMixed";
0235: public static final String TRISTATECHECKBOX_IMAGE_CHECKED = "TriStateCheckBoxImageChecked";
0236: public static final String TRISTATECHECKBOX_IMAGE_UNCHECKED = "TriStateCheckBoxImageUnChecked";
0237: public static final String TRISTATECHECKBOX_IMAGE_MIXED = "TriStateCheckBoxImageMixed";
0238:
0239: public static final String SUBMIT_IMAGE_FONT_STYLE = "SubmitImageFontStyle";
0240: public static final String SUBMIT_IMAGE_FONT_FACE = "SubmitImageFontFace";
0241: public static final String SUBMIT_IMAGE_FONT_SIZE = "SubmitImageFontSize";
0242: public static final String SUBMIT_IMAGE_BACKGROUND_COLOR = "SubmitImageBackgroundColor";
0243: public static final String SUBMIT_IMAGE_TEXT_COLOR = "SubmitImageTextColor";
0244: public static final String SUBMIT_IMAGE_TOPLEFT_BORDER_COLOR = "SubmitImageTopLeftBorderColor";
0245: public static final String SUBMIT_IMAGE_BOTTOMRIGHT_BORDER_COLOR = "SubmitImageBottomRightBorderColor";
0246: public static final String SUBMIT_IMAGE_TRANSPARENT_COLOR = "SubmitImageTransparentColor";
0247: public static final String SUBMIT_IMAGE_STYLE = "SubmitImageStyle";
0248: public static final String SUBMIT_IMAGE_DEFAULT_HEIGHT = "SubmitImageDefaultHeight";
0249:
0250: public static final String TEXTEDIT_FORCE_CASE = "TextEditForceCase";
0251: public static final String USE_DISABLED_ATTRIBUTE = "UseDisabledAttribute";
0252:
0253: public static final String SKIP_SECUREID = "SkipSecureID";
0254: public static final String DB_DATASOURCE = "DataSource";
0255:
0256: public static final String TLD_JAR = "TLDJar";
0257: public static final String TLD_PATH = "TLDPath";
0258: public static final String JSP_ENGINE_DEBUG_INPUT_FILE = "JSPEngineDebugInputFile";
0259: public static final String JSP_ENGINE_DEBUG_OUTPUT_FILE = "JSPEngineDebugOutputFile";
0260:
0261: public static final String XML_DATA_PATH = "XMLDataPath";
0262:
0263: public static final String WINWORD_PATH = "WinWordPath";
0264: public static final String WINWORD_TEMPLATE_PATH = "WinWordTemplatePath";
0265:
0266: public static final String IDE_DEFAULT_HOST = "IDEDefaultHost";
0267: public static final String IDE_TOMCAT_MANAGER_APP = "IDETomcatManagerApplication";
0268: public static final String IDE_TOMCAT_PATH = "IDETomcatPath";
0269: public static final String IDE_INTELLIJ_PATH = "IDEIntelliJPath";
0270: public static final String IDE_WEB_APP = "IDEDefaultWebApplication";
0271: public static final String IDE_BROWSER_PATH = "IDEBrowserPath";
0272: public static final String IDE_DEFAULT_RUN_URL = "IDEDefaultRunURL";
0273: public static final String IDE_DREAMWEAVER_PATH = "IDEDreamWeaverPath";
0274: public static final String IDE_DEFAULT_SOURCE_PATH = "IDEDefaultSourcePath";
0275: public static final String IDE_DEFAULT_FRAMEWORK_APP = "IDEDefaultFrameworkApplication";
0276: public static final String IDE_SERVER_TYPE = "IDEServerType";
0277: public static final String IDE_WEBLOGIC_APPLICATION_PATH = "IDEWeblogicApplicationPath";
0278: public static final String IDE_FRAMEWORK_SOURCE_PATH = "IDEFrameworkSourcePath";
0279: public static final String IDE_FRAMEWORK_RESOURCES_PATH = "IDEFrameworkResourcesPath";
0280: public static final String IDE_CLASSPATH = "IDEClassPath";
0281: public static final String IDE_LIBPATH = "IDELibraryPath";
0282: public static final String IDE_VMARGS = "IDEVMArgs";
0283: public static final String IDE_SERVER_CONFIG_FILE = "IDEConfigFile";
0284: public static final String IDE_WORKING_DIRECTORY = "IDEWorkingDirectory";
0285: public static final String IDE_SERVER_MANAGER_ID = "IDEServerManagerID";
0286: public static final String IDE_SERVER_MANAGER_PW = "IDEServerManagerPassword";
0287: public static final String IDE_SITE_MAP_INTERFACE = "IDESiteMapInterface";
0288: public static final String IDE_APP_PROPS_PATH = "IDEApplicationPropsPath";
0289: public static final String IDE_USE_APP_PROPERTIES = "IDEUseApplicationProperties";
0290: public static final String IDE_ECLIPSE_VM = "IDEEclipseVM";
0291: public static final String IDE_ECLIPSE_PLUGIN_JAR = "IDEEclipsePlugInJar";
0292:
0293: public static final String WML_MAINTAIN_SESSIONS = "WMLMaintainSessions";
0294: public static final String WML_SESSION_KEY_LENGTH = "WMLSessionKeyLength";
0295:
0296: public static final String LOCALE_TABLE = "LocaleTable";
0297: public static final String LOCALE_APP_COLUMN = "LocaleAppColumn";
0298: public static final String LOCALE_LANG_COLUMN = "LocaleLangColumn";
0299: public static final String LOCALE_KEY_COLUMN = "LocaleKeyColumn";
0300: public static final String LOCALE_RESOURCE_COLUMN = "LocaleResourceColumn";
0301: public static final String LOCALE_DB_PROFILE = "LocaleDBProfile";
0302: public static final String LOCALIZER_CLASS = "LocalizerClass";
0303: public static final String LOCALIZER_USE_CACHE = "LocalizerUseCache";
0304:
0305: public static final String NAVBAR_BG_COLOR = "NavBarBgColor";
0306: public static final String NAVBAR_ALIGN = "NavBarAlign";
0307: public static final String NAVBAR_BORDER = "NavBarBorder";
0308: public static final String NAVBAR_CELLPADDING = "NavBarCellPadding";
0309: public static final String NAVBAR_CELLSPACING = "NavBarCellSpacing";
0310: public static final String NAVBAR_H_SPACE = "NavBarHSpace";
0311: public static final String NAVBAR_V_SPACE = "NavBarVSpace";
0312: public static final String NAVBAR_HEIGHT = "NavBarHeight";
0313: public static final String NAVBAR_WIDTH = "NavBarWidth";
0314: public static final String NAVBAR_HREF_STYLE = "NavBarHrefStyle";
0315: public static final String NAVBAR_HOVER_STYLE = "NavBarHoverStyle";
0316: public static final String NAVBAR_TEXT_STYLE = "NavBarTextStyle";
0317: public static final String NAVBAR_SELECTED_STYLE = "NavBarSelectedStyle";
0318: public static final String NAVBAR_SELECTED_HOVER_STYLE = "NavBarSelectedHoverStyle";
0319: public static final String NAVBAR_SHOW_POPUP_STYLE = "NavBarShowPopupStyle";
0320: public static final String NAVBAR_SHOW_POPUP_HOVER_STYLE = "NavBarShowPopupHoverStyle";
0321: public static final String NAVBAR_SHOW_POPUP_SELECTED_STYLE = "NavBarShowPopupSelectedStyle";
0322: public static final String NAVBAR_SHOW_POPUP_SELECTED_HOVER_STYLE = "NavBarShowPopupSelectedHoverStyle";
0323: public static final String NAVBAR_CELL_BG_COLOR = "NavBarCellBgColor";
0324: public static final String NAVBAR_GROUP_CELL_BG_COLOR = "NavBarGroupCellBgColor";
0325: public static final String NAVBAR_GROUP_HREF_STYLE = "NavBarGroupHrefStyle";
0326: public static final String NAVBAR_GROUP_HOVER_STYLE = "NavBarGroupHoverStyle";
0327: public static final String NAVBAR_HOVER_BG_COLOR = "NavBarHoverBgColor";
0328: public static final String NAVBAR_GROUP_HOVER_BG_COLOR = "NavBarGroupHoverBgColor";
0329: public static final String NAVBAR_SELECTED_BG_COLOR = "NavBarSelectedBgColor";
0330: public static final String NAVBAR_SELECTED_HOVER_BG_COLOR = "NavBarSelectedHoverBgColor";
0331: public static final String NAVBAR_SHOW_POPUP_BG_COLOR = "NavBarShowPopupBgColor";
0332: public static final String NAVBAR_SUBMENU_BG_COLOR = "NavBarSubMenuBgColor";
0333: public static final String NAVBAR_MARKER_IMAGE = "NavBarMarkerImage";
0334: public static final String NAVBAR_MARKER_OVER_IMAGE = "NavBarMarkerOverImage";
0335: public static final String NAVBAR_SELECTED_MARKER_IMAGE = "NavBarSelectedMarkerImage";
0336: public static final String NAVBAR_TEXT_IMAGE = "NavBarTextImage";
0337: public static final String NAVBAR_V_SPACE_IMAGE = "NavBarVSpaceImage";
0338: public static final String NAVBAR_H_SPACE_IMAGE = "NavBarHSpaceImage";
0339: public static final String NAVBAR_GROUP_SPACER_IMAGE = "NavBarGroupSpacerImage";
0340: public static final String NAVBAR_SHOW_POPUP_IMAGE = "NavBarShowPopupImage";
0341: //SUBITEM STYLES
0342: public static final String NAVBAR_SUB_HREF_STYLE = "NavBarSubHrefStyle";
0343: public static final String NAVBAR_SUB_HOVER_STYLE = "NavBarSubHoverStyle";
0344: public static final String NAVBAR_SUB_HOVER_BG_COLOR = "NavBarSubHoverBgColor";
0345:
0346: //Button Properties
0347: public static final String BUTTON_BG_COLOR = "ButtonBgColor";
0348: public static final String BUTTON_FONT_STYLE = "ButtonFontStyle";
0349: public static final String BUTTON_STYLE_CLASS = "ButtonStyleClass";
0350:
0351: //SKIN Properties
0352: public static final String SKIN_MANAGER_CLASS = "SkinManagerClass";
0353: public static final String SKIN_PATH = "SkinPath";
0354: public static final String SKIN_TABLE = "SkinTable";
0355: public static final String SKIN_DB_PROFILE = "SkinDBProfile";
0356: public static final String SKIN_NAME_COLUMN = "SkinNameColumn";
0357: public static final String SKIN_KEY_COLUMN = "SkinKeyColumn";
0358: public static final String SKIN_VALUE_COLUMN = "SkinValueColumn";
0359: public static final String SKIN_DEFAULT = "SkinDefault";
0360:
0361: /*
0362: * Added by: Henry Tafolla
0363: * Date: Feburary 22 2003
0364: * Description: Properties for the HtmlTreeComponent
0365: */
0366: public static final String TREE_ANCHOR_CLASS = "TreeAnchorClass";
0367: public static final String TREE_CELLPADDING = "TreeCellPadding";
0368: public static final String TREE_CELLSPACING = "TreeCellSpacing";
0369: public static final String TREE_JAVASCRIPT_WINDOW = "TreeJavaScriptWindow";
0370: public static final String TREE_JAVASCRIPT_WINDOW_DIRECTORIES = "TreeJavaScriptWindowDirectories";
0371: public static final String TREE_JAVASCRIPT_WINDOW_HEIGHT = "TreeJavaScriptWindowHeight";
0372: public static final String TREE_JAVASCRIPT_WINDOW_LOCATION = "TreeJavaScriptWindowLocation";
0373: public static final String TREE_JAVASCRIPT_WINDOW_MENUBAR = "TreeJavaScriptWindowMenubar";
0374: public static final String TREE_JAVASCRIPT_WINDOW_NAME = "TreeJavaScriptWindowName";
0375: public static final String TREE_JAVASCRIPT_WINDOW_RESIZABLE = "TreeJavaScriptWindowResizable";
0376: public static final String TREE_JAVASCRIPT_WINDOW_SCROLLBARS = "TreeJavaScriptWindowScrollbars";
0377: public static final String TREE_JAVASCRIPT_WINDOW_STATUS = "TreeJavaScriptWindowStatus";
0378: public static final String TREE_JAVASCRIPT_WINDOW_TOOLBAR = "TreeJavaScriptWindowToolbar";
0379: public static final String TREE_JAVASCRIPT_WINDOW_WIDTH = "TreeJavaScriptWindowWidth";
0380: public static final String TREE_TABLE_CELL_CLASS = "TreeTableCellClass";
0381: public static final String TREE_TABLE_HEADER_CELL_CLASS = "TreeHeaderCellClass";
0382: public static final String TREE_TABLE_CELL_STYLE = "TreeTableCellStyle";
0383: public static final String TREE_TABLE_HEADER_CELL_STYLE = "TreeHeaderCellStyle";
0384: public static final String TREE_TABLE_STYLE = "TreeTableStyle";
0385: public static final String TREE_TABLE_CLASS = "TreeTableClass";
0386: public static final String TREE_NODE_FONT = "TreeNodeFont";
0387:
0388: public static final String SEARCH_FORM_DISPLAY_BOX_ADD_BUTTON_ACCESS_KEY = "SearchFormDisplayBoxAddButtonAccessKey";
0389: public static final String SEARCH_FORM_DISPLAY_BOX_ADD_BUTTON_CAPTION = "SearchFormDisplayBoxAddButtonCaption";
0390: public static final String SEARCH_FORM_DISPLAY_BOX_SEARCH_BUTTON_ACCESS_KEY = "SearchFormDisplayBoxSearchButtonAccessKey";
0391: public static final String SEARCH_FORM_DISPLAY_BOX_SEARCH_BUTTON_CAPTION = "SearchFormDisplayBoxSearchButtonCaption";
0392: public static final String SEARCH_FORM_DISPLAY_BOX_CANCEL_BUTTON_ACCESS_KEY = "SearchFormDisplayBoxCancelButtonAccessKey";
0393: public static final String SEARCH_FORM_DISPLAY_BOX_CANCEL_BUTTON_CAPTION = "SearchFormDisplayBoxCancelButtonCaption";
0394: public static final String SEARCH_FORM_DISPLAY_BOX_BUTTON_BG_COLOR = "SearchFormDisplayBoxButtonBgColor";
0395: public static final String SEARCH_FORM_DISPLAY_BOX_BUTTON_FONT_STYLE = "SearchFormDisplayBoxButtonFontStyle";
0396: public static final String SEARCH_FORM_DISPLAY_BOX_BUTTON_LOCATION = "SearchFormDisplayBoxButtonLocation";
0397: public static final String SEARCH_FORM_DISPLAY_BOX_BOTTOM_BUTTON_ALIGN = "SearchFormDisplayBoxBottomButtonAlign";
0398: public static final String SEARCH_FORM_DISPLAY_BOX_CLASS = "SearchFormDisplayBoxClass";
0399:
0400: public static final String LIST_FORM_DISPLAY_BOX_ADD_BUTTON_ACCESS_KEY = "ListFormDisplayBoxAddButtonAccessKey";
0401: public static final String LIST_FORM_DISPLAY_BOX_ADD_BUTTON_CAPTION = "ListFormDisplayBoxAddButtonCaption";
0402: public static final String LIST_FORM_DISPLAY_BOX_SAVE_BUTTON_ACCESS_KEY = "ListFormDisplayBoxSaveButtonAccessKey";
0403: public static final String LIST_FORM_DISPLAY_BOX_SAVE_BUTTON_CAPTION = "ListFormDisplayBoxSaveButtonCaption";
0404: public static final String LIST_FORM_DISPLAY_BOX_BUTTON_BG_COLOR = "ListFormDisplayBoxButtonBgColor";
0405: public static final String LIST_FORM_DISPLAY_BOX_BUTTON_FONT_STYLE = "ListFormDisplayBoxButtonFontStyle";
0406: public static final String LIST_FORM_DISPLAY_BOX_BUTTON_LOCATION = "ListFormDisplayBoxButtonLocation";
0407: public static final String LIST_FORM_DISPLAY_BOX_BOTTOM_BUTTON_ALIGN = "ListFormDisplayBoxBottomButtonAlign";
0408: public static final String LIST_FORM_DISPLAY_BOX_ROW_HIGHLIGHT_COLOR = "ListFormDisplayBoxRowHighlightColor";
0409: public static final String LIST_FORM_DISPLAY_BOX_CLASS = "ListFormDisplayBoxClass";
0410:
0411: public static final String DETAIL_FORM_DISPLAY_BOX_ADD_BUTTON_ACCESS_KEY = "DetailFormDisplayBoxAddButtonAccessKey";
0412: public static final String DETAIL_FORM_DISPLAY_BOX_ADD_BUTTON_CAPTION = "DetailFormDisplayBoxAddButtonCaption";
0413: public static final String DETAIL_FORM_DISPLAY_BOX_CANCEL_BUTTON_ACCESS_KEY = "DetailFormDisplayBoxCancelButtonAccessKey";
0414: public static final String DETAIL_FORM_DISPLAY_BOX_CANCEL_BUTTON_CAPTION = "DetailFormDisplayBoxCancelButtonCaption";
0415: public static final String DETAIL_FORM_DISPLAY_BOX_DELETE_BUTTON_ACCESS_KEY = "DetailFormDisplayBoxDeleteButtonAccessKey";
0416: public static final String DETAIL_FORM_DISPLAY_BOX_DELETE_BUTTON_CAPTION = "DetailFormDisplayBoxDeleteButtonCaption";
0417: public static final String DETAIL_FORM_DISPLAY_BOX_SAVE_BUTTON_ACCESS_KEY = "DetailFormDisplayBoxSaveButtonAccessKey";
0418: public static final String DETAIL_FORM_DISPLAY_BOX_SAVE_BUTTON_CAPTION = "DetailFormDisplayBoxSaveButtonCaption";
0419: public static final String DETAIL_FORM_DISPLAY_BOX_BUTTON_BG_COLOR = "DetailFormDisplayBoxButtonBgColor";
0420: public static final String DETAIL_FORM_DISPLAY_BOX_BUTTON_FONT_STYLE = "DetailFormDisplayBoxButtonFontStyle";
0421: public static final String DETAIL_FORM_DISPLAY_BOX_BUTTON_LOCATION = "DetailFormDisplayBoxButtonLocation";
0422: public static final String DETAIL_FORM_DISPLAY_BOX_BOTTOM_BUTTON_ALIGN = "DetailFormDisplayBoxBottomButtonAlign";
0423: public static final String DETAIL_FORM_DISPLAY_BOX_CLASS = "DetailFormDisplayBoxClass";
0424:
0425: public static final String FORM_DISPLAY_BOX_OK_BUTTON_CAPTION = "FormDisplayBoxOKButtonCaption";
0426: public static final String FORM_DISPLAY_BOX_CANCEL_BUTTON_CAPTION = "FormDisplayBoxCancelButtonCaption";
0427: public static final String FORM_DISPLAY_BOX_UNDO_BUTTON_CAPTION = "FormDisplayBoxUndoButtonCaption";
0428:
0429: public static final String LOOKUP_COMPONENT_POPUPATTRIBUTES = "LookupPopupAttributes";
0430: public static final String LOOKUP_COMPONENT_URL = "LookupURL";
0431: public static final String LOOKUP_COMPONENT_USEPOPUP = "LookupUsePopup";
0432: public static final String LOOKUP_COMPONENT_POPUPMODAL = "LookupPopupModal";
0433: public static final String LOOKUP_COMPONENT_POPUPDIV = "LookupPopupDiv";
0434: public static final String LOOKUP_COMPONENT_POPUPDIVBORDERSTYLE = "LookupPopupDivBorderStyle";
0435: public static final String LOOKUP_COMPONENT_POPUPWIDTH = "LookupPopupWidth";
0436: public static final String LOOKUP_COMPONENT_POPUPHEIGHT = "LookupPopupHeight";
0437: public static final String LOOKUP_COMPONENT_POPUPTOP = "LookupPopupTop";
0438: public static final String LOOKUP_COMPONENT_POPUPLEFT = "LookupPopupLeft";
0439: public static final String LOOKUP_COMPONENT_POPUPPOSITION = "LookupPopupPosition";
0440: public static final String LOOKUP_COMPONENT_EDITDESCRIPTION = "LookupEditDescription";
0441:
0442: public static final String HIBERNATE_FACTORY_CLASS = "HibernateFactoryClass";
0443: public static final String HIBERNATE_CONFIG_FILE = "HibernateConfigFile";
0444:
0445: /* End */
0446:
0447: static {
0448: setPropsPath();
0449: }
0450:
0451: private Props(Properties system, Properties application,
0452: Properties unit) {
0453: super ();
0454: _system = system;
0455: _application = application;
0456: _unit = unit;
0457: }
0458:
0459: private static PropsDescriptor getSystemPropsDescriptor() {
0460: return (PropsDescriptor) _appProps.get(getAppID());
0461: }
0462:
0463: private static String fixSlashes(String in) {
0464: StringBuffer ret = new StringBuffer(in.length());
0465: for (int i = 0; i < in.length(); i++) {
0466: char c = in.charAt(i);
0467: if (c == '\\')
0468: ret.append("\\\\");
0469: else
0470: ret.append(c);
0471: }
0472: return ret.toString();
0473: }
0474:
0475: /**
0476: * This method will return an boolean value from the properties object.
0477: * @return true if the property is found and is equal to : True,Yes,T,Y. It will return false otherwise.
0478: * @param key The property to search for.
0479: */
0480: public boolean getBooleanProperty(String key) {
0481: String prop = getProperty(key, null);
0482: if (prop == null)
0483: return false;
0484:
0485: prop = prop.toLowerCase();
0486: if (prop.equals("t") || prop.equals("true") || prop.equals("y")
0487: || prop.equals("yes"))
0488: return true;
0489:
0490: return false;
0491: }
0492:
0493: /**
0494: * This method will return an boolean value from the properties object.
0495: * @return true if the property is found and is equal to : True,Yes,T,Y. It will return false otherwise.
0496: * @param key The property to search for.
0497: * @param defaultProperty The property to return if no property is found.
0498: */
0499: public boolean getBooleanProperty(String key,
0500: boolean defaultProperty) {
0501: String prop = getProperty(key, null);
0502: if (prop == null)
0503: return defaultProperty;
0504:
0505: prop = prop.toLowerCase();
0506: if (prop.equals("t") || prop.equals("true") || prop.equals("y")
0507: || prop.equals("yes"))
0508: return true;
0509:
0510: return false;
0511: }
0512:
0513: /**
0514: * This method will return an color value from the properties object.
0515: * @return The property or null if it is not found or the property is not a color.
0516: * @param key The property to search for.
0517: */
0518: public Color getColorProperty(String key) {
0519: String prop = getProperty(key, null);
0520: if (prop == null)
0521: return null;
0522:
0523: if (prop.startsWith("#"))
0524: return Color.decode(prop);
0525: else {
0526: prop = prop.toUpperCase();
0527: if (prop.equals("WHITE"))
0528: return Color.white;
0529: else if (prop.equals("LIGHTGRAY"))
0530: return Color.lightGray;
0531: else if (prop.equals("GRAY"))
0532: return Color.gray;
0533: else if (prop.equals("DARKGRAY"))
0534: return Color.darkGray;
0535: else if (prop.equals("BLACK"))
0536: return Color.black;
0537: else if (prop.equals("RED"))
0538: return Color.red;
0539: else if (prop.equals("PINK"))
0540: return Color.pink;
0541: else if (prop.equals("ORANGE"))
0542: return Color.orange;
0543: else if (prop.equals("YELLOW"))
0544: return Color.yellow;
0545: else if (prop.equals("YELLOW"))
0546: return Color.yellow;
0547: else if (prop.equals("MAGENTA"))
0548: return Color.magenta;
0549: else if (prop.equals("CYAN"))
0550: return Color.cyan;
0551: else if (prop.equals("BLUE"))
0552: return Color.blue;
0553: }
0554: return null;
0555: }
0556:
0557: /**
0558: * This method will return an integer value from the properties object.
0559: * @return The property or -1 if it is not found or the property is not an integer.
0560: * @param key The property to search for.
0561: */
0562: public int getIntProperty(String key) {
0563: String prop = getProperty(key, null);
0564: if (prop == null)
0565: return -1;
0566:
0567: try {
0568: int ret = Integer.parseInt(prop);
0569: return ret;
0570: } catch (Exception e) {
0571: return -1;
0572: }
0573:
0574: }
0575:
0576: /**
0577: * This method will return an enumeration of keys from the system properties file
0578: */
0579: public Enumeration getKeys() {
0580: return _system.keys();
0581: }
0582:
0583: /**
0584: * This method will return a value from the properties object.
0585: * @return The property or null if it is not found.
0586: * @param key The property to search for.
0587: */
0588: public String getProperty(String key) {
0589: return getProperty(key, null);
0590: }
0591:
0592: /**
0593: * This method will return a value from the properties object.
0594: * @return The property.
0595: * @param key The property to search for.
0596: * @param def The default property to return if the key is not found.
0597: */
0598: public String getProperty(String key, String def) {
0599:
0600: String property = null;
0601:
0602: if (_unit != null) {
0603: property = _unit.getProperty(key);
0604: if (property != null)
0605: if (property.equals("null"))
0606: return null;
0607: }
0608:
0609: if (property == null && _application != null) {
0610: property = _application.getProperty(key);
0611: if (property != null)
0612: if (property.equals("null"))
0613: return null;
0614: }
0615:
0616: if (property == null && _system != null) {
0617: property = _system.getProperty(key);
0618: if (property != null)
0619: if (property.equals("null"))
0620: return null;
0621: }
0622:
0623: if (property == null)
0624: property = def;
0625:
0626: return property;
0627: }
0628:
0629: /**
0630: * Use this method to get a Props object.
0631: */
0632: public static Props getProps(String appName, String unitName) {
0633:
0634: File sysFile = new File(getPropsPath() + File.separatorChar
0635: + "System.properties");
0636: File appFile = new File(getPropsPath() + File.separatorChar
0637: + appName + ".properties");
0638:
0639: // if unitName has .jsp in it stip it off and use just the root pageName
0640: unitName = Util.stripDotJsp(unitName);
0641: File unitFile = new File(getPropsPath() + File.separatorChar
0642: + appName + "_" + unitName + ".properties");
0643:
0644: PropsDescriptor systemProps = getSystemPropsDescriptor();
0645: if (systemProps == null) {
0646: systemProps = loadProperties(sysFile, "System");
0647: _appProps.put(getAppID(), systemProps);
0648: } else if (systemProps.getLastMod() != sysFile.lastModified()) {
0649: reloadProperties(sysFile, systemProps);
0650: _appProps.put(getAppID(), systemProps);
0651: }
0652:
0653: PropsDescriptor app = systemProps.getSubProperty(appName);
0654: if (app == null) {
0655: app = loadProperties(appFile, appName);
0656: systemProps.setSubProperty(app);
0657: } else if (app.getLastMod() != appFile.lastModified()) {
0658: reloadProperties(appFile, app);
0659: }
0660:
0661: // srufle Jan 27, 2004
0662: // if (unitName != null) {
0663: if (Util.isFilled(unitName)) {
0664: PropsDescriptor unit = app.getSubProperty(unitName);
0665: if (unit == null) {
0666: unit = loadProperties(unitFile, unitName);
0667: app.setSubProperty(unit);
0668: } else if (unit.getLastMod() != unitFile.lastModified()) {
0669: reloadProperties(unitFile, unit);
0670: }
0671: return new Props(systemProps.getProperties(), app
0672: .getProperties(), unit.getProperties());
0673: } else
0674: return new Props(systemProps.getProperties(), app
0675: .getProperties(), null);
0676:
0677: }
0678:
0679: /**
0680: * Use this method to get the system properties object.
0681: */
0682: public static Props getSystemProps() {
0683: File sysFile = new File(getPropsPath() + File.separatorChar
0684: + "System.properties");
0685: if (!sysFile.exists())
0686: return null;
0687:
0688: PropsDescriptor systemProps = getSystemPropsDescriptor();
0689: if (systemProps == null) {
0690: systemProps = loadProperties(sysFile, "System");
0691: _appProps.put(getAppID(), systemProps);
0692: } else if (systemProps.getLastMod() != sysFile.lastModified()) {
0693: reloadProperties(sysFile, systemProps);
0694: _appProps.put(getAppID(), systemProps);
0695: }
0696:
0697: return new Props(systemProps.getProperties(), null, null);
0698: }
0699:
0700: /**
0701: * This method returns the last modified time for the system properties file
0702: */
0703: public static long getSystemPropsLastModified() {
0704: File sysFile = new File(getPropsPath() + File.separatorChar
0705: + "System.properties");
0706: return (sysFile.lastModified());
0707: }
0708:
0709: /**
0710: * This method will return an boolean value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned.
0711: * @return true if the property is found and is equal to : True,Yes,T,Y. It will return false otherwise.
0712: * @param theme The theme of the property to search for.
0713: * @param key The property to search for.
0714: */
0715: public boolean getThemeBooleanProperty(String theme, String key) {
0716: if (theme == null)
0717: return getBooleanProperty(key);
0718:
0719: String prop = getProperty(theme + "." + key, null);
0720: if (prop == null) {
0721: prop = getProperty(key, null);
0722: if (prop == null)
0723: return false;
0724: }
0725:
0726: prop = prop.toLowerCase();
0727: if (prop.equals("t") || prop.equals("true") || prop.equals("y")
0728: || prop.equals("yes"))
0729: return true;
0730:
0731: return false;
0732: }
0733:
0734: /**
0735: * This method will return an boolean value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned.
0736: * @return true if the property is found and is equal to : True,Yes,T,Y. It will return false otherwise.
0737: * @param theme The theme of the property to search for.
0738: * @param key The property to search for.
0739: * @param defaultProperty The default value if the property is not found
0740: */
0741: public boolean getThemeBooleanProperty(String theme, String key,
0742: boolean defaultProperty) {
0743: if (theme == null)
0744: return getBooleanProperty(key, defaultProperty);
0745:
0746: String prop = getProperty(theme + "." + key, null);
0747: if (prop == null) {
0748: prop = getProperty(key, null);
0749: if (prop == null)
0750: return defaultProperty;
0751: }
0752:
0753: prop = prop.toLowerCase();
0754: if (prop.equals("t") || prop.equals("true") || prop.equals("y")
0755: || prop.equals("yes"))
0756: return true;
0757:
0758: return false;
0759: }
0760:
0761: /**
0762: * This method will return an Color value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned..
0763: * @return The property or null if it is not found or the property is not a color.
0764: * @param theme The theme of the property to search for.
0765: * @param key The property to search for.
0766: */
0767: public Color getThemeColorProperty(String theme, String key) {
0768:
0769: if (theme == null)
0770: return getColorProperty(key);
0771:
0772: Color c = getColorProperty(theme + "." + key);
0773: if (c == null)
0774: return getColorProperty(key);
0775: else
0776: return c;
0777:
0778: }
0779:
0780: /**
0781: * This method will return an integer value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned..
0782: * @return The property or -1 if it is not found or the property is not an integer.
0783: * @param theme The theme of the property to search for.
0784: * @param key The property to search for.
0785: */
0786: public int getThemeIntProperty(String theme, String key) {
0787:
0788: if (theme == null)
0789: return getIntProperty(key);
0790:
0791: String prop = getProperty(theme + "." + key, null);
0792: if (prop == null) {
0793: prop = getProperty(key, null);
0794: if (prop == null)
0795: return -1;
0796: }
0797:
0798: try {
0799: int ret = Integer.parseInt(prop);
0800: return ret;
0801: } catch (Exception e) {
0802: return -1;
0803: }
0804:
0805: }
0806:
0807: /**
0808: * This method will return an integer value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned..
0809: * @return The property or -1 if it is not found or the property is not an integer.
0810: * @param theme The theme of the property to search for.
0811: * @param key The property to search for.
0812: * @param defaultVal the value to return if non is found in the property file
0813: */
0814: public int getThemeIntProperty(String theme, String key,
0815: int defaultVal) {
0816:
0817: if (theme == null)
0818: return getIntProperty(key);
0819:
0820: String prop = getProperty(theme + "." + key, null);
0821: if (prop == null) {
0822: prop = getProperty(key, null);
0823: if (prop == null)
0824: return defaultVal;
0825: }
0826:
0827: try {
0828: int ret = Integer.parseInt(prop);
0829: return ret;
0830: } catch (Exception e) {
0831: return defaultVal;
0832: }
0833:
0834: }
0835:
0836: /**
0837: * This method will return a value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned.
0838: * @return The property or null if it is not found.
0839: * @param theme The theme of the property to search for.
0840: * @param key The property to search for.
0841: */
0842: public String getThemeProperty(String theme, String key) {
0843: if (theme == null)
0844: return getProperty(key, null);
0845: else {
0846: String property = getProperty(theme + "." + key, null);
0847: if (property == null)
0848: return getProperty(key, null);
0849: else
0850: return property;
0851: }
0852: }
0853:
0854: /**
0855: * This method will return a value from the properties object using the specified theme. If the theme is null or not found, the default property will be returned.
0856: * @return The property or null if it is not found.
0857: * @param theme The theme of the property to search for.
0858: * @param key The property to search for.
0859: * @param defaultVal The default value for the property
0860: */
0861: public String getThemeProperty(String theme, String key,
0862: String defaultVal) {
0863: if (theme == null)
0864: return getProperty(key, null);
0865: else {
0866: String property = getProperty(theme + "." + key, null);
0867: if (property == null)
0868: return getProperty(key, defaultVal);
0869: else
0870: return property;
0871: }
0872: }
0873:
0874: private static PropsDescriptor loadProperties(File f, String name) {
0875: PropsDescriptor ret = null;
0876: try {
0877: FileInputStream in = new FileInputStream(f);
0878: Properties p = new Properties();
0879: p.load(in);
0880: in.close();
0881: ret = new PropsDescriptor(p, name, f.lastModified());
0882:
0883: } catch (Exception e) {
0884: ret = new PropsDescriptor(null, name, f.lastModified());
0885: }
0886: return ret;
0887: }
0888:
0889: private static void reloadProperties(File f, PropsDescriptor pd) {
0890: try {
0891: FileInputStream in = new FileInputStream(f);
0892: Properties p = new Properties();
0893: p.load(in);
0894: in.close();
0895: pd.setProperties(p);
0896: pd.setLastMod(f.lastModified());
0897: ObjectstoreCache.clearCache();
0898: } catch (Exception e) {
0899: }
0900: }
0901:
0902: public static void setPropsPath() {
0903: PROPS_DIR = null;
0904: String prop = System.getProperty("salmon.props.path");
0905: if (prop != null && prop.length() > 0)
0906: PROPS_DIR = prop;
0907: else {
0908: prop = System.getProperty("salmon.root");
0909: if (prop == null)
0910: prop = System.getProperty("server.root");
0911: if (prop != null)
0912: PROPS_DIR = prop + File.separatorChar + "properties"
0913: + File.separatorChar + "HTML Framework";
0914: }
0915:
0916: if (_displayBanner) {
0917: System.err
0918: .println("*********************************************************");
0919: System.err
0920: .println("Initializing Salmon Framework Property files");
0921: System.err
0922: .println("Salmon Server Properties File Directory:"
0923: + PROPS_DIR);
0924: if (PROPS_DIR != null) {
0925: File propsDir = new File(PROPS_DIR);
0926: System.err.println("Absolute path is:"
0927: + propsDir.getAbsolutePath());
0928: if (!propsDir.exists() || !propsDir.canRead()) {
0929: System.err
0930: .println("**Warning** Directory not readable!!");
0931: System.err
0932: .println("Property files will be loaded from the /WEB-INF/properties directory of each web application.");
0933: PROPS_DIR = null;
0934: }
0935: } else
0936: System.err
0937: .println("Property files will be loaded from the /WEB-INF/properties directory of each web application.");
0938: System.err
0939: .println("To change the property file location, set the VM System property \"salmon.props.path\" via the -D runtime switch.");
0940: System.err
0941: .println("*********************************************************");
0942: }
0943: _displayBanner = false;
0944: }
0945:
0946: /**
0947: * This method will change the path where property files are loaded from and reload the property files
0948: */
0949: public static void setPropsPath(String propsPath) {
0950: System.setProperty(SYS_PROPS_DIR_PROPERTY, propsPath);
0951: _appProps.remove(getAppID());
0952: setPropsPath();
0953: }
0954:
0955: /**
0956: * This method will change the path where property files are loaded from and reload the property files
0957: */
0958: public static void setPropsPath(String propsPath,
0959: boolean displayBanner) {
0960: _displayBanner = displayBanner;
0961: System.setProperty(SYS_PROPS_DIR_PROPERTY, propsPath);
0962: _appProps.remove(getAppID());
0963: setPropsPath();
0964: }
0965:
0966: /**
0967: * This method returns the directory for the property files
0968: */
0969: public static String getPropsPath() {
0970: if (PROPS_DIR != null && PROPS_DIR.length() > 0)
0971: return PROPS_DIR;
0972: else {
0973: String ret = System.getProperty(SYS_PROPS_DIR_PROPERTY);
0974: if (ret != null && ret.length() > 0)
0975: return ret;
0976: else {
0977: ApplicationContext cont = ApplicationContext
0978: .getContext();
0979: if (cont == null)
0980: return null;
0981: else
0982: return cont.getAppPropertiesPath();
0983: }
0984: }
0985: }
0986:
0987: /**
0988: * @returns true if the System.properties file is shared between web applications
0989: */
0990: public static boolean isPropsPathShared() {
0991: String ret = System.getProperty(SYS_PROPS_DIR_PROPERTY);
0992: return ret != null;
0993: }
0994:
0995: /**
0996: * Save changes to an application.properties file. Pass the directory where the System.properties are located. The passed hashtable should contain string key/value pairs with the items to be added to or modified in the property file.
0997: */
0998: public static void updateApplicationProperties(String propsDir,
0999: String applicationName, Hashtable changes)
1000: throws IOException {
1001: updateProperties(applicationName, changes, propsDir);
1002:
1003: }
1004:
1005: /**
1006: * Save changes to an application.properties file. The passed hashtable should contain string key/value pairs with the items to be added to or modified in the property file.
1007: */
1008: public static void updateApplicationProperties(
1009: String applicationName, Hashtable changes)
1010: throws IOException {
1011: updateProperties(applicationName, changes, null);
1012:
1013: }
1014:
1015: private static void mergeProperties(String fileToMerge, String app,
1016: String propsPath) throws IOException {
1017: String fileName = "System.properties";
1018: if (app != null)
1019: fileName = app + ".properties";
1020:
1021: String propsDir = PROPS_DIR;
1022: if (propsPath != null)
1023: propsDir = propsPath;
1024:
1025: // first write out the current properties file
1026: Hashtable currentProps = new Hashtable();
1027: File outFile = new File(propsDir + File.separator + fileName
1028: + ".$temp");
1029: File inFile = new File(propsDir + File.separator + fileName);
1030: PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
1031: BufferedReader in = new BufferedReader(new InputStreamReader(
1032: new FileInputStream(inFile)));
1033: String s = in.readLine();
1034: while (s != null) {
1035: int ndx = s.indexOf('=');
1036: if (ndx > -1) {
1037: String key = s.substring(0, ndx).trim();
1038: currentProps.put(key, key);
1039: }
1040: out.println(s);
1041: s = in.readLine();
1042: }
1043: in.close();
1044:
1045: //Now read the input file and merge in any items not already in there
1046: String lastComment = null;
1047: File mergeFile = new File(fileToMerge);
1048: in = new BufferedReader(new InputStreamReader(
1049: new FileInputStream(mergeFile)));
1050: s = in.readLine();
1051: while (s != null) {
1052: int ndx = s.indexOf('=');
1053: if (s.trim().length() == 0)
1054: lastComment = "\r\n";
1055: else if (s.startsWith("#")) {
1056: if (lastComment == null)
1057: lastComment = s;
1058: else
1059: lastComment += s;
1060: lastComment += "\r\n";
1061: } else if (ndx > -1) {
1062: String key = s.substring(0, ndx).trim();
1063: if (!currentProps.contains(key)) {
1064: if (lastComment != null) {
1065: out.print(lastComment);
1066: lastComment = null;
1067: }
1068: out.println(s);
1069: }
1070: }
1071: s = in.readLine();
1072: }
1073: in.close();
1074: out.close();
1075:
1076: if (inFile.delete())
1077: outFile.renameTo(inFile);
1078: else
1079: MessageLog.writeInfoMessage(
1080: "Error Merging Properties File:" + inFile
1081: + " delete of old file failed.", null);
1082:
1083: }
1084:
1085: private static void updateProperties(String app, Hashtable changes,
1086: String propsPath) throws IOException {
1087:
1088: String fileName = "System.properties";
1089: if (app != null)
1090: fileName = app + ".properties";
1091:
1092: String propsDir = PROPS_DIR;
1093: if (propsPath != null)
1094: propsDir = propsPath;
1095:
1096: File outFile = new File(propsDir + File.separator + fileName
1097: + ".$temp");
1098: File inFile = new File(propsDir + File.separator + fileName);
1099: PrintWriter out = new PrintWriter(new FileOutputStream(outFile));
1100: BufferedReader in = new BufferedReader(new InputStreamReader(
1101: new FileInputStream(inFile)));
1102: Hashtable changes2 = (Hashtable) changes.clone();
1103: String s = in.readLine();
1104: while (s != null) {
1105: int ndx = s.indexOf('=');
1106: if (ndx == -1)
1107: out.println(s);
1108: else {
1109: String key = s.substring(0, ndx).trim();
1110: if (changes.containsKey(key)) {
1111: s = key + "="
1112: + fixSlashes((String) changes.get(key));
1113: changes2.remove(key);
1114: }
1115: out.println(s);
1116: }
1117: s = in.readLine();
1118: }
1119:
1120: if (changes2.size() > 0) {
1121: out.println();
1122: Enumeration e = changes2.keys();
1123: while (e.hasMoreElements()) {
1124: String key = (String) e.nextElement();
1125: String val = (String) changes.get(key);
1126: out.println(key + "=" + fixSlashes(val));
1127: }
1128: }
1129:
1130: in.close();
1131: out.close();
1132: if (inFile.delete())
1133: outFile.renameTo(inFile);
1134: else
1135: MessageLog.writeInfoMessage(
1136: "Error Updating Properties File:" + inFile
1137: + " delete of old file failed.", null);
1138:
1139: }
1140:
1141: /**
1142: * Merges properties from the property file specified in inFile into the System.properties file in the propsDir. Merging consists of adding any new properties from the inFile that aren't currently in the System.properties.
1143: * @param inFile The properties file to merge into the System.properties
1144: * @param propsDir The directory where the System.properties file can be found or null to use the default
1145: * @throws IOException
1146: */
1147: public static void mergeSystemProperties(String inFile,
1148: String propsDir) throws IOException {
1149: mergeProperties(inFile, null, propsDir);
1150: }
1151:
1152: /**
1153: * Merges properties from the property file specified in inFile into the System.properties file. Merging consists of adding any new properties from the inFile that aren't currently in the System.properties.
1154: * @param inFile The properties file to merge into the System.properties
1155: * @throws IOException
1156: */
1157: public static void mergeSystemProperties(String inFile)
1158: throws IOException {
1159: mergeProperties(inFile, null, null);
1160: }
1161:
1162: /**
1163: * Save changes to the System.properties file. Pass the directory where the System.properties are located. The passed hashtable should contain string key/value pairs with the items to be added to or modified in the property file.
1164: */
1165: public static void updateSystemProperties(String propsDir,
1166: Hashtable changes) throws IOException {
1167: updateProperties(null, changes, propsDir);
1168:
1169: }
1170:
1171: /**
1172: * Save changes to the System.properties file. The passed hashtable should contain string key/value pairs with the items to be added to or modified in the property file.
1173: */
1174: public static void updateSystemProperties(Hashtable changes)
1175: throws IOException {
1176: updateProperties(null, changes, null);
1177:
1178: }
1179:
1180: /**
1181: * Overrides the unit properties loaded with this Props object and replaces it with the one specified
1182: */
1183: public void setUnitProperties(Properties props) {
1184: _unit = props;
1185: }
1186:
1187: private static String getAppID() {
1188: ApplicationContext cont = ApplicationContext.getContext();
1189: if (cont == null)
1190: return "";
1191: else
1192: return cont.getAppID();
1193: }
1194: }
|