Source Code Cross Referenced for WSRPTaskAdmin.java in  » Portal » Open-Portal » com » sun » portal » taskadmin » 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.taskadmin 
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:         */
013:        package com.sun.portal.taskadmin;
014:
015:        import java.util.Iterator;
016:        import java.util.Set;
017:        import java.util.HashSet;
018:
019:        import javax.servlet.http.HttpServletRequest;
020:
021:        import com.sun.portal.taskadmin.ChannelTaskAdmin;
022:        import com.sun.portal.taskadmin.TaskAdminException;
023:        import com.sun.portal.taskadmin.TaskAdminConstants;
024:        import com.sun.portal.taskadmin.context.TaskAdminContext;
025:        import com.sun.portal.taskadmin.context.TaskAdminContextFactory;
026:        import com.sun.portal.taskadmin.context.TaskAdminContextFactoryManager;
027:        import com.sun.portal.taskadmin.context.ISChannelTaskAdminContext;
028:
029:        import com.sun.portal.desktop.dp.DPChannel;
030:
031:        import com.sun.portal.wsrp.consumer.common.WSRPProviderConstants;
032:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntityManager;
033:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntityManagerFactory;
034:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntity;
035:        import com.sun.portal.wsrp.common.stubs.ServiceDescription;
036:        import com.sun.portal.wsrp.common.stubs.PortletDescription;
037:        import com.sun.portal.wsrp.common.stubs.LocalizedString;
038:        import com.sun.portal.wsrp.WSRPException;
039:        import com.iplanet.sso.SSOException;
040:        import com.iplanet.am.sdk.AMException;
041:        import com.iplanet.am.sdk.AMRole;
042:
043:        /**
044:         * This class implements the APIs that can be used
045:         * to achieve a set of administrative tasks associated
046:         * with WSRP.
047:         */
048:        public class WSRPTaskAdmin extends ChannelTaskAdmin {
049:
050:            //Reference to ProducerEntityManager that administer remote web services offered by the producers.
051:            ProducerEntityManager pem = null;
052:
053:            public WSRPTaskAdmin(HttpServletRequest req, String baseDN)
054:                    throws TaskAdminException {
055:                super (req, baseDN);
056:                try {
057:                    //initialize ProducerEntityManager.
058:                    pem = ProducerEntityManagerFactory.getInstance()
059:                            .getProducerEntityManager(
060:                                    context.getOrganizationDN(baseDN), req);
061:                } catch (WSRPException e) {
062:                    throw new TaskAdminException(
063:                            "WSRPTaskAdmin():Unable to intialize WSRPTaskAdmin",
064:                            e);
065:                }
066:            }
067:
068:            /**
069:             * Creates a new WSRP portlet channel.
070:             * A new channel is created based on the _WSRPProvider.
071:             * To create a nested channel, supply a hierarchical channel
072:             * name. For example, to create channel A inside of container X, based on
073:             * _WSRPProvider provider <br><br>
074:             * <code>createWSRPChannel("X" + "/" + "A", "MyProducerId", "MyPortletId");</code>
075:             * @param chname WSRP channel name.
076:             * @param pid produer entity id (producer id)
077:             * @param rid portlet id (portlet handler)
078:             * @throws TaskAdminException throws if exception ocurred during WSRP channel creation.
079:             */
080:            public void createWSRPChannel(String chname, String pid, String rid)
081:                    throws TaskAdminException {
082:                createChannel(chname, WSRPProviderConstants.WSRP_PROVIDER);
083:                DPChannel ch = dpRoot.getChannel(chname);
084:                ch.getProperties().setString(WSRPProviderConstants.CONSUMER_ID,
085:                        context.getOrganizationDN(baseDN));
086:                ch.getProperties().setString(
087:                        WSRPProviderConstants.PRODUCER_ENTITY_ID, pid);
088:                ch.getProperties().setString(WSRPProviderConstants.PORTLET_ID,
089:                        rid);
090:                ch.getProperties().setString(
091:                        WSRPProviderConstants.PORTLET_HANDLE, rid);
092:            }
093:
094:            /**
095:             * Returns the name of producer for the given producer ID.
096:             * @param producerID producer id.
097:             * @return producer name if valid producerID passed.
098:             * @throws TaskAdminException throws if exception ocurred during retrieveing the producer name.
099:             */
100:            public String getProducerName(String producerID)
101:                    throws TaskAdminException {
102:                try {
103:                    return pem.getProducerEntity(producerID).getName();
104:                } catch (WSRPException e) {
105:                    Object[] tokens = { baseDN, producerID, e.getMessage() };
106:                    throw new TaskAdminException(
107:                            TaskAdminConstants.PRODUCER_NAME_ERROR, tokens);
108:                }
109:            }
110:
111:            /**
112:             * This method returns the list of producer IDs that are existing
113:             * at the baseDN that is passed in. The producers in this list
114:             * can be used to get the portlets list by the user that can administer
115:             * the baseDN that is passed in.
116:             * @return Set of producers that are available at this baseDN.
117:             */
118:            public Set getExistingProducerIds() throws TaskAdminException {
119:                try {
120:                    return pem.getProducerEntityIds();
121:                } catch (WSRPException e) {
122:                    e.printStackTrace();
123:                    Object[] tokens = { baseDN, e.getMessage() };
124:                    throw new TaskAdminException(
125:                            TaskAdminConstants.PRODUCERS_ID_LIST_ERROR, tokens);
126:                }
127:            }
128:
129:            /**
130:             * Returns the portlet ids list for the given producer ID.
131:             * @param producerID produer id
132:             * @return Set contaning portlet handlers list.
133:             * @throws TaskAdminException
134:             */
135:            public Set getPortletHandlers(String producerID)
136:                    throws TaskAdminException {
137:                HashSet portletHandlers = new HashSet();
138:                try {
139:                    ProducerEntity pe = pem.getProducerEntity(producerID);
140:                    ServiceDescription sd = pe.getServiceDescription();
141:                    PortletDescription[] portlets = sd.getOfferedPortlets();
142:                    for (int i = 0; i < portlets.length; i++) {
143:                        String handle = portlets[i].getPortletHandle();
144:                        portletHandlers.add(handle);
145:                    }
146:                } catch (WSRPException e) {
147:                    Object[] tokens = { baseDN, e.getMessage() };
148:                    throw new TaskAdminException(
149:                            TaskAdminConstants.PORTLETS_HANDLER_LIST_ERROR,
150:                            tokens);
151:                }
152:                return portletHandlers;
153:            }
154:
155:            /**
156:             * Returns the name of portlet for the given producer ID and portletID.
157:             * @param producerID producer id.
158:             * @param portletID portlet id (portlet handler)
159:             * @return portlet name if valid producerID and portletID passed.
160:             * @throws TaskAdminException throws if exception ocurred during retrieveing the portlet name.
161:             */
162:            public String getPortletName(String producerID, String portletID)
163:                    throws TaskAdminException {
164:                try {
165:                    PortletDescription pd = pem.getProducerEntity(producerID)
166:                            .getPortletDescription(portletID);
167:                    LocalizedString name = pd.getDisplayName();
168:                    if (name != null && name.getValue() != null) {
169:                        return name.getValue();
170:                    } else {
171:                        //if LocalizedString is null , then return the
172:                        // portlet handle as a portlet name.
173:                        return pd.getPortletHandle();
174:                    }
175:                } catch (WSRPException e) {
176:                    Object[] tokens = { baseDN, producerID, portletID,
177:                            e.getMessage() };
178:                    throw new TaskAdminException(
179:                            TaskAdminConstants.PORTLET_NAME_ERROR, tokens);
180:                }
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.