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


001:        /**
002:         * Copyright 2005 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.admin.console.search;
013:
014:        import java.util.*;
015:        import java.util.logging.Level;
016:        import java.io.*;
017:
018:        import javax.faces.context.FacesContext;
019:        import javax.faces.application.FacesMessage;
020:        import javax.faces.component.UIComponent;
021:        import javax.faces.validator.*;
022:        import javax.servlet.http.HttpServletRequest;
023:        import javax.management.*;
024:
025:        import com.sun.web.ui.model.*;
026:        import com.sun.web.ui.event.*;
027:
028:        import com.sun.data.provider.*;
029:        import com.sun.data.provider.impl.ObjectListDataProvider;
030:
031:        import com.sun.cacao.agent.JmxClient;
032:
033:        import com.sun.portal.admin.common.util.AdminClientUtil;
034:        import com.sun.portal.admin.console.common.PSBaseBean;
035:
036:        public class CreateSearchServerBean extends PSBaseBean implements 
037:                WizardEventListener {
038:
039:            public String type = "SJSWS7";
040:
041:            public String id = "";
042:
043:            public String protocol = "http";
044:            public String host = "";
045:            public String port = "";
046:            public String domain = "";
047:            public String configurationName = "";
048:            public String instance = "";
049:            public String cell = "";
050:            public String node = "";
051:
052:            public String administrationProtocol = "http";
053:            public String administrationHost = "";
054:            public String administrationPort = "";
055:            public String administrator = "";
056:            public String administrationPassword = "";
057:
058:            public String masterPassword = "";
059:            public String managedServer = "false";
060:
061:            public String jdkDirectory = "";
062:            public String installDirectory = "";
063:            public String instanceDirectory = "";
064:            public String documentRootDirectory = "";
065:
066:            public boolean inProgress = false;
067:            public boolean showAlert = false;
068:            public String message = "";
069:
070:            public CreateSearchServerBean() {
071:            }
072:
073:            public boolean handleEvent(WizardEvent event) {
074:                switch (event.getNavigationEvent()) {
075:                case WizardEvent.FINISH:
076:                    createSearchServer();
077:                    break;
078:                case WizardEvent.CANCEL:
079:                case WizardEvent.CLOSE:
080:                    type = "SJSWS7";
081:                    id = "";
082:                    protocol = "http";
083:                    host = "";
084:                    port = "";
085:                    domain = "";
086:                    configurationName = "";
087:                    instance = "";
088:                    cell = "";
089:                    node = "";
090:                    administrationProtocol = "http";
091:                    administrationHost = "";
092:                    administrationPort = "";
093:                    administrator = "";
094:                    administrationPassword = "";
095:                    masterPassword = "";
096:                    managedServer = "false";
097:                    jdkDirectory = "";
098:                    installDirectory = "";
099:                    instanceDirectory = "";
100:                    documentRootDirectory = "";
101:                    break;
102:                default:
103:                    break;
104:                }
105:                return true;
106:            }
107:
108:            public String getId() {
109:                return id;
110:            }
111:
112:            public void setId(String id) {
113:                this .id = id;
114:            }
115:
116:            public Option[] getAvailableTypes() {
117:                Option[] options = new Option[5];
118:                options[0] = new Option("SJSWS7", getLocalizedString("search",
119:                        "search.searchserver.type.sjsws7"));
120:                options[1] = new Option("SJSWS6", getLocalizedString("search",
121:                        "search.searchserver.type.sjsws6"));
122:                options[2] = new Option("SJSAS81", getLocalizedString("search",
123:                        "search.searchserver.type.sjsas81"));
124:                options[3] = new Option("BEAWL8", getLocalizedString("search",
125:                        "search.searchserver.type.beawl8"));
126:                options[4] = new Option("IBMWAS5", getLocalizedString("search",
127:                        "search.searchserver.type.ibmwas5"));
128:                return options;
129:            }
130:
131:            public String getType() {
132:                return type;
133:            }
134:
135:            public void setType(String type) {
136:                this .type = type;
137:            }
138:
139:            public Option[] getAvailableProtocols() {
140:                Option[] options = new Option[2];
141:                options[0] = new Option("http", "http");
142:                options[1] = new Option("https", "https");
143:                return options;
144:            }
145:
146:            public String getProtocol() {
147:                return protocol;
148:            }
149:
150:            public void setProtocol(String protocol) {
151:                this .protocol = protocol;
152:            }
153:
154:            public String getHost() {
155:                return host;
156:            }
157:
158:            public void setHost(String host) {
159:                this .host = host;
160:            }
161:
162:            public String getPort() {
163:                return port;
164:            }
165:
166:            public void setPort(String port) {
167:                this .port = port;
168:            }
169:
170:            public String getDomain() {
171:                return domain;
172:            }
173:
174:            public void setDomain(String domain) {
175:                this .domain = domain;
176:            }
177:
178:            public String getConfigurationName() {
179:                return configurationName;
180:            }
181:
182:            public void setConfigurationName(String configurationName) {
183:                this .configurationName = configurationName;
184:            }
185:
186:            public String getInstance() {
187:                return instance;
188:            }
189:
190:            public void setInstance(String instance) {
191:                this .instance = instance;
192:            }
193:
194:            public String getCell() {
195:                return cell;
196:            }
197:
198:            public void setCell(String cell) {
199:                this .cell = cell;
200:            }
201:
202:            public String getNode() {
203:                return node;
204:            }
205:
206:            public void setNode(String node) {
207:                this .node = node;
208:            }
209:
210:            public Option[] getAvailableBoolean() {
211:                Option[] options = new Option[2];
212:                options[0] = new Option("true", getLocalizedString("search",
213:                        "search.general.true"));
214:                options[1] = new Option("false", getLocalizedString("search",
215:                        "search.general.false"));
216:                return options;
217:            }
218:
219:            public String getManagedServer() {
220:                return managedServer;
221:            }
222:
223:            public void setManagedServer(String managedServer) {
224:                this .managedServer = managedServer;
225:            }
226:
227:            public String getAdministrationProtocol() {
228:                return administrationProtocol;
229:            }
230:
231:            public void setAdministrationProtocol(String administrationProtocol) {
232:                this .administrationProtocol = administrationProtocol;
233:            }
234:
235:            public String getAdministrationHost() {
236:                return administrationHost;
237:            }
238:
239:            public void setAdministrationHost(String administrationHost) {
240:                this .administrationHost = administrationHost;
241:            }
242:
243:            public String getAdministrationPort() {
244:                return administrationPort;
245:            }
246:
247:            public void setAdministrationPort(String administrationPort) {
248:                this .administrationPort = administrationPort;
249:            }
250:
251:            public String getAdministrator() {
252:                return administrator;
253:            }
254:
255:            public void setAdministrator(String administrator) {
256:                this .administrator = administrator;
257:            }
258:
259:            public String getAdministrationPassword() {
260:                return administrationPassword;
261:            }
262:
263:            public void setAdministrationPassword(String administrationPassword) {
264:                this .administrationPassword = administrationPassword;
265:            }
266:
267:            public String getMasterPassword() {
268:                return masterPassword;
269:            }
270:
271:            public void setMasterPassword(String masterPassword) {
272:                this .masterPassword = masterPassword;
273:            }
274:
275:            public String getJdkDirectory() {
276:                return jdkDirectory;
277:            }
278:
279:            public void setJdkDirectory(String jdkDirectory) {
280:                this .jdkDirectory = jdkDirectory;
281:            }
282:
283:            public String getInstallDirectory() {
284:                return installDirectory;
285:            }
286:
287:            public void setInstallDirectory(String installDirectory) {
288:                this .installDirectory = installDirectory;
289:            }
290:
291:            public String getInstanceDirectory() {
292:                return instanceDirectory;
293:            }
294:
295:            public void setInstanceDirectory(String instanceDirectory) {
296:                this .instanceDirectory = instanceDirectory;
297:            }
298:
299:            public String getDocumentRootDirectory() {
300:                return documentRootDirectory;
301:            }
302:
303:            public void setDocumentRootDirectory(String documentRootDirectory) {
304:                this .documentRootDirectory = documentRootDirectory;
305:            }
306:
307:            public boolean getInProgress() {
308:                if (inProgress) {
309:                    checkCreateStatus();
310:                }
311:                return inProgress;
312:            }
313:
314:            public boolean getShowAlert() {
315:                if (inProgress) {
316:                    checkCreateStatus();
317:                }
318:                return showAlert;
319:            }
320:
321:            public String getMessage() {
322:                if (inProgress) {
323:                    checkCreateStatus();
324:                }
325:                return message;
326:            }
327:
328:            public boolean isTransient() {
329:                return false;
330:            }
331:
332:            public void setTransient(boolean flag) {
333:            }
334:
335:            public Object saveState(FacesContext fc) {
336:                return null;
337:            }
338:
339:            public void restoreState(FacesContext fc, Object state) {
340:            }
341:
342:            public void validate(FacesContext fc, UIComponent component,
343:                    Object value) throws ValidatorException {
344:                String id = component.getId();
345:                if (id.equals("searchServerID")) {
346:                    if (Validators.containsSpecialCharacters((String) value)) {
347:                        throw new ValidatorException(new FacesMessage(
348:                                FacesMessage.SEVERITY_ERROR,
349:                                getLocalizedString("search",
350:                                        "search.error.error"),
351:                                getLocalizedString("search",
352:                                        "search.error.specialcharacters")));
353:                    }
354:                    if (isDuplicate((String) value)) {
355:                        throw new ValidatorException(new FacesMessage(
356:                                FacesMessage.SEVERITY_ERROR,
357:                                getLocalizedString("search",
358:                                        "search.error.error"),
359:                                getLocalizedString("search",
360:                                        "search.error.duplicatesearchserver")));
361:                    }
362:                } else if (id.equals("host")) {
363:                    if (Validators.containsSpace((String) value)) {
364:                        throw new ValidatorException(new FacesMessage(
365:                                FacesMessage.SEVERITY_ERROR,
366:                                getLocalizedString("search",
367:                                        "search.error.error"),
368:                                getLocalizedString("search",
369:                                        "search.error.space")));
370:                    }
371:                    if (Validators.containsSpecialCharacters((String) value)) {
372:                        throw new ValidatorException(new FacesMessage(
373:                                FacesMessage.SEVERITY_ERROR,
374:                                getLocalizedString("search",
375:                                        "search.error.error"),
376:                                getLocalizedString("search",
377:                                        "search.error.specialcharacters")));
378:                    }
379:                } else if (id.equals("port")) {
380:                    if (!Validators.isPort((String) value)) {
381:                        throw new ValidatorException(new FacesMessage(
382:                                FacesMessage.SEVERITY_ERROR,
383:                                getLocalizedString("search",
384:                                        "search.error.error"),
385:                                getLocalizedString("search",
386:                                        "search.error.port")));
387:                    }
388:                } else if (id.equals("domain")) {
389:                    if (Validators.containsSpace((String) value)) {
390:                        throw new ValidatorException(new FacesMessage(
391:                                FacesMessage.SEVERITY_ERROR,
392:                                getLocalizedString("search",
393:                                        "search.error.error"),
394:                                getLocalizedString("search",
395:                                        "search.error.space")));
396:                    }
397:                    if (Validators.containsSpecialCharacters((String) value)) {
398:                        throw new ValidatorException(new FacesMessage(
399:                                FacesMessage.SEVERITY_ERROR,
400:                                getLocalizedString("search",
401:                                        "search.error.error"),
402:                                getLocalizedString("search",
403:                                        "search.error.specialcharacters")));
404:                    }
405:                } else if (id.equals("configurationName")) {
406:                    if (Validators.containsSpace((String) value)) {
407:                        throw new ValidatorException(new FacesMessage(
408:                                FacesMessage.SEVERITY_ERROR,
409:                                getLocalizedString("search",
410:                                        "search.error.error"),
411:                                getLocalizedString("search",
412:                                        "search.error.space")));
413:                    }
414:                    if (Validators.containsSpecialCharacters((String) value)) {
415:                        throw new ValidatorException(new FacesMessage(
416:                                FacesMessage.SEVERITY_ERROR,
417:                                getLocalizedString("search",
418:                                        "search.error.error"),
419:                                getLocalizedString("search",
420:                                        "search.error.specialcharacters")));
421:                    }
422:                } else if (id.equals("instance")) {
423:                    if (Validators.containsSpace((String) value)) {
424:                        throw new ValidatorException(new FacesMessage(
425:                                FacesMessage.SEVERITY_ERROR,
426:                                getLocalizedString("search",
427:                                        "search.error.error"),
428:                                getLocalizedString("search",
429:                                        "search.error.space")));
430:                    }
431:                    if (Validators.containsSpecialCharacters((String) value)) {
432:                        throw new ValidatorException(new FacesMessage(
433:                                FacesMessage.SEVERITY_ERROR,
434:                                getLocalizedString("search",
435:                                        "search.error.error"),
436:                                getLocalizedString("search",
437:                                        "search.error.specialcharacters")));
438:                    }
439:                } else if (id.equals("cell")) {
440:                    if (Validators.containsSpace((String) value)) {
441:                        throw new ValidatorException(new FacesMessage(
442:                                FacesMessage.SEVERITY_ERROR,
443:                                getLocalizedString("search",
444:                                        "search.error.error"),
445:                                getLocalizedString("search",
446:                                        "search.error.space")));
447:                    }
448:                    if (Validators.containsSpecialCharacters((String) value)) {
449:                        throw new ValidatorException(new FacesMessage(
450:                                FacesMessage.SEVERITY_ERROR,
451:                                getLocalizedString("search",
452:                                        "search.error.error"),
453:                                getLocalizedString("search",
454:                                        "search.error.specialcharacters")));
455:                    }
456:                } else if (id.equals("node")) {
457:                    if (Validators.containsSpace((String) value)) {
458:                        throw new ValidatorException(new FacesMessage(
459:                                FacesMessage.SEVERITY_ERROR,
460:                                getLocalizedString("search",
461:                                        "search.error.error"),
462:                                getLocalizedString("search",
463:                                        "search.error.space")));
464:                    }
465:                    if (Validators.containsSpecialCharacters((String) value)) {
466:                        throw new ValidatorException(new FacesMessage(
467:                                FacesMessage.SEVERITY_ERROR,
468:                                getLocalizedString("search",
469:                                        "search.error.error"),
470:                                getLocalizedString("search",
471:                                        "search.error.specialcharacters")));
472:                    }
473:                } else if (id.equals("administrationHost")) {
474:                    if (Validators.containsSpace((String) value)) {
475:                        throw new ValidatorException(new FacesMessage(
476:                                FacesMessage.SEVERITY_ERROR,
477:                                getLocalizedString("search",
478:                                        "search.error.error"),
479:                                getLocalizedString("search",
480:                                        "search.error.space")));
481:                    }
482:                    if (Validators.containsSpecialCharacters((String) value)) {
483:                        throw new ValidatorException(new FacesMessage(
484:                                FacesMessage.SEVERITY_ERROR,
485:                                getLocalizedString("search",
486:                                        "search.error.error"),
487:                                getLocalizedString("search",
488:                                        "search.error.specialcharacters")));
489:                    }
490:                } else if (id.equals("administrationPort")) {
491:                    if (!Validators.isPort((String) value)) {
492:                        throw new ValidatorException(new FacesMessage(
493:                                FacesMessage.SEVERITY_ERROR,
494:                                getLocalizedString("search",
495:                                        "search.error.error"),
496:                                getLocalizedString("search",
497:                                        "search.error.port")));
498:                    }
499:                } else if (id.equals("administrator")) {
500:                    if (Validators.containsSpace((String) value)) {
501:                        throw new ValidatorException(new FacesMessage(
502:                                FacesMessage.SEVERITY_ERROR,
503:                                getLocalizedString("search",
504:                                        "search.error.error"),
505:                                getLocalizedString("search",
506:                                        "search.error.space")));
507:                    }
508:                    if (Validators.containsSpecialCharacters((String) value)) {
509:                        throw new ValidatorException(new FacesMessage(
510:                                FacesMessage.SEVERITY_ERROR,
511:                                getLocalizedString("search",
512:                                        "search.error.error"),
513:                                getLocalizedString("search",
514:                                        "search.error.specialcharacters")));
515:                    }
516:                } else if (id.equals("administrationPassword")) {
517:                } else if (id.equals("masterPassword")) {
518:                } else if (id.equals("jdkDirectory")) {
519:                    if (Validators.containsSpace((String) value)) {
520:                        throw new ValidatorException(new FacesMessage(
521:                                FacesMessage.SEVERITY_ERROR,
522:                                getLocalizedString("search",
523:                                        "search.error.error"),
524:                                getLocalizedString("search",
525:                                        "search.error.space")));
526:                    }
527:                    if (Validators.containsSpecialCharacters((String) value)) {
528:                        throw new ValidatorException(new FacesMessage(
529:                                FacesMessage.SEVERITY_ERROR,
530:                                getLocalizedString("search",
531:                                        "search.error.error"),
532:                                getLocalizedString("search",
533:                                        "search.error.specialcharacters")));
534:                    }
535:                } else if (id.equals("installDirectory")) {
536:                    if (Validators.containsSpace((String) value)) {
537:                        throw new ValidatorException(new FacesMessage(
538:                                FacesMessage.SEVERITY_ERROR,
539:                                getLocalizedString("search",
540:                                        "search.error.error"),
541:                                getLocalizedString("search",
542:                                        "search.error.space")));
543:                    }
544:                    if (Validators.containsSpecialCharacters((String) value)) {
545:                        throw new ValidatorException(new FacesMessage(
546:                                FacesMessage.SEVERITY_ERROR,
547:                                getLocalizedString("search",
548:                                        "search.error.error"),
549:                                getLocalizedString("search",
550:                                        "search.error.specialcharacters")));
551:                    }
552:                } else if (id.equals("instanceDirectory")) {
553:                    if (Validators.containsSpace((String) value)) {
554:                        throw new ValidatorException(new FacesMessage(
555:                                FacesMessage.SEVERITY_ERROR,
556:                                getLocalizedString("search",
557:                                        "search.error.error"),
558:                                getLocalizedString("search",
559:                                        "search.error.space")));
560:                    }
561:                    if (Validators.containsSpecialCharacters((String) value)) {
562:                        throw new ValidatorException(new FacesMessage(
563:                                FacesMessage.SEVERITY_ERROR,
564:                                getLocalizedString("search",
565:                                        "search.error.error"),
566:                                getLocalizedString("search",
567:                                        "search.error.specialcharacters")));
568:                    }
569:                } else if (id.equals("documentRootDirectory")) {
570:                    if (Validators.containsSpace((String) value)) {
571:                        throw new ValidatorException(new FacesMessage(
572:                                FacesMessage.SEVERITY_ERROR,
573:                                getLocalizedString("search",
574:                                        "search.error.error"),
575:                                getLocalizedString("search",
576:                                        "search.error.space")));
577:                    }
578:                    if (Validators.containsSpecialCharacters((String) value)) {
579:                        throw new ValidatorException(new FacesMessage(
580:                                FacesMessage.SEVERITY_ERROR,
581:                                getLocalizedString("search",
582:                                        "search.error.error"),
583:                                getLocalizedString("search",
584:                                        "search.error.specialcharacters")));
585:                    }
586:                }
587:            }
588:
589:            public String createSearchServer() {
590:                if (!validWCInstance(host, port, instance)) {
591:                    inProgress = false;
592:                    showAlert = true;
593:                    message = getLocalizedString("search",
594:                            "search.error.badwcinstance");
595:                } else {
596:                    try {
597:                        LinkedList path = new LinkedList();
598:                        path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
599:                        ObjectName on = AdminClientUtil
600:                                .getResourceMBeanObjectName(
601:                                        AdminClientUtil.PORTAL_DOMAIN_MBEAN_TYPE,
602:                                        path);
603:
604:                        Properties p = new Properties();
605:                        p.setProperty("WebContainerType", type);
606:                        p.setProperty("Scheme", protocol);
607:                        p.setProperty("Host", host);
608:                        p.setProperty("Port", port);
609:                        if (!domain.equals("")) {
610:                            p.setProperty("WebContainerDomainName", domain);
611:                        } else if (!configurationName.equals("")) {
612:                            p.setProperty("WebContainerDomainName",
613:                                    configurationName);
614:                        } else {
615:                            p.setProperty("WebContainerDomainName", "");
616:                        }
617:                        p.setProperty("WebContainerInstanceName", instance);
618:                        p.setProperty("WebContainerDeployCell", cell);
619:                        p.setProperty("WebContainerDeployNode", node);
620:                        p.setProperty("WebContainerManagedServer",
621:                                managedServer);
622:                        p.setProperty("WebContainerAdminScheme",
623:                                administrationProtocol);
624:                        p.setProperty("WebContainerAdminHost",
625:                                administrationHost);
626:                        p.setProperty("WebContainerAdminPort",
627:                                administrationPort);
628:                        p.setProperty("WebContainerAdminUid", administrator);
629:                        p.setProperty("WebContainerAdminPassword",
630:                                administrationPassword);
631:                        p.setProperty("WebContainerMasterPassword",
632:                                masterPassword);
633:                        p.setProperty("WebContainerJDKDir", jdkDirectory);
634:                        p.setProperty("WebContainerInstallDir",
635:                                installDirectory);
636:                        p.setProperty("WebContainerInstanceDir",
637:                                instanceDirectory);
638:                        p.setProperty("WebContainerDocRoot",
639:                                documentRootDirectory);
640:
641:                        Object[] params = { id, p };
642:                        String[] signatures = { "java.lang.String",
643:                                "java.util.Properties" };
644:                        getMBeanServerConnection().invoke(on,
645:                                "createSearchServerBackground", params,
646:                                signatures);
647:
648:                        inProgress = true;
649:                        showAlert = false;
650:                        message = getLocalizedString("search",
651:                                "search.createsearchserver.inprogress");
652:                    } catch (Exception e) {
653:                        inProgress = false;
654:                        showAlert = true;
655:                        message = getLocalizedString("search",
656:                                "search.error.generalfault");
657:                        log(Level.SEVERE,
658:                                "CreateSearchServerBean.createSearchServer()",
659:                                e);
660:                    }
661:                }
662:                return null;
663:            }
664:
665:            private boolean isDuplicate(String value) {
666:                try {
667:                    ObjectName on = AdminClientUtil
668:                            .getSearchServerPattern(AdminClientUtil.DEFAULT_DOMAIN);
669:                    Set objects = getMBeanServerConnection().queryNames(on,
670:                            null);
671:                    Iterator i = objects.iterator();
672:                    while (i.hasNext()) {
673:                        on = (ObjectName) i.next();
674:                        String id = (String) getMBeanServerConnection()
675:                                .getAttribute(on, "ID");
676:                        if (value.equals(id)) {
677:                            return true;
678:                        }
679:                    }
680:                } catch (Exception e) {
681:                }
682:                return false;
683:            }
684:
685:            private boolean validWCInstance(String host, String port,
686:                    String instance) {
687:                try {
688:                    ObjectName on = AdminClientUtil
689:                            .getSearchServerPattern(AdminClientUtil.DEFAULT_DOMAIN);
690:                    Set objects = getMBeanServerConnection().queryNames(on,
691:                            new ObjectName(""));
692:                    Iterator i = objects.iterator();
693:                    while (i.hasNext()) {
694:                        on = (ObjectName) i.next();
695:                        String testHost = (String) getMBeanServerConnection()
696:                                .getAttribute(on, "Host");
697:                        String testPort = (String) getMBeanServerConnection()
698:                                .getAttribute(on, "Port");
699:                        String testInstance = (String) getMBeanServerConnection()
700:                                .getAttribute(on, "Instance");
701:                        if (testHost.equals(host) && testPort.equals(port)
702:                                && testInstance.equals(instance)) {
703:                            return false;
704:                        }
705:                    }
706:                    return true;
707:                } catch (Exception e) {
708:                    log(Level.SEVERE,
709:                            "CreateSearchServerBean.validWCInstance()", e);
710:                }
711:                return false;
712:            }
713:
714:            private void checkCreateStatus() {
715:                try {
716:                    LinkedList path = new LinkedList();
717:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
718:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
719:                            AdminClientUtil.PORTAL_DOMAIN_MBEAN_TYPE, path);
720:                    Object[] params = {};
721:                    String[] signatures = {};
722:                    Integer status = (Integer) getMBeanServerConnection()
723:                            .invoke(on, "retrieveCreateSearchServerStatus",
724:                                    params, signatures);
725:                    switch (status.intValue()) {
726:                    case 0:
727:                        inProgress = false;
728:                        showAlert = false;
729:                        message = getLocalizedString("search",
730:                                "search.createsearchserver.success");
731:                        break;
732:                    case 1:
733:                        inProgress = true;
734:                        showAlert = false;
735:                        message = getLocalizedString("search",
736:                                "search.createsearchserver.status1");
737:                        break;
738:                    case 2:
739:                        inProgress = true;
740:                        showAlert = false;
741:                        message = getLocalizedString("search",
742:                                "search.createsearchserver.status2");
743:                        break;
744:                    case 3:
745:                        inProgress = true;
746:                        showAlert = false;
747:                        message = getLocalizedString("search",
748:                                "search.createsearchserver.status3");
749:                        break;
750:                    case 4:
751:                        inProgress = true;
752:                        showAlert = false;
753:                        message = getLocalizedString("search",
754:                                "search.createsearchserver.status4");
755:                        break;
756:                    default:
757:                        inProgress = false;
758:                        showAlert = true;
759:                        message = getLocalizedString("search",
760:                                "search.error.generalfault");
761:                    }
762:                } catch (Exception e) {
763:                    inProgress = false;
764:                    showAlert = true;
765:                    message = getLocalizedString("search",
766:                            "search.error.generalfault");
767:                    log(Level.SEVERE,
768:                            "CreateSearchServerBean.checkCreateStatus()", e);
769:                }
770:            }
771:
772:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.