net.craftforge.essential.controller.managers
Class DocumentationManager

java.lang.Object
  extended by net.craftforge.essential.controller.managers.DocumentationManager

public class DocumentationManager
extends Object

Manages documentation of resources.

Since:
25.07.11
Author:
Christian Bick

Method Summary
protected  String defaultValuesAsString(String[] defaultValues)
          Converts a list of default values into a human readable string.
protected  List<WadlParam> filterNoneTemplateParams(List<WadlParam> params)
           
protected  List<WadlParam> filterTemplateParams(List<WadlParam> params)
          Filters all template parameters from a list of parameters.
protected  List<WadlParam> getClassParams(Class<?> resourceClass)
          Gets the list of resource parameters from a resource Java class
 WadlApplication getDocumentation(String path, Configuration config)
          Gets the documentation in WADL for a resource identified via the given path in context of the specified configuration.
static DocumentationManager getInstance(String packageName)
          Controls instantiation process to ensure that only one instance per package path is used.
protected  List<WadlParam> getMethodParams(Method resourceMethod)
          Gets the list of resource and request parameters from a resource Java method.
protected  List<WadlMethod> getMethods(List<Method> resourceMethods, Configuration configuration)
          Gets the list of all resource HTTP methods from a list of resource Java methods and a controller configuration.
protected  WadlParam getParam(String paramName, String defaultValue)
          Gets a request parameter from a parameter name and a parameter default value
protected  List<WadlRepresentation> getRepresentations(List<String> supportedMediaTypes)
          Gets a list of representations from a list of supported media types.
protected  WadlRequest getRequest(Method resourceMethod, Configuration configuration)
          Gets the request for a resource Java method and a controller configuration.
protected  List<WadlParam> getRequestParams(Method resourceMethod)
          Gets the list of request parameters for a resource Java method.
protected  List<WadlRepresentation> getRequestRepresentations(Method method, Configuration configuration)
          Gets a request representation from a Java method and a controller configuration.
protected  WadlResource getResource(String path, Configuration configuration)
          Gets a resource from a resource path and a controller configuration.
protected  List<WadlParam> getResourceParams(Class<?> resourceClass, Method resourceMethod)
          Gets the list of all resource parameters for a resource Java class and method.
protected  List<WadlRepresentation> getResponseRepresentations(Method method, Configuration configuration)
          Gets a response representation from a Java method and a controller configuration.
protected  List<WadlResponse> getResponses(Method resourceMethod, Configuration configuration)
          Gets a list of possible responses of a resource Java method and a controller configuration.
protected  List<WadlResource> getSubResources(String path)
          Gets the list of all sub-resources of a resource matching a resource path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static DocumentationManager getInstance(String packageName)
Controls instantiation process to ensure that only one instance per package path is used.

Parameters:
packageName - The package name
Returns:
The documentation manager responsible for the given package path

getDocumentation

public WadlApplication getDocumentation(String path,
                                        Configuration config)
Gets the documentation in WADL for a resource identified via the given path in context of the specified configuration.

Parameters:
path - The path
config - The configuration
Returns:
The documentation in WADL

getResource

protected WadlResource getResource(String path,
                                   Configuration configuration)

Gets a resource from a resource path and a controller configuration.

Includes:

Parameters:
path - The resource path
configuration - The controller configuration
Returns:
The resource

getSubResources

protected List<WadlResource> getSubResources(String path)

Gets the list of all sub-resources of a resource matching a resource path.

Parameters:
path - The resource path
Returns:
The list of all sub-resources

getMethods

protected List<WadlMethod> getMethods(List<Method> resourceMethods,
                                      Configuration configuration)

Gets the list of all resource HTTP methods from a list of resource Java methods and a controller configuration.

Parameters:
resourceMethods - The resource Java methods
configuration - The controller configuration
Returns:
The list of all resource HTTP methods

getResponses

protected List<WadlResponse> getResponses(Method resourceMethod,
                                          Configuration configuration)
Gets a list of possible responses of a resource Java method and a controller configuration.

Parameters:
resourceMethod - The resource Java method
configuration - The controller configuration
Returns:
The list of possible responses

getRequest

protected WadlRequest getRequest(Method resourceMethod,
                                 Configuration configuration)
Gets the request for a resource Java method and a controller configuration.

Parameters:
resourceMethod - The resource Java method
configuration - The controller configuration
Returns:
The request

filterNoneTemplateParams

protected List<WadlParam> filterNoneTemplateParams(List<WadlParam> params)

filterTemplateParams

protected List<WadlParam> filterTemplateParams(List<WadlParam> params)
Filters all template parameters from a list of parameters.

Parameters:
params - The list of parameters
Returns:
The list of template parameters

getResourceParams

protected List<WadlParam> getResourceParams(Class<?> resourceClass,
                                            Method resourceMethod)
Gets the list of all resource parameters for a resource Java class and method.

Parameters:
resourceClass - The resource class The resource Java class
resourceMethod - The resource method The resource Java method
Returns:
The list of all resource parameters

getRequestParams

protected List<WadlParam> getRequestParams(Method resourceMethod)
Gets the list of request parameters for a resource Java method.

Parameters:
resourceMethod - resource Java method
Returns:
The list of all request parameters

getMethodParams

protected List<WadlParam> getMethodParams(Method resourceMethod)
Gets the list of resource and request parameters from a resource Java method.

Parameters:
resourceMethod - The resource Java method
Returns:
The list of request parameters

getClassParams

protected List<WadlParam> getClassParams(Class<?> resourceClass)
Gets the list of resource parameters from a resource Java class

Parameters:
resourceClass - The resource Java class
Returns:
The list of request parameters

getParam

protected WadlParam getParam(String paramName,
                             String defaultValue)
Gets a request parameter from a parameter name and a parameter default value

Parameters:
paramName - The parameter name
defaultValue - The parameter default value
Returns:
The request parameter

getRequestRepresentations

protected List<WadlRepresentation> getRequestRepresentations(Method method,
                                                             Configuration configuration)
Gets a request representation from a Java method and a controller configuration.

Parameters:
method - The Java method
configuration - The controller configuration
Returns:
The request representation

getResponseRepresentations

protected List<WadlRepresentation> getResponseRepresentations(Method method,
                                                              Configuration configuration)
Gets a response representation from a Java method and a controller configuration.

Parameters:
method - The Java method
configuration - The controller configuration
Returns:
The response representation

getRepresentations

protected List<WadlRepresentation> getRepresentations(List<String> supportedMediaTypes)
Gets a list of representations from a list of supported media types.

Parameters:
supportedMediaTypes - The supported media types
Returns:
The list of representations

defaultValuesAsString

protected String defaultValuesAsString(String[] defaultValues)
Converts a list of default values into a human readable string.

Parameters:
defaultValues - The list of default values
Returns:
The human readable string


Copyright © 2011. All Rights Reserved.