com.xmlserv.main
Class BackendHandle

java.lang.Object
  |
  +--com.xmlserv.main.BackendHandle

public class BackendHandle
extends java.lang.Object

This class is used to represent the Backend entries in /WEB-INF/config.xml at runtime.
Note: The client attribute of the stylesheet element currently does not accept regular expressions.

Version:
$Id: BackendHandle.java,v 1.12 2002/11/27 20:05:59 muecke Exp $
Author:
Wolfram Saringer

Constructor Summary
BackendHandle()
          Create empty object with default SecurityManager.
BackendHandle(java.lang.String name)
          Create object with the given name and a default SecurityManager.
 
Method Summary
 void addParam(java.lang.String paramname, java.lang.String paramvalue)
           
 void addStylesheetByClient(java.lang.String client, java.lang.String stylesheet)
          Add stylesheet by client mapping.
 void addStylesheetByRoleGroup(java.lang.String rolegroup, java.lang.String stylesheet)
          Add stylesheet by rolegroup mapping.
 void addStylesheetByType(java.lang.String mimetype, java.lang.String stylesheet)
          Add stylesheet by mimetype mapping.
 void destroy()
          Destroy backend object by calling its destroy() method.
 void dump(java.io.PrintStream out)
          Write this BackendHandle to the given Stream in text format.
 boolean getBinary()
          Return binary output status.
 java.lang.String getClassname()
          Get the classname.
 java.lang.String getDefaultStylesheet()
          Return default stylesheet.
 XMLServBackend getInstance()
          Get an instance of this backend.
 java.lang.String getName()
          Get current name attribute value.
 boolean getPostprocess()
          Is Postprocessing by a ContentManager allowed?
 SecurityManager getSecurityManager()
          Return securitymanager for this backend.
 java.lang.String getStatus()
          Get a String representation of the current status of this Backend.
 java.lang.String getStylesheetByClient(java.lang.String client)
          Get a client specific stylesheet.
 java.lang.String getStylesheetByRoleGroup(java.lang.String rolegroup)
          Get stylesheet by rolegroup.
 java.lang.String getStylesheetByType(java.lang.String mimetype)
          Get stylesheet by MIME type.
 java.lang.String getUrl()
          Get current url attribute value.
 void setBinary(boolean binary)
          Use to indicate whether this returns binary data.
 void setClassname(java.lang.String classname)
          Set the classname attribute, validating the class by instantiating it.
 void setDefaultStylesheet(java.lang.String stylesheet)
          The default Stylesheet.
 void setName(java.lang.String name)
          Set name attribute.
 void setPostprocess(boolean postprocess)
          Set postprocessing option.
 void setSecurityManager(SecurityManager securitymanager)
          Set a securitymanager.
 void setUrl(java.lang.String url)
          Set the URL attribute, replacing a null value with an empty String.
 void validate()
          Ensure integrity by checking for valid settings of various attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackendHandle

public BackendHandle()
              throws XMLServException
Create empty object with default SecurityManager.

BackendHandle

public BackendHandle(java.lang.String name)
              throws XMLServException
Create object with the given name and a default SecurityManager.
Method Detail

destroy

public void destroy()
Destroy backend object by calling its destroy() method.

getStatus

public java.lang.String getStatus()
Get a String representation of the current status of this Backend.
Returns:
String describing Backend status.

setName

public void setName(java.lang.String name)
Set name attribute.
Parameters:
name - New value for name attribute.

getName

public java.lang.String getName()
Get current name attribute value.
Returns:
The current name.

setUrl

public void setUrl(java.lang.String url)
Set the URL attribute, replacing a null value with an empty String.
Parameters:
url - New value for URL attribute.

getUrl

public java.lang.String getUrl()
Get current url attribute value.

setClassname

public void setClassname(java.lang.String classname)
                  throws java.lang.InstantiationException,
                         java.lang.ClassNotFoundException,
                         java.lang.IllegalAccessException,
                         javax.servlet.ServletException
