001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/email/tags/sakai_2-4-1/email-api/api/src/java/org/sakaiproject/email/api/DigestService.java $
003: * $Id: DigestService.java 7287 2006-03-30 21:21:55Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.email.api;
021:
022: import java.util.List;
023:
024: import org.sakaiproject.exception.IdUnusedException;
025: import org.sakaiproject.exception.IdUsedException;
026: import org.sakaiproject.exception.InUseException;
027:
028: /**
029: * <p>
030: * The DigestService collects sets of messages for different users, and sends them out periodically.
031: * </p>
032: */
033: public interface DigestService {
034: /** This string can be used to find the service in the service manager. */
035: static final String SERVICE_NAME = DigestService.class.getName();
036:
037: /** This string starts the references to resources in this service. */
038: static final String REFERENCE_ROOT = "/digest";
039:
040: /** Securiy / Event for adding a digest. */
041: static final String SECURE_ADD_DIGEST = "digest.add";
042:
043: /** Securiy / Event for updating a digest. */
044: static final String SECURE_EDIT_DIGEST = "digest.upd";
045:
046: /** Securiy / Event for removing a digest. */
047: static final String SECURE_REMOVE_DIGEST = "digest.del";
048:
049: /**
050: * Access a digest associated with this id.
051: *
052: * @param id
053: * The digest id.
054: * @return The Digest object.
055: * @exception IdUnusedException
056: * if there is not digest object with this id.
057: */
058: Digest getDigest(String id) throws IdUnusedException;
059:
060: /**
061: * Access all digest objects.
062: *
063: * @return A List (Digest) of all defined digests.
064: */
065: List getDigests();
066:
067: /**
068: * Add a new message to a digest, creating one if needed. This returns right away; the digest will be added as soon as possible.
069: *
070: * @param message
071: * The message to digest.
072: * @param subject
073: * The to (user id) of the message.
074: * @param subject
075: * The subject of the message.
076: * @param body
077: * The subject of the message.
078: */
079: void digest(String to, String Subject, String body);
080:
081: /**
082: * Add a new digest with this id. Must commit(), remove() or cancel() when done.
083: *
084: * @param id
085: * The digest id.
086: * @return A new DigestEdit object for editing.
087: * @exception IdUsedException
088: * if these digest already exist.
089: */
090: DigestEdit add(String id) throws IdUsedException;
091:
092: /**
093: * Get a locked Digest object for editing. May be new. Must commit(), cancel() or remove() when done.
094: *
095: * @param id
096: * The digest id.
097: * @return A DigestEdit object for editing.
098: * @exception InUseException
099: * if the digest object is locked by someone else.
100: */
101: DigestEdit edit(String id) throws InUseException;
102:
103: /**
104: * Commit the changes made to a DigestEdit object, and release the lock. The DigestEdit is disabled, and not to be used after this call.
105: *
106: * @param user
107: * The DigestEdit object to commit.
108: */
109: void commit(DigestEdit edit);
110:
111: /**
112: * Cancel the changes made to a DigestEdit object, and release the lock. The DigestEdit is disabled, and not to be used after this call.
113: *
114: * @param user
115: * The DigestEdit object to commit.
116: */
117: void cancel(DigestEdit edit);
118:
119: /**
120: * Remove this DigestEdit - it must be locked from edit(). The DigestEdit is disabled, and not to be used after this call.
121: *
122: * @param user
123: * The DigestEdit object to remove.
124: */
125: void remove(DigestEdit edit);
126: }
|