com.uwyn.rife.engine
Class Site

java.lang.Object
  extended by com.uwyn.rife.engine.Site

public class Site
extends Object

A Site contains all the elements that will be used to handle web requests

Since:
1.0
Version:
$Revision: 3806 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Field Summary
static String DEFAULT_PARTICIPANT_NAME
           
 
Constructor Summary
protected Site()
           
 
Method Summary
 void addListener(SiteListener listener)
          Adds the specified listener to receive site-related events.
 void clearCaches()
          Clears the cached data
 boolean containsId(String id)
          Indicates whether an absolute element ID is present in the site.
 boolean containsUrl(String url)
          Indicates whether a certain URL has a mapping in this site.
 ElementToService findElementForRequest(String elementUrl)
          Looks for an element that corresponds to a particular request URL.
 void fireModified()
          Notifies the registered listeners that one of the site's resources has been detected as being modified.
static String getAbsoluteId(String id, ElementInfo reference)
          Transforms the provided element ID into an absolute element ID.
static String getCanonicalId(String id)
          Transforms the provided element ID into a canonical ID without any parent indicators.
 ContinuationManager getContinuationManager()
          Retrieves the continuation manager that is used by this site.
 Collection<String> getIds()
          Retrieves the collection of all the element IDs that are present in this site.
static Site getRepInstance()
          Retrieves the default object as a Site from the participant that was returned by getRepParticipant().
static Participant getRepParticipant()
          Retrieves the participant named "ParticipantSite" from the default repository.
 ResourceFinder getResourceFinder()
          Retrieves the resource finder that was used to populate this site.
 Map<UrlResource,Long> getResourceModificationTimes()
          Retrieves a map of all the resources that were used to construct the site and their last modification time.
 Collection<String> getUrls()
          Retrieves the collection of all the URLs that are present in this site.
static boolean hasRepInstance()
          Indicates whether the default repository has a participant named "ParticipantSite".
 void populateFromOther(Site otherSite)
          Populates this site instance from another site instance.
 void removeListener(SiteListener listener)
          Removes the site listener so that it no longer receives any events.
 void resetLastModificationCheck()
          Resets the last modification check so that the next request will always check for modifications.
 ElementInfo resolveId(String id)
          Retrieves the element information in this site that corresponds to provided absolute element ID.
 ElementInfo resolveId(String id, ElementInfo reference)
          Retrieves the element information in this site that corresponds to provided element ID.
 ElementInfo resolveUrl(String url, String pathinfo)
          Looks up the information of the element that is responsible for handling a certain URL and pathinfo.
 ElementInfo searchFallback(String url)
          Searches which element would be used as a fallback for a particilar URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PARTICIPANT_NAME

public static final String DEFAULT_PARTICIPANT_NAME
See Also:
Constant Field Values
Constructor Detail

Site

protected Site()
Method Detail

getResourceModificationTimes

public Map<UrlResource,Long> getResourceModificationTimes()
Retrieves a map of all the resources that were used to construct the site and their last modification time.

Returns:
the map of resources with their modification times; or

null if the site was totally built manually or if the SITE_AUTO_RELOAD configuration parameter was not set to true at the time of construction.

Since:
1.0

resetLastModificationCheck

public void resetLastModificationCheck()
Resets the last modification check so that the next request will always check for modifications.

Since:
1.5.1

clearCaches

public void clearCaches()
Clears the cached data

Since:
1.5.1

populateFromOther

public void populateFromOther(Site otherSite)
Populates this site instance from another site instance.

This method is typically used during the implementation of a SiteListener.modified(com.uwyn.rife.engine.Site) method. Doing this, will ensure that the active request as well as subsequent requests will be executed against the data of the other site instance.

Parameters:
otherSite - the other site that will be used to replace this site's data with
Since:
1.5

hasRepInstance

public static boolean hasRepInstance()
Indicates whether the default repository has a participant named "ParticipantSite".

Returns:
true if that participant was present; or

false otherwise

Since:
1.0
See Also:
Rep.getDefaultRepository(), Participant

getRepParticipant

public static Participant getRepParticipant()
Retrieves the participant named "ParticipantSite" from the default repository.

Returns:
the participant; or

null if no such participant was present

Since:
1.0
See Also:
Rep.getDefaultRepository(), Participant

getRepInstance

public static Site getRepInstance()
Retrieves the default object as a Site from the participant that was returned by getRepParticipant().

Returns:
the site instance; or

null if no "ParticipantSite" participant was present in the default repository