Set the classname attribute, validating the class by instantiating it.
Parameters:
classname - The fully qualified classname for this Backend or null to reset.
Throws:
java.lang.InstantiationException - The class could not be loaded.
java.lang.ClassNotFoundException - The class could not be loaded.
javax.servlet.ServletException - Class initialization failed.

getClassname

public java.lang.String getClassname()
Get the classname.
Returns:
classname or null if not set.

getInstance

public XMLServBackend getInstance()
Get an instance of this backend. This will always return the object instantiated when setClassname() was called (or null if not set).
Returns:
the instance of the Backend.

setDefaultStylesheet

public void setDefaultStylesheet(java.lang.String stylesheet)
The default Stylesheet.
Parameters:
stylesheet - The filename of the stylesheet or null (will be replaced by 'stylesheet.xsl')

getDefaultStylesheet

public java.lang.String getDefaultStylesheet()
Return default stylesheet.
Returns:
Default stylesheet (stylesheet.xsl if not set).

addStylesheetByClient

public void addStylesheetByClient(java.lang.String client,
                                  java.lang.String stylesheet)
Add stylesheet by client mapping.
Parameters:
client - The client identification string.
stylesheet - The filename of the stylesheet to use for this client.

getStylesheetByClient

public java.lang.String getStylesheetByClient(java.lang.String client)
Get a client specific stylesheet.
Returns:
Stylesheet for client or default stylesheet if no specific stylesheet is set.

addStylesheetByType

public void addStylesheetByType(java.lang.String mimetype,
                                java.lang.String stylesheet)
Add stylesheet by mimetype mapping.
Parameters:
mimetype - The MIME Type string.
stylesheet - The filename of the stylesheet.

addStylesheetByRoleGroup

public void addStylesheetByRoleGroup(java.lang.String rolegroup,
                                     java.lang.String stylesheet)
Add stylesheet by rolegroup mapping.
Parameters:
rolegroup - The MIME Type string.
stylesheet - The filename of the stylesheet.

getStylesheetByType

public java.lang.String getStylesheetByType(java.lang.String mimetype)
Get stylesheet by MIME type.
Returns:
Stylesheet for output format or default stylesheet if no specific stylesheet is set.

getStylesheetByRoleGroup

public java.lang.String getStylesheetByRoleGroup(java.lang.String rolegroup)
Get stylesheet by rolegroup.
Returns:
Stylesheet for output format or default stylesheet if no specific stylesheet is set.

setSecurityManager

public void setSecurityManager(SecurityManager securitymanager)
Set a securitymanager. Use one instance for all backends using the same SecurityManager implementation, as authorization information is currently not shared between instances of SecurityManager subclasses.
Parameters:
securitymanager - The SecurityManager instance to use.

getSecurityManager

public SecurityManager getSecurityManager()
Return securitymanager for this backend.
Returns:
The SecurityManager instance associated with this Backend.

setBinary

public void setBinary(boolean binary)
Use to indicate whether this returns binary data. That means that the process() method with an additional Parameter (HttpServletResponse) is called and no XSL Processing is done.

getBinary

public boolean getBinary()
Return binary output status.
Returns:
true if this Backend produces binary output, false otherwise.

getPostprocess

public boolean getPostprocess()
Is Postprocessing by a ContentManager allowed?

setPostprocess

public void setPostprocess(boolean postprocess)
Set postprocessing option.

addParam

public void addParam(java.lang.String paramname,
                     java.lang.String paramvalue)

validate

public void validate()
              throws XMLServException
Ensure integrity by checking for valid settings of various attributes. Should be called before adding this BackendHandle to the BackendRepository.
Throws:
XMLServException - if this object is not in a usable state.

dump

public void dump(java.io.PrintStream out)
Write this BackendHandle to the given Stream in text format.
Parameters:
out - The PrintStream to write output to.