com.endeca.infront.cartridge
Class ConfigInitializer

java.lang.Object
  extended by com.endeca.infront.cartridge.ConfigInitializer
All Implemented Interfaces:
ContentItemInitializer

public class ConfigInitializer
extends Object
implements ContentItemInitializer

Helper class for implementing CartridgeHandler.initialize(ContentItem).

See Also:
RequestParamMarshaller

Constructor Summary
ConfigInitializer()
           
 
Method Summary
protected static void addDefaults(ContentItem contentItem, ContentItem defaults)
          Helper method for adding defaults "below" the values present in a given ContentItem.
 ContentItem initialize(ContentItem instanceConfig)
          Subclasses can extend this method to add layers or re-order layers.
 void setDefaults(ContentItem defaults)
          Set the default configuration for a given CartridgeHandler.
 void setRequestParamMarshaller(RequestParamMarshaller marshaller)
          Set the RequestParamMarshaller that can create request-based configuration for a given CartridgeHandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigInitializer

public ConfigInitializer()
Method Detail

setDefaults

public void setDefaults(ContentItem defaults)
Set the default configuration for a given CartridgeHandler.

Parameters:
defaults - may be null

setRequestParamMarshaller

public void setRequestParamMarshaller(RequestParamMarshaller marshaller)
Set the RequestParamMarshaller that can create request-based configuration for a given CartridgeHandler.

Parameters:
marshaller - may be null

initialize

public ContentItem initialize(ContentItem instanceConfig)
Subclasses can extend this method to add layers or re-order layers. The default implementation layers configuration in the following order (lowest to highest precedence: default, instance, request state.

Specified by:
initialize in interface ContentItemInitializer
Parameters:
instanceConfig - cartridge instance configuration, typically from Experience Manager.
Returns:
either a new ContentItem instance, or the (possibly modified) input ContentItem

addDefaults

protected static void addDefaults(ContentItem contentItem,
                                  ContentItem defaults)
Helper method for adding defaults "below" the values present in a given ContentItem. This method will add values from the default ContentItem only for keys that are not already present.

Parameters:
contentItem - the ContentItem to mutate by the addition of defaults
defaults - the default ContentItem instance


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.