org.apache.tapestry.services.impl
Class LinkFactoryImpl

java.lang.Object
  extended by org.apache.tapestry.services.impl.LinkFactoryImpl
All Implemented Interfaces:
LinkFactory
Direct Known Subclasses:
PortletAssetLinkFactoryImpl, PortletLinkFactoryImpl

public class LinkFactoryImpl
extends Object
implements LinkFactory

Since:
4.0
Author:
Howard M. Lewis Ship

Field Summary
protected  URLCodec _codec
           
protected  PropertyPersistenceStrategySource _persistenceStrategySource
           
protected  WebRequest _request
           
protected  IRequestCycle _requestCycle
           
 
Constructor Summary
LinkFactoryImpl()
           
 
Method Summary
 ILink constructLink(IEngineService service, boolean post, Map parameters, boolean stateful)
          Constructs an ILink.
protected  ServiceEncoding createServiceEncoding(QueryParameterMap parameters)
          Creates a new service encoding, and allows the encoders to modify it before returning.
 Object[] extractListenerParameters(IRequestCycle cycle)
          A secondary function of the service is to convert encoded (aka "squeezed") listener parameters back into an array of Objects.
protected  void finalizeParameters(IEngineService service, Map parameters)
           
 ServiceEncoder[] getServiceEncoders()
          Returns an array of ServiceEncoder, ordering into execution order.
 void initializeService()
           
 void setContributions(List contributions)
           
 void setDataSqueezer(DataSqueezer dataSqueezer)
           
 void setErrorLog(org.apache.hivemind.ErrorLog errorLog)
           
 void setPersistenceStrategySource(PropertyPersistenceStrategySource persistenceStrategySource)
          This is kind of limiting; it's possible that other things beyond persistence strategies will want to have a hand at encoding data into URLs.
 void setRequest(WebRequest request)
           
 void setRequestCycle(IRequestCycle requestCycle)
           
 void setServletPath(String servletPath)
           
protected  void squeezeServiceParameters(Map parameters)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_codec

protected URLCodec _codec

_persistenceStrategySource

protected PropertyPersistenceStrategySource _persistenceStrategySource

_requestCycle

protected IRequestCycle _requestCycle

_request

protected WebRequest _request
Constructor Detail

LinkFactoryImpl

public LinkFactoryImpl()
Method Detail

initializeService

public void initializeService()

constructLink

public ILink constructLink(IEngineService service,
                           boolean post,
                           Map parameters,
                           boolean stateful)
Description copied from interface: LinkFactory
Constructs an ILink.

Specified by:
constructLink in interface LinkFactory
Parameters:
service - the service for which the link is being generated
post - if true, then the link will be used for a post (not a get, i.e., for a HTML form); this may affect what information is encoded into the link
parameters - A map; keys are strings and values are strings or string arrays (exception: key ServiceConstants.PARAMETER is an array of objects. Certain keys, defined in ServiceConstants may have special meaning. The map will typically be modified internally. May not be null.
stateful - If true, then the final URL should be encoded (with the session id) if necessary. If false, the session encoding should not occur. The latter case is useful for services that will absolutely not need any access to user-specific state.

finalizeParameters

protected void finalizeParameters(IEngineService service,
                                  Map parameters)

getServiceEncoders

public ServiceEncoder[] getServiceEncoders()
Description copied from interface: LinkFactory
Returns an array of ServiceEncoder, ordering into execution order. May return an empty array, but won't return null.

Specified by:
getServiceEncoders in interface LinkFactory

createServiceEncoding

protected ServiceEncoding createServiceEncoding(QueryParameterMap parameters)
Creates a new service encoding, and allows the encoders to modify it before returning.


squeezeServiceParameters

protected void squeezeServiceParameters(Map parameters)

extractListenerParameters

public Object[] extractListenerParameters(IRequestCycle cycle)
Description copied from interface: LinkFactory
A secondary function of the service is to convert encoded (aka "squeezed") listener parameters back into an array of Objects. This does (barely) makes sense .. the link factory is responsible for encoding the listener parameters, it should be responsible for decoding them.

Specified by:
extractListenerParameters in interface LinkFactory
Parameters:
cycle - the current request cycle
Returns:
an array of Object[]. May return an empty array, but won't return null.

setDataSqueezer

public void setDataSqueezer(DataSqueezer dataSqueezer)

setContributions

public void setContributions(List contributions)

setErrorLog

public void setErrorLog(org.apache.hivemind.ErrorLog errorLog)

setServletPath

public void setServletPath(String servletPath)

setRequest

public void setRequest(WebRequest request)

setPersistenceStrategySource

public void setPersistenceStrategySource(PropertyPersistenceStrategySource persistenceStrategySource)
This is kind of limiting; it's possible that other things beyond persistence strategies will want to have a hand at encoding data into URLs. If that comes to pass, we'll need to implement an event coordinator/listener combo to let implementations know about links being generated.

Parameters:
persistenceStrategySource - The persistent strategy to use.

setRequestCycle

public void setRequestCycle(IRequestCycle requestCycle)


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.