|
|||||||||
Home >> All >> com >> RuntimeCollective >> content >> [ bean overview ] | PREV PACKAGE NEXT PACKAGE |
Package com.RuntimeCollective.content.bean
The Content module defines the Content contract for the Josephine framework, as well as a collection of basic types of Content (TextComponent, File, Image).
See:
Description
Interface Summary | |
Content | Interface to implement if you want an object to be considerable as a piece of content. |
DublinCore | An interface that allows access to Dublin Core v1-1 metadata stored in the implementing object. |
Class Summary | |
ComplexContent | A piece of content made up of one or more pieces of subcontent. |
Editor | Deprecated. This class shouldn't be used anymore - use the Permissions packages instead. |
File | The File class will hold the content of a file, either directly, or via a filename reference. |
ForwardLink | The ForwardLink class implements the Link abstract class, using a URL. |
Image | The Image class contains a reference to a File, and some metadata (for now a simple caption). |
Link | The Link abstract class describes a Link entity, obviously. |
SimpleContent | A basic implementation of Content, which you shouldn't instantiate as is, but subclass. |
TextComponent | This class is a basic Content holding a piece of text. |
URLLink | The URLLink class implements the Link abstract class, using a URL. |
Package com.RuntimeCollective.content.bean Description
The Content module defines the Content contract for the Josephine framework, as well as a collection of basic types of Content (TextComponent, File, Image). It also contains an extension of webapps.bean.User called Editor, which can have admin and/or editor permissions.
1. Using Content beans
The content.bean.Content interface states clearly what you can do with a Content bean. The most important aspects are:- You can getTitle() and getDescription() of the Content. What these Title and Description are (eg how they are stored, generated) depends completely on the type of Content.
- You can viewFormat(format) the Content. This will give you an Object, a view of the Content for the format specified. Again, the nature of the Object you will get, and the format supported, will depend on the type of Content.
- When writing a JSP, you can use the viewFormat tag to display a Content. This tag simply calls the viewFormat(format) method.
2. Existing types of Content
The basic types of Content necessary to build an application are already defined, namely:- content.bean.TextComponent - a Content made of a piece of text, and a title
- content.bean.File - a Content made of an uploaded file, saved to the FileSystem. content.servlet.FileServlet is used to serve Files.
- content.bean.Image - a Content made of an image (internally stored as a File content), and its caption
- content.bean.Link - a Content representing a link. This is an abstract class, and is implemented by content.bean.ForwardLink (for links based of a Struts Forward) and content.bean.URLLink (for links based on a URL). Creating new types of Links is easy, there are only 2 methods to implement. (note: you will find more Link types in the Sitemap module)
3. Creating a new type of Content
The content.bean.Content defines the contract an EntityBean has to satisfy in order to be considerable as a Content. As such, *any* EntityBean class can be made into a Content. But if you are creating a new type of Content from scratch, your best bet is to extend the abstract content.bean.SimpleContent, which already implements part of the Content functionality. Most of your job will consist in 1/ deciding what data to store, 2/ choosing which format to support, 3/ overriding getTitle() and getDescription() so that they return some meaningful data, and 4/ overriding viewFormat(format) so that it supports the format you need and returns suitable views of the Content.
|
|||||||||
Home >> All >> com >> RuntimeCollective >> content >> [ bean overview ] | PREV PACKAGE NEXT PACKAGE |