org.apache.jetspeed.services.forward
Class JetspeedForwardService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.forward.JetspeedForwardService
All Implemented Interfaces:
ForwardService, org.apache.turbine.services.Initable, org.apache.turbine.services.Service

public class JetspeedForwardService
extends org.apache.turbine.services.TurbineBaseService
implements ForwardService

This is the implementation of the Jetspeed Forward services. The interface defines methods for forwarding navigation to other pages or panes in the portal. The Forward service provides an abstraction, by removing the hard-coding of portal resources in your actions. Instead, all forward targets are defined in a centralized configuration file. By using the forward service, you use logical forward names in your java code.

Version:
$Id: JetspeedForwardService.java,v 1.8 2005/01/17 23:35:30 morciuch Exp $
Author:
David Sean Taylor
See Also:
Profile

Field Summary
protected static java.lang.String CONFIG_DIRECTORY
           
protected static java.lang.String CONFIG_MAPPING
           
protected  java.lang.String directory
           
protected  org.apache.xml.serialize.OutputFormat format
          the output format for pretty printing when saving registries
protected  java.util.Map forwards
           
protected static java.lang.String KEY_DELIMITER
           
protected static JetspeedLogger logger
          Static initialization of the logger for this class
protected  org.exolab.castor.mapping.Mapping mapper
          the Castor mapping file name
protected  java.lang.String mapping
           
protected  java.util.Map portletForwards
           
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.forward.ForwardService
SERVICE_NAME
 
Constructor Summary
JetspeedForwardService()
           
 
Method Summary
protected  void dumpMap(java.lang.String mapName, java.util.Map map)
           
 org.apache.turbine.util.DynamicURI forward(org.apache.turbine.util.RunData rundata, java.lang.String forwardName)
          Forward to a specific forward by name.
 org.apache.turbine.util.DynamicURI forward(org.apache.turbine.util.RunData rundata, java.lang.String portlet, java.lang.String target)
          For the given portlet and given action, forward to the target defined in the forward configuration for the portlet + action.
 org.apache.turbine.util.DynamicURI forwardDynamic(org.apache.turbine.util.RunData rundata, java.lang.String forwardName, java.util.Map parameters)
          Forward to a specific forward by name.
 org.apache.turbine.util.DynamicURI forwardDynamic(org.apache.turbine.util.RunData rundata, java.lang.String portlet, java.lang.String target, java.util.Map parameters)
          For the given portlet and given action, forward to the target defined in the forward configuration for the portlet + action.
protected  org.apache.turbine.util.DynamicURI forwardInternal(org.apache.turbine.util.RunData rundata, java.lang.String forwardName, java.util.Map staticParams, java.util.Map dynamicParams)
          Internal implementation of Forward used by both forwards and portlet forwards.
 Forward getForward(java.lang.String forwardName)
          Lookup a single forward definition by forward name
 java.util.Collection getForwards()
          Get a collection of all forwards in the system.
 PortletForward getPortletForward(java.lang.String portlet, java.lang.String target)
          Lookup a single portlet forward definition by portlet name + target name
 java.util.Collection getPortletForwards()
          Get a collection of all portlet forwards in the system.
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
protected  void loadForwardConfiguration(java.io.File file)
          Load and unmarshal a Forward Configuration from a file.
protected  void loadForwards()
          Load all forward configuration files from forwards directory.
protected  java.lang.String makePortletForwardKey(java.lang.String portlet, java.lang.String target)
           
protected  void resyncParamMap(java.util.Map map)
           
protected  org.apache.turbine.util.DynamicURI setQueryParams(org.apache.turbine.util.DynamicURI duri, java.util.Map baseQueryParams, java.util.Map staticParams, java.util.Map dynamicParams)
          Adds query parameters to the final URI.
 void shutdown()
          This is the shutdown method called by the Turbine Service framework
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker
 

Field Detail

logger

protected static final JetspeedLogger logger
Static initialization of the logger for this class


CONFIG_MAPPING

protected static final java.lang.String CONFIG_MAPPING
See Also:
Constant Field Values

CONFIG_DIRECTORY

protected static final java.lang.String CONFIG_DIRECTORY
See Also:
Constant Field Values

mapping

protected java.lang.String mapping

directory

protected java.lang.String directory

mapper

protected org.exolab.castor.mapping.Mapping mapper
the Castor mapping file name


format

protected org.apache.xml.serialize.OutputFormat format
the output format for pretty printing when saving registries


forwards

protected java.util.Map forwards

portletForwards

protected java.util.Map portletForwards

KEY_DELIMITER

protected static final java.lang.String KEY_DELIMITER
See Also:
Constant Field Values
Constructor Detail

JetspeedForwardService

public JetspeedForwardService()
Method Detail

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException

shutdown

public void shutdown()
This is the shutdown method called by the Turbine Service framework

Specified by:
shutdown in interface org.apache.turbine.services.Initable

forward

public org.apache.turbine.util.DynamicURI forward(org.apache.turbine.util.RunData rundata,
                                                  java.lang.String forwardName)
Forward to a specific forward by name. All parameters are resolved statically (via the forward definition)

