org.inria.ns.reflex.modules.web
Class XApplication

java.lang.Object
  extended by org.inria.ns.reflex.xml.XComponent
      extended by org.inria.ns.reflex.modules.web.XApplication
All Implemented Interfaces:
NamedType, ChildItem, Renamable, Unwrappable, XOperable

public final class XApplication
extends XComponent
implements Unwrappable

A Web application (#web:x-application) is implemented in RefleX as a ServletContext ; XApplication wraps a ServletContext and exposes it as an XComponent.

Author:
Philippe Poulard
See Also:
ServletContext

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
XApplication(ServletContext context)
          Create an XComponent that wraps a ServletContext.
 
Method Summary
 EntryMap getAttributes()
           
 List getChildren()
           
 Object getParent()
          Return the parent of this child.
 String getPath()
          Get the path of this application.
 QName getQName()
           
 QName getTypeName()
          Return #web:x-application.
 XOperator getXOperator()
          Return the XOperator of this object.
 void rename(QName newName)
          Rename this object.
 void setAttributes(EntryMap attributes)
           
 void setPath(HttpServletRequest request)
          Set the path of this Web application.
 void setTypeName(QName typeName)
          Set the type of this component.
 Object unwrap()
          Return the context of the servlet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XApplication

public XApplication(ServletContext context)
Create an XComponent that wraps a ServletContext.

Parameters:
context - The servlet context to wrap.
See Also:
ServletContext
Method Detail

getTypeName

public QName getTypeName()
Return #web:x-application.

Specified by:
getTypeName in interface NamedType
Returns:
web:x-application

unwrap

public Object unwrap()
Return the context of the servlet. May be cast safely to ServletContext.

Specified by:
unwrap in interface Unwrappable
Returns:
The context of the servlet.
See Also:
Unwrappable.unwrap(), ServletContext

getPath

public String getPath()
Get the path of this application.

Returns:
The path of this application, can be null if not known.

setPath

public void setPath(HttpServletRequest request)
Set the path of this Web application.

Parameters:
request - The request from which the path will be extracted.

getXOperator

public XOperator getXOperator()
Return the XOperator of this object.

Specified by:
getXOperator in interface XOperable
Returns:
The XOperator of this object.
See Also:
XOperable.getXOperator()

setAttributes

public void setAttributes(EntryMap attributes)
See Also:
Configurable.setAttributes(java.util.Map)

getAttributes

public EntryMap getAttributes()
See Also:
Configurable.getAttributes()

getChildren

public List getChildren()

rename

public void rename(QName newName)
Description copied from interface: Renamable
Rename this object.

Specified by:
rename in interface Renamable
Parameters:
newName - The new name of the object.

getQName

public QName getQName()

setTypeName

public void setTypeName(QName typeName)
Set the type of this component.

Parameters:
typeName - The name of the type.
Throws:
IllegalStateException - When the type has been already set.

getParent

public Object getParent()
Description copied from interface: ChildItem
Return the parent of this child.

Specified by:
getParent in interface ChildItem
Returns:
Its parent, that may be null for an orphan.