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


001:        /**
002:         * Copyright 2004 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.cli.commands.search;
013:
014:        import java.util.*;
015:
016:        // JMX
017:        import javax.management.MBeanServerConnection;
018:        import javax.management.ObjectName;
019:        import javax.management.InstanceNotFoundException;
020:        import javax.management.MBeanException;
021:        import javax.management.ReflectionException;
022:        import javax.management.MalformedObjectNameException;
023:        import javax.management.RuntimeOperationsException;
024:
025:        // PS Admin Common
026:        import com.sun.portal.admin.common.util.AdminClientUtil;
027:
028:        // CLI framework
029:        import com.sun.enterprise.cli.framework.*;
030:
031:        // Base Class
032:        import com.sun.portal.admin.cli.commands.GenericCommand;
033:
034:        /**
035:         * This class implements the psadmin list-search-importagents subcommand.
036:         * The list-search-importagents subcommand calls the SearchServerMBean
037:         * and shows a list of import agents.
038:         */
039:        public class ListImportAgentsCommand extends GenericCommand {
040:
041:            /**
042:             *  An abstract method that executes the command
043:             *  @throws CommandException
044:             *  @throws CommandValidationException
045:             */
046:            public void runCommand() throws CommandException,
047:                    CommandValidationException {
048:                validateOptions();
049:                validateSearchServerID();
050:
051:                StringBuffer sb = new StringBuffer();
052:                try {
053:                    LinkedList path = new LinkedList();
054:                    path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
055:                    path.addFirst(getSearchServerId());
056:                    ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
057:                            AdminClientUtil.SEARCHSERVER_MBEAN_TYPE, path);
058:
059:                    MBeanServerConnection msc = getMBeanServerConnection(
060:                            getUserId(), getPassword(), getHost());
061:
062:                    ArrayList al = new ArrayList();
063:                    al.add("id");
064:                    al.add("input-file");
065:                    al.add("nickname");
066:                    Object[] params = { al };
067:                    String[] signatures = { "java.util.List" };
068:                    ArrayList data = (ArrayList) msc.invoke(on,
069:                            "getAllImportAgents", params, signatures);
070:
071:                    for (int index = 0; index < data.size(); index++) {
072:                        Properties p = (Properties) data.get(index);
073:
074:                        String id = getStringValue(p, "id");
075:                        String inputFile = getStringValue(p, "input-file");
076:                        String nickName = getStringValue(p, "nickname");
077:                        String agent = (!nickName.equals("")) ? nickName
078:                                : inputFile;
079:                        sb.append(id + "\t" + agent + "\n");
080:                    }
081:                } catch (InstanceNotFoundException ie) {
082:                    throw new CommandException(getLocalizedString(
083:                            ERROR_MBEAN_INSTANCE_NOT_FOUND,
084:                            new Object[] { "getAllImportAgents" }), ie);
085:                } catch (MBeanException me) {
086:                    throw new CommandException(getLocalizedString(
087:                            ERROR_JMX_INVOKE,
088:                            new Object[] { "getAllImportAgents" }), me);
089:                } catch (ReflectionException re) {
090:                    throw new CommandException(getLocalizedString(
091:                            ERROR_MBEAN_REFLECTION_ERROR,
092:                            new Object[] { "getAllImportAgents" }), re);
093:                } catch (CommandException ce) {
094:                    throw ce;
095:                } catch (Exception e) {
096:                    throw new CommandException(
097:                            getLocalizedString(COMMAND_FAILED), e);
098:                } finally {
099:                    closeMBeanServerConnection();
100:                }
101:
102:                CLILogger.getInstance().printMessage(sb.toString());
103:            }
104:
105:            private String getStringValue(Properties p, String key) {
106:                if (p.containsKey(key)) {
107:                    return p.getProperty(key);
108:                } else {
109:                    return "";
110:                }
111:            }
112:
113:        }
ww___w_.___j_a___v__a2___s___.__c___o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.