org.apache.cocoon.portal.event.impl
Class DefaultEventConverter

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.portal.impl.AbstractComponent
          extended byorg.apache.cocoon.portal.event.impl.DefaultEventConverter
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, EventConverter, Initializable, LogEnabled, Serviceable, ThreadSafe

public class DefaultEventConverter
extends AbstractComponent
implements EventConverter, Configurable

This implementation stores the events that can't be converted to strings (which don't support the ConvertableEvent interface) in the current user session. Each event is then converted to a string just containing the index of the event in this list. This list is cleared when the session is closed. TODO - What happens if two event classes have the same hash?

Version:
$Id: DefaultEventConverter.java 327168 2005-10-21 12:56:35Z cziegeler $

Field Summary
protected static String EVENT_LIST
           
protected  Map factories
          All factories mapped by a key.
 
Fields inherited from class org.apache.cocoon.portal.impl.AbstractComponent
context, manager, portalService
 
Fields inherited from interface org.apache.cocoon.portal.event.EventConverter
ROLE
 
Constructor Summary
DefaultEventConverter()
           
 
Method Summary
 void configure(Configuration config)
           
 Event decode(String value)
          Decode an event.
 String encode(Event event)
          Encode an event.
 void finish()
          This notifies the converter that an event processing phase ends.
protected  Constructor getConstructor(String factory)
           
 void start()
          This notifies the converter that a new event processing phase starts.
 
Methods inherited from class org.apache.cocoon.portal.impl.AbstractComponent
contextualize, dispose, initialize, service
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_LIST

protected static final String EVENT_LIST

factories

protected Map factories
All factories mapped by a key. The key is either the hash if the class name or a configured mapping. If there is no configured mapping for an event class, the value is the constructor to construct the event. If there is a configured mapping, then this map contains two entries: The first entry has the hash of the class name as the key and the value is the configured mapping name. The second entry has the configured mapping name as the key and the Constructor as the value.

Constructor Detail

DefaultEventConverter

public DefaultEventConverter()
Method Detail

configure

public void configure(Configuration config)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

getConstructor

protected Constructor getConstructor(String factory)

encode

public String encode(Event event)
Description copied from interface: EventConverter
Encode an event. This is used to "activate" events using a link

Specified by:
encode in interface EventConverter
Parameters:
event - The event to encode
Returns:
A unique string representation for this event
See Also:
EventConverter.encode(org.apache.cocoon.portal.event.Event)

decode

public Event decode(String value)
Description copied from interface: EventConverter
Decode an event. This is used to "activate" events using a link

Specified by:
decode in interface EventConverter
Parameters:
value - The string representation created using EventConverter.encode(Event)
Returns:
The event or null
See Also:
EventConverter.decode(java.lang.String)

start

public void start()
Description copied from interface: EventConverter
This notifies the converter that a new event processing phase starts.

Specified by:
start in interface EventConverter
See Also:
EventConverter.start()

finish

public void finish()
Description copied from interface: EventConverter
This notifies the converter that an event processing phase ends.

Specified by:
finish in interface EventConverter
See Also:
EventConverter.finish()


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.