Specified by:
forward in interface ForwardService
Parameters:
rundata - The turbine rundata context for this request.
forwardName - Forward to this abstract forward name.
Returns:
DynamicURI the full link to the referenced page

forwardDynamic

public org.apache.turbine.util.DynamicURI forwardDynamic(org.apache.turbine.util.RunData rundata,
                                                         java.lang.String forwardName,
                                                         java.util.Map parameters)
Forward to a specific forward by name. Parameters are resolved both statically and dynamically, with the dynamic parameter overriding the static parameter definitions.

Specified by:
forwardDynamic in interface ForwardService
Parameters:
rundata - The turbine rundata context for this request.
forwardName - Forward to this abstract forward name.
parameters - The dynamic Validation Parameters used in creating validation forwards
Returns:
DynamicURI the full link to the referenced page

forwardInternal

protected org.apache.turbine.util.DynamicURI forwardInternal(org.apache.turbine.util.RunData rundata,
                                                             java.lang.String forwardName,
                                                             java.util.Map staticParams,
                                                             java.util.Map dynamicParams)
Internal implementation of Forward used by both forwards and portlet forwards.

Parameters:
rundata - The turbine rundata context for this request.
staticParams - Map of static query parameters from PortletForward overriding the static Forwards query parameters
dynamicParams - Map of dynamic query parameters overriding both static PortletForward parameters and static Forwards query parameters
Returns:
DynamicURI the full link to the referenced page

setQueryParams

protected org.apache.turbine.util.DynamicURI setQueryParams(org.apache.turbine.util.DynamicURI duri,
                                                            java.util.Map baseQueryParams,
                                                            java.util.Map staticParams,
                                                            java.util.Map dynamicParams)
Adds query parameters to the final URI. Parameters are merged from the base forwards definition, with the overlay parameters being overlaid over th base parameters

Parameters:
duri - The dynamic URI to have query parameters added to it
baseQueryParams - The base query parameters from the forward definition
staticParams - Map of static query parameters from PortletForward overriding the static Forwards query parameters
dynamicParams - Map of dynamic query parameters overriding both static PortletForward parameters and static Forwards query parameters
Returns:
DynamicURI The new URI including query parameters

dumpMap

protected void dumpMap(java.lang.String mapName,
                       java.util.Map map)

forward

public org.apache.turbine.util.DynamicURI forward(org.apache.turbine.util.RunData rundata,
                                                  java.lang.String portlet,
                                                  java.lang.String target)
For the given portlet and given action, forward to the target defined in the forward configuration for the portlet + action. All parameters are resolved statically (via the forward definition)

Specified by:
forward in interface ForwardService
Parameters:
portlet - The name of the portlet for which we are forwarding.
target - A logical target name. Portlets can have 1 or more targets.
Returns:
DynamicURI the full link to the referenced page

forwardDynamic

public org.apache.turbine.util.DynamicURI forwardDynamic(org.apache.turbine.util.RunData rundata,
                                                         java.lang.String portlet,
                                                         java.lang.String target,
                                                         java.util.Map parameters)
For the given portlet and given action, forward to the target defined in the forward configuration for the portlet + action. Parameters are resolved both statically and dynamically, with the dynamic parameter overriding the static parameter definitions.

Specified by:
forwardDynamic in interface ForwardService
Parameters:
portlet - The name of the portlet for which we are forwarding.
target - A logical target name. Portlets can have 1 or more targets.
parameters - The dynamic Validation Parameters used in creating validation forwards
Returns:
DynamicURI the full link to the referenced page

getForwards

public java.util.Collection getForwards()
Get a collection of all forwards in the system.

Specified by:
getForwards in interface ForwardService
Returns:
Collection of all forward definitions

getPortletForwards

public java.util.Collection getPortletForwards()
Get a collection of all portlet forwards in the system.

Specified by:
getPortletForwards in interface ForwardService
Returns:
Collection of all portlet forward definitions

getForward

public Forward getForward(java.lang.String forwardName)
Lookup a single forward definition by forward name

Specified by:
getForward in interface ForwardService
Parameters:
forwardName - The name of the Forward to find
Returns:
Forward The found forward definition or null if not found

getPortletForward

public PortletForward getPortletForward(java.lang.String portlet,
                                        java.lang.String target)
Lookup a single portlet forward definition by portlet name + target name

Specified by:
getPortletForward in interface ForwardService
Parameters:
portlet - The name of the portlet in the Portlet Forward to find
target - The name of the target in the Portlet Forward to find
Returns:
Forward The found portlet forward definition or null if not found

loadForwards

protected void loadForwards()
                     throws org.apache.turbine.services.InitializationException
Load all forward configuration files from forwards directory.

Throws:
org.apache.turbine.services.InitializationException

makePortletForwardKey

protected java.lang.String makePortletForwardKey(java.lang.String portlet,
                                                 java.lang.String target)

loadForwardConfiguration

protected void loadForwardConfiguration(java.io.File file)
Load and unmarshal a Forward Configuration from a file.

Parameters:
file - the absolute file path storing this fragment

resyncParamMap

protected void resyncParamMap(java.util.Map map)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.