Source Code Cross Referenced for Test.java in  » Portal » Open-Portal » com » sun » portal » wsrp » producer » portletmanagement » test » 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.wsrp.producer.portletmanagement.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.sun.portal.wsrp.producer.portletmanagement.test;
002:
003:        import java.util.Properties;
004:        import java.util.Set;
005:        import java.util.HashSet;
006:
007:        import java.io.InputStream;
008:        import java.io.FileInputStream;
009:
010:        import com.sun.portal.wsrp.common.stubs.WSRP_v1_PortletManagement_PortType;
011:        import com.sun.portal.wsrp.common.stubs.PortletDescriptionResponse;
012:        import com.sun.portal.wsrp.common.stubs.PortletDescription;
013:        import com.sun.portal.wsrp.common.stubs.GetPortletDescription;
014:        import com.sun.portal.wsrp.common.stubs.RegistrationContext;
015:        import com.sun.portal.wsrp.common.stubs.PortletContext;
016:        import com.sun.portal.wsrp.common.stubs.UserContext;
017:        import com.sun.portal.wsrp.common.stubs.ClonePortlet;
018:        import com.sun.portal.wsrp.common.stubs.DestroyPortlets;
019:        import com.sun.portal.wsrp.common.stubs.DestroyPortletsResponse;
020:
021:        import com.sun.portal.wsrp.consumer.common.RemoteServiceStubManager;
022:        import com.sun.portal.wsrp.consumer.common.impl.PropertiesRemoteServiceStubManagerImpl;
023:
024:        import com.sun.portal.wsrp.common.WSRPFactory; //PM
025:        import com.sun.portal.wsrp.common.stubs.PropertyList;
026:        import com.sun.portal.wsrp.common.stubs.GetPortletProperties;
027:        import com.sun.portal.wsrp.common.stubs.SetPortletProperties;
028:        import com.sun.portal.wsrp.common.stubs.Property;
029:        import com.sun.portal.wsrp.common.stubs.PropertyList;
030:        import com.sun.portal.wsrp.common.stubs.PortletPropertyDescriptionResponse;
031:        import com.sun.portal.wsrp.common.stubs.GetPortletPropertyDescription;
032:
033:        //--PM
034:
035:        public class Test {
036:            private Properties config = null;
037:            private WSRP_v1_PortletManagement_PortType portType = null;
038:            private String[] args = null;
039:
040:            public static void main(String[] args) {
041:                try {
042:                    new Test(args).execute();
043:                } catch (Exception e) {
044:                    e.printStackTrace();
045:                }
046:            }
047:
048:            public Test(String[] args) throws Exception {
049:                config = new Properties();
050:                InputStream is = new FileInputStream("./config.properties");
051:                config.load(is);
052:                this .args = args;
053:
054:                RemoteServiceStubManager stubMgr = new PropertiesRemoteServiceStubManagerImpl(
055:                        "./config.properties");
056:                portType = stubMgr
057:                        .getPortletManagementPortType(RemoteServiceStubManager.PORTLET_MANAGEMENT_PORT_BINDING);
058:            }
059:
060:            void execute() throws Exception {
061:                String op = args[0];
062:
063:                if (op.equalsIgnoreCase("getportletdescription")) {
064:                    PortletDescriptionResponse pdr = getPortletDescription();
065:                    PortletDescription pd = pdr.getPortletDescription();
066:                    System.out.println(WSRPFactory.getInstance()
067:                            .getPortletDescriptionXML(pd, true));
068:                } else if (op.equalsIgnoreCase("cloneportlet")) {
069:                    PortletContext pc = clonePortlet();
070:                    System.out.println(WSRPFactory.getInstance()
071:                            .getPortletContextXML(pc, true));
072:                } else if (op.equalsIgnoreCase("destroyportlets")) {
073:                    DestroyPortletsResponse dpr = destroyPortlets();
074:                    System.out.println(WSRPFactory.getInstance()
075:                            .getDestroyPortletsResponseXML(dpr, true));
076:                } else if (op.equalsIgnoreCase("getportletproperties")) {
077:                    PropertyList pl = getPortletProperties();
078:                    System.out.println(WSRPFactory.getInstance()
079:                            .getPropertyListXML(pl, true));
080:                } else if (op.equalsIgnoreCase("setportletproperties")) {
081:                    PortletContext pc = setPortletProperties();
082:                    System.out.println(WSRPFactory.getInstance()
083:                            .getPortletContextXML(pc, true));
084:                } else if (op.equalsIgnoreCase("getportletpropertydescription")) {
085:                    PortletPropertyDescriptionResponse ppdr = getPortletPropertyDescription();
086:                    System.out.println(WSRPFactory.getInstance()
087:                            .getPortletPropertyDescriptionResponseXML(ppdr,
088:                                    true));
089:                } else {
090:                    throw new Exception("unknown operation: " + op);
091:                }
092:            }
093:
094:            private PortletContext clonePortlet() throws Exception {
095:                ClonePortlet cp = getClonePortlet();
096:                PortletContext pc = (PortletContext) portType.clonePortlet(cp);
097:
098:                return pc;
099:            }
100:
101:            private DestroyPortletsResponse destroyPortlets() throws Exception {
102:                DestroyPortlets dp = getDestroyPortlets();
103:                DestroyPortletsResponse dpr = (DestroyPortletsResponse) portType
104:                        .destroyPortlets(dp);
105:
106:                return dpr;
107:            }
108:
109:            private DestroyPortlets getDestroyPortlets() {
110:                RegistrationContext rc = getRegistrationContext();
111:                String[] phs = getPortletHandles();
112:
113:                return new DestroyPortlets(rc, phs);
114:            }
115:
116:            private String[] getPortletHandles() {
117:                Set handles = new HashSet();
118:                for (int i = 2; i < args.length; i++) {
119:                    handles.add(args[i]);
120:                }
121:
122:                return (String[]) handles.toArray(new String[0]);
123:            }
124:
125:            private ClonePortlet getClonePortlet() {
126:                RegistrationContext rc = getRegistrationContext();
127:                PortletContext pc = getPortletContext();
128:                UserContext uc = getUserContext();
129:
130:                ClonePortlet cp = new ClonePortlet(rc, pc, uc);
131:                return cp;
132:            }
133:
134:            private PortletDescriptionResponse getPortletDescription()
135:                    throws Exception {
136:                GetPortletDescription gpd = getGetPortletDescription();
137:                PortletDescriptionResponse pdr = (PortletDescriptionResponse) portType
138:                        .getPortletDescription(gpd);
139:
140:                return pdr;
141:            }
142:
143:            private GetPortletDescription getGetPortletDescription() {
144:                RegistrationContext rc = getRegistrationContext();
145:                PortletContext pc = getPortletContext();
146:                UserContext uc = getUserContext();
147:
148:                GetPortletDescription gpd = new GetPortletDescription(rc, pc,
149:                        uc, null);
150:
151:                return gpd;
152:            }
153:
154:            private RegistrationContext getRegistrationContext() {
155:                System.out.println("Registration Context :" + args[1]);
156:                return new RegistrationContext(args[1], null, null);
157:            }
158:
159:            private PortletContext getPortletContext() {
160:                System.out.println("Portlet Context :" + args[3]);
161:                return new PortletContext(args[3], null, null);
162:            }
163:
164:            private UserContext getUserContext() {
165:                System.out.println("User Context :" + args[2]);
166:                return new UserContext(args[2], null, null, null);
167:            }
168:
169:            //PM
170:            private PortletPropertyDescriptionResponse getPortletPropertyDescription()
171:                    throws Exception {
172:                GetPortletPropertyDescription gppd = getGetPortletPropertyDescription();
173:                PortletPropertyDescriptionResponse ppdr = (PortletPropertyDescriptionResponse) portType
174:                        .getPortletPropertyDescription(gppd);
175:
176:                return ppdr;
177:            }
178:
179:            private GetPortletPropertyDescription getGetPortletPropertyDescription()
180:                    throws Exception {
181:                RegistrationContext rc = getRegistrationContext();
182:                PortletContext pc = getPortletContext();
183:                UserContext uc = getUserContext();
184:                String[] dls = null;
185:                dls = new String[1];
186:                dls[0] = args[4];
187:                System.out.println("Locales :" + dls[0]);
188:                GetPortletPropertyDescription gppd = new GetPortletPropertyDescription(
189:                        rc, pc, uc, dls);
190:                return gppd;
191:            }
192:
193:            private PortletContext setPortletProperties() throws Exception {
194:                SetPortletProperties spp = getSetPortletProperties();
195:                PortletContext pc = (PortletContext) portType
196:                        .setPortletProperties(spp);
197:
198:                return pc;
199:            }
200:
201:            private SetPortletProperties getSetPortletProperties()
202:                    throws Exception {
203:                RegistrationContext rc = getRegistrationContext();
204:                PortletContext pc = getPortletContext();
205:                UserContext uc = getUserContext();
206:                PropertyList pl = getPropertyList();
207:
208:                SetPortletProperties spp = new SetPortletProperties(rc, pc, uc,
209:                        pl);
210:
211:                return spp;
212:            }
213:
214:            private PropertyList getPortletProperties() throws Exception {
215:                GetPortletProperties gpp = getGetPortletProperties();
216:                PropertyList pl = (PropertyList) portType
217:                        .getPortletProperties(gpp);
218:
219:                return pl;
220:            }
221:
222:            private GetPortletProperties getGetPortletProperties()
223:                    throws Exception {
224:                RegistrationContext rc = getRegistrationContext();
225:                PortletContext pc = getPortletContext();
226:                UserContext uc = getUserContext();
227:                // TBD, test this
228:                String[] names = null;
229:
230:                GetPortletProperties gpp = new GetPortletProperties(rc, pc, uc,
231:                        names);
232:                return gpp;
233:            }
234:
235:            private PropertyList getPropertyList() {
236:                String key = args[4];
237:                String val = args[5];
238:
239:                Property p = new Property(key, "en-US", val, null);
240:                PropertyList pl = new PropertyList(new Property[] { p }, null,
241:                        null);
242:
243:                return pl;
244:            }
245:            //--PM
246:        }
ww___w__.j__a__v_a___2__s.__co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.