|
||||||||||
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<javax.jcr.Node>
org.apache.abdera.protocol.server.adapters.jcr.JcrCollectionAdapter
public class JcrCollectionAdapter
Adapter implementation that uses a JCR Repository to store Atompub collection entries. The adapter is intended to be used with the DefaultProvider implementation.
Constructor Summary | |
---|---|
JcrCollectionAdapter()
|
Method Summary | |
---|---|
void |
deleteEntry(String resourceName,
RequestContext request)
Delete an entry |
static void |
dump(javax.jcr.Node node)
Recursively outputs the contents of the given node. |
void |
end(RequestContext request,
ResponseContext response)
Called by the provider after dispatching the request to the adapter |
String |
getAuthor(RequestContext request)
|
List<Person> |
getAuthors(javax.jcr.Node entry,
RequestContext request)
Get the authors for an entry. |
ResponseContext |
getCategories(RequestContext request)
Get an Atompub Categories document |
Object |
getContent(javax.jcr.Node entry,
RequestContext request)
Get the content for the entry. |
String |
getContentType(javax.jcr.Node entry)
Get the content-type for the entry. |
static Calendar |
getDateOrNull(javax.jcr.Node node,
String propName)
|
Iterable<javax.jcr.Node> |
getEntries(RequestContext request)
Get the listing of entries requested |
javax.jcr.Node |
getEntry(String resourceName,
RequestContext request)
Get a specific entry |
String |
getId(javax.jcr.Node entry)
Gets the UUID for the specified entry. |
String |
getId(RequestContext request)
|
String |
getMediaName(javax.jcr.Node entry)
Get the name of the media resource. |
InputStream |
getMediaStream(javax.jcr.Node entry)
Get an input stream for the media resource. |
String |
getName(javax.jcr.Node entry)
Get the name of the entry resource (used to construct links) |
protected javax.jcr.Session |
getSession(RequestContext request)
|
static String |
getStringOrNull(javax.jcr.Node node,
String propName)
|
Text |
getSummary(javax.jcr.Node entry,
RequestContext request)
Get the summary of the entry. |
String |
getTitle(javax.jcr.Node entry)
Get the title fo the entry |
String |
getTitle(RequestContext request)
Get the value of the app:collection element's atom:title element. |
Date |
getUpdated(javax.jcr.Node entry)
Get the value to use in the atom:updated element |
static javax.jcr.Value |
getValueOrNull(javax.jcr.Node node,
String propName)
|
void |
initialize()
Logs into the repository and posts a node for the collection if one does not exist. |
boolean |
isMediaEntry(javax.jcr.Node entry)
True if this entry is a media-link entry. |
protected javax.jcr.Node |
mapEntryToNode(javax.jcr.Node entry,
String title,
String summary,
Date updated,
List<Person> authors,
Content content,
javax.jcr.Session session)
|
javax.jcr.Node |
postEntry(String title,
IRI id,
String summary,
Date updated,
List<Person> authors,
Content content,
RequestContext request)
Create a new entry |
protected javax.jcr.Node |
postEntry(String title,
String summary,
Date updated,
List<Person> authors,
Content content,
javax.jcr.Session session,
javax.jcr.Node collectionNode,
String resourceName,
int num)
|
javax.jcr.Node |
postMedia(javax.activation.MimeType mimeType,
String slug,
InputStream inputStream,
RequestContext request)
Post a new media resource to the collection. |
protected String |
postSummaryForEntry(javax.jcr.Node n)
post a summary for an entry. |
void |
putEntry(javax.jcr.Node entry,
String title,
Date updated,
List<Person> authors,
String summary,
Content content,
RequestContext request)
Update an entry. |
void |
setAuthor(String author)
|
void |
setCollectionNodePath(String collectionNodePath)
|
void |
setCredentials(javax.jcr.Credentials credentials)
|
void |
setMaxActiveSessions(int maxActiveSessions)
|
void |
setRepository(javax.jcr.Repository repository)
|
void |
setTitle(String title)
|
void |
start(RequestContext request)
Called by the provider before dispatching the request to the adapter |
Methods inherited from class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter |
---|
addContent, addEntryDetails, addFeedDetails, addMediaContent, buildGetMediaResponse, createMediaEntry, createNonMediaEntry, deleteEntry, deleteMedia, deleteMedia, getEntry, getEntryFromCollectionProvider, getFeed, getFeedIriForEntry, getLink, getLink, getLink, getLink, getMedia, getQueryParameters, headEntry, headMedia, postEntry, postMedia, putEntry, putMedia, putMedia |
Methods inherited from class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter |
---|
asCollectionElement, buildCreateEntryResponse, buildGetEntryResponse, buildGetFeedResponse, buildHeadEntryResponse, buildPostMediaEntryResponse, compensate, createErrorResponse, createFeedBase, extensionRequest, getAccepts, getCategoriesInfo, getEntryFromRequest, getHref, getHref, getResourceName, optionsEntry, optionsMedia, setHref |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JcrCollectionAdapter()
Method Detail |
---|
public void setCollectionNodePath(String collectionNodePath)
public void setTitle(String title)
public void setAuthor(String author)
public void initialize() throws Exception
javax.jcr.RepositoryException
Exception
public void start(RequestContext request) throws ResponseContextException
Transactional
start
in interface Transactional
start
in class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
ResponseContextException
public void end(RequestContext request, ResponseContext response)
Transactional
end
in interface Transactional
end
in class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
public String getContentType(javax.jcr.Node entry)
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getContentType
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
public boolean isMediaEntry(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
isMediaEntry
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public javax.jcr.Node postMedia(javax.activation.MimeType mimeType, String slug, InputStream inputStream, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
postMedia
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
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
protected String postSummaryForEntry(javax.jcr.Node n)
n
-
public javax.jcr.Node postEntry(String title, IRI id, String summary, Date updated, List<Person> authors, Content content, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
postEntry
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
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 elementsrequest
- The request context
ResponseContextException
protected javax.jcr.Node postEntry(String title, String summary, Date updated, List<Person> authors, Content content, javax.jcr.Session session, javax.jcr.Node collectionNode, String resourceName, int num) throws ResponseContextException, javax.jcr.RepositoryException
ResponseContextException
javax.jcr.RepositoryException
protected javax.jcr.Node mapEntryToNode(javax.jcr.Node entry, String title, String summary, Date updated, List<Person> authors, Content content, javax.jcr.Session session) throws ResponseContextException, javax.jcr.RepositoryException
ResponseContextException
javax.jcr.RepositoryException
protected javax.jcr.Session getSession(RequestContext request)
public void deleteEntry(String resourceName, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
deleteEntry
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
resourceName
- The entry to deleterequest
- The request context
ResponseContextException
public static void dump(javax.jcr.Node node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public String getAuthor(RequestContext request) throws ResponseContextException
getAuthor
in class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
ResponseContextException
public List<Person> getAuthors(javax.jcr.Node entry, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getAuthors
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public Object getContent(javax.jcr.Node entry, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getContent
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public Iterable<javax.jcr.Node> getEntries(RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getEntries
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public javax.jcr.Node getEntry(String resourceName, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getEntry
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
resourceName
- The entry to getrequest
- The request context
ResponseContextException
public String getId(RequestContext request)
getId
in class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
public String getId(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getId
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public String getMediaName(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getMediaName
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public InputStream getMediaStream(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getMediaStream
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public String getName(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getName
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public Text getSummary(javax.jcr.Node entry, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getSummary
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public String getTitle(RequestContext request)
CollectionInfo
public String getTitle(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getTitle
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public Date getUpdated(javax.jcr.Node entry) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
getUpdated
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
ResponseContextException
public void putEntry(javax.jcr.Node entry, String title, Date updated, List<Person> authors, String summary, Content content, RequestContext request) throws ResponseContextException
org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter
putEntry
in class org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter<javax.jcr.Node>
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
public static String getStringOrNull(javax.jcr.Node node, String propName) throws ResponseContextException
ResponseContextException
public ResponseContext getCategories(RequestContext request)
CollectionAdapter
getCategories
in interface CollectionAdapter
getCategories
in class org.apache.abdera.protocol.server.impl.AbstractCollectionAdapter
public static Calendar getDateOrNull(javax.jcr.Node node, String propName) throws ResponseContextException
ResponseContextException
public static javax.jcr.Value getValueOrNull(javax.jcr.Node node, String propName) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void setRepository(javax.jcr.Repository repository)
public void setCredentials(javax.jcr.Credentials credentials)
public void setMaxActiveSessions(int maxActiveSessions)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |