001: /**
002: * Copyright 2002 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and iPlanet
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */
013:
014: /**
015: * Copyright 2002 Sun Microsystems, Inc. All
016: * rights reserved. Use of this product is subject
017: * to license terms. Federal Acquisitions:
018: * Commercial Software -- Government Users
019: * Subject to Standard License Terms and
020: * Conditions.
021: *
022: * Sun, Sun Microsystems, the Sun logo, and iPlanet
023: * are trademarks or registered trademarks of Sun Microsystems,
024: * Inc. in the United States and other countries.
025: */package com.sun.portal.app.calendarcommon.calendar;
026:
027: import javax.portlet.PortletRequest;
028: import com.sun.comclient.calendar.CalendarStore;
029:
030: import com.sun.portal.app.calendarcommon.common.SharedServicesException;
031: import com.sun.portal.portlet.service.provision.PortletProvisionPreferences;
032: import com.sun.portal.search.demo.SearchDatabase;
033: import java.util.Map;
034: import java.util.Properties;
035: import javax.faces.context.FacesContext;
036: import javax.servlet.http.HttpServletRequest;
037:
038: /**
039: * Utility methods relevant to the Shared Calendar services.
040: *
041: * @author Nigel Jacobs
042: * @created May 18, 2005
043: */
044: public interface SharedCalendarUtils {
045:
046: // Prefix that establishes the Coummunity (Shared) Calendar namespace
047: public static final String CTY_CAL_PREFIX = "CTY_CAL_";
048:
049: // Attribute name of proxy cal store cache on ServletContext.
050: public static final String CAL_STORE_CACHE_CONTEXT_ATTR = "community.calendar.calstores";
051:
052: // Attribute name of member cal store cache on portlet session
053: public static final String CAL_STORE_CACHE_SESSION_ATTR = "member.calendar.calstores";
054:
055: // Attribute name of member cal domain cache on ServletContext.
056: public static final String MBR_CAL_DOMAIN_CACHE_CONTEXT_ATTR = "community.calendar.mbr.domains";
057:
058: // Names of config props in cal SSO adapter config.
059: public static final String CONFIG_PROP_daHost = "daHost";
060: public static final String CONFIG_PROP_daPort = "daPort";
061: public static final String CONFIG_PROP_daProxyUid = "daProxyUid";
062: public static final String CONFIG_PROP_daProxyPassword = "daProxyPassword";
063: public static final String CONFIG_PROP_daDomain = "daDomain";
064:
065: public static final String CONFIG_PROP_calHost = "calHost";
066: public static final String CONFIG_PROP_calPort = "calPort";
067: public static final String CONFIG_PROP_calProxyUid = "calProxyUid";
068: public static final String CONFIG_PROP_calProxyPassword = "calProxyPassword";
069:
070: public static final String CONFIG_PROP_autoDeleteProxyUserCal = "autoDeleteProxyUserCal";
071: public static final String CONFIG_PROP_isHostedDomain = "isHostedDomain";
072: public static final String CONFIG_PROP_configDesc = "configDesc";
073: public static final String CONFIG_PROP_ssoClassName = "ssoClassName";
074: public static final String CONFIG_PROP_createEventsInMembersCal = "createEventsInMembersCal";
075:
076: public static final int APP_TYPE_SHAREDEVENTS = 0;
077: public static final int APP_TYPE_SHAREDTASKS = 1;
078: /**
079: * The name of the ServletContext attribute used to store the SharedCalendarUtils singleton.
080: */
081: public static final String SHARED_CAL_UTILS_CONTEXT_ATTR = "community.calendar.utils";
082:
083: /**
084: * The name of the attribute used to store the shared calendar config name in the PortletPreferences and ServletContext.
085: */
086: public static final String SHARED_CAL_CONFIG_ATTR = "community.calendar.config";
087:
088: /**
089: * The default shared calendar config name.
090: */
091: public static final String SHARED_CAL_CONFIG_DEFAULT = "CTY-SHARED-CALENDAR";
092:
093: // Attribute name of config cache on ServletContext.
094: public static final String CONFIG_CACHE_CONTEXT_ATTR = "community.calendar.configs";
095:
096: /** * The portlet preference that inidicates the name of the search database.
097: */
098: public static final String SEARCH_DB_PREF = "ps.searchdb";
099:
100: /**
101: * The portlet preference that inidicates the URL of the search server.
102: */
103: public static final String SEARCH_SERVER_URL_PREF = "ps.searchserverurl";
104:
105: /**
106: * Compute the community proxy users calendar id for this community.
107: * e.g. "Friends" => "CTY_CAL_Friends"
108: * @param portletRequest Used to retrieve the community id.
109: * @return Community proxys calendar id
110: */
111: public String getCommunityCalendarID(PortletRequest portletRequest)
112: throws SharedServicesException;
113:
114: /**
115: * Compute the community proxy users calendar id for this community.
116: * e.g. "Friends" => "CTY_CAL_Friends"
117: * @param portletRequest Used to retrieve the community id.
118: * @return Community proxys calendar id
119: */
120: public String getCommunityCalendarID(FacesContext context)
121: throws SharedServicesException;
122:
123: /**
124: * Compute the community proxy users calendar id for this community.
125: * e.g. "Friends" => "CTY_CAL_Friends"
126: * @param communityID
127: * @param domainIfHosted the domain if we are in hosted mode, else null
128: * @return Community proxys calendar id
129: *
130: * RETIRED: Not used or useful outside of SharedCalendarUtilsImpl
131: *
132: public String getCommunityCalendarID(String communityID, String domainIfHosted);
133: */
134:
135: /**
136: * Compute the proxy user uid from the communityID
137: * e.g. "Friends" => "CTY_CAL_PRX_JTO__Friends"
138: */
139: public String getProxyUser(String communityID);
140:
141: /**
142: * Compute the community member's universal calendar id (common across communities). Uses
143: * the cached organization param, retrieve from the portlet request.
144: * e.g. "joe" in organization "sun.com" => CTY_CAL_joe@sun.com
145: * @param portletRequest
146: * @param memberID
147: * @return
148: */
149: public String getMemberCalendarID(PortletRequest portletRequest,
150: String memberID) throws SharedServicesException;
151:
152: /**
153: * Compute the community member's universal calendar id (common across communities). Uses
154: * the cached organization param, retrieve from the portlet request.
155: * e.g. "joe" in organization "sun.com" => CTY_CAL_joe@sun.com
156: * @param portletRequest
157: * @param memberID
158: * @return
159: */
160: public String getMemberCalendarID(FacesContext context,
161: String memberID) throws SharedServicesException;
162:
163: /**
164: * Get the user id, and configuration via the request.
165: * Generate the calendar id from the user id.
166: * If the calendar store is cached (indexed by calendar id), return it.
167: * Otherwise connect to calendar server, get the users calendar store, and create the calendar with id,
168: * setting default permissions, but allowing the proxy user update access.
169: * Cache and return the store
170: * @param portletRequest
171: * @param memberID
172: * @return
173: */
174: public CalendarStore getMemberCalendarStore(
175: PortletRequest portletRequest, String memberID)
176: throws SharedServicesException;
177:
178: /**
179: * Get the user id, and configuration via the request.
180: * Generate the calendar id from the user id.
181: * If the calendar store is cached (indexed by calendar id), return it.
182: * Otherwise connect to calendar server, get the users calendar store, and create the calendar with id,
183: * setting default permissions, but allowing the proxy user update access.
184: * Cache and return the store
185: * @param portletRequest
186: * @param memberID
187: * @return
188: */
189: public CalendarStore getMemberCalendarStore(FacesContext context,
190: String memberID) throws SharedServicesException;
191:
192: /**
193: * Get the user id, and configuration via the request.
194: * Generate the calendar id from the user id.
195: * If the calendar store is cached (indexed by calendar id), return it.
196: * Otherwise connect to calendar server, get the users calendar store, and create the calendar with id,
197: * setting default permissions, but allowing the proxy user update access.
198: * Cache and return the store
199: * @param servletRequest
200: * @param preferences The PortletPreferences / PortletProvisionPreferences map.
201: * @param communityID
202: * @param memberID
203: * @return calendar store
204: */
205: public CalendarStore getMemberCalendarStore(
206: HttpServletRequest servletRequest, Map preferences,
207: String communityID, String memberID)
208: throws SharedServicesException;
209:
210: /**
211: * Get the community id, and the configuration via the request.
212: * Generate the calendar id from the community id.
213: * If the calendar store is cached (indexed by calendar id), return it.
214: * Otherwise connect to calendar server, get the proxys calendar store, and create the calendar with id
215: * Cache and return the store.
216: * @param portletRequest
217: * @return
218: */
219: public CalendarStore getProxyCalendarStore(
220: PortletRequest portletRequest)
221: throws SharedServicesException;
222:
223: /**
224: * Get the community id, and the configuration via the request.
225: * Generate the calendar id from the community id.
226: * If the calendar store is cached (indexed by calendar id), return it.
227: * Otherwise connect to calendar server, get the proxys calendar store, and create the calendar with id
228: * Cache and return the store.
229: * @param portletRequest
230: * @return
231: */
232: public CalendarStore getProxyCalendarStore(FacesContext context)
233: throws SharedServicesException;
234:
235: /**
236: * Get the community id, and the configuration via the request.
237: * Generate the calendar id from the community id.
238: * If the calendar store is cached (indexed by calendar id), return it.
239: * Otherwise connect to calendar server, get the proxys calendar store, and create the calendar with id
240: * Cache and return the store.
241: * @param portletRequest
242: * @return
243: */
244: public CalendarStore getProxyCalendarStore(
245: PortletProvisionPreferences preferences,
246: HttpServletRequest servletRequest, String communityID)
247: throws SharedServicesException;
248:
249: /**
250: * Delete the proxy calendar store, if auto-delete is set in config props
251: */
252: public void deleteProxyCalendarStore(String communityID,
253: Properties configurationProperties)
254: throws SharedServicesException;
255:
256: /**
257: * Perform any clean up operations: close connections and release resources.
258: */
259: public void destroy();
260:
261: /**
262: * Get the Shared Calendar configuration properties for this portlet.
263: * Use the config name stored in the portlet prefs to look up the sso adapter config,
264: * and return contained properties.
265: * @param preferences A read-only map of portlet prefs (PortletPreferences or PortletProvisionPreferences)
266: * @param servletRequest
267: * @return
268: */
269: public Properties getConfigProperties(Map preferences,
270: HttpServletRequest servletRequest)
271: throws SharedServicesException;
272:
273: /**
274: * Find of create a DelegatedAdministratorHandler for the community.
275: * @param communityID The community ID.
276: * @param configProps The SSO adapter configuration properties for the community.
277: * @return The DelegatedAdministratorHandler for the community.
278: */
279: public DelegatedAdministratorHandler getDAHandler(
280: String communityID, Properties configProps);
281:
282: /**
283: * Should events be created in the member's community calendar,
284: * or solely in the proxy community calendar (defined in SSO adapter config param).
285: * @param The faces context.
286: * @return Whether to create events in members community calendar
287: */
288: public boolean createEventsInMembersCalendar(FacesContext context)
289: throws SharedServicesException;
290:
291: /**
292: * Should events be created in the member's community calendar,
293: * or solely in the proxy community calendar (defined in SSO adapter config param).
294: * @param The portlet request.
295: * @return Whether to create events in members community calendar
296: */
297: public boolean createEventsInMembersCalendar(
298: PortletRequest portletRequest)
299: throws SharedServicesException;
300:
301: /**
302: * Insert a resource description for the calendar item into the search database.
303: * @param FacesContext The faces context.
304: * @param appType APP_TYPE_SHAREDEVENTS or APP_TYPE_SHAREDTASKS
305: * @param memberID The id of the community member
306: * @param itemID The ID of the event or task
307: * @param title The title of the event (summary)
308: * @param description The one line description of the item
309: * @param displayURL The url that when selected will display the item.
310: */
311: public void insertItemIntoSearchDatabase(FacesContext context,
312: int appType, String memberID, String itemID, String title,
313: String description, String displayURL)
314: throws SharedServicesException;
315:
316: /**
317: * Delete a resource description for the calendar item from the search database.
318: * @param appType APP_TYPE_SHAREDEVENTS or APP_TYPE_SHAREDTASKS
319: * @param itemID The ID of the event or task
320: */
321: public void deleteItemFromSearchDatabase(FacesContext context,
322: int appType, String itemID) throws SharedServicesException;
323:
324: /**
325: * Connect to a search database for the community.
326: * @param The faces context.
327: */
328: public SearchDatabase getSearchDatabase(FacesContext context)
329: throws SharedServicesException;
330:
331: }
|