org.edg.data.util
Class AxisHelpers

java.lang.Object
  |
  +--org.edg.data.util.AxisHelpers

public final class AxisHelpers
extends java.lang.Object

Helper methods useful when dealing with Axis Faults and Exceptions.

Version:
$ Id:$
Author:
James Casey

Field Summary
static java.lang.String LOG4J_CONFIGFILE_PATH
          the name of the parameter whose value contains the path to the log4j config file
 
Method Summary
static void dumpFault(java.rmi.RemoteException e, java.io.PrintStream p)
          check if a RemoteException is an AxisFault.
static java.lang.Object getAttribute(java.lang.String attrName)
          Get an attribute from our current ServletContext It returns null if the attribute is not defined.
static org.apache.axis.server.AxisServer getAxisEngine()
          get the AxisServer in this servlet.
static java.lang.String getEndpointUrl()
          Get the endpoint URL this is running on.
static java.lang.String getInitParameter(java.lang.String paramName)
          Get an initialization parameter from the Servlet deployment descriptor.
static boolean isFault(java.rmi.RemoteException e, java.lang.String faultType)
          check we have a fault of a given type
static void setAttribute(java.lang.String attrName, java.lang.Object attr)
          An an Attribute to our current ServletContext.
static void setupLogging()
          Set up log4j logging, getting the name of the log file from an init-param.
static void setupLogging(javax.servlet.ServletContext context)
          Set up log4j logging, getting the name of the log file from an init-param.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CONFIGFILE_PATH

public static final java.lang.String LOG4J_CONFIGFILE_PATH
the name of the parameter whose value contains the path to the log4j config file

See Also:
Constant Field Values
Method Detail

dumpFault

public static void dumpFault(java.rmi.RemoteException e,
                             java.io.PrintStream p)
                      throws java.rmi.RemoteException
check if a RemoteException is an AxisFault. If so, dump out its details to a PrintStream.

Parameters:
e - the exception to check
p - the print stream to output to. This should not be null.
Throws:
java.rmi.RemoteException - if it is not an AxisFault

isFault

public static boolean isFault(java.rmi.RemoteException e,
                              java.lang.String faultType)
check we have a fault of a given type

Parameters:
e - the exception to check
faultType - the name of the fault we expect
Returns:
true if the exception is the mentioned fault type

getInitParameter

public static java.lang.String getInitParameter(java.lang.String paramName)
Get an initialization parameter from the Servlet deployment descriptor. This can come from the web.xml, or from the <Context> block in tomcat. It returns null if the parameter is not defined.

Parameters:
paramName - the name of the parameter
Returns:
it's value

getAttribute

public static java.lang.Object getAttribute(java.lang.String attrName)
Get an attribute from our current ServletContext It returns null if the attribute is not defined.

Parameters:
attrName - the name of the parameter
Returns:
it's value

setAttribute

public static void setAttribute(java.lang.String attrName,
                                java.lang.Object attr)
An an Attribute to our current ServletContext.

Parameters:
attrName - the name of the parameter
attr - the attribute to store

setupLogging

public static void setupLogging(javax.servlet.ServletContext context)
Set up log4j logging, getting the name of the log file from an init-param. To configure, you need to set a block inside the <Servlet> section of the web.xml;
 <Servlet>
   ...
   ...
   <init-param>
     <param-name>log4j.configFile.path</param-name>
     <param-value>/opt/edg/etc/@BUILD.WEBAPP@/log4j-server.properties</param-value>
     <description>The path the log4j configuration properties file.</description>
   </init-param>
 <Servlet>
 
It is usually possible to override the defualt value set in the web.xml, via some application server specific mechanism. In tomcat4, you do this as a <Parameter> in the <Context> block, and in Oracle 9ias, you do it via Oracle Enterprise Manager.

Parameters:
context - the ServletContext to get the configuration information from
See Also:
LOG4J_CONFIGFILE_PATH

setupLogging

public static void setupLogging()
Set up log4j logging, getting the name of the log file from an init-param. To configure, you need to set a block inside the <Servlet> section of the web.xml;
 <Servlet>
   ...
   ...
   <init-param>
     <param-name>log4j.configFile.path</param-name>
     <param-value>/opt/edg/etc/@BUILD.WEBAPP@/log4j-server.properties</param-value>
     <description>The path the log4j configuration properties file.</description>
   </init-param>
 <Servlet>
 
It is usually possible to override the defualt value set in the web.xml, via some application server specific mechanism. In tomcat4, you do this as a <Parameter> in the <Context> block, and in Oracle 9ias, you do it via Oracle Enterprise Manager.

See Also:
LOG4J_CONFIGFILE_PATH

getAxisEngine

public static org.apache.axis.server.AxisServer getAxisEngine()
get the AxisServer in this servlet. Returns null if the AxisServer is not yet created.

Returns:
The AxisServer object

getEndpointUrl

public static java.lang.String getEndpointUrl()
Get the endpoint URL this is running on. Deal with inserting correct hostname in case it is localhost

Returns:
the URL