org.apache.tapestry
Interface INamespace

All Superinterfaces:
ILocatable
All Known Implementing Classes:
Namespace

public interface INamespace
extends ILocatable

Organizes different libraries of Tapestry pages, components and services into "frameworks", used to disambiguate names.

Tapestry release 3.0 includes dynamic discovery of pages and components; an application or library may contain a page or component that won't be "known" until the name is resolved (because it involves searching for a particular named file).

Since:
2.2
Version:
$Id: INamespace.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship
See Also:
PageSpecificationResolver, ComponentSpecificationResolver

Field Summary
static String FRAMEWORK_NAMESPACE
          Reserved name of a the implicit Framework library.
static char SEPARATOR
          Character used to seperate the namespace prefix from the page name or component type.
 
Method Summary
 String constructQualifiedName(String pageName)
          Constructs a qualified name for the given simple page name by applying the correct prefix (if any).
 boolean containsComponentType(String type)
          Returns true if the namespace contains the indicated component type.
 boolean containsPage(String name)
          Returns true if this namespace contains the specified page name.
 List getChildIds()
          Returns a sorted, immutable list of the ids of the immediate children of this namespace.
 INamespace getChildNamespace(String id)
          Returns a namespace contained by this namespace.
 IComponentSpecification getComponentSpecification(String type)
          Returns the path for the named component (within the namespace).
 List getComponentTypes()
          Returns a sorted list of component types.
 String getExtendedId()
          Returns the extended id for this namespace, which is a dot-seperated sequence of ids.
 String getId()
          Returns an identifier for the namespace.
 String getNamespaceId()
          Returns a version of the extended id appropriate for error messages.
 List getPageNames()
          Returns a sorted list of page names.
 IComponentSpecification getPageSpecification(String name)
          Returns the page specification of the named page (defined within the namespace).
 INamespace getParentNamespace()
          Returns the parent namespace; the namespace which contains this namespace.
 String getServiceClassName(String name)
          Returns the class name of a service provided by the namespace.
 List getServiceNames()
          Returns the names of all services provided by the namespace, as a sorted, immutable list.
 ILibrarySpecification getSpecification()
          Returns the LibrarySpecification from which this namespace was created.
 IResourceLocation getSpecificationLocation()
          Returns the location of the resource from which the specification for this namespace was read.
 void installComponentSpecification(String type, IComponentSpecification specification)
          Used to specify additional components beyond those that came from the namespace's specification.
 void installPageSpecification(String pageName, IComponentSpecification specification)
          Used to specify additional pages beyond those that came from the namespace's specification.
 boolean isApplicationNamespace()
          Returns true if the namespace is the special application namespace (which has special search rules for handling undeclared pages and components).
 
Methods inherited from interface org.apache.tapestry.ILocatable
getLocation
 

Field Detail

FRAMEWORK_NAMESPACE

static final String FRAMEWORK_NAMESPACE
Reserved name of a the implicit Framework library.

See Also:
Constant Field Values

SEPARATOR

static final char SEPARATOR
Character used to seperate the namespace prefix from the page name or component type.

Since:
2.3
See Also:
Constant Field Values
Method Detail

getId

String getId()
Returns an identifier for the namespace. Identifiers are simple names (they start with a letter, and may contain letters, numbers, underscores and dashes). An identifier must be unique among a namespaces siblings.

The application namespace has a null id; the framework namespace has an id of "framework".


getExtendedId

String getExtendedId()
Returns the extended id for this namespace, which is a dot-seperated sequence of ids.


getNamespaceId

String getNamespaceId()
Returns a version of the extended id appropriate for error messages. This is the based on getExtendedId(), unless this is the application or framework namespace, in which case special strings are returned.

Since:
3.0

getParentNamespace

INamespace getParentNamespace()
Returns the parent namespace; the namespace which contains this namespace.

The application and framework namespaces return null as the parent.


getChildNamespace

INamespace getChildNamespace(String id)
Returns a namespace contained by this namespace.

Parameters:
id - either a simple name (of a directly contained namespace), or a dot-seperarated name sequence.
Returns:
the child namespace
Throws:
ApplicationRuntimeException - if no such namespace exist.

getChildIds

List getChildIds()
Returns a sorted, immutable list of the ids of the immediate children of this namespace. May return the empty list, but won't return null.


getPageSpecification

IComponentSpecification getPageSpecification(String name)
Returns the page specification of the named page (defined within the namespace).

Parameters:
name - the name of the page
Returns:
the specification
Throws:
ApplicationRuntimeException - if the page specification doesn't exist or can't be loaded

containsPage

boolean containsPage(String name)
Returns true if this namespace contains the specified page name.


getPageNames

List getPageNames()
Returns a sorted list of page names. May return an empty list, but won't return null. The return list is immutable.


getComponentSpecification

IComponentSpecification getComponentSpecification(String type)
Returns the path for the named component (within the namespace).

Parameters:
type - the component alias
Returns:
the specification path of the component
Throws:
ApplicationRuntimeException - if the specification doesn't exist or can't be loaded

containsComponentType

boolean containsComponentType(String type)
Returns true if the namespace contains the indicated component type.

Parameters:
type - a simple component type (no namespace prefix is allowed)

getComponentTypes

List getComponentTypes()
Returns a sorted list of component types. May return an empty list, but won't return null. The return list is immutable. Represents just the known component types (additional types may be discoverred dynamically).

Is this method even needed?

Since:
3.0

getServiceClassName

String getServiceClassName(String name)
Returns the class name of a service provided by the namespace.

Parameters:
name - the name of the service.
Returns:
the complete class name of the service, or null if the namespace does not contain the named service.

getServiceNames

List getServiceNames()
Returns the names of all services provided by the namespace, as a sorted, immutable list. May return the empty list, but won't return null.


getSpecification

ILibrarySpecification getSpecification()
Returns the LibrarySpecification from which this namespace was created.


constructQualifiedName

String constructQualifiedName(String pageName)
Constructs a qualified name for the given simple page name by applying the correct prefix (if any).

Since:
2.3

getSpecificationLocation

IResourceLocation getSpecificationLocation()
Returns the location of the resource from which the specification for this namespace was read.


isApplicationNamespace

boolean isApplicationNamespace()
Returns true if the namespace is the special application namespace (which has special search rules for handling undeclared pages and components).

Since:
3.0

installPageSpecification

void installPageSpecification(String pageName,
                              IComponentSpecification specification)
Used to specify additional pages beyond those that came from the namespace's specification. This is used when pages in the application namespace are dynamically discovered.

Since:
3.0

installComponentSpecification

void installComponentSpecification(String type,
                                   IComponentSpecification specification)
Used to specify additional components beyond those that came from the namespace's specification. This is used when components in the application namespace are dynamically discovered.

Since:
3.0