Source Code Cross Referenced for ConsoleSettingUtil.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » console » server » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ESB » cbesb 1.2 » com.bostechcorp.cbesb.console.server 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.bostechcorp.cbesb.console.server;
002:
003:        import java.util.Map;
004:
005:        import org.apache.commons.logging.Log;
006:        import org.apache.commons.logging.LogFactory;
007:
008:        import com.bostechcorp.cbesb.common.i18n.CoreMessageConstants;
009:        import com.bostechcorp.cbesb.common.i18n.Messages;
010:        import com.bostechcorp.cbesb.common.util.runtimedb.ConsoleSettingDB;
011:        import com.bostechcorp.cbesb.common.util.runtimedb.vo.ConsoleSettingVO;
012:        import com.bostechcorp.cbesb.console.common.ConsoleSystemSettingInfo;
013:        import com.bostechcorp.cbesb.console.common.ConsoleUserSettingInfo;
014:        import com.bostechcorp.cbesb.console.common.LogViewProperties;
015:
016:        public class ConsoleSettingUtil {
017:            /**
018:             * The init value need to be true to make sure Status load custom status at the forst time
019:             */
020:            private static boolean customStatusSettingChanged = true;
021:            protected static final int DEFAULT_INTERVAL = 60000;
022:            protected static final int DEFAULT_PAGESIZE = 25;
023:            private static Log log = LogFactory
024:                    .getLog(ConsoleSettingUtil.class);
025:
026:            public static ConsoleUserSettingInfo getConsoleUserSetting(
027:                    String userId) {
028:                ConsoleUserSettingInfo consoleUserSettingInfo = new ConsoleUserSettingInfo();
029:
030:                try {
031:                    Map<String, ConsoleSettingVO> map = ConsoleSettingDB
032:                            .getSettingByUserId(userId);
033:                    consoleUserSettingInfo.setUserId(userId);
034:                    SetUserSettingInfoFromMap(map, consoleUserSettingInfo);
035:                } catch (Exception e) {
036:                    consoleUserSettingInfo.setException((Messages
037:                            .get(CoreMessageConstants.FAILED_GET_PREFERENCE)),
038:                            e);
039:                }
040:
041:                return consoleUserSettingInfo;
042:            }
043:
044:            public static ConsoleSystemSettingInfo getConsoleSystemSettingInfo() {
045:                ConsoleSystemSettingInfo consoleSystemSettingInfo = new ConsoleSystemSettingInfo();
046:                String userId = "0";
047:                try {
048:                    Map<String, ConsoleSettingVO> map = ConsoleSettingDB
049:                            .getSettingByUserId(userId);
050:                    consoleSystemSettingInfo.setUserId(userId);
051:                    SetUserSettingInfoFromMap(map, consoleSystemSettingInfo);
052:
053:                    if ((map
054:                            .containsKey(ConsoleSystemSettingInfo.MEMORY_PING_INTERVAL)))
055:                        consoleSystemSettingInfo.setMemoryPingInterval(map.get(
056:                                ConsoleSystemSettingInfo.MEMORY_PING_INTERVAL)
057:                                .getValue());
058:                    if ((map
059:                            .containsKey(ConsoleSystemSettingInfo.CPU_PING_INTERVAL)))
060:                        consoleSystemSettingInfo.setCpuPingInterval(map.get(
061:                                ConsoleSystemSettingInfo.CPU_PING_INTERVAL)
062:                                .getValue());
063:                    if ((map
064:                            .containsKey(ConsoleSystemSettingInfo.LICENSE_PING_INTERVAL)))
065:                        consoleSystemSettingInfo
066:                                .setLicensePingInterval(map
067:                                        .get(
068:                                                ConsoleSystemSettingInfo.LICENSE_PING_INTERVAL)
069:                                        .getValue());
070:                    if ((map
071:                            .containsKey(ConsoleSystemSettingInfo.DISK_PING_INTERVAL)))
072:                        consoleSystemSettingInfo.setDiskPingInterval(map.get(
073:                                ConsoleSystemSettingInfo.DISK_PING_INTERVAL)
074:                                .getValue());
075:                    if ((map
076:                            .containsKey(ConsoleSystemSettingInfo.SERVER_PING_INTERVAL)))
077:                        consoleSystemSettingInfo.setServerPingInterval(map.get(
078:                                ConsoleSystemSettingInfo.SERVER_PING_INTERVAL)
079:                                .getValue());
080:                    if ((map
081:                            .containsKey(ConsoleSystemSettingInfo.SA_PING_INTERVAL)))
082:                        consoleSystemSettingInfo.setSAPingInterval(map.get(
083:                                ConsoleSystemSettingInfo.SA_PING_INTERVAL)
084:                                .getValue());
085:                    if ((map
086:                            .containsKey(ConsoleSystemSettingInfo.COMPONENT_PING_INTERVAL)))
087:                        consoleSystemSettingInfo
088:                                .setComponentPingInterval(map
089:                                        .get(
090:                                                ConsoleSystemSettingInfo.COMPONENT_PING_INTERVAL)
091:                                        .getValue());
092:                    if ((map
093:                            .containsKey(ConsoleSystemSettingInfo.FILE_STATUS_PING_INTERVAL)))
094:                        consoleSystemSettingInfo
095:                                .setFileStatusPingInterval(map
096:                                        .get(
097:                                                ConsoleSystemSettingInfo.FILE_STATUS_PING_INTERVAL)
098:                                        .getValue());
099:                    if ((map
100:                            .containsKey(ConsoleSystemSettingInfo.CUSTOM_STATUS_VALUES)))
101:                        consoleSystemSettingInfo.setCustomStatusValues(map.get(
102:                                ConsoleSystemSettingInfo.CUSTOM_STATUS_VALUES)
103:                                .getValue());
104:                    if ((map
105:                            .containsKey(ConsoleSystemSettingInfo.ERROR_COUNT_PING_INTERVAL)))
106:                        consoleSystemSettingInfo
107:                                .setErrorCountPingInterval(map
108:                                        .get(
109:                                                ConsoleSystemSettingInfo.ERROR_COUNT_PING_INTERVAL)
110:                                        .getValue());
111:
112:                } catch (Exception e) {
113:                    consoleSystemSettingInfo.setException((Messages
114:                            .get(CoreMessageConstants.FAILD_GET_SETTING)), e);
115:                }
116:                return consoleSystemSettingInfo;
117:
118:            }
119:
120:            private static void SetUserSettingInfoFromMap(
121:                    Map<String, ConsoleSettingVO> map,
122:                    ConsoleUserSettingInfo consoleUserSettingInfo) {
123:                if ((map
124:                        .containsKey(ConsoleUserSettingInfo.ALERTVIEW_PAGE_SIZE)))
125:                    consoleUserSettingInfo.setAlertViewPageSize(map.get(
126:                            ConsoleUserSettingInfo.ALERTVIEW_PAGE_SIZE)
127:                            .getValue());
128:                if ((map
129:                        .containsKey(ConsoleUserSettingInfo.ALERTVIEW_REFRESH_RATE)))
130:                    consoleUserSettingInfo.setAlertViewRefreshRate(map.get(
131:                            ConsoleUserSettingInfo.ALERTVIEW_REFRESH_RATE)
132:                            .getValue());
133:                if ((map
134:                        .containsKey(ConsoleUserSettingInfo.COMPONENT_REFRESH_RATE)))
135:                    consoleUserSettingInfo.setComponentRefreshRate(map.get(
136:                            ConsoleUserSettingInfo.COMPONENT_REFRESH_RATE)
137:                            .getValue());
138:                if ((map
139:                        .containsKey(ConsoleUserSettingInfo.ENDPOINT_STATUS_REFRESH_RATE)))
140:                    consoleUserSettingInfo
141:                            .setEndpointStatusRefreshRate(map
142:                                    .get(
143:                                            ConsoleUserSettingInfo.ENDPOINT_STATUS_REFRESH_RATE)
144:                                    .getValue());
145:                if ((map.containsKey(ConsoleUserSettingInfo.ERRORDB_PAGE_SIZE)))
146:                    consoleUserSettingInfo.setErrorDbPageSize(map.get(
147:                            ConsoleUserSettingInfo.ERRORDB_PAGE_SIZE)
148:                            .getValue());
149:                if ((map
150:                        .containsKey(ConsoleUserSettingInfo.LOGVIEW_LINE_BUFFER_SIZE)))
151:                    consoleUserSettingInfo.setLogViewerLineBufferSize(map.get(
152:                            ConsoleUserSettingInfo.LOGVIEW_LINE_BUFFER_SIZE)
153:                            .getValue());
154:                if ((map.containsKey(ConsoleUserSettingInfo.LOGVIEW_NUMOF_LINE)))
155:                    consoleUserSettingInfo.setLogViewerNumOfLine(map.get(
156:                            ConsoleUserSettingInfo.LOGVIEW_NUMOF_LINE)
157:                            .getValue());
158:                if ((map.containsKey(ConsoleUserSettingInfo.SA_REFRESH_RATE)))
159:                    consoleUserSettingInfo.setSaRefreshRate(map.get(
160:                            ConsoleUserSettingInfo.SA_REFRESH_RATE).getValue());
161:                if ((map
162:                        .containsKey(ConsoleUserSettingInfo.STATISTICS_REFRESH_RATE)))
163:                    consoleUserSettingInfo.setStatisticsRefreshRate(map.get(
164:                            ConsoleUserSettingInfo.STATISTICS_REFRESH_RATE)
165:                            .getValue());
166:                if ((map.containsKey(ConsoleUserSettingInfo.SA_IN_ENDPOINTVIEW)))
167:                    consoleUserSettingInfo.setSaInEndpointView(map.get(
168:                            ConsoleUserSettingInfo.SA_IN_ENDPOINTVIEW)
169:                            .getValue());
170:                if ((map.containsKey(ConsoleUserSettingInfo.LOG_REFRESH_RATE)))
171:                    consoleUserSettingInfo
172:                            .setLogRefreshRate(map.get(
173:                                    ConsoleUserSettingInfo.LOG_REFRESH_RATE)
174:                                    .getValue());
175:
176:            }
177:
178:            public static boolean isCustomStatusSettingChanged() {
179:                return customStatusSettingChanged;
180:            }
181:
182:            public static void setCustomStatusSettingChanged(
183:                    boolean customStatusSettingChanged) {
184:                ConsoleSettingUtil.customStatusSettingChanged = customStatusSettingChanged;
185:            }
186:
187:            public static String getCustomStatusValues() {
188:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
189:                if (settingInfo.isError())
190:                    return "";
191:                else
192:                    return settingInfo.getCustomStatusValues();
193:            }
194:
195:            public static int getErrorCountPingInterval() {
196:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
197:                try {
198:                    return Integer.parseInt(settingInfo
199:                            .getErrorCountPingInterval()) * 1000;
200:                } catch (Exception e) {
201:                    log.error("ErrorCountPingInterval retrive error", e);
202:                }
203:                return DEFAULT_INTERVAL;
204:            }
205:
206:            public static int getFileStatusPingInterval() {
207:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
208:                try {
209:                    return Integer.parseInt(settingInfo
210:                            .getFileStatusPingInterval()) * 1000;
211:                } catch (Exception e) {
212:                    log.error("FileStatusPingInterval retrive error", e);
213:                }
214:                return DEFAULT_INTERVAL;
215:            }
216:
217:            public static int getServerPingInterval() {
218:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
219:                try {
220:                    return Integer
221:                            .parseInt(settingInfo.getServerPingInterval()) * 1000;
222:                } catch (Exception e) {
223:                    log.error("ServerPingInterval retrive error", e);
224:                }
225:                return DEFAULT_INTERVAL;
226:            }
227:
228:            public static int getComponentPingInterval() {
229:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
230:                try {
231:                    return Integer.parseInt(settingInfo
232:                            .getComponentPingInterval()) * 1000;
233:                } catch (Exception e) {
234:                    log.error("ComponentPingInterval retrive error", e);
235:                }
236:                return DEFAULT_INTERVAL;
237:            }
238:
239:            public static int getSAPingInterval() {
240:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
241:                try {
242:                    return Integer.parseInt(settingInfo.getSAPingInterval()) * 1000;
243:                } catch (Exception e) {
244:                    log.error("SAPingInterval retrive error", e);
245:                }
246:                return DEFAULT_INTERVAL;
247:            }
248:
249:            public static int getMemoryPingInterval() {
250:                ConsoleSystemSettingInfo settingInfo = getConsoleSystemSettingInfo();
251:                try {
252:                    return Integer
253:                            .parseInt(settingInfo.getMemoryPingInterval()) * 1000;
254:                } catch (Exception e) {
255:                    log.error("MemoryPingInterval retrive error", e);
256:                }
257:                return DEFAULT_INTERVAL;
258:            }
259:
260:            public static int getAlertViewRefreshRate(String userId) {
261:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
262:                try {
263:                    return Integer.parseInt(settingInfo
264:                            .getAlertViewRefreshRate()) * 1000;
265:                } catch (Exception e) {
266:                    log.error("AlertViewRefreshRate retrive error", e);
267:                }
268:                return DEFAULT_INTERVAL;
269:            }
270:
271:            public static int getEndpointStatusRefreshRate(String userId) {
272:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
273:                try {
274:                    return Integer.parseInt(settingInfo
275:                            .getEndpointStatusRefreshRate()) * 1000;
276:                } catch (Exception e) {
277:                    log.error("EndpointStatusRefreshRate retrive error", e);
278:                }
279:                return DEFAULT_INTERVAL;
280:            }
281:
282:            public static int getComponentRefreshRate(String userId) {
283:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
284:                try {
285:                    return Integer.parseInt(settingInfo
286:                            .getComponentRefreshRate()) * 1000;
287:                } catch (Exception e) {
288:                    log.error("ComponentRefreshRate retrive error", e);
289:                }
290:                return DEFAULT_INTERVAL;
291:            }
292:
293:            public static int getSaRefreshRate(String userId) {
294:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
295:                try {
296:                    return Integer.parseInt(settingInfo.getSaRefreshRate()) * 1000;
297:                } catch (Exception e) {
298:                    log.error("SaRefreshRate retrive error", e);
299:                }
300:                return DEFAULT_INTERVAL;
301:            }
302:
303:            public static int getStatisticsRefreshRate(String userId) {
304:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
305:                try {
306:                    return Integer.parseInt(settingInfo
307:                            .getStatisticsRefreshRate()) * 1000;
308:                } catch (Exception e) {
309:                    log.error("StatisticsRefreshRate retrive error", e);
310:                }
311:                return DEFAULT_INTERVAL;
312:            }
313:
314:            public static int getAlertViewPageSize(String userId) {
315:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
316:                try {
317:                    return Integer.parseInt(settingInfo.getAlertViewPageSize());
318:                } catch (Exception e) {
319:                    log.error("AlertViewPageSize retrive error", e);
320:                }
321:                return DEFAULT_PAGESIZE;
322:            }
323:
324:            public static int getErrorDbPageSize(String userId) {
325:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
326:                try {
327:                    return Integer.parseInt(settingInfo.getErrorDbPageSize());
328:                } catch (Exception e) {
329:                    log.error("ErrorDbPageSize retrive error", e);
330:                }
331:                return DEFAULT_PAGESIZE;
332:            }
333:
334:            public static LogViewProperties getLogViewProperties(String userId) {
335:                ConsoleUserSettingInfo settingInfo = getConsoleUserSetting(userId);
336:
337:                return settingInfo.getLogViewProperties();
338:            }
339:
340:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.