net.contextfw.web.application.conf
Class WebConfiguration

java.lang.Object
  extended by net.contextfw.web.application.conf.WebConfiguration

public class WebConfiguration
extends Object

Configures the application during initialization


Constructor Summary
WebConfiguration()
           
 
Method Summary
<S> WebConfiguration
addAttributeJsonSerializer(Class<S> type, Class<? extends AttributeJsonSerializer<S>> serializer)
          Convinience method to add all serializer types at same time
<S> WebConfiguration
addAttributeSerializerClass(Class<S> cl, Class<? extends AttributeSerializer<S>> serializerClass)
           
<S> WebConfiguration
addJsonDeserializerClass(Class<S> cl, Class<? extends com.google.gson.JsonDeserializer<S>> serializerClass)
           
<S> WebConfiguration
addJsonSerializerClass(Class<S> cl, Class<? extends com.google.gson.JsonSerializer<S>> serializerClass)
           
 WebConfiguration addResourcePaths(String... resources)
          Add paths where to look for resources.
 WebConfiguration addXMLNamespace(String prefix, String path)
           
 WebConfiguration debugMode(boolean debugMode)
           
 Set<Map.Entry<Class<?>,Class<? extends AttributeSerializer<?>>>> getAttributeSerializerClasses()
           
 String getContextPath()
           
 long getErrorTime()
           
 Set<Map.Entry<Class<?>,Class<? extends com.google.gson.JsonDeserializer<?>>>> getJsonDeserializerClasses()
           
 Set<Map.Entry<Class<?>,Class<? extends com.google.gson.JsonSerializer<?>>>> getJsonSerializerClasses()
           
 Class<? extends LifecycleListener> getLifecycleListener()
           
 long getMaxInactivity()
           
 long getPollTime()
           
 Class<? extends PropertyProvider> getPropertyProvider()
           
 long getRemovalSchedulePeriod()
           
 List<String> getResourcePaths()
           
 String getResourcesPrefix()
           
 int getTransformerCount()
           
 List<String> getViewComponentRootPackages()
           
 Map<String,String> getXMLNamespaces()
           
 String getXmlParamName()
           
 boolean isDebugMode()
           
 boolean isLogXML()
           
 WebConfiguration setContextPath(String contextPath)
           
 void setErrorTime(long errorTime)
           
 WebConfiguration setLifecycleListener(Class<? extends LifecycleListener> lifecycleListener)
           
 void setLogXML(boolean logXML)
           
 void setMaxInactivity(long maxInactivity)
           
 void setPollTime(long pollTime)
           
 WebConfiguration setPropertyProvider(Class<? extends PropertyProvider> propertyProvider)
           
 void setRemovalSchedulePeriod(long removalSchedulePeriod)
           
 void setResourcesPrefix(String resourcesPrefix)
          Set's the prefix for public resources files.
 WebConfiguration setTransformerCount(int transformerCount)
          Sets the number of concurrent transformers Transformers are used to transform DOM-tree via XSL to XHTML.
 WebConfiguration setViewComponentRootPackages(String... packages)
           
 void setXmlParamName(String xmlParamName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebConfiguration

public WebConfiguration()
Method Detail

addXMLNamespace

public WebConfiguration addXMLNamespace(String prefix,
                                        String path)

getXMLNamespaces

public Map<String,String> getXMLNamespaces()

debugMode

public WebConfiguration debugMode(boolean debugMode)

setViewComponentRootPackages

public WebConfiguration setViewComponentRootPackages(String... packages)

addResourcePaths

public WebConfiguration addResourcePaths(String... resources)
Add paths where to look for resources.

Supported possibilities are

Parameters:
resources -
Returns:

getViewComponentRootPackages

public List<String> getViewComponentRootPackages()

getResourcePaths

public List<String> getResourcePaths()

isDebugMode

public boolean isDebugMode()

setXmlParamName

public void setXmlParamName(String xmlParamName)

getXmlParamName

public String getXmlParamName()

setLogXML

public void setLogXML(boolean logXML)

isLogXML

public boolean isLogXML()

setResourcesPrefix

public void setResourcesPrefix(String resourcesPrefix)
Set's the prefix for public resources files.

That is javascript and css-files

Parameters:
resourcesPrefix -

getResourcesPrefix

public String getResourcesPrefix()

setPollTime

public void setPollTime(long pollTime)

getPollTime

public long getPollTime()

setMaxInactivity

public void setMaxInactivity(long maxInactivity)

getMaxInactivity

public long getMaxInactivity()

setErrorTime

public void setErrorTime(long errorTime)

getErrorTime

public long getErrorTime()

getContextPath

public String getContextPath()

setContextPath

public WebConfiguration setContextPath(String contextPath)

setTransformerCount

public WebConfiguration setTransformerCount(int transformerCount)
Sets the number of concurrent transformers

Transformers are used to transform DOM-tree via XSL to XHTML.

This methods sets the number of that can be used concurrently. This requirement comes from the fact that transformers are not thread-safe.

By default the number of transformers is 1 and is usable in development. Hoverer for production the number should be increased, but there is a down side for large number of transformer, which is memory consumption. Templates must be loaded for every transformer and they cannot be shared.

Parameters:
transformerCount - The number of transformers. Minimum is 1.
Returns:
The configuration

getTransformerCount

public int getTransformerCount()

addAttributeJsonSerializer

public <S> WebConfiguration addAttributeJsonSerializer(Class<S> type,
                                                       Class<? extends AttributeJsonSerializer<S>> serializer)
Convinience method to add all serializer types at same time

Type Parameters:
S - Type type of source
Parameters:
type - The class of type
serializer - The class of serializer
Returns:

addAttributeSerializerClass

public <S> WebConfiguration addAttributeSerializerClass(Class<S> cl,
                                                        Class<? extends AttributeSerializer<S>> serializerClass)

addJsonSerializerClass

public <S> WebConfiguration addJsonSerializerClass(Class<S> cl,
                                                   Class<? extends com.google.gson.JsonSerializer<S>> serializerClass)

addJsonDeserializerClass

public <S> WebConfiguration addJsonDeserializerClass(Class<S> cl,
                                                     Class<? extends com.google.gson.JsonDeserializer<S>> serializerClass)

getJsonDeserializerClasses

public Set<Map.Entry<Class<?>,Class<? extends com.google.gson.JsonDeserializer<?>>>> getJsonDeserializerClasses()

getJsonSerializerClasses

public Set<Map.Entry<Class<?>,Class<? extends com.google.gson.JsonSerializer<?>>>> getJsonSerializerClasses()

getAttributeSerializerClasses

public Set<Map.Entry<Class<?>,Class<? extends AttributeSerializer<?>>>> getAttributeSerializerClasses()

setLifecycleListener

public WebConfiguration setLifecycleListener(Class<? extends LifecycleListener> lifecycleListener)

getLifecycleListener

public Class<? extends LifecycleListener> getLifecycleListener()

setRemovalSchedulePeriod

public void setRemovalSchedulePeriod(long removalSchedulePeriod)

getRemovalSchedulePeriod

public long getRemovalSchedulePeriod()

setPropertyProvider

public WebConfiguration setPropertyProvider(Class<? extends PropertyProvider> propertyProvider)

getPropertyProvider

public Class<? extends PropertyProvider> getPropertyProvider()


Copyright © 2011. All Rights Reserved.