001: /**
002: * $Id: DisplayProfile.java,v 1.42 2006/02/08 19:23:22 rt94277 Exp $
003: * Copyright 2004 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.desktop.admin.mbeans;
014:
015: import java.util.*;
016: import java.util.logging.Logger;
017: import java.util.logging.Level;
018:
019: import com.sun.portal.log.common.PortalLogger;
020:
021: import com.sun.portal.admin.server.AdminServerUtil;
022: import com.sun.portal.admin.server.mbeans.PSResource;
023: import com.sun.portal.admin.common.context.PortalDomainContext;
024: import com.sun.portal.admin.common.context.PSConfigContext;
025: import com.sun.portal.admin.common.PSConfigConstants;
026: import com.sun.portal.admin.common.DesktopConstants;
027:
028: import com.sun.portal.taskadmin.ChannelTaskAdmin;
029: import com.sun.portal.taskadmin.TaskAdminException;
030: import com.sun.portal.desktop.admin.mbeans.tasks.DPTreeHelper;
031: import com.sun.portal.desktop.admin.mbeans.tasks.DPHelper;
032: import com.sun.portal.desktop.admin.mbeans.tasks.DesktopDataException;
033:
034: import com.sun.portal.desktop.admin.mbeans.DisplayProfileMBean;
035: import com.sun.portal.desktop.context.ContextError;
036: import com.sun.portal.desktop.dp.DPError;
037:
038: import com.sun.portal.admin.common.PSMBeanException;
039:
040: import com.sun.portal.desktop.dp.DPError;
041:
042: public class DisplayProfile extends PSResource implements
043: DisplayProfileMBean {
044:
045: private String psPortalID;
046: private PSConfigContext cc;
047: private PortalDomainContext pdc;
048: private static Logger logger = PortalLogger
049: .getLogger(DisplayProfile.class);
050: private static final String MSG_PREFIX = "desktop.";
051: private static final String PROPERTY_TOP_LEVEL_CONTAINER = "isTopLevel";
052:
053: public DisplayProfile() {
054: ;
055: }
056:
057: public void init(PSConfigContext cc, PortalDomainContext pdc,
058: List path) {
059: super .init(cc, pdc, path);
060:
061: this .cc = cc;
062: this .psPortalID = (String) path.get(1);
063:
064: }
065:
066: /**Creates a new channel
067: *
068: * @param baseDN
069: * @param channelName
070: * @param providerName
071: * @throws PSMBeanException
072: */
073: public void createChannel(String baseDN, String channelName,
074: String providerName) throws PSMBeanException {
075: try {
076: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
077: .getSSOToken(), baseDN, psPortalID, false);
078: cta.createChannel(channelName, providerName);
079: cta.store();
080: } catch (TaskAdminException tae) {
081: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
082: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
083: tae.getMessage(), tae.getTokens());
084: } catch (DPError e) {
085: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
086: throw new PSMBeanException(MSG_PREFIX
087: + "message.create.channel.dperror", e.getMessage());
088: }
089: }
090:
091: /**
092: * Creates a new container.
093: * A new container is created based on the named provider.
094: * To create a nested container, supply a hierarchical container
095: * name. For example, to create container A inside of container X, based on
096: * provider P :<br><br>
097: * <code>createContainer("X" + "/" + "A", "P");</code>
098: */
099: public void createContainer(String baseDN, String channelName,
100: String providerName) throws PSMBeanException {
101: try {
102: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
103: .getSSOToken(), baseDN, psPortalID, false);
104: cta.createContainer(channelName, providerName);
105: cta.store();
106: } catch (TaskAdminException tae) {
107: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
108: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
109: tae.getMessage(), tae.getTokens());
110: } catch (DPError e) {
111: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
112: throw new PSMBeanException(MSG_PREFIX
113: + "message.create.container.dperror", e
114: .getMessage());
115: }
116: }
117:
118: /**
119: * Creates a new Tab.
120: * A new container is created based on the named provider.
121: * To create a nested container, supply a hierarchical container
122: * name. For example, to create container A inside of container X, based on
123: * provider P :<br><br>
124: * <code>createTab("X" + "/" + "A", "P");</code>
125: */
126: public void createTab(String baseDN, String channelName,
127: String providerName, String parentContainer, Map tabProps)
128: throws PSMBeanException {
129: try {
130: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
131: .getSSOToken(), baseDN, psPortalID, false);
132: if (parentContainer != null) {
133: String cName = parentContainer + "/" + channelName;
134: String title = (String) tabProps.get("title");
135: String description = (String) tabProps
136: .get("description");
137: cta.createContainer(cName, providerName);
138: if (title != null && title.length() != 0) {
139: cta.setStringProperty(cName,
140: DesktopConstants.TAB_TITLE, title, null);
141: }
142: if (description != null && description.length() != 0) {
143: cta.setStringProperty(cName,
144: DesktopConstants.TAB_DESCRIPTION,
145: description, null);
146: }
147: List available = cta
148: .getAvailableChannels(parentContainer);
149: List selected = cta
150: .getSelectedChannels(parentContainer);
151: available.add(cName);
152: selected.add(cName);
153: cta.setAvailableChannels(available, parentContainer);
154: cta.setSelectedChannels(selected, parentContainer);
155: Map props = cta.getMapProperty(parentContainer,
156: DesktopConstants.TAB_PROPERTIES, null);
157: props.put(cName, (Map) tabProps
158: .get(DesktopConstants.TAB_PROPERTIES));
159: cta.setMapProperty(parentContainer,
160: DesktopConstants.TAB_PROPERTIES, props, null);
161: }
162: cta.store();
163: } catch (TaskAdminException tae) {
164: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
165: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
166: tae.getMessage(), tae.getTokens());
167: }
168: }
169:
170: /**
171: * Gets the assignable channels
172: * A new container is created based on the named provider.
173: * gets the assignable channels
174: * deletes the created container.
175: * This method is used for a special case where the assignable channels
176: * have to be shown before creating the container.
177: */
178: public Set getNonExistentContainerAssignableChannels(String baseDN,
179: String parentContainer, String channelName,
180: String providerName) throws PSMBeanException {
181: Set channels = null;
182: try {
183: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
184: .getSSOToken(), baseDN, psPortalID);
185: String cName = null;
186: if (parentContainer != null) {
187: cName = parentContainer + "/" + channelName;
188: }
189: cta.createContainer(cName, providerName);
190: channels = cta.getAssignableChannels(cName);
191: cta.deleteChannel(channelName, parentContainer);
192: } catch (TaskAdminException tae) {
193: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
194: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
195: tae.getMessage(), tae.getTokens());
196: }
197: return channels;
198: }
199:
200: /**
201: * Deletes a channel/container.
202: * To delete a nested channel/container, supply parent name.
203: * For example, to delete channel A inside
204: * of container X:<br><br>
205: * <code>deleteChannel("A", "X");</code>
206: */
207: public void deleteChannel(String baseDN, String channelName,
208: String parentcontainer) throws PSMBeanException {
209: try {
210: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
211: .getSSOToken(), baseDN, psPortalID);
212: cta.deleteChannel(channelName, parentcontainer);
213: cta.store();
214: } catch (TaskAdminException tae) {
215: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
216: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
217: tae.getMessage(), tae.getTokens());
218: } catch (DPError e) {
219: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
220: throw new PSMBeanException(MSG_PREFIX
221: + "message.delete.channel.dperror", e.getMessage());
222: }
223: }
224:
225: /**
226: * This method returns the list of channels that are existing
227: * at the baseDN. The channels in this list
228: * can be modifiable or deleted by the user that can administer
229: * the baseDN.
230: * This method returns the list of channels which includes
231: * the channels defined at the baseDN that is passed in, channels
232: * defined inside the containers that are defined at the baseDN.
233: * if specified all, all the channels from the merged list is returned.
234: * @param all all the channels from mergers
235: * @return Set of channels that are available at this baseDN.
236: */
237: public Set getExistingChannels(String baseDN, Boolean all)
238: throws PSMBeanException {
239: Set channels = null;
240: try {
241: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
242: .getSSOToken(), baseDN, psPortalID);
243: channels = cta.getExistingChannels(all.booleanValue());
244: } catch (TaskAdminException tae) {
245: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
246: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
247: tae.getMessage(), tae.getTokens());
248: } catch (DPError e) {
249: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
250: throw new PSMBeanException(MSG_PREFIX
251: + "message.get.existing.channels.dperror", e
252: .getMessage());
253: }
254: return channels;
255: }
256:
257: /**
258: * This method returns the list of containers that are existing
259: * at the baseDN that is passed in. The containers in this list
260: * can be modifiable or deleted by the user that can administer
261: * the baseDN that is passed in.
262: * This method returns the list of containers which includes
263: * the containers defined at the baseDN that is passed in, containers
264: * defined inside the containers that are defined at the baseDN.
265: * if specified all, all the containers from the merged list is returned.
266: * @param all all the channels from mergers
267: * @return Set of channels that are available at this baseDN.
268: */
269: public Set getExistingContainers(String baseDN, Boolean all)
270: throws PSMBeanException {
271: Set containers = null;
272: try {
273: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
274: .getSSOToken(), baseDN, psPortalID);
275: containers = cta.getExistingContainers(all.booleanValue());
276: } catch (TaskAdminException tae) {
277: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
278: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
279: tae.getMessage(), tae.getTokens());
280: } catch (DPError e) {
281: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
282: throw new PSMBeanException(MSG_PREFIX
283: + "message.get.existing.containers.dperror", e
284: .getMessage());
285: }
286: return containers;
287: }
288:
289: public Set getExistingTabContainers(String baseDN, Boolean all)
290: throws PSMBeanException {
291: Set tabContainers = new HashSet();
292: try {
293: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
294: .getSSOToken(), baseDN, psPortalID);
295: Set containers = cta.getExistingContainers(all
296: .booleanValue());
297: for (Iterator i = containers.iterator(); i.hasNext();) {
298: String container = (String) i.next();
299: if (cta.isTabContainer(container)) {
300: tabContainers.add(container);
301: }
302: }
303: } catch (TaskAdminException tae) {
304: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
305: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
306: tae.getMessage(), tae.getTokens());
307: } catch (DPError e) {
308: logger.log(Level.SEVERE, "PSDT_CSPDAMB0012", e);
309: throw new PSMBeanException(MSG_PREFIX
310: + "message.get.existing.tabcontainers.dperror", e
311: .getMessage());
312: }
313: return tabContainers;
314: }
315:
316: /**
317: * This method returns the list of providers that are existing
318: * at the baseDN that is passed in. The providers in this list
319: * can be used to create channels by the user that can administer
320: * the baseDN that is passed in. Always takes mergers into account.
321: * @return Set of providers that are available at this baseDN.
322: */
323: public Set getExistingProviders(String baseDN)
324: throws PSMBeanException {
325: Set providers = null;
326: try {
327: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
328: .getSSOToken(), baseDN, psPortalID);
329: providers = cta.getExistingProviders();
330: } catch (TaskAdminException tae) {
331: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
332: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
333: tae.getMessage(), tae.getTokens());
334: }
335: return providers;
336: }
337:
338: /**
339: * This method returns the list of containerproviders that are existing
340: * at the baseDN that is passed in. The containerproviders in this list
341: * can be used to create container channels by the user that can administer
342: * the baseDN that is passed in. Always takes mergers into account.
343: * @return Set of containerproviders that are available at this baseDN.
344: */
345: public Set getExistingContainerProviders(String baseDN)
346: throws PSMBeanException {
347: Set providers = null;
348: try {
349: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
350: .getSSOToken(), baseDN, psPortalID);
351: providers = cta.getExistingContainerProviders();
352: } catch (TaskAdminException tae) {
353: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
354: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
355: tae.getMessage(), tae.getTokens());
356: }
357: return providers;
358: }
359:
360: /**
361: * This method returns the list of channels/containers that are assignable
362: * to the available and selected list of a container.
363: * This method returns the list of channels which includes
364: * the container's children and the container's parent's
365: * children, parent's parent's children and traverses recursively
366: * until it reaches the Display Profile root.
367: * Mergers are taken into account when the channels are traversed.
368: * @param container container name for which channels has to be assigned.
369: * @return Set of channels that can be assignable.
370: */
371: public Set getAssignableChannels(String baseDN, String container)
372: throws PSMBeanException {
373: Set channels = null;
374: try {
375: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
376: .getSSOToken(), baseDN, psPortalID);
377: channels = cta.getAssignableChannels(container);
378: } catch (TaskAdminException tae) {
379: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
380: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
381: tae.getMessage(), tae.getTokens());
382: }
383: return channels;
384: }
385:
386: /**
387: * Gets the available channels for the container channel at a
388: * particular baseDN.
389: */
390: public List getAvailableChannels(String baseDN, String containerName)
391: throws PSMBeanException {
392: List channels = null;
393: try {
394: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
395: .getSSOToken(), baseDN, psPortalID);
396: channels = cta.getAvailableChannels(containerName);
397: } catch (TaskAdminException tae) {
398: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
399: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
400: tae.getMessage(), tae.getTokens());
401: }
402: return channels;
403: }
404:
405: /**
406: * Gets the selected channels for the container channel at a
407: * particular baseDN.
408: */
409: public List getSelectedChannels(String baseDN, String containerName)
410: throws PSMBeanException {
411: List channels = null;
412: try {
413: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
414: .getSSOToken(), baseDN, psPortalID);
415: channels = cta.getSelectedChannels(containerName);
416: } catch (TaskAdminException tae) {
417: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
418: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
419: tae.getMessage(), tae.getTokens());
420: }
421: return channels;
422: }
423:
424: /**
425: * Sets the available channels for the container channel at a
426: * particular baseDN.
427: */
428: public void setAvailableChannels(String baseDN, List available,
429: String containerName) throws PSMBeanException {
430: try {
431: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
432: .getSSOToken(), baseDN, psPortalID, false);
433: cta.setAvailableChannels(available, containerName);
434: cta.store();
435: } catch (TaskAdminException tae) {
436: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
437: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
438: tae.getMessage(), tae.getTokens());
439:
440: }
441: }
442:
443: /**
444: * Sets the selected channels for the container channel at a
445: * particular baseDN.
446: */
447: public void setSelectedChannels(String baseDN, List selected,
448: String containerName) throws PSMBeanException {
449: try {
450: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
451: .getSSOToken(), baseDN, psPortalID, false);
452: cta.setSelectedChannels(selected, containerName);
453: cta.store();
454: } catch (TaskAdminException tae) {
455: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
456: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
457: tae.getMessage(), tae.getTokens());
458: }
459: }
460:
461: /**
462: * Return the value for channel String property.
463: * @param channelName channel name.
464: * @param key property name
465: * @param pflist properties filter list
466: * @return Value of the string property.
467: * @throws PSMBeanException
468: */
469: public String getStringProperty(String baseDN, String channelName,
470: String key, List pflist) throws PSMBeanException {
471: String value = null;
472: ChannelTaskAdmin cta = null;
473: try {
474: cta = new ChannelTaskAdmin(AdminServerUtil.getSSOToken(),
475: baseDN, psPortalID);
476: value = cta.getStringProperty(channelName, key, pflist);
477: } catch (TaskAdminException tae) {
478: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
479: //throw new PSMBeanException(tae.getErrorKey(),tae.getLocalizedMessage(cta.getResourceBundle()));
480: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
481: tae.getMessage(), tae.getTokens());
482: }
483: return value;
484: }
485:
486: /**
487: * Return the value for channel integer property.
488: * @param channelName channel name.
489: * @param key property name
490: * @param pflist properties filter list
491: * @return value of the integer property.
492: * @throws PSMBeanException
493: */
494: public Integer getIntegerProperty(String baseDN,
495: String channelName, String key, List pflist)
496: throws PSMBeanException {
497: int value;
498: try {
499: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
500: .getSSOToken(), baseDN, psPortalID);
501: value = cta.getIntegerProperty(channelName, key, pflist);
502: } catch (TaskAdminException tae) {
503: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
504: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
505: tae.getMessage(), tae.getTokens());
506: }
507: return new Integer(value);
508: }
509:
510: /**
511: * Return the value for channel's boolean property.
512: * @param channelName channel name.
513: * @param key property name
514: * @param pflist properties filter list
515: * @return value of the boolean property.
516: * @throws PSMBeanException
517: */
518: public Boolean getBooleanProperty(String baseDN,
519: String channelName, String key, List pflist)
520: throws PSMBeanException {
521: boolean value;
522: try {
523: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
524: .getSSOToken(), baseDN, psPortalID);
525: value = cta.getBooleanProperty(channelName, key, pflist);
526: } catch (TaskAdminException tae) {
527: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
528: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
529: tae.getMessage(), tae.getTokens());
530: }
531: return new Boolean(value);
532:
533: }
534:
535: /**
536: * This method returns the Map collection object for the given
537: * collection property.
538: * @param channelName channel name.
539: * @param key property name
540: * @param pflist
541: * @return
542: * @throws PSMBeanException
543: */
544: public Map getMapProperty(String baseDN, String channelName,
545: String key, List pflist) throws PSMBeanException {
546: Map value = null;
547: try {
548: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
549: .getSSOToken(), baseDN, psPortalID);
550: value = cta.getMapProperty(channelName, key, pflist);
551: } catch (TaskAdminException tae) {
552: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
553: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
554: tae.getMessage(), tae.getTokens());
555: }
556: return value;
557: }
558:
559: /**
560: * This method returns the List collection object for the given
561: * collection property.
562: * @param channelName channel name.
563: * @param key property name
564: * @param pflist
565: * @return
566: * @throws PSMBeanException
567: */
568: public List getListProperty(String baseDN, String channelName,
569: String key, List pflist) throws PSMBeanException {
570: List value = null;
571: try {
572: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
573: .getSSOToken(), baseDN, psPortalID);
574: value = cta.getListProperty(channelName, key, pflist);
575: } catch (TaskAdminException tae) {
576: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
577: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
578: tae.getMessage(), tae.getTokens());
579: }
580: return value;
581: }
582:
583: public void setStringProperty(String baseDN, String channelName,
584: String key, String value, List pflist)
585: throws PSMBeanException {
586: try {
587: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
588: .getSSOToken(), baseDN, psPortalID, false);
589: cta.setStringProperty(channelName, key, value, pflist);
590: cta.store();
591: } catch (TaskAdminException tae) {
592: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
593: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
594: tae.getMessage(), tae.getTokens());
595: }
596: }
597:
598: public void setIntegerProperty(String baseDN, String channelName,
599: String key, Integer value, List pflist)
600: throws PSMBeanException {
601: try {
602: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
603: .getSSOToken(), baseDN, psPortalID, false);
604: cta.setIntegerProperty(channelName, key, value.intValue(),
605: pflist);
606: cta.store();
607: } catch (TaskAdminException tae) {
608: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
609: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
610: tae.getMessage(), tae.getTokens());
611: }
612: }
613:
614: public void setBooleanProperty(String baseDN, String channelName,
615: String key, Boolean value, List pflist)
616: throws PSMBeanException {
617: try {
618: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
619: .getSSOToken(), baseDN, psPortalID, false);
620: cta.setBooleanProperty(channelName, key, value
621: .booleanValue(), pflist);
622: cta.store();
623: } catch (TaskAdminException tae) {
624: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
625: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
626: tae.getMessage(), tae.getTokens());
627: }
628: }
629:
630: public void setMapProperty(String baseDN, String channelName,
631: String key, Map value, List pflist) throws PSMBeanException {
632: try {
633: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
634: .getSSOToken(), baseDN, psPortalID, false);
635: cta.setMapProperty(channelName, key, value, pflist);
636: cta.store();
637: } catch (TaskAdminException tae) {
638: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
639: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
640: tae.getMessage(), tae.getTokens());
641: }
642: }
643:
644: public void setListProperty(String baseDN, String channelName,
645: String key, List value, List pflist)
646: throws PSMBeanException {
647: try {
648: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
649: .getSSOToken(), baseDN, psPortalID, false);
650: cta.setListProperty(channelName, key, value, pflist);
651: cta.store();
652: } catch (TaskAdminException tae) {
653: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
654: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
655: tae.getMessage(), tae.getTokens());
656: }
657: }
658:
659: public Object[] getVisualHierarchy(String baseDN,
660: String rootContainer) throws PSMBeanException {
661:
662: Object[] tree = null;
663:
664: try {
665: DPTreeHelper dth = new DPTreeHelper(AdminServerUtil
666: .getSSOToken(), baseDN, psPortalID);
667: dth.setLogger(logger);
668: tree = dth.getVisualTree(rootContainer);
669: } catch (TaskAdminException tae) {
670: logger.log(Level.SEVERE, "Error Getting Visual Hierarcy",
671: tae);
672: throw new PSMBeanException("Error Getting Visual Hierarcy");
673: }
674:
675: return tree;
676: }
677:
678: public Set getTopLevelChannels(String baseDN)
679: throws PSMBeanException {
680: Set topLevelChannels = new TreeSet();
681: boolean isTopLevelContainerValue = false;
682: ChannelTaskAdmin cta = null;
683: try {
684: cta = new ChannelTaskAdmin(AdminServerUtil.getSSOToken(),
685: baseDN, psPortalID);
686:
687: //get all the container channels
688: Set containers = cta.getExistingContainers(true);
689: Iterator iterator = containers.iterator();
690: while (iterator.hasNext()) {
691: //if container has isTopLevelProperty set to true , it is toplevel container
692: String containerName = (String) iterator.next();
693: try {
694: isTopLevelContainerValue = false;
695: isTopLevelContainerValue = cta.getBooleanProperty(
696: containerName,
697: PROPERTY_TOP_LEVEL_CONTAINER, null);
698: if (isTopLevelContainerValue) {
699: topLevelChannels.add(containerName); //add only when property exists and is true
700: }
701: } catch (TaskAdminException tae) {
702: //logger.log(Level.SEVERE, "Error Getting top level property", tae);
703: //do nothing as the property does not exist for this container
704: }
705:
706: }
707:
708: } catch (TaskAdminException tae) {
709: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
710:
711: }
712: return topLevelChannels;
713: }
714:
715: public Object[] getPhysicalHierarchy(String baseDN)
716: throws PSMBeanException {
717:
718: Object[] tree = null;
719:
720: try {
721: DPTreeHelper dth = new DPTreeHelper(AdminServerUtil
722: .getSSOToken(), baseDN, psPortalID);
723: dth.setLogger(logger);
724: tree = dth.getPhysicalTree();
725: } catch (TaskAdminException tae) {
726: logger.log(Level.SEVERE, "Error Getting Visual Hierarcy",
727: tae);
728: throw new PSMBeanException("Error Getting Visual Hierarcy");
729: }
730:
731: return tree;
732: }
733:
734: public Map getNodeProperties(String fqcn, String rpn, String dn,
735: String client, String locale) throws PSMBeanException {
736: Map map = null;
737: try {
738: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
739: .getSSOToken(), dn, psPortalID);
740: map = cta.getNodeProperties(fqcn, rpn, client, locale);
741: } catch (TaskAdminException tae) {
742: logger.log(Level.SEVERE, "Error getting properties for "
743: + fqcn + " at " + dn, tae);
744: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
745: getStackTrace(tae), tae.getTokens());
746: } catch (Error dpe) {
747: logger.log(Level.SEVERE, "Error getting properties for "
748: + fqcn + " at " + dn, dpe);
749: throw new PSMBeanException("", getStackTrace(dpe));
750: } catch (Exception e) {
751: logger.log(Level.SEVERE, "Error getting properties for "
752: + fqcn + " at " + dn, e);
753: throw new PSMBeanException("", getStackTrace(e));
754: }
755: return map;
756: }
757:
758: public void setNodeProperties(String fqcn, String rpn, String dn,
759: String client, String locale, Object values)
760: throws PSMBeanException {
761: try {
762: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
763: .getSSOToken(), dn, psPortalID, false);
764: cta.setNodeProperties(fqcn, rpn, client, locale, values);
765: } catch (TaskAdminException tae) {
766: logger.log(Level.SEVERE, "Error setting properties for "
767: + fqcn + " at " + dn, tae);
768: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
769: getStackTrace(tae), tae.getTokens());
770: } catch (Error dpe) {
771: logger.log(Level.SEVERE, "Error setting properties for "
772: + fqcn + " at " + dn, dpe);
773: throw new PSMBeanException("", getStackTrace(dpe));
774: } catch (Exception e) {
775: logger.log(Level.SEVERE, "Error setting properties for "
776: + fqcn + " at " + dn, e);
777: throw new PSMBeanException("", getStackTrace(e));
778: }
779: }
780:
781: public void removeCustomization(String fqcn, String rpn, String dn,
782: String client, String locale, List names)
783: throws PSMBeanException {
784: try {
785: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
786: .getSSOToken(), dn, psPortalID, false, false);
787: cta.removeCustomization(fqcn, rpn, client, locale, names);
788: } catch (TaskAdminException tae) {
789: logger.log(Level.SEVERE,
790: "Error removing customization for " + fqcn + " at "
791: + dn, tae);
792: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
793: getStackTrace(tae), tae.getTokens());
794: } catch (Error dpe) {
795: logger.log(Level.SEVERE,
796: "Error removing customization for " + fqcn + " at "
797: + dn, dpe);
798: throw new PSMBeanException("", getStackTrace(dpe));
799: } catch (Exception e) {
800: logger.log(Level.SEVERE,
801: "Error removing customization for " + fqcn + " at "
802: + dn, e);
803: throw new PSMBeanException("", getStackTrace(e));
804: }
805: }
806:
807: public void createNodeProperty(String fqcn, String rpn, String dn,
808: String client, String locale, String name, Object value,
809: Boolean advanced) throws PSMBeanException {
810: try {
811: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
812: .getSSOToken(), dn, psPortalID, false);
813: cta.createNodeProperty(fqcn, rpn, client, locale, name,
814: value, advanced);
815: } catch (TaskAdminException tae) {
816: logger.log(Level.SEVERE, "Error creating property " + name
817: + " for " + fqcn + " at " + dn, tae);
818: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
819: getStackTrace(tae), tae.getTokens());
820: } catch (Error dpe) {
821: logger.log(Level.SEVERE, "Error creating property " + name
822: + " for " + fqcn + " at " + dn, dpe);
823: throw new PSMBeanException("", getStackTrace(dpe));
824: } catch (Exception e) {
825: logger.log(Level.SEVERE, "Error creating property " + name
826: + " for " + fqcn + " at " + dn, e);
827: throw new PSMBeanException("", getStackTrace(e));
828: }
829: }
830:
831: public String getDPPriority(String baseDN) throws PSMBeanException {
832: String priority = null;
833: try {
834: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
835: .getSSOToken(), baseDN, psPortalID);
836: priority = cta.getDPPriority();
837: } catch (TaskAdminException tae) {
838: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
839: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
840: tae.getMessage(), tae.getTokens());
841: }
842: return priority;
843: }
844:
845: public void setDPPriority(String baseDN, String priority)
846: throws PSMBeanException {
847: try {
848: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
849: .getSSOToken(), baseDN, psPortalID, false);
850: cta.setDPPriority(priority);
851: } catch (TaskAdminException tae) {
852: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
853: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
854: tae.getMessage(), tae.getTokens());
855: }
856: }
857:
858: public Boolean isContainer(String baseDN, String channelName)
859: throws PSMBeanException {
860: boolean container = false;
861: try {
862: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
863: .getSSOToken(), baseDN, psPortalID);
864: container = cta.isContainer(channelName);
865: } catch (TaskAdminException tae) {
866: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
867: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
868: tae);
869: }
870: return new Boolean(container);
871: }
872:
873: public Boolean isTabContainer(String baseDN, String channelName)
874: throws PSMBeanException {
875: boolean container = false;
876: try {
877: ChannelTaskAdmin cta = new ChannelTaskAdmin(AdminServerUtil
878: .getSSOToken(), baseDN, psPortalID);
879: container = cta.isTabContainer(channelName);
880: } catch (TaskAdminException tae) {
881: logger.log(Level.SEVERE, "PSDT_CSPDAMB0008", tae);
882: throw new PSMBeanException(MSG_PREFIX + tae.getErrorKey(),
883: tae.getMessage(), tae.getTokens());
884: }
885: return new Boolean(container);
886: }
887:
888: public String getDPDocument(String baseDN) throws PSMBeanException {
889: String dp = null;
890: try {
891: DPHelper dpHelper = DPHelper.getDPHelper(cc,
892: AdminServerUtil.getSSOToken(), psPortalID);
893: dpHelper.setLogger(logger);
894:
895: dp = dpHelper.getDPDocument(baseDN);
896: } catch (DesktopDataException de) {
897: throw new PSMBeanException(MSG_PREFIX
898: + "getDP.DesktopDataException", de.getMessage());
899: } catch (ContextError ce) {
900: throw new PSMBeanException(MSG_PREFIX
901: + "getDP.ContextError", ce.getMessage());
902: }
903:
904: return dp;
905: }
906:
907: public void setDPDocument(String baseDN, String dp)
908: throws PSMBeanException {
909: try {
910: DPHelper dpHelper = DPHelper.getDPHelper(cc,
911: AdminServerUtil.getSSOToken(), psPortalID);
912: dpHelper.setLogger(logger);
913: dpHelper.storeDPDocument(baseDN, dp);
914: } catch (DesktopDataException de) {
915: throw new PSMBeanException(MSG_PREFIX
916: + "storeDP.DesktopDataException", de.getMessage());
917: } catch (ContextError ce) {
918: throw new PSMBeanException(MSG_PREFIX
919: + "storeDP.ContextError", ce.getMessage());
920: }
921:
922: }
923:
924: public void removeDPDocument(String baseDN) throws PSMBeanException {
925: try {
926: DPHelper dpHelper = DPHelper.getDPHelper(cc,
927: AdminServerUtil.getSSOToken(), psPortalID);
928: dpHelper.setLogger(logger);
929: dpHelper.removeDPDocument(baseDN);
930: } catch (DesktopDataException de) {
931: throw new PSMBeanException(MSG_PREFIX
932: + "removeDP.DesktopDataException", de.getMessage());
933: } catch (ContextError ce) {
934: throw new PSMBeanException(MSG_PREFIX
935: + "removeDP.ContextError", ce.getMessage());
936: }
937:
938: }
939:
940: }
|