org.apache.lenya.cms.publication
Class PublicationUtil

java.lang.Object
  extended by org.apache.lenya.cms.publication.PublicationUtil

public class PublicationUtil
extends java.lang.Object

Publication utility.


Constructor Summary
PublicationUtil()
           
 
Method Summary
static Publication getPublication(org.apache.avalon.framework.service.ServiceManager manager, java.util.Map objectModel)
          Creates a new publication.
static Publication getPublication(org.apache.avalon.framework.service.ServiceManager manager, org.apache.cocoon.environment.Request request)
          Creates a new publication based on a request.
static Publication getPublicationFromUrl(org.apache.avalon.framework.service.ServiceManager manager, DocumentFactory factory, java.lang.String webappUrl)
          Creates a publication from a webapp URL and a servlet context directory.
static Publication[] getPublications(org.apache.avalon.framework.service.ServiceManager manager, DocumentFactory factory)
          Returns a list of all available publications.
static boolean isValidArea(java.lang.String area)
          Returns if a given string is a valid area name.
static boolean isValidPublicationID(java.lang.String id)
          Checks if a publication id is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicationUtil

public PublicationUtil()
Method Detail

getPublication

public static Publication getPublication(org.apache.avalon.framework.service.ServiceManager manager,
                                         java.util.Map objectModel)
                                  throws PublicationException
Creates a new publication. The publication ID is resolved from the request URI. The servlet context path is resolved from the context object.

Parameters:
manager - The service manager.
objectModel - The object model of the Cocoon component.
Returns:
a Publication
Throws:
PublicationException - if there was a problem creating the publication.

getPublication

public static Publication getPublication(org.apache.avalon.framework.service.ServiceManager manager,
                                         org.apache.cocoon.environment.Request request)
                                  throws PublicationException
Creates a new publication based on a request.

Parameters:
manager - The service manager.
request - A request.
Returns:
A publication.
Throws:
PublicationException - if there was a problem creating the publication.

getPublicationFromUrl

public static Publication getPublicationFromUrl(org.apache.avalon.framework.service.ServiceManager manager,
                                                DocumentFactory factory,
                                                java.lang.String webappUrl)
                                         throws PublicationException
Creates a publication from a webapp URL and a servlet context directory.

Parameters:
manager - The service manager.
factory - The factory.
webappUrl - The URL within the web application (without context prefix)
Returns:
A publication
Throws:
PublicationException - when something went wrong

getPublications

public static Publication[] getPublications(org.apache.avalon.framework.service.ServiceManager manager,
                                            DocumentFactory factory)
                                     throws PublicationException
Returns a list of all available publications.

Parameters:
manager - The service manager.
factory - The document factory.
Returns:
An array of publications.
Throws:
PublicationException - if an error occurs.

isValidPublicationID

public static boolean isValidPublicationID(java.lang.String id)
Checks if a publication id is valid.

Parameters:
id -
Returns:
true if the id contains only lowercase letters and/or numbers, and is not an empty string.

isValidArea

public static boolean isValidArea(java.lang.String area)
Returns if a given string is a valid area name.

Parameters:
area - The area string to test.
Returns:
A boolean value.


Copyright 1999-2006 Apache Software Foundation. All Rights Reserved.