org.apache.shale.remoting.impl
Class MappingImpl

java.lang.Object
  extended by org.apache.shale.remoting.impl.MappingImpl
All Implemented Interfaces:
Mapping

public class MappingImpl
extends Object
implements Mapping

Default implementation of Mapping. This implementation recognizes patterns similar to URL mappings in the Servlet Specification:

If a view identifier matches, the corresponding resource identifier is calculated by stripping the non-wildcard part of the view identifier (/foo or .foo for the examples above) and returning the remainder.


Constructor Summary
MappingImpl()
          Construct an unconfigured instance.
MappingImpl(Mechanism mechanism, String pattern, Processor processor)
          Construct a fully configured instance.
 
Method Summary
 boolean equals(Object object)
          Two Mappings are equal if they have the same pattern.
 Mappings getMappings()
          

Return the Mappings instance this Mapping instance is associated with.

 Mechanism getMechanism()
          

Return a description of the mechanism used to return the response from this processor.

 String getPattern()
          

Return the matching pattern for the view identifier for this request, used to determine if this is the appropriate Mapping for processing the current request or not.

 Processor getProcessor()
          

Return the Processor instance to be used to process requests where the view identifier matches our pattern.

 int hashCode()
          Return the hash code for this object.
 String mapResourceId(javax.faces.context.FacesContext context, String resourceId)
          

Map the specified resource identifier to a complete URL that may be used to request this resource from the server.

 String mapViewId(javax.faces.context.FacesContext context)
          

If the specified view identifier matches the pattern specified by this Mapping, return the corresponding resource identifier that should be passed on to our Processor.

 void setMappings(Mappings mappings)
          

Set the Mappings instance this Mapping instance is associated with.

 void setMechanism(Mechanism mechanism)
          

Set the mechanism used by this mapping.

 void setPattern(String pattern)
          

Set the matching pattern used by this mapping.

 void setProcessor(Processor processor)
          

Set the Processor instance used by this mapping.

 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingImpl

public MappingImpl()

Construct an unconfigured instance.


MappingImpl

public MappingImpl(Mechanism mechanism,
                   String pattern,
                   Processor processor)

Construct a fully configured instance.

Parameters:
mechanism - Mechanism used to produce response for this mapping
pattern - URL matching pattern for this mapping
processor - Processor instance for this mapping
Method Detail

getMappings

public Mappings getMappings()

Return the Mappings instance this Mapping instance is associated with.

Specified by:
getMappings in interface Mapping

setMappings

public void setMappings(Mappings mappings)

Set the Mappings instance this Mapping instance is associated with.

Specified by:
setMappings in interface Mapping
Parameters:
mappings - The new Mappings instance

getMechanism

public Mechanism getMechanism()

Return a description of the mechanism used to return the response from this processor. This value may be interpreted, for example, by a JavaServer Faces component that wishes to calculate an appropriate URL for a component specific resource that is packaged in a particular manner.

Specified by:
getMechanism in interface Mapping

setMechanism

public void setMechanism(Mechanism mechanism)

Set the mechanism used by this mapping.

Specified by:
setMechanism in interface Mapping
Parameters:
mechanism - The new mechanism

getPattern

public String getPattern()

Return the matching pattern for the view identifier for this request, used to determine if this is the appropriate Mapping for processing the current request or not.

Specified by:
getPattern in interface Mapping

setPattern

public void setPattern(String pattern)

Set the matching pattern used by this mapping.

Specified by:
setPattern in interface Mapping
Parameters:
pattern - The new pattern

getProcessor

public Processor getProcessor()

Return the Processor instance to be used to process requests where the view identifier matches our pattern.

Specified by:
getProcessor in interface Mapping

setProcessor

public void setProcessor(Processor processor)

Set the Processor instance used by this mapping.

Specified by:
setProcessor in interface Mapping
Parameters:
processor - The new Processor instance

mapResourceId

public String mapResourceId(javax.faces.context.FacesContext context,
                            String resourceId)

Map the specified resource identifier to a complete URL that may be used to request this resource from the server.

Specified by:
mapResourceId in interface Mapping
Parameters:
context - FacesContext for the current request
resourceId - Resource identifier to be mapped

mapViewId

public String mapViewId(javax.faces.context.FacesContext context)

If the specified view identifier matches the pattern specified by this Mapping, return the corresponding resource identifier that should be passed on to our Processor. If the specified view identifier does not match, return null instead.

Specified by:
mapViewId in interface Mapping
Parameters:
context - FacesContext for the current request

hashCode

public int hashCode()

Return the hash code for this object.

Overrides:
hashCode in class Object

equals

public boolean equals(Object object)

Two Mappings are equal if they have the same pattern.

Overrides:
equals in class Object
Parameters:
object - Object to which we are tested for equality


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.