|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.turbine.util.TurbineConfig
public class TurbineConfig
A class used for initialization of Turbine without a servlet container.
If you need to use Turbine outside of a servlet container, you can use this class for initialization of the Turbine servlet.
TurbineConfig config = new TurbineConfig(".", "conf/TurbineResources.properties");
All paths referenced in TurbineResources.properties and the path to the properties file itself (the second argument) will be resolved relative to the directory given as the first argument of the constructor, here - the directory where application was started. Don't worry about discarding the references to objects created above. They are not needed, once everything is initialized.
In order to initialize the Services Framework outside of the Turbine Servlet,
you need to call the init() method. By default, this will
initialize the Resource and Logging Services and any other services you
have defined in your TurbineResources.properties file.
| Field Summary | |
|---|---|
protected Map<String,Object> |
attributes
Servlet container (or emulator) attributes. |
static String |
CONFIGURATION_PATH_KEY
Servlet initialization parameter name for the path to TurbineConfiguration.xml file used by Turbine |
protected Map<String,String> |
initParams
Turbine servlet initialization parameters. |
static String |
PROPERTIES_PATH_DEFAULT
Default value of TurbineResources.properties file path ( /WEB-INF/conf/TurbineResources.properties). |
static String |
PROPERTIES_PATH_KEY
Servlet initialization parameter name for the path to Turbine.properties file used by Turbine |
protected File |
root
Filenames are looked up in this directory. |
| Constructor Summary | |
|---|---|
TurbineConfig(String path,
Map<String,Object> attributes,
Map<String,String> initParams)
Constructs a new TurbineConfig. |
|
TurbineConfig(String path,
Map<String,String> initParams)
|
|
TurbineConfig(String path,
String properties)
Constructs a TurbineConfig. |
|
| Method Summary | |
|---|---|
void |
dispose()
Shutdown the Turbine System, lifecycle style |
Object |
getAttribute(String s)
Returns the servlet container attribute with the given name, or null if there is no attribute by that name. |
Enumeration |
getAttributeNames()
Returns an Enumeration containing the attribute names available within this servlet context. |
javax.servlet.ServletContext |
getContext(String s)
Not implemented. |
String |
getContextPath()
Returns the context path. |
String |
getInitParameter(String name)
Retrieves an initialization parameter. |
Enumeration |
getInitParameterNames()
Retrieves an Enumeration of initialization parameter names. |
int |
getMajorVersion()
Not implemented. |
String |
getMimeType(String s)
Not implemented. |
int |
getMinorVersion()
Not implemented. |
javax.servlet.RequestDispatcher |
getNamedDispatcher(String s)
Not implemented. |
String |
getRealPath(String path)
Translates a path relative to the web application root into an absolute path. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(String s)
Not implemented. |
URL |
getResource(String s)
Returns a URL to the resource that is mapped to a specified path. |
InputStream |
getResourceAsStream(String s)
Returns the resource located at the named path as an InputStream object. |
Set |
getResourcePaths(String s)
Not implemented. |
String |
getServerInfo()
Not implemented. |
javax.servlet.Servlet |
getServlet(String s)
Deprecated. As of Java Servlet API 2.1, with no direct replacement. |
javax.servlet.ServletContext |
getServletContext()
Returns a reference to the object cast onto ServletContext type. |
String |
getServletContextName()
Returns the context name. |
String |
getServletName()
Returns the servlet name. |
Enumeration |
getServletNames()
Deprecated. As of Java Servlet API 2.1, with no replacement. |
Enumeration |
getServlets()
Deprecated. As of Java Servlet API 2.0, with no replacement. |
Turbine |
getTurbine()
Returns a reference to the Turbine servlet that was initialized. |
void |
init(RunData data)
Initialization requiring a HTTP GET request. |
void |
initialize()
Causes this class to initialize itself which in turn initializes all of the Turbine Services that need to be initialized. |
void |
log(Exception e,
String m)
Deprecated. use log(String,Throwable) instead |
void |
log(String m)
Logs a message. |
void |
log(String m,
Throwable t)
Logs an error message. |
void |
removeAttribute(String s)
Not implemented. |
void |
setAttribute(String s,
Object o)
Not implemented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONFIGURATION_PATH_KEY
public static final String PROPERTIES_PATH_KEY
public static final String PROPERTIES_PATH_DEFAULT
/WEB-INF/conf/TurbineResources.properties).
protected File root
protected Map<String,Object> attributes
protected Map<String,String> initParams
| Constructor Detail |
|---|
public TurbineConfig(String path,
Map<String,Object> attributes,
Map<String,String> initParams)
For the list of recognized init parameters, see
Turbine class.
path - The web application root (i.e. the path for file lookup).attributes - Servlet container (or emulator) attributes.initParams - initialization parameters.
public TurbineConfig(String path,
Map<String,String> initParams)
TurbineConfig(String path, Map attributes, Map initParams)
public TurbineConfig(String path,
String properties)
path - The web application root (i.e. the path for file lookup).properties - the relative path to TurbineResources.properties file| Method Detail |
|---|
public void initialize()
initialize in interface org.apache.avalon.framework.activity.Initializablepublic void init(RunData data)
GET request.
public void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposablepublic Turbine getTurbine()
public javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.ServletConfigpublic String getRealPath(String path)
getRealPath in interface javax.servlet.ServletContextpath - A path relative to the web application root.
null
if the translated path doesn't map to a file or directory.public String getInitParameter(String name)
getInitParameter in interface javax.servlet.ServletConfiggetInitParameter in interface javax.servlet.ServletContextname - the name of the parameter.
public Enumeration getInitParameterNames()
getInitParameterNames in interface javax.servlet.ServletConfiggetInitParameterNames in interface javax.servlet.ServletContextpublic String getServletName()
getServletName in interface javax.servlet.ServletConfigpublic String getServletContextName()
getServletContextName in interface javax.servlet.ServletContextpublic String getContextPath()
public URL getResource(String s)
throws MalformedURLException
getResource in interface javax.servlet.ServletContexts - the path to the resource
MalformedURLExceptionpublic InputStream getResourceAsStream(String s)
InputStream object.
getResourceAsStream in interface javax.servlet.ServletContexts - the path to the resource
@Deprecated
public void log(Exception e,
String m)
log in interface javax.servlet.ServletContexte - an Exception.m - a message.public void log(String m)
log in interface javax.servlet.ServletContextm - a message.
public void log(String m,
Throwable t)
log in interface javax.servlet.ServletContextt - a Throwable object.m - a message.public Object getAttribute(String s)
getAttribute in interface javax.servlet.ServletContextpublic Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletContextpublic javax.servlet.ServletContext getContext(String s)
UnsuportedOperationException
upon invocation
getContext in interface javax.servlet.ServletContextpublic int getMajorVersion()
UnsuportedOperationException
upon invocation
getMajorVersion in interface javax.servlet.ServletContextpublic String getMimeType(String s)
UnsuportedOperationException
upon invocation
getMimeType in interface javax.servlet.ServletContextpublic int getMinorVersion()
UnsuportedOperationException
upon invocation
getMinorVersion in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getNamedDispatcher(String s)
UnsuportedOperationException
upon invocation
getNamedDispatcher in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getRequestDispatcher(String s)
UnsuportedOperationException
upon invocation
getRequestDispatcher in interface javax.servlet.ServletContextpublic Set getResourcePaths(String s)
UnsuportedOperationException upon invocation
getResourcePaths in interface javax.servlet.ServletContextpublic String getServerInfo()
UnsuportedOperationException upon invocation
getServerInfo in interface javax.servlet.ServletContext@Deprecated public javax.servlet.Servlet getServlet(String s)
UnsuportedOperationException upon invocation
getServlet in interface javax.servlet.ServletContext@Deprecated public Enumeration getServletNames()
UnsuportedOperationException upon invocation
getServletNames in interface javax.servlet.ServletContext@Deprecated public Enumeration getServlets()
UnsuportedOperationException upon invocation
getServlets in interface javax.servlet.ServletContextpublic void removeAttribute(String s)
UnsuportedOperationException upon invocation
removeAttribute in interface javax.servlet.ServletContext
public void setAttribute(String s,
Object o)
UnsuportedOperationException upon invocation
setAttribute in interface javax.servlet.ServletContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||