org.apache.lenya.cms.linking
Interface LinkResolver

All Known Implementing Classes:
LinkResolverImpl

public interface LinkResolver

Resolve a link from a document to another document using it's

All of these parameters are optional and default to the attributes of the document which contains the link.

Syntax (square brackets denote optional parts):

lenya-document:<uuid>[,lang=...][,area=...][,rev=...][,pub=...]

The fallback mode determines the behaviour if the target language is omitted and the target document doesn't exist in the language of the source document. The default fallback mode is MODE_DEFAULT_LANGUAGE.


Field Summary
static int MODE_DEFAULT_LANGUAGE
          Try to fall back to the default language.
static int MODE_FAIL
          Fail if the target document doesn't exist in the source language.
static java.lang.String ROLE
          The Avalon role.
static java.lang.String SCHEME
          The link URI scheme.
 
Method Summary
 int getFallbackMode()
           
 LinkTarget resolve(org.apache.lenya.cms.publication.DocumentFactory factory, java.lang.String linkUri)
          Resolve a link.
 LinkTarget resolve(org.apache.lenya.cms.publication.Document currentDocument, java.lang.String linkUri)
          Resolve a link.
 void setFallbackMode(int mode)
          Sets the fallback mode.
 

Field Detail

ROLE

static final java.lang.String ROLE
The Avalon role.


SCHEME

static final java.lang.String SCHEME
The link URI scheme.

See Also:
Constant Field Values

MODE_FAIL

static final int MODE_FAIL
Fail if the target document doesn't exist in the source language.

See Also:
Constant Field Values

MODE_DEFAULT_LANGUAGE

static final int MODE_DEFAULT_LANGUAGE
Try to fall back to the default language.

See Also:
Constant Field Values
Method Detail

setFallbackMode

void setFallbackMode(int mode)
Sets the fallback mode.

Parameters:
mode - one of MODE_FAIL and MODE_DEFAULT_LANGUAGE.

getFallbackMode

int getFallbackMode()
Returns:
the fallback mode.

resolve

LinkTarget resolve(org.apache.lenya.cms.publication.Document currentDocument,
                   java.lang.String linkUri)
                   throws java.net.MalformedURLException
Resolve a link.

Parameters:
currentDocument - The document which contains the link.
linkUri - The link URI.
Returns:
A link target.
Throws:
java.net.MalformedURLException - if the URI is invalid.

resolve

LinkTarget resolve(org.apache.lenya.cms.publication.DocumentFactory factory,
                   java.lang.String linkUri)
                   throws java.net.MalformedURLException
Resolve a link. The link URI has to contain the UUID, language, area and publication ID.

Parameters:
factory - The document factory to use.
linkUri - The link URI.
Returns:
A link target.
Throws:
java.net.MalformedURLException - if the URI is invalid.


Copyright © $ Apache Software Foundation. All Rights Reserved.