|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<T>
T
- The entity that this is backed by.public abstract class AbstractEntityCollectionAdapter<T>
By extending this class it becomes easy to build Collections which are backed by a set of entities - such as a database row, domain objects, or files.
Constructor Summary | |
---|---|
AbstractEntityCollectionAdapter()
|
Method Summary | |
---|---|
protected void |
addContent(Entry e,
T doc,
RequestContext request)
Adds the atom:content element to an entry |
protected String |
addEntryDetails(RequestContext request,
Entry e,
IRI feedIri,
T entryObj)
Add the details to an entry |
protected void |
addFeedDetails(Feed feed,
RequestContext request)
Adds the selected entries to the Feed document. |
protected String |
addMediaContent(IRI feedIri,
Entry entry,
T entryObj,
RequestContext request)
Add media content details to a media-link entry |
protected ResponseContext |
buildGetMediaResponse(String id,
T entryObj)
Creates a ResponseContext for a GET media request. |
protected ResponseContext |
createMediaEntry(RequestContext request)
Create a media entry |
protected ResponseContext |
createNonMediaEntry(RequestContext request)
Create a regular entry |
ResponseContext |
deleteEntry(RequestContext request)
Delete an entry from the collection |
abstract void |
deleteEntry(String resourceName,
RequestContext request)
Delete an entry |
ResponseContext |
deleteMedia(RequestContext request)
Delete a media resource from the collection |
void |
deleteMedia(String resourceName,
RequestContext request)
Delete a media resource. |
List<Person> |
getAuthors(T entry,
RequestContext request)
Get the authors for an entry. |
abstract Object |
getContent(T entry,
RequestContext request)
Get the content for the entry. |
String |
getContentType(T entry)
Get the content-type for the entry. |
abstract Iterable<T> |
getEntries(RequestContext request)
Get the listing of entries requested |
ResponseContext |
getEntry(RequestContext request)
Get an entry from the collection |
abstract T |
getEntry(String resourceName,
RequestContext request)
Get a specific entry |
protected Entry |
getEntryFromCollectionProvider(RequestContext request)
|
ResponseContext |
getFeed(RequestContext request)
Get the collections Atom feed document |
protected String |
getFeedIriForEntry(T entryObj,
RequestContext request)
Get the Feed IRI |
abstract String |
getId(T entry)
Gets the UUID for the specified entry. |
protected String |
getLink(String name,
T entryObj,
IRI feedIri,
RequestContext request)
|
protected String |
getLink(String name,
T entryObj,
IRI feedIri,
RequestContext request,
boolean absolute)
|
protected String |
getLink(T entryObj,
IRI feedIri,
RequestContext request)
|
protected String |
getLink(T entryObj,
IRI feedIri,
RequestContext request,
boolean absolute)
|
ResponseContext |
getMedia(RequestContext request)
Get a media resource |
String |
getMediaName(T entry)
Get the name of the media resource. |
InputStream |
getMediaStream(T entry)
Get an input stream for the media resource. |
abstract String |
getName(T entry)
Get the name of the entry resource (used to construct links) |
protected String |
getQueryParameters(T entryObj,
RequestContext request)
|
Text |
getSummary(T entry,
RequestContext request)
Get the summary of the entry. |
abstract String |
getTitle(T entry)
Get the title fo the entry |
abstract Date |
getUpdated(T entry)
Get the value to use in the atom:updated element |
ResponseContext |
headEntry(RequestContext request)
Get metadata for an entry from the collection |
ResponseContext |
headMedia(RequestContext request)
Get metdata for a media resource |
boolean |
isMediaEntry(T entry)
True if this entry is a media-link entry. |
ResponseContext |
postEntry(RequestContext request)
Post a new entry to the collection |
abstract T |
postEntry(String title,
IRI id,
String summary,
Date updated,
List<Person> authors,
Content content,
RequestContext request)
Create a new entry |
T |
postMedia(javax.activation.MimeType mimeType,
String slug,
InputStream inputStream,
RequestContext request)
Post a new media resource to the collection. |
ResponseContext |
postMedia(RequestContext request)
Add a new media resource to the collection, resulting in the creation of a new Media Link Entry. |
ResponseContext |
putEntry(RequestContext request)
Update an existing entry |
abstract void |
putEntry(T entry,
String title,
Date updated,
List<Person> authors,
String summary,
Content content,
RequestContext request)
Update an entry. |
ResponseContext |
putMedia(RequestContext request)
Update a media resource |
void |
putMedia(T entryObj,
javax.activation.MimeType contentType,
String slug,
InputStream inputStream,
RequestContext request)
Update a media resource. |
Methods inherited from class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter |
---|
asCollectionElement, buildCreateEntryResponse, buildGetEntryResponse, buildGetFeedResponse, buildHeadEntryResponse, buildPostMediaEntryResponse, compensate, createErrorResponse, createFeedBase, end, extensionRequest, getAccepts, getAuthor, getCategories, getCategoriesInfo, getEntryFromRequest, getHref, getHref, getId, getResourceName, optionsEntry, optionsMedia, setHref, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.abdera.protocol.server.CollectionInfo |
---|
getTitle |
Constructor Detail |
---|
public AbstractEntityCollectionAdapter()
Method Detail |
---|
public abstract T postEntry(String title, IRI id, String summary, Date updated, List<Person> authors, Content content, RequestContext request) throws ResponseContextException
title
- The title of the entry (assumes that type="text")id
- The value of the atom:id elementsummary
- The summary of the entryupdated
- The value of the atom:updated elementauthors
- Listing of atom:author elementscontext
- The content of the entryrequest
- The request context
ResponseContextException
public ResponseContext postMedia(RequestContext request)
MediaCollectionAdapter
postMedia
in interface MediaCollectionAdapter
postMedia
in class AbstractCollectionAdapter
public ResponseContext putMedia(RequestContext request)
MediaCollectionAdapter
putMedia
in interface MediaCollectionAdapter
putMedia
in class AbstractCollectionAdapter
public void putMedia(T entryObj, javax.activation.MimeType contentType, String slug, InputStream inputStream, RequestContext request) throws ResponseContextException
entryObj
- contentType
- The mime-type of the media resourceslug
- The value of the Slug request headerinputStream
- An input stream providing access to the request payloadrequest
- The request context
ResponseContextException
public ResponseContext postEntry(RequestContext request)
CollectionAdapter
protected String getLink(T entryObj, IRI feedIri, RequestContext request) throws ResponseContextException
ResponseContextException
protected String getLink(T entryObj, IRI feedIri, RequestContext request, boolean absolute) throws ResponseContextException
ResponseContextException
protected String getLink(String name, T entryObj, IRI feedIri, RequestContext request)
protected String getLink(String name, T entryObj, IRI feedIri, RequestContext request, boolean absolute)
protected String getQueryParameters(T entryObj, RequestContext request)
public T postMedia(javax.activation.MimeType mimeType, String slug, InputStream inputStream, RequestContext request) throws ResponseContextException
mimeType
- The mime-type of the resourceslug
- The value of the Slug headerinputStream
- An InputStream providing access to the request payloadrequest
- The request context
ResponseContextException
public ResponseContext deleteEntry(RequestContext request)
CollectionAdapter
public abstract void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException
resourceName
- The entry to deleterequest
- The request context
ResponseContextException
public ResponseContext deleteMedia(RequestContext request)
MediaCollectionAdapter
deleteMedia
in interface MediaCollectionAdapter
deleteMedia
in class AbstractCollectionAdapter
public void deleteMedia(String resourceName, RequestContext request) throws ResponseContextException
ResponseContextException
public List<Person> getAuthors(T entry, RequestContext request) throws ResponseContextException
ResponseContextException
public abstract Object getContent(T entry, RequestContext request) throws ResponseContextException
ResponseContextException
public String getContentType(T entry)
public abstract Iterable<T> getEntries(RequestContext request) throws ResponseContextException
ResponseContextException
public ResponseContext getEntry(RequestContext request)
CollectionAdapter
public abstract T getEntry(String resourceName, RequestContext request) throws ResponseContextException
resourceName
- The entry to getrequest
- The request context
ResponseContextException
public ResponseContext headEntry(RequestContext request)
CollectionAdapter
headEntry
in interface CollectionAdapter
headEntry
in class AbstractCollectionAdapter
public ResponseContext headMedia(RequestContext request)
MediaCollectionAdapter
headMedia
in interface MediaCollectionAdapter
headMedia
in class AbstractCollectionAdapter
public ResponseContext getFeed(RequestContext request)
CollectionAdapter
protected void addFeedDetails(Feed feed, RequestContext request) throws ResponseContextException
ResponseContextException
public abstract String getId(T entry) throws ResponseContextException
entry
-
ResponseContextException
public ResponseContext getMedia(RequestContext request)
MediaCollectionAdapter
getMedia
in interface MediaCollectionAdapter
getMedia
in class AbstractCollectionAdapter
protected ResponseContext buildGetMediaResponse(String id, T entryObj) throws ResponseContextException
ResponseContextException
public String getMediaName(T entry) throws ResponseContextException
ResponseContextException
public InputStream getMediaStream(T entry) throws ResponseContextException
ResponseContextException
public abstract String getName(T entry) throws ResponseContextException
ResponseContextException
public abstract String getTitle(T entry) throws ResponseContextException
ResponseContextException
public abstract Date getUpdated(T entry) throws ResponseContextException
ResponseContextException
public boolean isMediaEntry(T entry) throws ResponseContextException
ResponseContextException
public ResponseContext putEntry(RequestContext request)
CollectionAdapter
protected String getFeedIriForEntry(T entryObj, RequestContext request)
public abstract void putEntry(T entry, String title, Date updated, List<Person> authors, String summary, Content content, RequestContext request) throws ResponseContextException
entry
- The entry to updatetitle
- The new title of the entryupdated
- The new value of atom:updatedauthors
- To new listing of authorssummary
- The new summarycontent
- The new contentrequest
- The request context
ResponseContextException
protected void addContent(Entry e, T doc, RequestContext request) throws ResponseContextException
ResponseContextException
protected String addEntryDetails(RequestContext request, Entry e, IRI feedIri, T entryObj) throws ResponseContextException
request
- The request contexte
- The entryfeedIri
- The feed IRIentryObj
-
ResponseContextException
public Text getSummary(T entry, RequestContext request) throws ResponseContextException
ResponseContextException
protected String addMediaContent(IRI feedIri, Entry entry, T entryObj, RequestContext request) throws ResponseContextException
feedIri
- The feed irientry
- The entry objectentryObj
- request
- The request context
ResponseContextException
protected ResponseContext createMediaEntry(RequestContext request)
request
- The request contextprotected ResponseContext createNonMediaEntry(RequestContext request)
request
- The request contextprotected Entry getEntryFromCollectionProvider(RequestContext request) throws ResponseContextException
ResponseContextException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |