001: /**
002: *
003: */package org.sakaiproject.content.api;
004:
005: import java.io.InputStream;
006: import java.util.List;
007:
008: import org.sakaiproject.exception.ServerOverloadException;
009:
010: /**
011: * @author ieb
012: */
013: public interface ContentHostingHandler {
014:
015: /**
016: * Cancel an edit to a collection, if this needs to be done in the impl.
017: *
018: * @param edit
019: */
020: void cancel(ContentCollectionEdit edit);
021:
022: /**
023: * cancel an edit to a resource ( if this needs to be done )
024: *
025: * @param edit
026: */
027: void cancel(ContentResourceEdit edit);
028:
029: /**
030: * commit a collection
031: *
032: * @param edit
033: */
034: void commit(ContentCollectionEdit edit);
035:
036: /**
037: * commit a resource
038: *
039: * @param edit
040: */
041: void commit(ContentResourceEdit edit);
042:
043: /**
044: * commit a deleted resource
045: *
046: * @param edit
047: * @param uuid
048: */
049: void commitDeleted(ContentResourceEdit edit, String uuid);
050:
051: /**
052: * get a list of collections contained within the supplied collection
053: *
054: * @param collection
055: * @return
056: */
057: List getCollections(ContentCollection collection);
058:
059: /**
060: * get a ContentCollectionEdit for the ID, creating it if necessary, this should not persist until commit is invoked
061: *
062: * @param id
063: * @return
064: */
065: ContentCollectionEdit getContentCollectionEdit(String id);
066:
067: /**
068: * get a content resource edit for the supplied ID, creating it if necesary. This sould not persist until commit is invoked
069: *
070: * @param id
071: * @return
072: */
073: ContentResourceEdit getContentResourceEdit(String id);
074:
075: /**
076: * get a list of string ids of all resources below this point
077: *
078: * @param ce
079: * @return
080: */
081: List getFlatResources(ContentEntity ce);
082:
083: /**
084: * get the resource body
085: *
086: * @param resource
087: * @return
088: * @throws ServerOverloadException
089: */
090: byte[] getResourceBody(ContentResource resource)
091: throws ServerOverloadException;
092:
093: /**
094: * get a list of resource ids as strings within the collection
095: *
096: * @param collection
097: * @return
098: */
099: List getResources(ContentCollection collection);
100:
101: /**
102: * Convert the passed-in ContentEntity into a virtual Content Entity. The implementation should check that the passed in entity is managed by this content handler before performing the translation. Additionally it must register the content handler
103: * with the newly proxied ContentEntity so that subsequent invocations are routed back to the correct ContentHostingHandler implementation
104: *
105: * @param edit
106: * @return
107: */
108: ContentEntity getVirtualContentEntity(ContentEntity edit,
109: String finalId);
110:
111: /**
112: * perform a wastebasket operation on the names id, if the implementation supports the operation otherwise its safe to ignore.
113: *
114: * @param id
115: * @param uuid
116: * @param userId
117: * @return
118: */
119: ContentResourceEdit putDeleteResource(String id, String uuid,
120: String userId);
121:
122: /**
123: * remove the supplied collection
124: *
125: * @param edit
126: */
127: void removeCollection(ContentCollectionEdit edit);
128:
129: /**
130: * remove the resource
131: *
132: * @param edit
133: */
134: void removeResource(ContentResourceEdit edit);
135:
136: /**
137: * stream the body of the resource
138: *
139: * @param resource
140: * @return
141: * @throws ServerOverloadException
142: */
143: InputStream streamResourceBody(ContentResource resource)
144: throws ServerOverloadException;
145:
146: /**
147: * get the number of members
148: * @param ce
149: * @return
150: */
151: int getMemberCount(ContentEntity ce);
152:
153: }
|