Source Code Cross Referenced for NetletBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » sra » netlet » 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 » Portal » Open Portal » com.sun.portal.admin.console.sra.netlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: NetletBean.java,v 1.31 2006/11/08 08:17:32 vp154433 Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.admin.console.sra.netlet;
014:
015:        import com.sun.portal.admin.console.sra.utils.SraObjectListDataProvider;
016:        import com.sun.portal.admin.console.sra.SraBaseBean;
017:        import com.sun.portal.admin.console.sra.utils.Util;
018:        import com.sun.web.ui.model.Option;
019:        import com.sun.data.provider.DataProvider;
020:        import com.sun.data.provider.impl.ObjectListDataProvider;
021:        import com.sun.portal.admin.console.sra.utils.AllowDenyModel;
022:        import com.sun.portal.admin.console.sra.utils.AllowDenyItem;
023:
024:        import java.util.ArrayList;
025:        import java.util.List;
026:        import java.util.Iterator;
027:
028:        public class NetletBean extends SraBaseBean {
029:
030:            private static final String LOOPBACK_PORT = "sunPortalNetletClientLoopbackPort";
031:
032:            private static final String DO_REAUTH = "sunPortalNetletDoReauth";
033:
034:            private static final String PORT_WARN = "sunPortalNetletPortWarn";
035:
036:            private static final String WARN_CHECKBOX = "sunPortalNetletPortWarnCheckbox";
037:
038:            private static final String KEEP_ALIVE_INTERVAL = "sunPortalNetletKeepAliveInterval";
039:
040:            private static final String TERMINATE_AT_LOGOUT = "sunPortalNetletTerminateAtLogout";
041:
042:            private static final String LAUNCH_MODE = "sunPortalNetletLaunchMode";
043:
044:            private static final String NETLET_RULES = "sunPortalNetletRules";
045:
046:            private static final String DEFAULT_KSSL_CIPHER = "sunPortalNetletKSSLDefaultCipher";
047:
048:            private static final String DEFAULT_JSSE_CIPHER = "sunPortalNetletJSSEDefaultCipher";
049:
050:            private static final String ACCESS_RULES = "sunPortalNetletAccessRules";
051:
052:            private static final String DENY_RULES = "sunPortalNetletDenyRules";
053:
054:            private static final String ACCESS_HOSTS = "sunPortalNetletAccessHosts";
055:
056:            private static final String DENY_HOSTS = "sunPortalNetletDenyHosts";
057:
058:            private static final String CLIENT_BIND_IP = "sunPortalNetletClientBindIP";
059:
060:            private static final String NETLET_EXECUTE = "sunPortalNetletExecute";
061:
062:            private static final String USER_CIPHER = "sunPortalNetletUserCipher";
063:
064:            private static final String NETLET_PASSWORD = "sunPortalNetletPassword";
065:
066:            private static final String PROXY_TYPE = "sunPortalNetletProxyType";
067:
068:            private static final String PROXY_HOST = "sunPortalNetletProxyHost";
069:
070:            private static final String PROXY_PORT = "sunPortalNetletProxyPort";
071:
072:            private static final String PROXY_OVERRIDE = "sunPortalNetletProxyOverride";
073:
074:            static final String[] ATTR_LIST = { COS_PRIORITY, LOOPBACK_PORT,
075:                    DO_REAUTH, PORT_WARN, WARN_CHECKBOX, KEEP_ALIVE_INTERVAL,
076:                    TERMINATE_AT_LOGOUT, LAUNCH_MODE, NETLET_RULES,
077:                    DEFAULT_KSSL_CIPHER, DEFAULT_JSSE_CIPHER, ACCESS_RULES,
078:                    DENY_RULES, ACCESS_HOSTS, DENY_HOSTS, CLIENT_BIND_IP,
079:                    NETLET_EXECUTE, USER_CIPHER, NETLET_PASSWORD, PROXY_TYPE,
080:                    PROXY_HOST, PROXY_PORT, PROXY_OVERRIDE };
081:
082:            private String launchMode;
083:
084:            private boolean terminateAtLogout;
085:
086:            private boolean portWarn;
087:
088:            private boolean portWarnCheckbox;
089:
090:            private boolean doReauth;
091:
092:            private String keepAliveInterval;
093:
094:            private String clientLoopbackPort;
095:
096:            //Non-LDAP fields
097:            private boolean jnlpLaunchMode = false;
098:
099:            private boolean appletLaunchMode = true;
100:
101:            private Option[] defaultKSSLCipher;
102:
103:            private Option[] defaultJSSECipher;
104:
105:            private String selectedDefaultJSSECipher;
106:
107:            private String selectedDefaultKSSLCipher;
108:
109:            private List rulesData;
110:
111:            private SraObjectListDataProvider netletRuleDataProvider;
112:
113:            private AllowDenyModel allowDenyHost;
114:
115:            private AllowDenyModel allowDenyRule;
116:
117:            private static int DEFAULT_LOOP_BACK_PORT = 58000;
118:
119:            private static int DEFUALT_KEEP_ALIVE_INTERVAL = 0;
120:
121:            static {
122:                setPropertyVisibility(NETLET_RULES, SHOW, SHOW, SHOW);
123:                setPropertyVisibility(DEFAULT_KSSL_CIPHER, SHOW, SHOW, SHOW);
124:                setPropertyVisibility(DEFAULT_JSSE_CIPHER, SHOW, SHOW, SHOW);
125:                setPropertyVisibility(LOOPBACK_PORT, SHOW, SHOW, SHOW);
126:                setPropertyVisibility(DO_REAUTH, SHOW, SHOW, SHOW);
127:                setPropertyVisibility(PORT_WARN, SHOW, SHOW, SHOW);
128:                setPropertyVisibility(WARN_CHECKBOX, SHOW, SHOW, SHOW);
129:                setPropertyVisibility(KEEP_ALIVE_INTERVAL, SHOW, SHOW, SHOW);
130:                setPropertyVisibility(TERMINATE_AT_LOGOUT, SHOW, SHOW, SHOW);
131:                setPropertyVisibility(ACCESS_RULES, SHOW, SHOW, SHOW);
132:                setPropertyVisibility(DENY_RULES, SHOW, SHOW, SHOW);
133:                setPropertyVisibility(ACCESS_HOSTS, SHOW, SHOW, SHOW);
134:                setPropertyVisibility(DENY_HOSTS, SHOW, SHOW, SHOW);
135:                setPropertyVisibility(CLIENT_BIND_IP, SHOW, SHOW, SHOW);
136:                setPropertyVisibility(LAUNCH_MODE, SHOW, SHOW, SHOW);
137:
138:                // User Level Attributes
139:                setPropertyVisibility(USER_CIPHER, HIDE, HIDE, SHOW);
140:                setPropertyVisibility(NETLET_PASSWORD, HIDE, HIDE, SHOW);
141:                setPropertyVisibility(PROXY_TYPE, HIDE, HIDE, SHOW);
142:                setPropertyVisibility(PROXY_HOST, HIDE, HIDE, SHOW);
143:                setPropertyVisibility(PROXY_PORT, HIDE, HIDE, SHOW);
144:                setPropertyVisibility(PROXY_OVERRIDE, HIDE, HIDE, SHOW);
145:
146:                setPropertyVisibility(COS_PRIORITY, HIDE, SHOW, HIDE);
147:            }
148:
149:            public NetletBean() {
150:                super (NETLET_SVC, ATTR_LIST);
151:                initData();
152:                /*try {
153:                    _attributeNameValueMap = (HashMap) getDataFromStore();
154:                    initData();
155:
156:                } catch (Exception e) {
157:                    e.printStackTrace();
158:                }*/
159:            }
160:
161:            /**
162:             */
163:            public void initData() {
164:
165:                defaultKSSLCipher = new Option[5];
166:
167:                defaultKSSLCipher[0] = new Option(
168:                        "KSSL_SSL3_RSA_EXPORT_WITH_RC4_40_MD5",
169:                        "KSSL_SSL3_RSA_EXPORT_WITH_RC4_40_MD5");
170:                defaultKSSLCipher[1] = new Option(
171:                        "KSSL_SSL3_RSA_WITH_3DES_EDE_CBC_SHA",
172:                        "KSSL_SSL3_RSA_WITH_3DES_EDE_CBC_SHA");
173:                defaultKSSLCipher[2] = new Option(
174:                        "KSSL_SSL3_RSA_WITH_DES_CBC_SHA",
175:                        "KSSL_SSL3_RSA_WITH_DES_CBC_SHA");
176:                defaultKSSLCipher[3] = new Option(
177:                        "KSSL_SSL3_RSA_WITH_RC4_128_MD5",
178:                        "KSSL_SSL3_RSA_WITH_RC4_128_MD5");
179:                defaultKSSLCipher[4] = new Option(
180:                        "KSSL_SSL3_RSA_WITH_RC4_128_SHA",
181:                        "KSSL_SSL3_RSA_WITH_RC4_128_SHA");
182:
183:                defaultJSSECipher = new Option[6];
184:                defaultJSSECipher[0] = new Option(
185:                        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
186:                        "SSL_RSA_EXPORT_WITH_RC4_40_MD5");
187:                defaultJSSECipher[1] = new Option(
188:                        "SSL_RSA_WITH_3DES_EDE_CBC_SHA",
189:                        "SSL_RSA_WITH_3DES_EDE_CBC_SHA");
190:                defaultJSSECipher[2] = new Option("SSL_RSA_WITH_DES_CBC_SHA",
191:                        "SSL_RSA_WITH_DES_CBC_SHA");
192:                defaultJSSECipher[3] = new Option("SSL_RSA_WITH_NULL_MD5",
193:                        "SSL_RSA_WITH_NULL_MD5");
194:                defaultJSSECipher[4] = new Option("SSL_RSA_WITH_RC4_128_MD5",
195:                        "SSL_RSA_WITH_RC4_128_MD5");
196:                defaultJSSECipher[5] = new Option("SSL_RSA_WITH_RC4_128_SHA",
197:                        "SSL_RSA_WITH_RC4_128_SHA");
198:
199:                terminateAtLogout = getBooleanValue(TERMINATE_AT_LOGOUT);
200:
201:                portWarn = getBooleanValue(PORT_WARN);
202:
203:                portWarnCheckbox = getBooleanValue(WARN_CHECKBOX);
204:
205:                doReauth = getBooleanValue(DO_REAUTH);
206:
207:                keepAliveInterval = getStringValue(KEEP_ALIVE_INTERVAL);
208:                int keepAliveInt = -1;
209:                try {
210:                    keepAliveInt = Integer.parseInt(keepAliveInterval);
211:                } catch (NumberFormatException e) { /* ignore */
212:                }
213:                if (keepAliveInt == -1)
214:                    keepAliveInterval = EMPTY_STRING
215:                            + DEFUALT_KEEP_ALIVE_INTERVAL;
216:
217:                clientLoopbackPort = getStringValue(LOOPBACK_PORT);
218:                int clientLoopbackPortInt = -1;
219:                try {
220:                    clientLoopbackPortInt = Integer
221:                            .parseInt(clientLoopbackPort);
222:                } catch (Exception e) { /* ignore */
223:                }
224:                if (clientLoopbackPortInt == -1)
225:                    clientLoopbackPort = EMPTY_STRING + DEFAULT_LOOP_BACK_PORT;
226:
227:                String s = getStringValue(LAUNCH_MODE);
228:
229:                selectedDefaultJSSECipher = getStringValue(DEFAULT_JSSE_CIPHER);
230:
231:                selectedDefaultKSSLCipher = getStringValue(DEFAULT_KSSL_CIPHER);
232:
233:                String[] netletRules = getStringArrayValue(NETLET_RULES);
234:
235:                rulesData = new java.util.ArrayList();
236:
237:                for (int i = 0; i < netletRules.length; i++) {
238:                    if (netletRules[i].length() > 0) {
239:                        rulesData.add(new NetletRuleBean(netletRules[i]));
240:                    }
241:                }
242:
243:                if (s.equalsIgnoreCase("Applet")) {
244:                    appletLaunchMode = true;
245:                    jnlpLaunchMode = false;
246:                } else {
247:                    appletLaunchMode = false;
248:                    jnlpLaunchMode = true;
249:
250:                }
251:
252:                ArrayList states = new ArrayList();
253:                states
254:                        .add((String) Util
255:                                .evaluateCachedValueBinding("#{netlet['option.allow.string']}"));
256:                states
257:                        .add((String) Util
258:                                .evaluateCachedValueBinding("#{netlet['option.deny.string']}"));
259:
260:                allowDenyHost = new AllowDenyModel("NETLET_ALLOW_DENY_HOSTS",
261:                        states, getListValue(ACCESS_HOSTS),
262:                        getListValue(DENY_HOSTS));
263:                allowDenyRule = new AllowDenyModel("NETLET_ALLOW_DENY_RULES",
264:                        states, getListValue(ACCESS_RULES),
265:                        getListValue(DENY_RULES));
266:
267:            }
268:
269:            public void storeData() {
270:                netletRuleDataProvider.commitChanges();
271:                saveAllowDenyHostList();
272:                saveAllowDenyRuleList();
273:                saveRulesData();
274:                super .storeDataToStore();
275:            }
276:
277:            /**
278:             * @return Returns the displayCheckboxInWarning.
279:             */
280:            public boolean getPortWarnCheckbox() {
281:                return portWarnCheckbox;
282:            }
283:
284:            /**
285:             * @param displayCheckboxInWarning
286:             *            The displayCheckboxInWarning to set.
287:             */
288:            public void setPortWarnCheckbox(boolean displayCheckboxInWarning) {
289:                this .portWarnCheckbox = displayCheckboxInWarning;
290:                updateAttributeNVMap(WARN_CHECKBOX, "" + portWarnCheckbox);
291:            }
292:
293:            public boolean getDontPortWarnCheckbox() {
294:                return !portWarnCheckbox;
295:            }
296:
297:            public void setDontPortWarnCheckbox(
298:                    boolean dontDisplayCheckboxInWarning) {
299:                this .portWarnCheckbox = !dontDisplayCheckboxInWarning;
300:                updateAttributeNVMap(WARN_CHECKBOX, "" + this .portWarnCheckbox);
301:            }
302:
303:            /**
304:             * @return Returns the displayWarning.
305:             */
306:            public boolean getPortWarn() {
307:                return portWarn;
308:            }
309:
310:            /**
311:             * @param displayWarning
312:             *            The displayWarning to set.
313:             */
314:            public void setPortWarn(boolean displayWarning) {
315:                this .portWarn = displayWarning;
316:                updateAttributeNVMap(PORT_WARN, "" + portWarn);
317:            }
318:
319:            public boolean getDontPortWarn() {
320:                return !portWarn;
321:            }
322:
323:            public void setDontPortWarn(boolean dontDisplayWarning) {
324:                this .portWarn = !dontDisplayWarning;
325:                updateAttributeNVMap(PORT_WARN, "" + this .portWarn);
326:            }
327:
328:            /**
329:             * @return Returns the reauthenticateForConnections.
330:             */
331:            public boolean getDoReauth() {
332:                return doReauth;
333:            }
334:
335:            /**
336:             * @param reauthenticateForConnections
337:             *            The reauthenticateForConnections to set.
338:             */
339:            public void setDoReauth(boolean reauthenticateForConnections) {
340:                this .doReauth = reauthenticateForConnections;
341:                updateAttributeNVMap(DO_REAUTH, "" + doReauth);
342:            }
343:
344:            public boolean getDontDoReauth() {
345:                return !doReauth;
346:            }
347:
348:            public void setDontDoReauth(boolean dontReauthenticateForConnections) {
349:                this .doReauth = !dontReauthenticateForConnections;
350:                updateAttributeNVMap(DO_REAUTH, "" + this .doReauth);
351:            }
352:
353:            /**
354:             * @return Returns the terminateAtLogout.
355:             */
356:            public boolean getTerminateAtLogout() {
357:                return terminateAtLogout;
358:            }
359:
360:            /**
361:             * @param terminateAtLogout
362:             *            The terminateAtLogout to set.
363:             */
364:            public void setTerminateAtLogout(boolean terminateAtLogout) {
365:                this .terminateAtLogout = terminateAtLogout;
366:                updateAttributeNVMap(TERMINATE_AT_LOGOUT, ""
367:                        + this .terminateAtLogout);
368:            }
369:
370:            public boolean getDontTerminateAtLogout() {
371:                return !terminateAtLogout;
372:            }
373:
374:            public void setDontTerminateAtLogout(boolean dontTerminateAtLogout) {
375:                this .terminateAtLogout = !dontTerminateAtLogout;
376:                updateAttributeNVMap(TERMINATE_AT_LOGOUT, ""
377:                        + this .terminateAtLogout);
378:            }
379:
380:            /**
381:             * @return Returns the keepAliveInterval.
382:             */
383:            public String getKeepAliveInterval() {
384:                return keepAliveInterval;
385:            }
386:
387:            /**
388:             * @param keepAliveInterval
389:             *            The keepAliveInterval to set.
390:             */
391:            public void setKeepAliveInterval(String keepAliveInterval) {
392:                this .keepAliveInterval = keepAliveInterval;
393:                updateAttributeNVMap(KEEP_ALIVE_INTERVAL, ""
394:                        + this .keepAliveInterval);
395:            }
396:
397:            /**
398:             * @return Returns the loopbackPort.
399:             */
400:            public String getClientLoopbackPort() {
401:                return clientLoopbackPort;
402:            }
403:
404:            /**
405:             * @param loopbackPort
406:             *            The loopbackPort to set.
407:             */
408:            public void setClientLoopbackPort(String loopbackPort) {
409:                this .clientLoopbackPort = loopbackPort;
410:                updateAttributeNVMap(LOOPBACK_PORT, "" + clientLoopbackPort);
411:            }
412:
413:            /**
414:             * @return Returns the selectedLaunchMode.
415:             */
416:            public Object getLaunchMode() {
417:                return launchMode;
418:            }
419:
420:            public boolean getAppletLaunchMode() {
421:                return appletLaunchMode;
422:            }
423:
424:            public void setAppletLaunchMode(boolean appletLaunchMode) {
425:                this .appletLaunchMode = appletLaunchMode;
426:                if (appletLaunchMode)
427:                    updateAttributeNVMap(LAUNCH_MODE, "Applet");
428:            }
429:
430:            public boolean getJnlpLaunchMode() {
431:                return jnlpLaunchMode;
432:            }
433:
434:            public void setJnlpLaunchMode(boolean jnlpLaunchMode) {
435:                this .jnlpLaunchMode = jnlpLaunchMode;
436:                if (jnlpLaunchMode)
437:                    updateAttributeNVMap(LAUNCH_MODE, "Java Web Start");
438:            }
439:
440:            public void setAllowedHosts(List allowedHosts) {
441:                updateAttributeNVMap(ACCESS_HOSTS, allowedHosts);
442:            }
443:
444:            public void setDeniedHosts(List deniedHosts) {
445:                updateAttributeNVMap(DENY_HOSTS, deniedHosts);
446:            }
447:
448:            public void setAccessRules(List accessRules) {
449:                updateAttributeNVMap(ACCESS_RULES, accessRules);
450:            }
451:
452:            public void setDenyRules(List denyRules) {
453:                updateAttributeNVMap(DENY_RULES, denyRules);
454:            }
455:
456:            public Option[] getDefaultKSSLCipher() {
457:                return defaultKSSLCipher;
458:            }
459:
460:            public void setDefaultKSSLCipher(Option[] defaultKSSLCipher) {
461:                this .defaultKSSLCipher = defaultKSSLCipher;
462:            }
463:
464:            public Option[] getDefaultJSSECipher() {
465:                return defaultJSSECipher;
466:            }
467:
468:            public void getDefaultJSSECipher(Option[] defaultJSSECipher) {
469:                this .defaultJSSECipher = defaultJSSECipher;
470:
471:            }
472:
473:            public String getSelectedDefaultJSSECipher() {
474:                return selectedDefaultJSSECipher;
475:            }
476:
477:            public String getSelectedDefaultKSSLCipher() {
478:                return selectedDefaultKSSLCipher;
479:            }
480:
481:            public void setSelectedDefaultJSSECipher(
482:                    String selectedDefaultJSSECipher) {
483:                this .selectedDefaultJSSECipher = selectedDefaultJSSECipher;
484:                updateAttributeNVMap(DEFAULT_JSSE_CIPHER,
485:                        selectedDefaultJSSECipher);
486:            }
487:
488:            public void setSelectedDefaultKSSLCipher(
489:                    String selectedDefaultKSSLCipher) {
490:                this .selectedDefaultKSSLCipher = selectedDefaultKSSLCipher;
491:                updateAttributeNVMap(DEFAULT_KSSL_CIPHER,
492:                        selectedDefaultKSSLCipher);
493:            }
494:
495:            /**
496:             * Getter for property rulesData.
497:             * @return Value of property rulesData.
498:             */
499:            public SraObjectListDataProvider getRulesData() {
500:                /*if(rulesData.size()==0){
501:                    rulesData.add(new NetletRuleBean(""));
502:                }*/
503:                netletRuleDataProvider = new SraObjectListDataProvider(
504:                        NetletRuleBean.class.getName(), rulesData);
505:                return netletRuleDataProvider;
506:            }
507:
508:            public String getRuleNames() {
509:                String ruleNames = "";
510:                for (int i = 0; i < rulesData.size(); i++) {
511:                    NetletRuleBean nrb = (NetletRuleBean) rulesData.get(i);
512:                    ruleNames += nrb.getName() + ",";
513:                }
514:                if (!ruleNames.equals("")) {
515:
516:                    if (ruleNames.charAt(ruleNames.length() - 1) == ',')
517:                        ruleNames = ruleNames.substring(0,
518:                                ruleNames.length() - 1);
519:                }
520:
521:                return ruleNames;
522:            }
523:
524:            public void saveRulesData() {
525:                if (netletRuleDataProvider != null) {
526:                    rulesData = netletRuleDataProvider.getList();
527:                }
528:                String[] netletRules = new String[rulesData.size()];
529:                NetletRuleBean nr = null;
530:                for (int i = 0; i < rulesData.size(); i++) {
531:                    nr = (NetletRuleBean) rulesData.get(i);
532:                    if (nr.getName() == "") {
533:                        continue;
534:                    }
535:                    netletRules[i] = nr.decode();
536:
537:                }
538:
539:                updateAttributeNVMap(NETLET_RULES, netletRules);
540:                storeDataToStore(NETLET_RULES);
541:
542:            }
543:
544:            public String newRule() {
545:                setSessionAttribute("rule", NetletRuleBean.getInstance());
546:                return "dispNetletRule";
547:            }
548:
549:            public String dispNetletRule() {
550:                String id = (String) Util.getRequestParameter("rulename");
551:                NetletRuleBean nr = null;
552:                for (int i = 0; i < rulesData.size(); i++) {
553:                    nr = (NetletRuleBean) rulesData.get(i);
554:                    if (nr.getName().equals(id)) {
555:                        setSessionAttribute("rule", nr);
556:                        break;
557:                    }
558:                }
559:                return "dispNetletRule";
560:            }
561:
562:            public void removeNetletRule() {
563:                String ruleName = (String) Util
564:                        .getRequestAttribute("rulecheck");
565:                NetletRuleBean nrb = null;
566:
567:                if (netletRuleDataProvider == null)
568:                    netletRuleDataProvider = getRulesData();
569:
570:                rulesData = netletRuleDataProvider.getList();
571:                for (int i = 0; i < rulesData.size(); i++) {
572:                    nrb = (NetletRuleBean) rulesData.get(i);
573:                    if (nrb.getName().equals(ruleName)) {
574:                        netletRuleDataProvider.removeObject(nrb);
575:                        break;
576:                    }
577:                }
578:                netletRuleDataProvider.commitChanges();
579:
580:                rulesData = netletRuleDataProvider.getList();
581:                NetletRuleBean nr = null;
582:                for (int i = 0; i < rulesData.size(); i++) {
583:                    nr = (NetletRuleBean) rulesData.get(i);
584:                }
585:                saveRulesData();
586:            }
587:
588:            public void addRule(NetletRuleBean nrb) {
589:                NetletRuleBean nb = null;
590:                for (int i = 0; i < rulesData.size(); i++) {
591:                    nb = (NetletRuleBean) rulesData.get(i);
592:                    if (nb.getName().equalsIgnoreCase(nrb.getName())) {
593:                        rulesData.set(i, nrb);
594:                        saveRulesData();
595:                        return;
596:                    }
597:                }
598:                rulesData.add(nrb);
599:                saveRulesData();
600:            }
601:
602:            public void addAllowDenyHost() {
603:                allowDenyHost.addNewItem();
604:            }
605:
606:            public void deleteAllowDenyHost() {
607:                allowDenyHost.deleteItem();
608:                saveAllowDenyHostList();
609:            }
610:
611:            private void saveAllowDenyHostList() {
612:                setAllowedHosts(allowDenyHost.getAllowList());
613:                storeDataToStore(ACCESS_HOSTS);
614:                setDeniedHosts(allowDenyHost.getDenyList());
615:                storeDataToStore(DENY_HOSTS);
616:            }
617:
618:            public DataProvider getAllowDenyHostList() {
619:                return allowDenyHost.getAllowDenyDataProvider();
620:            }
621:
622:            /* public boolean isAllowDenyHostListContainsEmpty()
623:             {
624:                 return doesTableContainEmptyRow(allowDenyHost);
625:             }
626:
627:             public boolean isAllowDenyRuleListContainsEmpty()
628:             {
629:                 return doesTableContainEmptyRow(allowDenyRule);
630:             }*/
631:
632:            public void addAllowDenyRule() {
633:                allowDenyRule.addNewItem();
634:            }
635:
636:            public void deleteAllowDenyRule() {
637:                allowDenyRule.deleteItem();
638:                saveAllowDenyRuleList();
639:            }
640:
641:            private void saveAllowDenyRuleList() {
642:                setAccessRules(allowDenyRule.getAllowList());
643:                storeDataToStore(ACCESS_RULES);
644:                setDenyRules(allowDenyRule.getDenyList());
645:                storeDataToStore(DENY_RULES);
646:            }
647:
648:            public DataProvider getAllowDenyRuleList() {
649:                return allowDenyRule.getAllowDenyDataProvider();
650:            }
651:
652:            public ArrayList getOperations() {
653:                return allowDenyHost.getOperations();
654:            }
655:
656:            public boolean isServiceAssigned() {
657:                return isServiceAssigned("srapNetletService");
658:            }
659:        }
ww_w_.__j_ava___2s_._c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.