org.apache.tapestry.record
Class ClientPropertyPersistenceStrategy

java.lang.Object
  extended by org.apache.tapestry.record.ClientPropertyPersistenceStrategy
All Implemented Interfaces:
PropertyPersistenceStrategy

public class ClientPropertyPersistenceStrategy
extends Object
implements PropertyPersistenceStrategy

Service tapestry.persist.ClientPropertyPersistenceStrategy. Encodes persistent page properties on the client as query parameters.

Uses the threaded model.

Since:
4.0
Author:
Howard M. Lewis Ship
See Also:
ILink

Field Summary
protected  Map _data
          Keyed on page name (String), values are PersistentPropertyData.
protected  PersistentPropertyDataEncoder _encoder
           
protected  WebRequest _request
           
protected  ClientPropertyPersistenceScope _scope
           
 
Constructor Summary
ClientPropertyPersistenceStrategy()
           
 
Method Summary
 void addParametersForPersistentProperties(ServiceEncoding encoding, boolean post)
          Invoked by a LinkFactory , the parameters may be modified (added to) to store information related to persistent properties.
 void discardStoredChanges(String pageName)
          Invoked to discard any stored changes for the specified page.
 ClientPropertyPersistenceScope getScope()
           
 Collection getStoredChanges(String pageName)
          Returns a collection of PropertyChanges.
 void initializeService()
          Initializer for this service, invoked every time a service instance is created.
 void setEncoder(PersistentPropertyDataEncoder encoder)
           
 void setRequest(WebRequest request)
           
 void setScope(ClientPropertyPersistenceScope scope)
           
 void store(String pageName, String idPath, String propertyName, Object newValue)
          Stores the new value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_data

protected final Map _data
Keyed on page name (String), values are PersistentPropertyData.


_encoder

protected PersistentPropertyDataEncoder _encoder

_request

protected WebRequest _request

_scope

protected ClientPropertyPersistenceScope _scope
Constructor Detail

ClientPropertyPersistenceStrategy

public ClientPropertyPersistenceStrategy()
Method Detail

initializeService

public void initializeService()
Initializer for this service, invoked every time a service instance is created. This initializer pulls out of the request and query parameters whose prefix is "client:" and expects them to be encoded PersistentPropertyData, which are stored internally. Because the service model is threaded, this information is specific to a single request, and will be discarded at the end of the request.


store

public void store(String pageName,
                  String idPath,
                  String propertyName,
                  Object newValue)
Description copied from interface: PropertyPersistenceStrategy
Stores the new value.

Specified by:
store in interface PropertyPersistenceStrategy
Parameters:
pageName - the name of the page containing the property
idPath - the path to the component with the property (may be null)
propertyName - the name of the property to be persisted
newValue - the new value (which may be null)

getStoredChanges

public Collection getStoredChanges(String pageName)
Description copied from interface: PropertyPersistenceStrategy
Returns a collection of PropertyChanges. These represent prior changes previously stored. The order is not significant. Must not return null. Does not have to reflect changes made during the current request (this method is typically invoked as part of rolling back a page to a prior state, before any further changes are possible).

Specified by:
getStoredChanges in interface PropertyPersistenceStrategy

discardStoredChanges

public void discardStoredChanges(String pageName)
Description copied from interface: PropertyPersistenceStrategy
Invoked to discard any stored changes for the specified page.

Specified by:
discardStoredChanges in interface PropertyPersistenceStrategy

addParametersForPersistentProperties

public void addParametersForPersistentProperties(ServiceEncoding encoding,
                                                 boolean post)
Description copied from interface: PropertyPersistenceStrategy
Invoked by a LinkFactory , the parameters may be modified (added to) to store information related to persistent properties. This method is forwarded to all PropertyPersistenceStrategys.

Specified by:
addParametersForPersistentProperties in interface PropertyPersistenceStrategy
Parameters:
encoding - Service encoding, which indentifies the URL and the query parameters from which the ILink will be created.
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
See Also:
PropertyPersistenceStrategySource

setRequest

public void setRequest(WebRequest request)

getScope

public ClientPropertyPersistenceScope getScope()

setScope

public void setScope(ClientPropertyPersistenceScope scope)

setEncoder

public void setEncoder(PersistentPropertyDataEncoder encoder)


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