001: /**
002: * $Id: DPProviderProvisionPropertiesImpl.java,v 1.4 2007/01/26 03:50:15 portalbld 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.service.provider.impl;
014:
015: import java.util.Set;
016:
017: import java.io.File;
018:
019: import java.util.Map;
020: import java.util.List;
021: import java.util.ArrayList;
022: import java.util.Vector;
023: import java.util.Hashtable;
024:
025: import com.sun.portal.taskadmin.TaskAdminException;
026: import com.sun.portal.taskadmin.ChannelTaskAdmin;
027: import com.sun.portal.desktop.dp.DPChannel;
028: import com.sun.portal.taskadmin.TaskAdminException;
029: import com.sun.portal.taskadmin.ChannelTaskAdmin;
030:
031: import javax.servlet.http.HttpServletRequest;
032:
033: import com.iplanet.sso.SSOToken;
034: import com.sun.portal.providers.service.provision.ProviderProvisionPropertiesException;
035: import com.sun.portal.providers.service.provision.ProviderProvisionProperties;
036:
037: import com.sun.portal.desktop.dp.DPRoot;
038:
039: public class DPProviderProvisionPropertiesImpl implements
040: ProviderProvisionProperties {
041: private String _channelName;
042: private ChannelTaskAdmin _channelTaskAdmin;
043: private String _communityPrincipalId;
044: private boolean _readOnly;
045:
046: public DPProviderProvisionPropertiesImpl(SSOToken ssoToken,
047: String communityPrincipalId, DPRoot dpRoot,
048: String channelName, boolean readOnly)
049: throws TaskAdminException {
050:
051: _channelTaskAdmin = new ChannelTaskAdmin(ssoToken, dpRoot);
052: _channelName = channelName;
053: _communityPrincipalId = communityPrincipalId;
054: _readOnly = readOnly;
055:
056: }
057:
058: public void setStringProperty(String key, String value, List pflist)
059: throws ProviderProvisionPropertiesException {
060: if (_readOnly) {
061: throw new ProviderProvisionPropertiesException(
062: "Properties can't be set in this mode.");
063: }
064: try {
065: _channelTaskAdmin.setStringProperty(_channelName, key,
066: value, pflist);
067: } catch (Exception ex) {
068: throw new ProviderProvisionPropertiesException(ex);
069: }
070: }
071:
072: public void setListProperty(String key, List value, List pflist)
073: throws ProviderProvisionPropertiesException {
074: if (_readOnly) {
075: throw new ProviderProvisionPropertiesException(
076: "Properties can't be set in this mode.");
077: }
078: try {
079: _channelTaskAdmin.setListProperty(_channelName, key, value,
080: pflist);
081: } catch (Exception ex) {
082: throw new ProviderProvisionPropertiesException(ex);
083: }
084: }
085:
086: public void setMapProperty(String key, Map value, List pflist)
087: throws ProviderProvisionPropertiesException {
088: if (_readOnly) {
089: throw new ProviderProvisionPropertiesException(
090: "Properties can't be set in this mode.");
091: }
092: try {
093: _channelTaskAdmin.setMapProperty(_channelName, key, value,
094: pflist);
095: } catch (Exception ex) {
096: throw new ProviderProvisionPropertiesException(ex);
097: }
098: }
099:
100: public void setIntegerProperty(String key, int value, List pflist)
101: throws ProviderProvisionPropertiesException {
102: if (_readOnly) {
103: throw new ProviderProvisionPropertiesException(
104: "Properties can't be set in this mode.");
105: }
106: try {
107: _channelTaskAdmin.setIntegerProperty(_channelName, key,
108: value, pflist);
109: } catch (Exception ex) {
110: throw new ProviderProvisionPropertiesException(ex);
111: }
112: }
113:
114: public void setBooleanProperty(String key, boolean value,
115: List pflist) throws ProviderProvisionPropertiesException {
116: if (_readOnly) {
117: throw new ProviderProvisionPropertiesException(
118: "Properties can't be set in this mode.");
119: }
120: try {
121: _channelTaskAdmin.setBooleanProperty(_channelName, key,
122: value, pflist);
123: } catch (Exception ex) {
124: throw new ProviderProvisionPropertiesException(ex);
125: }
126: }
127:
128: /**
129: * Return the value for channel String property.
130: * @param channelName channel name.
131: * @param key property name
132: * @param pflist properties filter list
133: * @return Value of the string property.
134: * @throws ProviderProvisionPreferencesException
135: */
136: public String getStringProperty(String key, List pflist)
137: throws ProviderProvisionPropertiesException {
138: try {
139: return _channelTaskAdmin.getStringProperty(_channelName,
140: key, pflist);
141: } catch (Exception ex) {
142: throw new ProviderProvisionPropertiesException(ex);
143: }
144: }
145:
146: /**
147: * Return the value for channel integer property.
148: * @param channelName channel name.
149: * @param key property name
150: * @param pflist properties filter list
151: * @return value of the integer property.
152: * @throws ProviderProvisionPreferencesException
153: */
154: public int getIntegerProperty(String key, List pflist)
155: throws ProviderProvisionPropertiesException {
156: try {
157: return _channelTaskAdmin.getIntegerProperty(_channelName,
158: key, pflist);
159: } catch (Exception ex) {
160: throw new ProviderProvisionPropertiesException(ex);
161: }
162:
163: }
164:
165: /**
166: * Return the value for channel's boolean property.
167: * @param channelName channel name.
168: * @param key property name
169: * @param pflist properties filter list
170: * @return value of the boolean property.
171: * @throws ProviderProvisionPreferencesException
172: */
173: public boolean getBooleanProperty(String key, List pflist)
174: throws ProviderProvisionPropertiesException {
175: try {
176: return _channelTaskAdmin.getBooleanProperty(_channelName,
177: key, pflist);
178: } catch (Exception ex) {
179: throw new ProviderProvisionPropertiesException(ex);
180: }
181:
182: }
183:
184: /**
185: * This method returns the Map collection object for the given
186: * collection property.
187: * @param channelName channel name.
188: * @param key property name
189: * @param pflist
190: * @return
191: * @throws ProviderProvisionPreferencesException
192: */
193: public Map getMapProperty(String key, List pflist)
194: throws ProviderProvisionPropertiesException {
195: try {
196: return _channelTaskAdmin.getMapProperty(_channelName, key,
197: pflist);
198: } catch (Exception ex) {
199: throw new ProviderProvisionPropertiesException(ex);
200: }
201:
202: }
203:
204: /**
205: * This method returns the List collection object for the given
206: * collection property.
207: * @param channelName channel name.
208: * @param key property name
209: * @param pflist
210: * @return
211: * @throws ProviderProvisionPreferencesException
212: */
213: public List getListProperty(String key, List pflist)
214: throws ProviderProvisionPropertiesException {
215: try {
216: return _channelTaskAdmin.getListProperty(_channelName, key,
217: pflist);
218: } catch (Exception ex) {
219: throw new ProviderProvisionPropertiesException(ex);
220: }
221:
222: }
223:
224: /**
225: * This method returns the list of property names that are existing
226: * at the baseDN and at the given channel name that is passed in. This method
227: * returns only the default property names and filters out all the conditional
228: * properties.
229: *
230: * @param channelName the channel name for which property names list to be returned.
231: * @param advanced advanced flag to specify whether to return basic/advanced propertynames.
232: * @return Set Contaning property name list.
233: */
234: public Set getPropertyNames(boolean advanced)
235: throws ProviderProvisionPropertiesException {
236: try {
237: return _channelTaskAdmin.getPropertyNames(_channelName,
238: advanced);
239: } catch (Exception ex) {
240: throw new ProviderProvisionPropertiesException(ex);
241: }
242:
243: }
244:
245: }
|