public abstract class Framework extends Object
Components consist of Blocks which typically are pieces of JSP.
The framework uses an urlfilter FrameworkFilter that can be configured
in 'config/framework.xml'.| Modifier and Type | Field and Description |
|---|---|
static Parameter<String> |
BLOCK
The proposed parameter if the framework can be explicitely requested a block to render.
|
static Parameter<String> |
COMPONENT
The proposed parameter if the framework can be explicitely requested a (block of a certain) component to render.
|
static String |
COMPONENT_CLASS_KEY
CSS-class to be used on block.
|
static String |
COMPONENT_CURRENTUSER_KEY
The components' block rendering may want to know that the node associated with the current
user is.
|
static String |
COMPONENT_ID_KEY
CSS-id to be used on block.
|
static String |
COMPONENT_INCLUDEPATH_KEY
If a component's block implementation decides to support 'tree/leaf
including' it can use this framework-provided path for it.
|
(package private) static Framework |
framework
Reference to the Framework singleton.
|
static Parameter<Node> |
N
A framework must be able to provide a node to the rendered blocks.
|
static String |
NAMESPACE |
static String |
XSD |
| Constructor and Description |
|---|
Framework() |
| Modifier and Type | Method and Description |
|---|---|
abstract Parameters |
createParameters()
Return a Parameters object that needs to be passed on to the getUrl() call.
|
abstract Parameters |
createSettingValueParameters() |
static Framework |
getInstance()
Returns the framework.
|
abstract String |
getInternalUrl(String path,
Map<String,?> params,
Parameters frameworkParameters)
Generates an URL to a resource to be called and included by a renderer.
|
abstract String |
getName()
Return the name of the framework
|
abstract Parameter<?>[] |
getParameterDefinition() |
abstract String |
getProcessUrl(String path,
Map<String,?> parameters,
Parameters frameworkParameters,
boolean escapeAmps) |
abstract Block |
getRenderingBlock(Parameters frameworkParameters)
Returns the block, which is currently rendering, or
null |
abstract <C> C |
getSettingValue(Setting<C> setting,
Parameters parameters)
|
abstract String |
getUrl(String path,
Map<String,?> parameters,
Parameters frameworkParameters,
boolean escapeAmps)
Return a (possibly modified) URL for a given path.
|
abstract String |
getUserBuilder()
Return the builder name that is used to store users.
|
abstract Node |
getUserNode(Parameters frameworkParameters)
Return an MMBase Node for the user currently using the framework.
|
abstract void |
process(Processor processor,
Parameters blockParameters,
Parameters frameworkParameters)
Processes a block.
|
abstract void |
render(Renderer renderer,
Parameters blockParameters,
Parameters frameworkParameters,
Writer w,
WindowState state)
Render content (such as HTML or XML) using a Renderer obtained from a component's block.
|
abstract <C> C |
setSettingValue(Setting<C> setting,
Parameters parameters,
C value)
|
static Framework framework
public static final String XSD
public static final String NAMESPACE
public static final Parameter<String> COMPONENT
public static final Parameter<String> BLOCK
public static final String COMPONENT_ID_KEY
public static final String COMPONENT_CLASS_KEY
public static final String COMPONENT_INCLUDEPATH_KEY
public static final String COMPONENT_CURRENTUSER_KEY
public static Framework getInstance()
null.public abstract String getName()
public abstract Block getRenderingBlock(Parameters frameworkParameters)
nullpublic abstract Parameters createParameters()
Parameter.REQUEST and Parameter.RESPONSE. So it is
recommended that those parameters are supported by the framework.
The MMBase taglib component tag will e.g. auto-fill those parameters. Other parameters can be
added using 'mm:frameworkparameter'
A framework may create a different or expanded list of parameters, but is responsible for filling them properly.
If the framework does not use the MMBase taglib for rendering of components, it needs to provide it's own mechanism to
fill the above parameters with default values (such as through a servlet or portlet).public abstract void render(Renderer renderer, Parameters blockParameters, Parameters frameworkParameters, Writer w, WindowState state) throws FrameworkException
COMPONENT_CLASS_KEY.renderer - the Renderer used to produce the content. This parameter is obtained using Block.getRenderer(org.mmbase.framework.Renderer.Type)blockParameters - The parameters specific for the call of this renderer's blockframeworkParameters - The parameters that are required by the framework, such as the 'request' and 'cloud' objectsw - The writer where the code generated by the renderer is to be written (such as the jspWriter)state - the window state in which the content should be renderedFrameworkException - when the renderer failed to create content or could not write data to the writerpublic abstract void process(Processor processor, Parameters blockParameters, Parameters frameworkParameters) throws FrameworkException
processor - the Processor used to produce the content. This parameter is obtained using Block.getProcessor()blockParameters - The parameters specific for the call of this renderer's block.frameworkParameters - The parameters that are required by the framework, such as the 'request' and 'cloud' objects.FrameworkException - when the process failed to runpublic abstract Node getUserNode(Parameters frameworkParameters)
BasicFramework, so based on MMBase security only, and
using a Parameter.CLOUD as a framework parameter. It can be implemented differently,
if the framework chooses not to use MMBase security to distinguish between users.frameworkParameters - The parameters that are required by the framework, such as the 'request' and 'cloud' objects.public abstract String getUserBuilder()
UnsupportedOperationExceptionpublic abstract Parameters createSettingValueParameters()
public abstract <C> C getSettingValue(Setting<C> setting, Parameters parameters)
Setting (which is
always associated with a certain Component.
The framework can (and should) return the default values of the Setting if it does not know
what to do. It can also administrate overridden values, e.g. in its own configuration file.
Using the 'parameters' (created with createSettingValueParameters(), the Framework can also
implement context specific values for a setting. It can e.g. use a request object, and store
user specific value as cookies.public abstract <C> C setSettingValue(Setting<C> setting, Parameters parameters, C value) throws SecurityException
getSettingValue(org.mmbase.framework.Setting<C>, org.mmbase.util.functions.Parameters). Depending on the framework, the set value may not necessarily be persistent.SecurityException - If you are not allowed to change the setting.public abstract Parameter<?>[] getParameterDefinition()
public abstract String getUrl(String path, Map<String,?> parameters, Parameters frameworkParameters, boolean escapeAmps) throws FrameworkException
path - The path (generally a relative URL) to create an URL for.parameters - Parameters The parameters to be passed to the pageframeworkParameters - The parameters that are required by the frameworkescapeAmps - true if parameters should be added with an escaped & (&).
You should escape & when a URL is exposed (i.e. in HTML), but not if the url is
for some reason called directly.null.FrameworkException - thrown when something goes wrong in the Frameworkpublic abstract String getProcessUrl(String path, Map<String,?> parameters, Parameters frameworkParameters, boolean escapeAmps) throws FrameworkException
FrameworkExceptionpublic abstract String getInternalUrl(String path, Map<String,?> params, Parameters frameworkParameters) throws FrameworkException
JspRenderer,
who calls the resource using the RequestDispatcher.
This method allows for frameworks to do some filtering on URLs (such as pretty URLs).
You should generally not call this method unless you write a Renderer that depends on code or
data from external resources.path - The page (e.g. image/css) provided by the component to create an URL forparams - Extra parameters for that pathframeworkParameters - The parameters that are required by the framework, such as the
'request' and 'cloud' objectsnull if nothing framework specific could be
determined (this would make it possible to 'chain' frameworks).FrameworkException - thrown when something goes wrong in the FrameworkMMBase 1.9-SNAPSHOT - ${javadoctimestamp}