@Deprecated public class FileBasedCollection extends Collection
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
baseDir
Deprecated.
|
private java.lang.String[] |
catNames
Deprecated.
|
private java.lang.String |
collection
Deprecated.
|
private java.lang.String |
contextURI
Deprecated.
|
private static java.lang.String |
FEED_TYPE
Deprecated.
|
private java.lang.String |
handle
Deprecated.
|
private boolean |
inlineCats
Deprecated.
|
private boolean |
relativeURIs
Deprecated.
|
private java.lang.String |
servletPath
Deprecated.
|
private java.lang.String |
singular
Deprecated.
|
ENTRY_TYPE
Constructor and Description |
---|
FileBasedCollection(java.lang.String title,
java.lang.String handle,
java.lang.String collection,
java.lang.String singular,
java.lang.String accept,
boolean inlineCats,
java.lang.String[] catNames,
boolean relativeURIs,
java.lang.String contextURI,
java.lang.String contextPath,
java.lang.String servletPath,
java.lang.String baseDir)
Deprecated.
Construct by providing title (plain text, no HTML), a workspace handle, a plural collection
name (e.g.
|
Modifier and Type | Method and Description |
---|---|
Entry |
addEntry(Entry entry)
Deprecated.
Add entry to collection.
|
java.lang.String |
addMediaEntry(Entry entry,
java.lang.String slug,
java.io.InputStream is)
Deprecated.
Add media entry to collection.
|
private static void |
checkExistence(java.lang.String path)
Deprecated.
|
private java.io.InputStream |
createDefaultFeedDocument(java.lang.String uri)
Deprecated.
|
private java.lang.String |
createFileName(java.lang.String title,
java.lang.String contentType)
Deprecated.
Creates a file name for a file based on a weblog handle, title string and a content-type.
|
void |
deleteEntry(java.lang.String fsid)
Deprecated.
Delete an entry and any associated media file.
|
private Entry |
findEntry(java.lang.String id,
Feed feed)
Deprecated.
|
private java.lang.String |
getBaseDir()
Deprecated.
|
java.util.List<Categories> |
getCategories()
Deprecated.
Get list of one Categories object containing categories allowed by collection, returns
in-line categories if collection set to use in-line categories.
|
java.util.List<Categories> |
getCategories(boolean inline)
Deprecated.
Get list of one Categories object containing categories allowed by collection.
|
private java.lang.String |
getCategoriesURI()
Deprecated.
|
Entry |
getEntry(java.lang.String fsid)
Deprecated.
Get an entry from the collection.
|
private java.lang.String |
getEntryDirPath(java.lang.String id)
Deprecated.
|
private java.lang.String |
getEntryEditURI(java.lang.String fsid,
boolean relative,
boolean singleEntry)
Deprecated.
|
private java.lang.String |
getEntryMediaEditURI(java.lang.String fsid,
boolean relative,
boolean singleEntry)
Deprecated.
|
private java.lang.String |
getEntryMediaPath(java.lang.String id)
Deprecated.
|
private java.lang.String |
getEntryMediaViewURI(java.lang.String fsid)
Deprecated.
|
private java.lang.String |
getEntryPath(java.lang.String id)
Deprecated.
|
private java.lang.String |
getEntryViewURI(java.lang.String fsid)
Deprecated.
|
Feed |
getFeedDocument()
Deprecated.
Get feed document representing collection.
|
private java.lang.String |
getFeedPath()
Deprecated.
|
AtomMediaResource |
getMediaResource(java.lang.String fileName)
Deprecated.
Get media resource wrapping a file.
|
private Entry |
loadAtomEntry(java.io.InputStream in)
Deprecated.
Create a Rome Atom entry based on a Roller entry.
|
private Entry |
loadAtomResourceEntry(java.io.InputStream in,
java.io.File file)
Deprecated.
|
private void |
saveMediaFile(java.lang.String name,
java.lang.String contentType,
long size,
java.io.InputStream is)
Deprecated.
Save file to website's resource directory.
|
void |
updateEntry(Entry entry,
java.lang.String fsid)
Deprecated.
Update an entry in the collection.
|
private void |
updateEntryAppLinks(Entry entry,
java.lang.String fsid,
boolean singleEntry)
Deprecated.
|
private void |
updateFeedDocument(Feed f)
Deprecated.
|
private void |
updateFeedDocumentRemovingEntry(Feed f,
java.lang.String id)
Deprecated.
|
private void |
updateFeedDocumentWithExistingEntry(Feed f,
Entry e)
Deprecated.
|
private void |
updateFeedDocumentWithNewEntry(Feed f,
Entry e)
Deprecated.
|
Entry |
updateMediaEntry(java.lang.String fileName,
java.lang.String contentType,
java.io.InputStream is)
Deprecated.
Update media associated with a media-link entry.
|
private void |
updateMediaEntryAppLinks(Entry entry,
java.lang.String fileName,
boolean singleEntry)
Deprecated.
|
private void |
updateTimestamps(Entry entry)
Deprecated.
Update existing or add new app:edited.
|
accepts, addAccept, addCategories, collectionToElement, elementToCollection, getAccepts, getHref, getHrefResolved, getHrefResolved, getTitle, getTitleType, parseCollectionElement, setAccepts, setHref, setTitle, setTitleType
private java.lang.String handle
private java.lang.String singular
private java.lang.String collection
private boolean inlineCats
private java.lang.String[] catNames
private boolean relativeURIs
private java.lang.String contextURI
private java.lang.String servletPath
private java.lang.String baseDir
private static final java.lang.String FEED_TYPE
public FileBasedCollection(java.lang.String title, java.lang.String handle, java.lang.String collection, java.lang.String singular, java.lang.String accept, boolean inlineCats, java.lang.String[] catNames, boolean relativeURIs, java.lang.String contextURI, java.lang.String contextPath, java.lang.String servletPath, java.lang.String baseDir)
title
- Title of collection (plain text, no HTML)handle
- Workspace handlecollection
- Collection handle, pluralsingular
- Collection handle, singularaccept
- Content type range accepted by collectioninlineCats
- True for inline categoriescatNames
- Category names for this workspacebaseDir
- Base directory for file storagerelativeURIs
- True for relative URIscontextURI
- Absolute URI of context that hosts APP servicecontextPath
- Context path of APP service (e.g. "/sample-atomserver")servletPath
- Servlet path of APP service (e.g. "/app")public Feed getFeedDocument() throws AtomException
com.rometools.rome.propono.atom.server.AtomException
- On error retrieving feed file.AtomException
public java.util.List<Categories> getCategories(boolean inline)
inline
- True if Categories object should contain collection of in-line Categories
objects or false if it should set the Href for out-of-line categories.public java.util.List<Categories> getCategories()
getCategories
in class Collection
com.rometools.rome.propono.atom.common.Categories
objects.public Entry addEntry(Entry entry) throws java.lang.Exception
entry
- Entry to be added to collection. Entry will be saved to disk in a directory
under the collection's directory and the path will follow the pattern
[collection-plural]/[entryid]/entry.xml. The entry will be added to the
collection's feed in [collection-plural]/feed.xml.java.lang.Exception
- On error.public java.lang.String addMediaEntry(Entry entry, java.lang.String slug, java.io.InputStream is) throws java.lang.Exception
[collection-plural]/[entryid]/media/[entryid]
. An Atom entry will be
created to store metadata for the entry and it will exist at the path
[collection-plural]/[entryid]/entry.xml
. The entry will be added to the
collection's feed in [collection-plural]/feed.xml.entry
- Entry objectslug
- String to be used in file-nameis
- Source of media datajava.lang.Exception
- On Errorpublic Entry getEntry(java.lang.String fsid) throws java.lang.Exception
fsid
- Internal ID of entry to be returnedjava.lang.Exception
- On errorpublic AtomMediaResource getMediaResource(java.lang.String fileName) throws java.lang.Exception
java.lang.Exception
public void updateEntry(Entry entry, java.lang.String fsid) throws java.lang.Exception
entry
- Updated entry to be storedfsid
- Internal ID of entryjava.lang.Exception
- On errorpublic Entry updateMediaEntry(java.lang.String fileName, java.lang.String contentType, java.io.InputStream is) throws java.lang.Exception
fileName
- Internal ID of entry being updatedcontentType
- Content type of datais
- Source of updated datajava.lang.Exception
- On errorpublic void deleteEntry(java.lang.String fsid) throws java.lang.Exception
fsid
- Internal ID of entryjava.lang.Exception
- On errorprivate void updateFeedDocumentWithNewEntry(Feed f, Entry e) throws AtomException
AtomException
private void updateFeedDocumentRemovingEntry(Feed f, java.lang.String id) throws AtomException
AtomException
private void updateFeedDocumentWithExistingEntry(Feed f, Entry e) throws AtomException
AtomException
private void updateFeedDocument(Feed f) throws AtomException
AtomException
private java.io.InputStream createDefaultFeedDocument(java.lang.String uri) throws AtomException
AtomException
private Entry loadAtomResourceEntry(java.io.InputStream in, java.io.File file)
private void updateEntryAppLinks(Entry entry, java.lang.String fsid, boolean singleEntry)
private void updateMediaEntryAppLinks(Entry entry, java.lang.String fileName, boolean singleEntry)
private Entry loadAtomEntry(java.io.InputStream in)
private void updateTimestamps(Entry entry)
private void saveMediaFile(java.lang.String name, java.lang.String contentType, long size, java.io.InputStream is) throws AtomException
handle
- Weblog handle to save toname
- Name of file to savesize
- Size of file to be savedis
- Read file from input streamAtomException
private java.lang.String createFileName(java.lang.String title, java.lang.String contentType)
handle
- Weblog handletitle
- Title to be used as basis for file name (or null)contentType
- Content type of file (must not be null)
If a title is specified, the method will apply the same create-anchor logic we use
for weblog entries to create a file name based on the title.
If title is null, the base file name will be the weblog handle plus a YYYYMMDDHHSS
timestamp.
The extension will be formed by using the part of content type that comes after he
slash.
For example: weblog.handle = "daveblog" title = "Port Antonio" content-type =
"image/jpg" Would result in port_antonio.jpg
Another example: weblog.handle = "daveblog" title = null content-type =
"image/jpg" Might result in daveblog-200608201034.jpgprivate java.lang.String getEntryEditURI(java.lang.String fsid, boolean relative, boolean singleEntry)
private java.lang.String getEntryViewURI(java.lang.String fsid)
private java.lang.String getEntryMediaEditURI(java.lang.String fsid, boolean relative, boolean singleEntry)
private java.lang.String getEntryMediaViewURI(java.lang.String fsid)
private java.lang.String getCategoriesURI()
private java.lang.String getBaseDir()
private java.lang.String getFeedPath()
private java.lang.String getEntryDirPath(java.lang.String id)
private java.lang.String getEntryPath(java.lang.String id)
private java.lang.String getEntryMediaPath(java.lang.String id)
private static void checkExistence(java.lang.String path) throws AtomNotFoundException
AtomNotFoundException