Since:
1.0
See Also:
getRepParticipant(), Participant.getObject()

getResourceFinder

public ResourceFinder getResourceFinder()
Retrieves the resource finder that was used to populate this site.

Returns:
this site's resource finder
Since:
1.4

getContinuationManager

public ContinuationManager getContinuationManager()
Retrieves the continuation manager that is used by this site.

Returns:
the site's contiuation manager
Since:
1.5

getIds

public Collection<String> getIds()
Retrieves the collection of all the element IDs that are present in this site.

Returns:
the collection of all the element IDs in this site
Since:
1.0

searchFallback

public ElementInfo searchFallback(String url)
                           throws EngineException
Searches which element would be used as a fallback for a particilar URL.

Parameters:
url - the URL for which a fallback should be found
Returns:
the fallback element; or

null if no fallback is available for that URL

Throws:
EngineException
Since:
1.0

containsUrl

public boolean containsUrl(String url)
Indicates whether a certain URL has a mapping in this site.

Parameters:
url - the URL that should be looked up
Returns:
true if the URL corresponds to and element; or

false otherwise

Since:
1.0

resolveUrl

public ElementInfo resolveUrl(String url,
                              String pathinfo)
                       throws EngineException
Looks up the information of the element that is responsible for handling a certain URL and pathinfo.

Parameters:
url - the URL that should be looked up
pathinfo - the pathinfo that should be taken into account
Returns:
the corresponding element information; or

null if the URL and pathinfo aren't registered in this site

Throws:
EngineException
Since:
1.4

findElementForRequest

public ElementToService findElementForRequest(String elementUrl)
Looks for an element that corresponds to a particular request URL.

This method will determine the best element match by stepping up the path segments. It will also look for fallback elements, cater for trailing slashes, and figure out the correct pathinfo.

Basically, this is the method that is used by the Gate to figure out which element to service when a request arrives.

Parameters:
elementUrl - the URL that will be used to search for the element
Returns:
an instance of ElementToService when an element match was found; or

null if no suitable element could be found.

Since:
1.6

getUrls

public Collection<String> getUrls()
Retrieves the collection of all the URLs that are present in this site.

Returns:
the collection of all the URLs in this site
Since:
1.0

containsId

public boolean containsId(String id)
Indicates whether an absolute element ID is present in the site.

Parameters:
id - the absolute element ID that should be looked up
Returns:
true if the element ID could be found; or

false otherwise

Since:
1.0

resolveId

public ElementInfo resolveId(String id)
                      throws EngineException
Retrieves the element information in this site that corresponds to provided absolute element ID.

Parameters:
id - the absolute element ID that should be looked up
Returns:
the corresponding element information; or

null if the absolute element ID couldn't be found

Throws:
EngineException
Since:
1.0

resolveId

public ElementInfo resolveId(String id,
                             ElementInfo reference)
                      throws EngineException
Retrieves the element information in this site that corresponds to provided element ID.

Parameters:
id - the element ID that should be looked up
reference - the element information that should be used as a reference to look up the element information from when a relative ID is provided
Returns:
the corresponding element information; or

null if the element ID couldn't be found

Throws:
EngineException
Since:
1.0

getAbsoluteId

public static String getAbsoluteId(String id,
                                   ElementInfo reference)
Transforms the provided element ID into an absolute element ID.

Parameters:
id - the element ID that should be transformed
reference - the element information that should be used as a reference to look up the element information from when a relative ID is provided
Returns:
the absolute element ID that corresponds to the provided element ID
Since:
1.0

getCanonicalId

public static String getCanonicalId(String id)
Transforms the provided element ID into a canonical ID without any parent indicators.

Parameters:
id - the element ID that should be transformed
Returns:
the canonical element ID that corresponds to the provided element ID
Since:
1.0

addListener

public void addListener(SiteListener listener)
Adds the specified listener to receive site-related events. If listener is null, no exception is thrown and no action is performed.

Parameters:
listener - The site listener that will be added.
Since:
1.5
See Also:
SiteListener, removeListener(SiteListener)

removeListener

public void removeListener(SiteListener listener)
Removes the site listener so that it no longer receives any events. This method performs no function, nor does it throw an exception if the listener specified by the argument was not previously added to this component or is null.

Parameters:
listener - The site listener that will be removed.
Since:
1.5
See Also:
SiteListener, addListener(SiteListener)

fireModified

public void fireModified()
Notifies the registered listeners that one of the site's resources has been detected as being modified.

Since:
1.5
See Also:
SiteListener


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.