Skip navigation links


com.fatwire.cs.core.uri
Class AbstractAssembler.AssemblyContext

java.lang.Object
  extended by com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext

All Implemented Interfaces:
Definition
Enclosing class:
AbstractAssembler

protected static class AbstractAssembler.AssemblyContext
extends java.lang.Object
implements Definition

This class is a wrapper over the Definition object. It also provides a storage location for context parameters for use while assembling the definition into a URI. This object also implements the Definition interface.

The default implementation is simply a thin wrapper over the input Definition object. Overriding classes, however, will likely need to extend this class so that they can include context parameters for specific parameters that the assembler needs. For example, if the pagename parameter is extracted from the definition then altered or split for inclusion in the URI, it may be helpful to store the derived value in the context so that it can be subsequently retrieved in each of the main worker methods (AbstractAssembler.getScheme(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getAuthority(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getPath(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), AbstractAssembler.getQuery(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext), and AbstractAssembler.getFragment(com.fatwire.cs.core.uri.AbstractAssembler.AssemblyContext) without having to re-parse the definition each time. In addition, it may be helpful to simply override the methods that implement the Definition interface so that certain parameters can be intercepted and changed. For instance, to suppress rendermode in the url it might be helpful to override AbstractAssembler.AssemblyContext.getParameterNames(), to never include rendermode, and to override AbstractAssembler.AssemblyContext.getParameter(java.lang.String), and AbstractAssembler.AssemblyContext.getParameters(java.lang.String) so that when rendermode is passed, null is always returned. Similar techniques can be applied to other parameters as well.


Nested Class Summary

 

Nested classes/interfaces inherited from interface com.fatwire.cs.core.uri.Definition
Definition.AppType, Definition.ContainerType, Definition.SatelliteContext

 

Field Summary

 

Fields inherited from interface com.fatwire.cs.core.uri.Definition
LOG_NAME

 

Constructor Summary
protected AbstractAssembler.AssemblyContext(Definition def)
          Construct the simplest possible assembly context that wraps the input definition.

 

Method Summary
 Definition.AppType getAppType()
          Get the app type.
 java.util.Collection getAttrbuteNames()
          Returns the keys of all the attributes.
 java.lang.Object getAttribute(java.lang.String name)
          Return an attribute with the given key.
 java.lang.String getAuthority()
          Get the authority.
 Definition.ContainerType getContainerType()
          Get the container type.
 java.lang.Object getContextParameter(java.lang.Object key)
          Method to return arbitrary context parameters for use by overriding classes during the assembly operations.
 java.lang.String getFragment()
          Get the uri fragment.
protected  Definition getOriginalDefinition()
          Method to return the original input definition object.
 java.lang.String getParameter(java.lang.String name)
          Get the specified parameter.
 java.util.Collection getParameterNames()
          Get the specified parameter names.
 java.lang.String[] getParameters(java.lang.String name)
          Get the specified parameters.
 Definition.SatelliteContext getSatelliteContext()
          Get the satellite context.
 java.lang.String getScheme()
          Get the scheme.
 boolean sessionEncode()
          Get session encode switch

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

AbstractAssembler.AssemblyContext

protected AbstractAssembler.AssemblyContext(Definition def)
Construct the simplest possible assembly context that wraps the input definition.
Parameters:
def -

Method Detail

getScheme

public java.lang.String getScheme()
Get the scheme.
Specified by:
getScheme in interface Definition
Returns:
the scheme defined by the wrapped definition.
See Also:
URI.getScheme()

getAuthority

public java.lang.String getAuthority()
Get the authority.
Specified by:
getAuthority in interface Definition
Returns:
the authority defined by the wrapped definition.
See Also:
URI.getAuthority()

getContainerType

public Definition.ContainerType getContainerType()
Get the container type.
Specified by:
getContainerType in interface Definition
Returns:
the container type defined by the wrapped definition.
See Also:
ContainerType}

getAppType

public Definition.AppType getAppType()
Get the app type.
Specified by:
getAppType in interface Definition
Returns:
the app type defined by the wrapped definition.
See Also:
@link{AppType}

getParameter

public java.lang.String getParameter(java.lang.String name)
Get the specified parameter.
Specified by:
getParameter in interface Definition
Parameters:
name - parameter name
Returns:
the specified parameter as specified by the wrapped definition.

getParameters

public java.lang.String[] getParameters(java.lang.String name)
Get the specified parameters.
Specified by:
getParameters in interface Definition
Parameters:
name - parameter name
Returns:
the specified parameters as specified by the wrapped definition.

getParameterNames

public java.util.Collection getParameterNames()
Get the specified parameter names.
Specified by:
getParameterNames in interface Definition
Returns:
the specified parameter names as specified by the wrapped definition.

getFragment

public java.lang.String getFragment()
Get the uri fragment.
Specified by:
getFragment in interface Definition
Returns:
the uri fragment as specified by the wrapped definition.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: Definition
Return an attribute with the given key.
Specified by:
getAttribute in interface Definition
Parameters:
name - attribute key
Returns:
attribute value or null if not found

getAttrbuteNames

public java.util.Collection getAttrbuteNames()
Description copied from interface: Definition
Returns the keys of all the attributes.
Specified by:
getAttrbuteNames in interface Definition
Returns:
collection of attribute names

sessionEncode

public boolean sessionEncode()
Get session encode switch
Specified by:
sessionEncode in interface Definition
Returns:
the session encode switch as specified by the wrapped definition.

getSatelliteContext

public Definition.SatelliteContext getSatelliteContext()
Get the satellite context.
Specified by:
getSatelliteContext in interface Definition
Returns:
the satellite context defined by the wrapped definition.
See Also:
SatelliteContext}

getOriginalDefinition

protected final Definition getOriginalDefinition()
Method to return the original input definition object. This may be useful for overriding classes, but the method is never invoked by the AbstractAssembler class.
Returns:
input Definition

getContextParameter

public java.lang.Object getContextParameter(java.lang.Object key)
Method to return arbitrary context parameters for use by overriding classes during the assembly operations.

This default implementation returns null.

Parameters:
key -
Returns:
null

Skip navigation links


Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.