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


001:        /**
002:         * $Id: Consumer.java,v 1.20 2006/06/06 07:01:09 kk155903 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.wsrp.consumer.admin.mbeans;
014:
015:        import com.sun.portal.log.common.PortalLogger;
016:        import com.iplanet.am.sdk.AMOrganization;
017:        import com.iplanet.am.sdk.AMStoreConnection;
018:        import com.iplanet.am.sdk.AMException;
019:        import com.iplanet.sso.SSOToken;
020:        import com.iplanet.sso.SSOException;
021:        import java.util.List;
022:        import java.util.Properties;
023:        import java.util.Set;
024:        import java.util.Iterator;
025:        import java.util.Map;
026:        import java.util.HashMap;
027:        import java.util.Collections;
028:        import java.util.logging.Level;
029:        import java.util.logging.Logger;
030:
031:        import java.net.URL;
032:        import java.net.MalformedURLException;
033:
034:        import com.sun.xml.rpc.wsdl.framework.ParseException;
035:
036:        import com.sun.portal.admin.common.PSMBeanException;
037:        import com.sun.portal.admin.common.context.PortalDomainContext;
038:        import com.sun.portal.admin.common.context.PSConfigContext;
039:        import com.sun.portal.admin.common.PSConfigConstants;
040:        import com.sun.portal.admin.server.mbeans.PSResource;
041:        import com.sun.portal.admin.server.AdminServerUtil;
042:
043:        import com.sun.portal.wsrp.common.stubs.ItemDescription;
044:        import com.sun.portal.wsrp.common.stubs.LocalizedString;
045:        import com.sun.portal.wsrp.common.stubs.ModelDescription;
046:        import com.sun.portal.wsrp.common.stubs.PropertyDescription;
047:        import com.sun.portal.wsrp.common.stubs.ServiceDescription;
048:        import com.sun.portal.wsrp.common.stubs.RegistrationData;
049:        import com.sun.portal.wsrp.common.stubs.Property;
050:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerBootstrap;
051:        import com.sun.portal.wsrp.consumer.common.WSRPConsumerException;
052:
053:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntityManagerFactory;
054:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntityManager;
055:        import com.sun.portal.wsrp.consumer.producermanager.ProducerEntity;
056:        import com.sun.portal.wsrp.consumer.producermanager.InbandRegistrationNotSupportedException;
057:
058:        import com.sun.portal.admin.server.PASModule;
059:        import com.sun.portal.admin.common.context.PortalDomainContextException;
060:        import com.sun.portal.wsrp.common.IdentityPropagationConstants;
061:
062:        public class Consumer extends PSResource implements  ConsumerMBean,
063:                IdentityPropagationConstants {
064:
065:            private String portalId = null;
066:            private String domainId = null;
067:            private String wsrpConsumerConfigFileName = PSConfigConstants.PS_WSRP_CONSUMER_CONFIG_FILE;
068:            private static Logger logger = PortalLogger
069:                    .getLogger(Consumer.class);
070:
071:            public void init(PSConfigContext cc, PortalDomainContext pdc,
072:                    List path) {
073:                super .init(cc, pdc, path);
074:                portalId = (String) path.get(1);
075:                domainId = (String) path.get(2);
076:
077:            }
078:
079:            public Map listConfiguredProducers(String orgDN)
080:                    throws PSMBeanException {
081:                try {
082:                    validateDN(orgDN);
083:                    WSRPConsumerBootstrap.cliInitialized(
084:                            wsrpConsumerConfigFileName, portalId);
085:                    ProducerEntityManager pem = ProducerEntityManagerFactory
086:                            .getInstance().getProducerEntityManager(
087:                                    AdminServerUtil.getSSOToken(), portalId,
088:                                    getOrgDN(orgDN));
089:
090:                    Set producerEntityIds = pem.getProducerEntityIds();
091:                    Map result = null;
092:
093:                    if ((producerEntityIds != null)
094:                            && (producerEntityIds.size() > 0)) {
095:                        result = new HashMap(producerEntityIds.size());
096:
097:                        for (Iterator i = producerEntityIds.iterator(); i
098:                                .hasNext();) {
099:                            String producerEntityId = (String) i.next();
100:                            ProducerEntity pe = pem
101:                                    .getProducerEntity(producerEntityId);
102:                            String producerName = pe.getName();
103:                            result.put(producerEntityId, producerName);
104:                        }
105:                    }
106:                    return result;
107:
108:                } catch (Exception e) {
109:                    boolean pe = e instanceof  PSMBeanException;
110:                    if ((pe)
111:                            && ((PSMBeanException) e).getErrorKey().equals(
112:                                    "Invalid DN")) {
113:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0001",
114:                                new Object[] { orgDN });
115:                        throw new PSMBeanException(
116:                                "wsrp.consumer.error.list-configured-producers.invalid.dn",
117:                                e.getMessage(), e, new Object[] { orgDN });
118:                    } else {
119:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0002", e);
120:                        throw new PSMBeanException(
121:                                "wsrp.consumer.error.list-configured-producers",
122:                                e.getMessage());
123:                    }
124:                }
125:
126:            }
127:
128:            private String getOrgDN(String dn) throws PSMBeanException {
129:                try {
130:                    AMStoreConnection amsc = new AMStoreConnection(
131:                            AdminServerUtil.getSSOToken());
132:                    int objType = amsc.getAMObjectType(dn);
133:                    if (objType == AMOrganization.USER) {
134:                        dn = amsc.getUser(dn).getOrganizationDN();
135:                    }
136:                } catch (AMException ame) {
137:                    logger.log(Level.SEVERE, ame.getMessage(), ame);
138:                    throw new PSMBeanException("Invalid DN");
139:                } catch (SSOException e) {
140:                    logger.log(Level.SEVERE, e.getMessage(), e);
141:                    throw new PSMBeanException(e.getMessage());
142:                }
143:                return dn;
144:            }
145:
146:            public void createConfiguredProducer(String orgDN,
147:                    String producerName, String producerURL,
148:                    Properties registrationData) throws PSMBeanException {
149:
150:                createConfiguredProducer(orgDN, producerName, producerURL,
151:                        NO_IDENTITY_PROPAGATION, null, registrationData);
152:            }
153:
154:            public void createConfiguredProducer(String orgDN,
155:                    String producerName, String producerURL,
156:                    String registrationHandle) throws PSMBeanException {
157:
158:                createConfiguredProducer(orgDN, producerName, producerURL,
159:                        NO_IDENTITY_PROPAGATION, null, registrationHandle);
160:            }
161:
162:            public void createConfiguredProducer(String orgDN,
163:                    String producerName, String producerURL,
164:                    String identityPropagationType, Map userCategoryMap,
165:                    Properties registrationData) throws PSMBeanException {
166:                try {
167:                    validateDN(orgDN);
168:                    validateName(producerName);
169:                    ServiceDescription sd = null;
170:                    Map userCategories = null;
171:                    Map allowedUserProfiles = null;
172:                    Map customerUserProfiles = null;
173:                    RegistrationData regData = null;
174:                    URL url = null;
175:
176:                    ClassLoader cl = this .getClass().getClassLoader();
177:                    Thread.currentThread().setContextClassLoader(cl);
178:
179:                    WSRPConsumerBootstrap.cliInitialized(
180:                            wsrpConsumerConfigFileName, portalId);
181:                    ProducerEntityManager pem = ProducerEntityManagerFactory
182:                            .getInstance().getProducerEntityManager(
183:                                    AdminServerUtil.getSSOToken(), portalId,
184:                                    orgDN);
185:
186:                    Set producerEntityIds = pem.getProducerEntityIds();
187:
188:                    if ((producerEntityIds != null)
189:                            && (producerEntityIds.size() > 0)) {
190:                        for (Iterator i = producerEntityIds.iterator(); i
191:                                .hasNext();) {
192:                            String producerEntityId = (String) i.next();
193:                            ProducerEntity pe = pem
194:                                    .getProducerEntity(producerEntityId);
195:                            String configuredProducerName = pe.getName();
196:                            if (producerName.equals(configuredProducerName)) {
197:                                throw new PSMBeanException(
198:                                        "Configured Producer Exists");
199:                            } else {
200:                                continue;
201:                            }
202:                        }
203:                    }
204:
205:                    url = new URL(producerURL);
206:
207:                    sd = pem.getServiceDescription(url);
208:                    ItemDescription[] ucs = sd.getUserCategoryDescriptions();
209:
210:                    if ((ucs != null) && (ucs.length > 0)) {
211:                        userCategories = new HashMap(ucs.length);
212:
213:                        for (int i = 0; i < ucs.length; i++) {
214:                            if (ucs[i] != null) {
215:                                List roles = null;
216:
217:                                if (userCategoryMap != null) {
218:                                    roles = (List) userCategoryMap.get(ucs[i]
219:                                            .getItemName());
220:                                }
221:
222:                                if (roles == null) {
223:                                    roles = Collections.EMPTY_LIST;
224:                                }
225:
226:                                userCategories.put(ucs[i].getItemName(), roles);
227:                            }
228:                        }
229:                    }
230:
231:                    regData = pem.getDefaultRegistrationData();
232:
233:                    if ((registrationData != null)
234:                            && (registrationData.size() > 0)) {
235:                        Property[] ps = new Property[registrationData.size()];
236:                        int index = 0;
237:                        Iterator it = registrationData.keySet().iterator();
238:
239:                        while (it.hasNext()) {
240:                            String name = (String) it.next();
241:                            String value = (String) registrationData.get(name);
242:                            ps[index] = new Property();
243:                            ps[index].setName(name);
244:                            ps[index].setStringValue(value);
245:                            index++;
246:                        }
247:
248:                        regData.setRegistrationProperties(ps);
249:                    }
250:
251:                    String producerId = pem.addProducerEntity(producerName,
252:                            url, identityPropagationType, regData,
253:                            userCategories, null, null);
254:
255:                    pdc.createResource(ConfiguredProducerMBean.TYPE, path,
256:                            producerId, Collections.EMPTY_MAP);
257:
258:                    PASModule.reloadMBeans(pdc, ConfiguredProducerMBean.TYPE,
259:                            path);
260:                    createWSSSOConfiguration(url, identityPropagationType,
261:                            orgDN, pem);
262:
263:                } catch (Exception e) {
264:                    boolean pe = e instanceof  PSMBeanException;
265:                    if ((pe)
266:                            && ((PSMBeanException) e).getErrorKey().equals(
267:                                    "Invalid DN")) {
268:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0001",
269:                                new Object[] { orgDN });
270:                        throw new PSMBeanException(
271:                                "wsrp.consumer.error.create-configured-producer.invalid.dn",
272:                                e.getMessage(), e, new Object[] { orgDN });
273:                    } else if ((pe)
274:                            && ((PSMBeanException) e).getErrorKey().equals(
275:                                    "Configured Producer Exists")) {
276:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0003",
277:                                new Object[] { producerName });
278:                        throw new PSMBeanException(
279:                                "wsrp.consumer.error.create-configured-producer.producer.exists",
280:                                e.getMessage(), e,
281:                                new Object[] { producerName });
282:                    } else if ((pe)
283:                            && ((PSMBeanException) e).getErrorKey().equals(
284:                                    "Invalid Characters")) {
285:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0010", e);
286:                        throw new PSMBeanException(
287:                                "wsrp.consumer.error.create-configured-producer.invalid.characters",
288:                                e.getMessage(), e);
289:                    } else if (e instanceof  MalformedURLException) {
290:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0004",
291:                                new Object[] { producerURL });
292:                        throw new PSMBeanException(
293:                                "wsrp.consumer.error.create-configured-producer.invalid.url",
294:                                e.getMessage(), new Object[] { producerURL });
295:                    } else if (e instanceof  ParseException) {
296:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0005",
297:                                new Object[] { producerURL });
298:                        throw new PSMBeanException(
299:                                "wsrp.consumer.error.create-configured-producer.invalid.wsdl",
300:                                e.getMessage(), new Object[] { producerURL });
301:                    } else if (e instanceof  InbandRegistrationNotSupportedException) {
302:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0006", e);
303:                        throw new PSMBeanException(
304:                                "wsrp.consumer.error.create-configured-producer.inband.registration.not.supported",
305:                                e.getMessage());
306:                    } else if (e instanceof  PortalDomainContextException) {
307:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0007", e);
308:                        throw new PSMBeanException(
309:                                "wsrp.consumer.error.create-configured-producer.mbean.error",
310:                                e.getMessage());
311:                    } else {
312:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0009",
313:                                new Object[] { producerName });
314:                        logger.log(Level.SEVERE, "", e);
315:                        throw new PSMBeanException(
316:                                "wsrp.consumer.error.create-configured-producer",
317:                                e.getMessage(), new Object[] { producerName });
318:                    }
319:
320:                }
321:
322:            }
323:
324:            public void createConfiguredProducer(String orgDN,
325:                    String producerName, String producerURL,
326:                    String identityPropagationType, Map userCategoryMap,
327:                    String registrationHandle) throws PSMBeanException {
328:                try {
329:                    validateDN(orgDN);
330:                    validateName(producerName);
331:                    ServiceDescription sd = null;
332:                    Map userCategories = null;
333:                    Map allowedUserProfiles = null;
334:                    Map customerUserProfiles = null;
335:                    URL url = null;
336:
337:                    ClassLoader cl = this .getClass().getClassLoader();
338:                    Thread.currentThread().setContextClassLoader(cl);
339:
340:                    WSRPConsumerBootstrap.cliInitialized(
341:                            wsrpConsumerConfigFileName, portalId);
342:                    ProducerEntityManager pem = ProducerEntityManagerFactory
343:                            .getInstance().getProducerEntityManager(
344:                                    AdminServerUtil.getSSOToken(), portalId,
345:                                    orgDN);
346:
347:                    Set producerEntityIds = pem.getProducerEntityIds();
348:
349:                    if ((producerEntityIds != null)
350:                            && (producerEntityIds.size() > 0)) {
351:                        for (Iterator i = producerEntityIds.iterator(); i
352:                                .hasNext();) {
353:                            String producerEntityId = (String) i.next();
354:                            ProducerEntity pe = pem
355:                                    .getProducerEntity(producerEntityId);
356:                            String configuredProducerName = pe.getName();
357:                            if (producerName.equals(configuredProducerName)) {
358:                                throw new PSMBeanException(
359:                                        "Configured Producer Exists");
360:                            } else {
361:                                continue;
362:                            }
363:                        }
364:                    }
365:
366:                    url = new URL(producerURL);
367:
368:                    sd = pem.getServiceDescription(url);
369:                    ItemDescription[] ucs = sd.getUserCategoryDescriptions();
370:
371:                    if ((ucs != null) && (ucs.length > 0)) {
372:                        userCategories = new HashMap(ucs.length);
373:
374:                        for (int i = 0; i < ucs.length; i++) {
375:                            if (ucs[i] != null) {
376:                                List roles = null;
377:
378:                                if (userCategoryMap != null) {
379:                                    roles = (List) userCategoryMap.get(ucs[i]
380:                                            .getItemName());
381:                                }
382:
383:                                if (roles == null) {
384:                                    roles = Collections.EMPTY_LIST;
385:                                }
386:
387:                                userCategories.put(ucs[i].getItemName(), roles);
388:                            }
389:                        }
390:                    }
391:
392:                    String producerId = pem.addProducerEntity(producerName,
393:                            url, identityPropagationType, registrationHandle,
394:                            userCategories, null, null);
395:
396:                    pdc.createResource(ConfiguredProducerMBean.TYPE, path,
397:                            producerId, Collections.EMPTY_MAP);
398:
399:                    PASModule.reloadMBeans(pdc, ConfiguredProducerMBean.TYPE,
400:                            path);
401:                    createWSSSOConfiguration(url, identityPropagationType,
402:                            orgDN, pem);
403:
404:                } catch (Exception e) {
405:                    boolean pe = e instanceof  PSMBeanException;
406:                    if ((pe)
407:                            && ((PSMBeanException) e).getErrorKey().equals(
408:                                    "Invalid DN")) {
409:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0001",
410:                                new Object[] { orgDN });
411:                        throw new PSMBeanException(
412:                                "wsrp.consumer.error.create-configured-producer.invalid.dn",
413:                                e.getMessage(), e, new Object[] { orgDN });
414:                    } else if ((pe)
415:                            && ((PSMBeanException) e).getErrorKey().equals(
416:                                    "Configured Producer Exists")) {
417:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0003",
418:                                new Object[] { producerName });
419:                        throw new PSMBeanException(
420:                                "wsrp.consumer.error.create-configured-producer.producer.exists",
421:                                e.getMessage(), e,
422:                                new Object[] { producerName });
423:                    } else if ((pe)
424:                            && ((PSMBeanException) e).getErrorKey().equals(
425:                                    "Invalid Characters")) {
426:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0010", e);
427:                        throw new PSMBeanException(
428:                                "wsrp.consumer.error.create-configured-producer.invalid.characters",
429:                                e.getMessage(), e);
430:                    } else if (e instanceof  MalformedURLException) {
431:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0004",
432:                                new Object[] { producerURL });
433:                        throw new PSMBeanException(
434:                                "wsrp.consumer.error.create-configured-producer.invalid.url",
435:                                e.getMessage(), new Object[] { producerURL });
436:                    } else if (e instanceof  ParseException) {
437:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0005",
438:                                new Object[] { producerURL });
439:                        throw new PSMBeanException(
440:                                "wsrp.consumer.error.create-configured-producer.invalid.wsdl",
441:                                e.getMessage(), new Object[] { producerURL });
442:                    } else if (e instanceof  InbandRegistrationNotSupportedException) {
443:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0006", e);
444:                        throw new PSMBeanException(
445:                                "wsrp.consumer.error.create-configured-producer.inband.registration.not.supported",
446:                                e.getMessage());
447:                    } else if (e instanceof  PortalDomainContextException) {
448:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0007", e);
449:                        throw new PSMBeanException(
450:                                "wsrp.consumer.error.create-configured-producer.mbean.error",
451:                                e.getMessage());
452:                    } else {
453:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0009",
454:                                new Object[] { producerName });
455:                        throw new PSMBeanException(
456:                                "wsrp.consumer.error.create-configured-producer",
457:                                e.getMessage(), new Object[] { producerName });
458:                    }
459:
460:                }
461:
462:            }
463:
464:            public void deleteConfiguredProducer(String orgDN, String producerId)
465:                    throws PSMBeanException {
466:                try {
467:
468:                    validateDN(orgDN);
469:                    validateName(producerId);
470:                    setContextClassLoader();
471:
472:                    WSRPConsumerBootstrap.cliInitialized(
473:                            wsrpConsumerConfigFileName, portalId);
474:                    ProducerEntityManager pem = ProducerEntityManagerFactory
475:                            .getInstance().getProducerEntityManager(
476:                                    AdminServerUtil.getSSOToken(), portalId,
477:                                    orgDN);
478:                    ProducerEntity pe = pem.getProducerEntity(producerId);
479:                    URL wsURL = pe.getURL();
480:                    String idType = pe.getIdentityPropagationType();
481:                    pem.removeProducerEntity(producerId);
482:                    pdc.removeResource(ConfiguredProducerMBean.TYPE,
483:                            AdminServerUtil.getChildPath(path, producerId));
484:                    PASModule.reloadMBeans(pdc, ConfiguredProducerMBean.TYPE,
485:                            path);
486:                    deleteWSSSOConfiguration(wsURL, idType, orgDN, pem);
487:
488:                } catch (Exception e) {
489:                    boolean pe = e instanceof  PSMBeanException;
490:                    if ((pe)
491:                            && ((PSMBeanException) e).getErrorKey().equals(
492:                                    "Invalid DN")) {
493:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0001",
494:                                new Object[] { orgDN });
495:                        throw new PSMBeanException(
496:                                "wsrp.consumer.error.delete-configured-producer.invalid.dn",
497:                                e.getMessage(), e, new Object[] { orgDN });
498:                    } else if ((pe)
499:                            && ((PSMBeanException) e).getErrorKey().equals(
500:                                    "Invalid Characters")) {
501:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0011", e);
502:                        throw new PSMBeanException(
503:                                "wsrp.consumer.error.create-configured-producer.invalid.characters",
504:                                e.getMessage(), e);
505:                    } else if (e instanceof  InbandRegistrationNotSupportedException) {
506:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0006", e);
507:                        throw new PSMBeanException(
508:                                "wsrp.consumer.error.delete-configured-producer.inband.registration.not.supported",
509:                                e.getMessage());
510:                    } else if (e instanceof  PortalDomainContextException) {
511:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0012", e);
512:                        throw new PSMBeanException(
513:                                "wsrp.consumer.error.delete-configured-producer.mbean.error",
514:                                e.getMessage());
515:                    } else {
516:                        logger.log(Level.SEVERE, "PSWS_CSPWCAB0013",
517:                                new Object[] { producerId });
518:                        throw new PSMBeanException(
519:                                "wsrp.consumer.error.delete-configured-producer",
520:                                e.getMessage(), new Object[] { producerId });
521:                    }
522:
523:                }
524:
525:            }
526:
527:            private void setContextClassLoader() {
528:                ClassLoader cl = this .getClass().getClassLoader();
529:                Thread.currentThread().setContextClassLoader(cl);
530:            }
531:
532:            public Map getProducerInfo(String orgDN, String producerURL)
533:                    throws PSMBeanException {
534:
535:                Map info = new HashMap();
536:                Map ucds = new HashMap();
537:                Map rpds = new HashMap();
538:
539:                try {
540:                    ClassLoader cl = this .getClass().getClassLoader();
541:                    Thread.currentThread().setContextClassLoader(cl);
542:                    WSRPConsumerBootstrap.cliInitialized(
543:                            wsrpConsumerConfigFileName, portalId);
544:                    ProducerEntityManager pem = ProducerEntityManagerFactory
545:                            .getInstance().getProducerEntityManager(
546:                                    AdminServerUtil.getSSOToken(), portalId,
547:                                    orgDN);
548:                    URL url = new URL(producerURL);
549:                    ServiceDescription sd = pem.getServiceDescription(url);
550:                    boolean regRequired = sd.isRequiresRegistration();
551:                    info.put("RegistrationRequired", Boolean
552:                            .valueOf(regRequired));
553:                    boolean inbandSupported = pem
554:                            .isInbandRegistrationSupported(url);
555:                    info.put("InbandSupported", Boolean
556:                            .valueOf(inbandSupported));
557:                    ItemDescription[] ucd = sd.getUserCategoryDescriptions();
558:
559:                    if (ucd != null) {
560:                        for (int i = 0; i < ucd.length; i++) {
561:                            String itemName = ucd[i].getItemName();
562:                            LocalizedString desc = ucd[i].getDescription();
563:                            ucds.put(itemName, (desc == null) ? "" : desc
564:                                    .getValue());
565:                        }
566:                    }
567:
568:                    info.put("userCategoryDescriptions", ucds);
569:                    ModelDescription md = sd
570:                            .getRegistrationPropertyDescription();
571:
572:                    if (md != null) {
573:                        PropertyDescription[] pds = md
574:                                .getPropertyDescriptions();
575:
576:                        if (pds != null) {
577:                            for (int i = 0; i < pds.length; i++) {
578:                                String name = pds[i].getName();
579:                                LocalizedString hint = pds[i].getHint();
580:                                String desc = (hint == null) ? "" : hint
581:                                        .getValue();
582:                                rpds.put(name, desc);
583:                            }
584:                        }
585:                    }
586:
587:                    info.put("RegistrationPropertyDescription", rpds);
588:                    info.put("AllRoles", AMHelper.getAllRoles(orgDN));
589:                    return info;
590:                } catch (Exception e) {
591:
592:                    logger.log(Level.SEVERE, "PSWS_CSPWCAB0014", e);
593:                    throw new PSMBeanException(
594:                            "wsrp.consumer.error.producer-info", e.getMessage());
595:                }
596:            }
597:
598:            private boolean validateDN(String orgDN) throws PSMBeanException {
599:                try {
600:                    SSOToken token = AdminServerUtil.getSSOToken();
601:                    AMStoreConnection amsc = new AMStoreConnection(token);
602:
603:                    int objType = amsc.getAMObjectType(orgDN);
604:                } catch (AMException ame) {
605:                    logger.log(Level.SEVERE, ame.getMessage(), ame);
606:                    throw new PSMBeanException("Invalid DN");
607:                } catch (SSOException e) {
608:                    logger.log(Level.SEVERE, e.getMessage(), e);
609:                    throw new PSMBeanException(e.getMessage());
610:                }
611:                return true;
612:
613:            }
614:
615:            private void validateName(String name) throws PSMBeanException {
616:                name = name.trim();
617:                for (int i = 0; i < name.length(); i++) {
618:                    char c = name.charAt(i);
619:
620:                    if (!Character.isLetterOrDigit(c) && (c != '_')) {
621:
622:                        throw new PSMBeanException("Invalid Characters");
623:
624:                    }
625:                }
626:            }
627:
628:            private void createWSSSOConfiguration(URL wsURL, String idpType,
629:                    String orgDN, ProducerEntityManager pem)
630:                    throws WSRPConsumerException {
631:                WSSSOHelper.createWSSSOConfiguration(wsURL, idpType, orgDN,
632:                        pem, domainId, portalId);
633:            }
634:
635:            private void deleteWSSSOConfiguration(URL wsURL, String idpType,
636:                    String orgDN, ProducerEntityManager pem)
637:                    throws WSRPConsumerException {
638:                WSSSOHelper.deleteWSSSOConfiguration(wsURL, idpType, orgDN,
639:                        pem, domainId, portalId);
640:            }
641:        }
ww__w._j___a__v__a_2__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.