atg.rest.output
Class RestOutputCustomizerImpl

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.rest.output.RestOutputCustomizerImpl
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, RestOutputCustomizer, java.util.EventListener
Direct Known Subclasses:
JSONOutputCustomizer, XMLOutputCustomizer

public abstract class RestOutputCustomizerImpl
extends GenericService
implements RestOutputCustomizer

An abstract class which implements functionality common to output customizers.


Nested Class Summary
 class RestOutputCustomizerImpl.NucleusComponentReferenceObject
          class to store nucleus component reference values
 class RestOutputCustomizerImpl.RepositoryItemReferenceObject
          class to store repository item reference values
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected static java.lang.String REQUEST_SCOPE_PATH
           
protected static java.lang.String SESSION_SCOPE_PATH
           
protected static char SPACE
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
RestOutputCustomizerImpl()
          Constructor
 
Method Summary
 java.lang.Object checkAgainstNonExpandableList(java.lang.Object pValue)
          This method checks input value against nonExpandableList
 java.lang.Object createBeanOutput(ParsedURI pParsedURI, java.lang.Object pResContainer, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates an object which contains a representation of the data to be output
 java.lang.Object createBeanValueOutput(ParsedURI pParsedURI, java.lang.String pResourceName, java.lang.Object pValue, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Outputs a bean property value to the output stream in the appropriate format.
protected  ComponentConfiguration createComponentConfiguration(java.lang.String pComponentName, boolean pDefaultIncludes, JSONObject pObject)
          create a ComponentConfiguration object from a json object of the form: { "": [ {"item-descriptor": "", "depth": , "properties": { "": { "hidden": , "writable": , "target": "", "component": "", "property-customizer": "" }, ...
protected  void createOutputObject(ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates and returns a child element representing the data which will be written to the response's output stream.
protected  void createOutputObjectNoFiltering(ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates and returns a child element representing the data which will be written to the response's output stream.
protected  void createOutputObjectWithDefaultIncludes(ComponentConfiguration pComponentConfig, ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates and returns a child element representing the data which will be written to the response's output stream.
protected  void createOutputObjectWithoutDefaultIncludes(ComponentConfiguration pComponentConfig, ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates and returns a child element representing the data which will be written to the response's output stream.
protected  boolean enableShowRESTPaths()
          enable show rest paths
protected  JSONObject findComponentConfigJSON(JSONArray pArray, int pNestingDepth, java.lang.String pItemDescriptorName)
          find the json object for a component configuration from an array of component configurations
 java.lang.String getArrayElementString()
          The string to use for array element tags
protected  boolean getBooleanControlParam(java.lang.String pName, boolean pDefault)
          get a specified boolean control param value
 java.lang.String getCollectionElementString()
          The string to use for collection element tags
protected  ComponentConfiguration getComponentConfiguration(ParsedURI pParsedURI, java.lang.Object pResContainer, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the component configuration for the resource container
protected  ComponentConfiguration getComponentConfiguration(ParsedURI pParsedURI, java.lang.Object pResContainer, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the component configuration for the resource container
 ComponentResolver getComponentResolver()
           
 java.lang.String getContentType()
          Returns the content type that the output customizer will set on the response
 java.lang.String getEncoding()
          Returns the encoding to use for the XML output.
 FilteringManager getFilteringManager()
           
 java.lang.String getFormat()
          Returns a format for the output customizer, for example "json" or "xml"
protected  java.lang.String getHostAndPortString(DynamoHttpServletRequest pRequest)
          Returns the host and port string from the request
 int getIndentSize()
          Returns the indent size, which is the number of space characters used when indenting, default is 2.
 java.lang.String getMapElementString()
          The string to use for map element tags
 java.lang.String getMapKeyElementString()
          The string to use for map key tags
 java.lang.String getMapValueElementString()
          The string to use for map value tags
protected  java.lang.String getNucleusComponentPropertyReferenceString(BeanURI pBeanURI, java.lang.String pPropertyName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given nucleus component property
protected  java.lang.String getNucleusComponentPropertyReferenceString(GenericService pService, java.lang.String pPropertyName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given nucleus component property
protected  java.lang.String getNucleusComponentReferenceString(BeanURI pBeanURI, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given nucleus component
protected  java.lang.String getNucleusComponentReferenceString(GenericService pService, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given nucleus component
protected  java.lang.String getReferenceStringRoot(DynamoHttpServletRequest pRequest)
          Returns the base of a rest URL, example http://localhost:80/rest
protected  java.lang.String getRepositoryItemPropertyReferenceString(RepositoryItem pItem, java.lang.String pPropertyName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given repository item property
protected  java.lang.String getRepositoryItemReferenceString(RepositoryItem pItem, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns a REST URL string for the given repository item
 java.lang.String getRootElementString()
          Returns the string that the output customizer will use as its root
protected  java.lang.String getStringControlParam(java.lang.String pName)
          get a specified string control param value
 java.lang.String getTimeZoneId()
          Returns the Time Zone id to use for output dates.
 boolean isEnableFormatDateOutput()
          get EnableFormatDateOutput
 boolean isEnablePerRequestClassFilters()
          get EnablePerRequestClassFilters
 boolean isEnablePerRequestComponentFilters()
          get EnablePerRequestComponentFilters
 boolean isEnablePerRequestFilters()
          get EnablePerRequestFilters
 boolean isEnablePerRequestRepositoryFilters()
          get EnablePerRequestRepositoryFilters
 boolean isLoggingPropertyDebug()
           
protected  boolean isObjectANonGenericServiceNucleusComponent(java.lang.Object pContainer, BeanURI pURI)
          determine if the container object is a non-GenericService nucleus component
 boolean isShowRESTPaths()
          get ShowRESTPaths
protected  boolean loadNucleusComponentIntoMap(java.lang.String pComponentPath, java.lang.Object pComponent, BeanURI pURI)
          load a nucleus component into the uri's properties map
protected  boolean loadNucleusComponentIntoMap(java.lang.String pResourceName, java.lang.Object pValue, java.lang.Object pContainer, BeanURI pURI)
          load a nucleus component into the uri's properties map
 void outputBean(ParsedURI pParsedURI, java.lang.Object pResContainer, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method outputs all the properties of an object to the response's output stream
 void outputBeanProperty(ParsedURI pParsedURI, java.lang.Object pResContainer, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method outputs a single bean property to the response's output stream by passing it to the output customizer
 void outputBeanValue(ParsedURI pParsedURI, java.lang.String pResourceName, java.lang.Object pValue, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Outputs a bean property value to the output stream
protected  void outputFilteredProperty(PropertyConfiguration pPropertyConfig, ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method adds a single property and value to the output object.
protected  void outputNonFilteredProperty(java.lang.String pPropertyName, ParsedURI pParsedURI, java.lang.Object pResContainer, java.lang.Object pParent, int pNestingDepth, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method adds a single property and value to the output object.
protected  ComponentConfiguration searchComponentConfigs(java.lang.String pKey, int pDepth)
          get a component config using the key and depth
 void setArrayElementString(java.lang.String pArrayElementString)
          Sets the string to use for array element tags
 void setCollectionElementString(java.lang.String pCollectionElementString)
          Sets the string to use for collection element tags
 void setContentType(java.lang.String pContentType)
          Sets the content type that the output customizer will set on the response
 void setEnableFormatDateOutput(boolean pEnableFormatDateOutput)
          set EnableFormatDateOutput
 void setEnablePerRequestClassFilters(boolean pEnablePerRequestClassFilters)
          set EnablePerRequestClassFilters
 void setEnablePerRequestComponentFilters(boolean pEnablePerRequestComponentFilters)
          set EnablePerRequestComponentFilters
 void setEnablePerRequestFilters(boolean pEnablePerRequestFilters)
          set EnablePerRequestFilters
 void setEnablePerRequestRepositoryFilters(boolean pEnablePerRequestRepositoryFilters)
          set EnablePerRequestRepositoryFilters
 void setEncoding(java.lang.String pEncoding)
          Sets the encoding for the XML output
 void setFormat(java.lang.String pFormat)
          Sets a format for the output customizer, for example "json" or "xml"
 void setIndentSize(int pIndentSize)
          Sets the indent size, which is the number of space characters used when indenting
 void setLoggingPropertyDebug(boolean pLoggingPropertyDebug)
           
 void setMapElementString(java.lang.String pMapElementString)
          Sets the string to use for map element tags
 void setMapKeyElementString(java.lang.String pMapKeyElementString)
          Sets the string to use for map key tags
 void setMapValueElementString(java.lang.String pMapValueElementString)
          Sets the string to use for map value tags
 void setRootElementString(java.lang.String pRootElementString)
          Sets the string that the output customizer will use as its root
 void setShowRESTPaths(boolean pShowRESTPaths)
          set ShowRESTPaths
 void setTimeZoneId(java.lang.String pTimeZoneId)
          Sets the Time Zone for output date data
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.rest.output.RestOutputCustomizer
addValueToOutputObject, createOutputContainer, sendToOutputStream
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


SPACE

protected static final char SPACE
See Also:
Constant Field Values

REQUEST_SCOPE_PATH

protected static final java.lang.String REQUEST_SCOPE_PATH
See Also:
Constant Field Values

SESSION_SCOPE_PATH

protected static final java.lang.String SESSION_SCOPE_PATH
See Also:
Constant Field Values
Constructor Detail

RestOutputCustomizerImpl

public RestOutputCustomizerImpl()
Constructor

Method Detail

getFormat

public java.lang.String getFormat()
Returns a format for the output customizer, for example "json" or "xml"

Specified by:
getFormat in interface RestOutputCustomizer
Returns:
the value of format

setFormat

public void setFormat(java.lang.String pFormat)
Sets a format for the output customizer, for example "json" or "xml"

Parameters:
pFormat - the format to set

getIndentSize

public int getIndentSize()
Returns the indent size, which is the number of space characters used when indenting, default is 2.

Returns:
the indentSize

setIndentSize

public void setIndentSize(int pIndentSize)
Sets the indent size, which is the number of space characters used when indenting

Parameters:
pIndentSize - the indentSize to set

getEncoding

public java.lang.String getEncoding()
Returns the encoding to use for the XML output. Default is "UTF-8".

Returns:
the encoding

setEncoding

public void setEncoding(java.lang.String pEncoding)
Sets the encoding for the XML output

Parameters:
pEncoding - the encoding to set

getTimeZoneId

public java.lang.String getTimeZoneId()
Returns the Time Zone id to use for output dates. Default is "GMT".

Returns:
the Time Zone id

setTimeZoneId

public void setTimeZoneId(java.lang.String pTimeZoneId)
Sets the Time Zone for output date data

Parameters:
pTimeZoneId - the Time Zone id

getContentType

public java.lang.String getContentType()
Returns the content type that the output customizer will set on the response

Returns:
the content type that the output customizer will set on the response

setContentType

public void setContentType(java.lang.String pContentType)
Sets the content type that the output customizer will set on the response

Parameters:
pContentType - the contentType to set

getRootElementString

public java.lang.String getRootElementString()
Returns the string that the output customizer will use as its root

Returns:
the rootElementString

setRootElementString

public void setRootElementString(java.lang.String pRootElementString)
Sets the string that the output customizer will use as its root

Parameters:
pRootElementString - the rootElementString to set

getArrayElementString

public java.lang.String getArrayElementString()
The string to use for array element tags

Returns:
the arrayElementString

setArrayElementString

public void setArrayElementString(java.lang.String pArrayElementString)
Sets the string to use for array element tags

Parameters:
pArrayElementString - the arrayElementString to set

getCollectionElementString

public java.lang.String getCollectionElementString()
The string to use for collection element tags

Returns:
the collectionElementString

setCollectionElementString

public void setCollectionElementString(java.lang.String pCollectionElementString)
Sets the string to use for collection element tags

Parameters:
pCollectionElementString - the collectionElementString to set

getMapElementString

public java.lang.String getMapElementString()
The string to use for map element tags

Returns:
the mapElementString

setMapElementString

public void setMapElementString(java.lang.String pMapElementString)
Sets the string to use for map element tags

Parameters:
pMapElementString - the mapElementString to set

getMapKeyElementString

public java.lang.String getMapKeyElementString()
The string to use for map key tags

Returns:
the mapKeyElementString

setMapKeyElementString

public void setMapKeyElementString(java.lang.String pMapKeyElementString)
Sets the string to use for map key tags

Parameters:
pMapKeyElementString - the mapKeyElementString to set

getMapValueElementString

public java.lang.String getMapValueElementString()
The string to use for map value tags

Returns:
the mapValueElementString

setMapValueElementString

public void setMapValueElementString(java.lang.String pMapValueElementString)
Sets the string to use for map value tags

Parameters:
pMapValueElementString - the mapValueElementString to set

isLoggingPropertyDebug

public boolean isLoggingPropertyDebug()
Returns:
the value of loggingPropertyDebug

setLoggingPropertyDebug

public void setLoggingPropertyDebug(boolean pLoggingPropertyDebug)
Parameters:
pLoggingPropertyDebug - the loggingPropertyDebug to set

getComponentResolver

public ComponentResolver getComponentResolver()
Returns:
the value of componentResolver

getFilteringManager

public FilteringManager getFilteringManager()
Returns:
the value of filteringManager

setShowRESTPaths

public void setShowRESTPaths(boolean pShowRESTPaths)
set ShowRESTPaths

Parameters:
pShowRESTPaths - the ShowRESTPaths

isShowRESTPaths

public boolean isShowRESTPaths()
get ShowRESTPaths

Returns:
the ShowRESTPaths

setEnablePerRequestFilters

public void setEnablePerRequestFilters(boolean pEnablePerRequestFilters)
set EnablePerRequestFilters

Parameters:
pEnablePerRequestFilters - the EnablePerRequestFilters

isEnablePerRequestFilters

public boolean isEnablePerRequestFilters()
get EnablePerRequestFilters

Returns:
the EnablePerRequestFilters

setEnablePerRequestRepositoryFilters

public void setEnablePerRequestRepositoryFilters(boolean pEnablePerRequestRepositoryFilters)
set EnablePerRequestRepositoryFilters

Parameters:
pEnablePerRequestRepositoryFilters - the EnablePerRequestRepositoryFilters

isEnablePerRequestRepositoryFilters

public boolean isEnablePerRequestRepositoryFilters()
get EnablePerRequestRepositoryFilters

Returns:
the EnablePerRequestRepositoryFilters

setEnablePerRequestComponentFilters

public void setEnablePerRequestComponentFilters(boolean pEnablePerRequestComponentFilters)
set EnablePerRequestComponentFilters

Parameters:
pEnablePerRequestComponentFilters - the EnablePerRequestComponentFilters

isEnablePerRequestComponentFilters

public boolean isEnablePerRequestComponentFilters()
get EnablePerRequestComponentFilters

Returns:
the EnablePerRequestComponentFilters

setEnablePerRequestClassFilters

public void setEnablePerRequestClassFilters(boolean pEnablePerRequestClassFilters)
set EnablePerRequestClassFilters

Parameters:
pEnablePerRequestClassFilters - the EnablePerRequestClassFilters

isEnablePerRequestClassFilters

public boolean isEnablePerRequestClassFilters()
get EnablePerRequestClassFilters

Returns:
the EnablePerRequestClassFilters

setEnableFormatDateOutput

public void setEnableFormatDateOutput(boolean pEnableFormatDateOutput)
set EnableFormatDateOutput

Parameters:
pEnableFormatDateOutput - the EnableFormatDateOutput

isEnableFormatDateOutput

public boolean isEnableFormatDateOutput()
get EnableFormatDateOutput

Returns:
the EnableFormatDateOutput

checkAgainstNonExpandableList

public java.lang.Object checkAgainstNonExpandableList(java.lang.Object pValue)
This method checks input value against nonExpandableList

Parameters:
pValue -
Returns:
the same object or its string value if value class is present in nonExpandableList

createBeanOutput

public java.lang.Object createBeanOutput(ParsedURI pParsedURI,
                                         java.lang.Object pResContainer,
                                         int pNestingDepth,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws RestException,
                                         java.io.IOException
This method creates an object which contains a representation of the data to be output

Specified by:
createBeanOutput in interface RestOutputCustomizer
Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Returns:
an object representing the data to be output
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

createBeanValueOutput

public java.lang.Object createBeanValueOutput(ParsedURI pParsedURI,
                                              java.lang.String pResourceName,
                                              java.lang.Object pValue,
                                              int pNestingDepth,
                                              DynamoHttpServletRequest pRequest,
                                              DynamoHttpServletResponse pResponse)
                                       throws RestException,
                                              java.io.IOException
Outputs a bean property value to the output stream in the appropriate format.

Specified by:
createBeanValueOutput in interface RestOutputCustomizer
Parameters:
pParsedURI - an object containing the ParsedURI
pResourceName - the name of the resource being output
pValue - the value of the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Returns:
an object representing the data to be output
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs
See Also:
atg.rest.output.RestOutputCustomizer#outputBeanValue(java.lang.String, java.lang.Object, atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)

outputBean

public void outputBean(ParsedURI pParsedURI,
                       java.lang.Object pResContainer,
                       int pNestingDepth,
                       DynamoHttpServletRequest pRequest,
                       DynamoHttpServletResponse pResponse)
                throws RestException,
                       java.io.IOException
This method outputs all the properties of an object to the response's output stream

Specified by:
outputBean in interface RestOutputCustomizer
Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

outputBeanValue

public void outputBeanValue(ParsedURI pParsedURI,
                            java.lang.String pResourceName,
                            java.lang.Object pValue,
                            int pNestingDepth,
                            DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws RestException,
                            java.io.IOException
Outputs a bean property value to the output stream

Specified by:
outputBeanValue in interface RestOutputCustomizer
Parameters:
pParsedURI - an object containing the parsed URI
pResourceName - the name of the resource being output
pValue - the value of the resource
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs
See Also:
atg.rest.output.RestOutputCustomizer#outputBeanValue(java.lang.String, java.lang.Object, atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse)

outputBeanProperty

public void outputBeanProperty(ParsedURI pParsedURI,
                               java.lang.Object pResContainer,
                               DynamoHttpServletRequest pRequest,
                               DynamoHttpServletResponse pResponse)
                        throws java.io.IOException,
                               RestException
This method outputs a single bean property to the response's output stream by passing it to the output customizer

Specified by:
outputBeanProperty in interface RestOutputCustomizer
Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object containing the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an input or output stream exception occurs

getComponentConfiguration

protected ComponentConfiguration getComponentConfiguration(ParsedURI pParsedURI,
                                                           java.lang.Object pResContainer,
                                                           DynamoHttpServletRequest pRequest,
                                                           DynamoHttpServletResponse pResponse)
                                                    throws RestException
Returns the component configuration for the resource container

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pRequest - the servlet request
pResponse - the servlet response
Returns:
the ComponentConfiguration for the resource container
Throws:
RestException - if an error occurs processing the REST request

getComponentConfiguration

protected ComponentConfiguration getComponentConfiguration(ParsedURI pParsedURI,
                                                           java.lang.Object pResContainer,
                                                           int pNestingDepth,
                                                           DynamoHttpServletRequest pRequest,
                                                           DynamoHttpServletResponse pResponse)
                                                    throws RestException
Returns the component configuration for the resource container

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pNestingDepth - the current nesting depth
pRequest - the servlet request
pResponse - the servlet response
Returns:
the ComponentConfiguration for the resource container
Throws:
RestException - if an error occurs processing the REST request

searchComponentConfigs

protected ComponentConfiguration searchComponentConfigs(java.lang.String pKey,
                                                        int pDepth)
get a component config using the key and depth


findComponentConfigJSON

protected JSONObject findComponentConfigJSON(JSONArray pArray,
                                             int pNestingDepth,
                                             java.lang.String pItemDescriptorName)
                                      throws JSONException
find the json object for a component configuration from an array of component configurations

Parameters:
pArray - the json array of configurations
pNestingDepth - the current nesting depth
pItemDescriptorName - the item descriptor name
Returns:
the JSONObject with the component configuration info
Throws:
JSONException

createComponentConfiguration

protected ComponentConfiguration createComponentConfiguration(java.lang.String pComponentName,
                                                              boolean pDefaultIncludes,
                                                              JSONObject pObject)
                                                       throws JSONException,
                                                              RestInitializationException
create a ComponentConfiguration object from a json object of the form: { "": [ {"item-descriptor": "", "depth": , "properties": { "": { "hidden": , "writable": , "target": "", "component": "", "property-customizer": "" }, ... }, ... }, ... ], ... }

Parameters:
pComponentName - the component name
pDefaultIncludes - should we include everything by default
pObject - the json object
Returns:
the corresponding ComponentConfiguration
Throws:
JSONException - if there's an error parsing the json object
RestInitializationException

createOutputObject

protected void createOutputObject(ParsedURI pParsedURI,
                                  java.lang.Object pResContainer,
                                  java.lang.Object pParent,
                                  int pNestingDepth,
                                  DynamoHttpServletRequest pRequest,
                                  DynamoHttpServletResponse pResponse)
                           throws RestException,
                                  java.io.IOException
This method creates and returns a child element representing the data which will be written to the response's output stream.

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

createOutputObjectNoFiltering

protected void createOutputObjectNoFiltering(ParsedURI pParsedURI,
                                             java.lang.Object pResContainer,
                                             java.lang.Object pParent,
                                             int pNestingDepth,
                                             DynamoHttpServletRequest pRequest,
                                             DynamoHttpServletResponse pResponse)
                                      throws RestException,
                                             java.io.IOException
This method creates and returns a child element representing the data which will be written to the response's output stream. This method assumes no filtering of any properties is configured.

Parameters:
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

createOutputObjectWithDefaultIncludes

protected void createOutputObjectWithDefaultIncludes(ComponentConfiguration pComponentConfig,
                                                     ParsedURI pParsedURI,
                                                     java.lang.Object pResContainer,
                                                     java.lang.Object pParent,
                                                     int pNestingDepth,
                                                     DynamoHttpServletRequest pRequest,
                                                     DynamoHttpServletResponse pResponse)
                                              throws RestException,
                                                     java.io.IOException
This method creates and returns a child element representing the data which will be written to the response's output stream. This method assumes that there is filtering configured for this component and that it should include the properties that are not explicitly configured.

Parameters:
pComponentConfig - the ComponentConfiguration object for the resource in pResContainer
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

createOutputObjectWithoutDefaultIncludes

protected void createOutputObjectWithoutDefaultIncludes(ComponentConfiguration pComponentConfig,
                                                        ParsedURI pParsedURI,
                                                        java.lang.Object pResContainer,
                                                        java.lang.Object pParent,
                                                        int pNestingDepth,
                                                        DynamoHttpServletRequest pRequest,
                                                        DynamoHttpServletResponse pResponse)
                                                 throws RestException,
                                                        java.io.IOException
This method creates and returns a child element representing the data which will be written to the response's output stream. This method assumes that there is filtering configured for this component and that it should only include the properties that are explicitly configured.

Parameters:
pComponentConfig - the ComponentConfiguration object for the resource in pResContainer
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

outputNonFilteredProperty

protected void outputNonFilteredProperty(java.lang.String pPropertyName,
                                         ParsedURI pParsedURI,
                                         java.lang.Object pResContainer,
                                         java.lang.Object pParent,
                                         int pNestingDepth,
                                         DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws RestException,
                                         java.io.IOException
This method adds a single property and value to the output object. This method assumes that there is no filtering on the property.

Parameters:
pPropertyName - the name of the property
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

outputFilteredProperty

protected void outputFilteredProperty(PropertyConfiguration pPropertyConfig,
                                      ParsedURI pParsedURI,
                                      java.lang.Object pResContainer,
                                      java.lang.Object pParent,
                                      int pNestingDepth,
                                      DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws RestException,
                                      java.io.IOException
This method adds a single property and value to the output object. This method takes filtering configuration into account.

Parameters:
pPropertyConfig - the PropertyConfiguration object which contains the filtering information
pParsedURI - an object containing the parsed URI
pResContainer - the object container which is the resource
pParent - the parent object to write or construct the output data in
pNestingDepth - the current nesting depth from the resource
pRequest - the servlet request
pResponse - the servlet response
Throws:
RestException - if an error occurs processing the REST request
java.io.IOException - if an error occurs writing data to the output object

getReferenceStringRoot

protected java.lang.String getReferenceStringRoot(DynamoHttpServletRequest pRequest)
Returns the base of a rest URL, example http://localhost:80/rest

Parameters:
pRequest - the servlet request
Returns:
the root of a rest URL

getRepositoryItemReferenceString

protected java.lang.String getRepositoryItemReferenceString(RepositoryItem pItem,
                                                            DynamoHttpServletRequest pRequest,
                                                            DynamoHttpServletResponse pResponse)
                                                     throws RestException
Returns a REST URL string for the given repository item

Parameters:
pItem - the repository item to generate the reference URL string for
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

getNucleusComponentReferenceString

protected java.lang.String getNucleusComponentReferenceString(GenericService pService,
                                                              DynamoHttpServletRequest pRequest,
                                                              DynamoHttpServletResponse pResponse)
Returns a REST URL string for the given nucleus component

Parameters:
pService - the nucleus component to generate the reference URL string for
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

getNucleusComponentReferenceString

protected java.lang.String getNucleusComponentReferenceString(BeanURI pBeanURI,
                                                              DynamoHttpServletRequest pRequest,
                                                              DynamoHttpServletResponse pResponse)
Returns a REST URL string for the given nucleus component

Parameters:
pBeanURI - the bean uri for the component
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

getRepositoryItemPropertyReferenceString

protected java.lang.String getRepositoryItemPropertyReferenceString(RepositoryItem pItem,
                                                                    java.lang.String pPropertyName,
                                                                    DynamoHttpServletRequest pRequest,
                                                                    DynamoHttpServletResponse pResponse)
                                                             throws RestException
Returns a REST URL string for the given repository item property

Parameters:
pItem - the repository item which contains the property to generate the reference URL string for
pPropertyName - the property name to generate the reference URL string for
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

getNucleusComponentPropertyReferenceString

protected java.lang.String getNucleusComponentPropertyReferenceString(GenericService pService,
                                                                      java.lang.String pPropertyName,
                                                                      DynamoHttpServletRequest pRequest,
                                                                      DynamoHttpServletResponse pResponse)
Returns a REST URL string for the given nucleus component property

Parameters:
pService - the nucleus component which contains the property to generate the reference URL string for
pPropertyName - the property name to generate the reference URL string for
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

getNucleusComponentPropertyReferenceString

protected java.lang.String getNucleusComponentPropertyReferenceString(BeanURI pBeanURI,
                                                                      java.lang.String pPropertyName,
                                                                      DynamoHttpServletRequest pRequest,
                                                                      DynamoHttpServletResponse pResponse)
Returns a REST URL string for the given nucleus component property

Parameters:
pBeanURI - the bean uri for the component
pPropertyName - the property name to generate the reference URL string for
pRequest - the servlet request
pResponse - the servlet response
Returns:
the REST URL string
Throws:
RestException - if an exception occurs determining the item descriptor type

isObjectANonGenericServiceNucleusComponent

protected boolean isObjectANonGenericServiceNucleusComponent(java.lang.Object pContainer,
                                                             BeanURI pURI)
determine if the container object is a non-GenericService nucleus component

Parameters:
pContainer - the container object
pURI - the uri in which the property map is stored

loadNucleusComponentIntoMap

protected boolean loadNucleusComponentIntoMap(java.lang.String pResourceName,
                                              java.lang.Object pValue,
                                              java.lang.Object pContainer,
                                              BeanURI pURI)
load a nucleus component into the uri's properties map

Parameters:
pResourceName - the name of the property containing the object
pValue - the object
pContainer - the container object
pURI - the uri in which the property map is stored
Returns:
true if we were able to find a properties file for the pComponentPath and load it in the map, or if one already existed in the map

loadNucleusComponentIntoMap

protected boolean loadNucleusComponentIntoMap(java.lang.String pComponentPath,
                                              java.lang.Object pComponent,
                                              BeanURI pURI)
load a nucleus component into the uri's properties map

Parameters:
pComponentPath - the component path
pComponent - the nucleus component
Returns:
true if we were able to find a properties file for the pComponentPath and load it in the map, or if one already existed in the map

getHostAndPortString

protected java.lang.String getHostAndPortString(DynamoHttpServletRequest pRequest)
Returns the host and port string from the request

Parameters:
pRequest - the request object
Returns:
the host and port string from the request

enableShowRESTPaths

protected boolean enableShowRESTPaths()
enable show rest paths


getBooleanControlParam

protected boolean getBooleanControlParam(java.lang.String pName,
                                         boolean pDefault)
get a specified boolean control param value

Parameters:
pName - the name of the control param
pDefault - the default value for the control param
Returns:
the value of the control param

getStringControlParam

protected java.lang.String getStringControlParam(java.lang.String pName)
get a specified string control param value

Parameters:
pName - the name of the control param
Returns:
the value of the control param