Java Doc for Embedded.java in  » Sevlet-Container » tomcat-catalina » org » apache » catalina » startup » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Sevlet Container » tomcat catalina » org.apache.catalina.startup 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.catalina.core.StandardService
      org.apache.catalina.startup.Embedded

All known Subclasses:   org.apache.catalina.startup.Catalina,
Embedded
public class Embedded extends StandardService implements Lifecycle(Code)
Convenience class to embed a Catalina servlet container environment inside another application. You must call the methods of this class in the following order to ensure correct operation.
  • Instantiate a new instance of this class.
  • Set the relevant properties of this object itself. In particular, you will want to establish the default Logger to be used, as well as the default Realm if you are using container-managed security.
  • Call createEngine() to create an Engine object, and then call its property setters as desired.
  • Call createHost() to create at least one virtual Host associated with the newly created Engine, and then call its property setters as desired. After you customize this Host, add it to the corresponding Engine with engine.addChild(host).
  • Call createContext() to create at least one Context associated with each newly created Host, and then call its property setters as desired. You SHOULD create a Context with a pathname equal to a zero-length string, which will be used to process all requests not mapped to some other Context. After you customize this Context, add it to the corresponding Host with host.addChild(context).
  • Call addEngine() to attach this Engine to the set of defined Engines for this object.
  • Call createConnector() to create at least one TCP/IP connector, and then call its property setters as desired.
  • Call addConnector() to attach this Connector to the set of defined Connectors for this object. The added Connector will use the most recently added Engine to process its received requests.
  • Repeat the above series of steps as often as required (although there will typically be only one Engine instance created).
  • Call start() to initiate normal operations of all the attached components.
After normal operations have begun, you can add and remove Connectors, Engines, Hosts, and Contexts on the fly. However, once you have removed a particular component, it must be thrown away -- you can create a new one with the same characteristics if you merely want to do a restart.

To initiate a normal shutdown, call the stop() method of this object.

IMPLEMENTATION NOTE: The main() method of this class is a simple example that exercizes the features of dynamically starting and stopping various components. You can execute this by executing the following steps (on a Unix platform):

 cd $CATALINA_HOME
 ./bin/catalina.sh embedded
 

author:
   Craig R. McClanahan
version:
   $Revision: 1.16 $ $Date: 2004/06/10 18:59:48 $


Field Summary
protected  booleanawait
     Use await.
protected  Engineengines
     The set of Engines that have been deployed in this server.
final protected static  Stringinfo
     Descriptive information about this server implementation.
protected  LifecycleSupportlifecycle
     The lifecycle event support for this component.
protected  Loggerlogger
     The default logger to be used by this component itself.
protected  Realmrealm
     The default realm to be used by all containers associated with this compoennt.
protected static  StringManagersm
     The string manager for this package.
protected  StringsocketFactory
     The socket factory that will be used when a secure Connector is created.
protected  booleanstarted
    
protected  booleanuseNaming
    

Constructor Summary
public  Embedded()
     Construct a new instance of this class with default properties.
public  Embedded(Logger logger, Realm realm)
     Construct a new instance of this class with specified properties.

Method Summary
public synchronized  voidaddConnector(Connector connector)
     Add a new Connector to the set of defined Connectors.
public synchronized  voidaddEngine(Engine engine)
     Add a new Engine to the set of defined Engines.
public  voidaddLifecycleListener(LifecycleListener listener)
     Add a lifecycle event listener to this component.
public  ConnectorcreateConnector(InetAddress address, int port, boolean secure)
     Create, configure, and return a new TCP/IP socket connector based on the specified properties.
public  ConnectorcreateConnector(String address, int port, boolean secure)
    
public  ConnectorcreateConnector(InetAddress address, int port, String protocol)
    
public  ConnectorcreateConnector(String address, int port, String protocol)
    
public  ContextcreateContext(String path, String docBase)
     Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.
public  EnginecreateEngine()
     Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.
public  HostcreateHost(String name, String appBase)
     Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.

After you have customized the properties, listeners, and Valves for this Host, you must attach it to the corresponding Engine by calling:

 engine.addChild(host);
 
which will also cause the Host to be started if the Engine has already been started.
public  LoadercreateLoader(ClassLoader parent)
     Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
public  LifecycleListener[]findLifecycleListeners()
     Get the lifecycle listeners associated with this lifecycle.
public  StringgetCatalinaBase()
    
public  StringgetCatalinaHome()
    
public  StringgetInfo()
     Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
public  LoggergetLogger()
     Return the Logger for this component.
public  RealmgetRealm()
     Return the default Realm for our Containers.
public  StringgetSocketFactory()
     Return the secure socket factory class name.
protected  voidinitDirs()
    
protected  voidinitNaming()
     Initialize naming - this should only enable java:env and root naming. If tomcat is embeded in an application that already defines those - it shouldn't do it. XXX The 2 should be separated, you may want to enable java: but not the initial context and the reverse XXX Can we "guess" - i.e.
public  booleanisAwait()
    
public  booleanisUseNaming()
     Return true if naming is enabled.
public synchronized  voidremoveContext(Context context)
     Remove the specified Context from the set of defined Contexts for its associated Host.
public synchronized  voidremoveEngine(Engine engine)
     Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts.
public synchronized  voidremoveHost(Host host)
     Remove the specified Host, along with all of its related Contexts, from the set of defined Hosts for its associated Engine.
public  voidremoveLifecycleListener(LifecycleListener listener)
     Remove a lifecycle event listener from this component.
public  voidsetAwait(boolean b)
    
public  voidsetCatalinaBase(String s)
    
public  voidsetCatalinaHome(String s)
    
public  voidsetLogger(Logger logger)
     Set the Logger for this component.
public  voidsetRealm(Realm realm)
     Set the default Realm for our Containers.
protected  voidsetSecurityProtection()
     Set the security package access/protection.
public  voidsetSocketFactory(String socketFactory)
     Set the secure socket factory class name.
public  voidsetUseNaming(boolean useNaming)
     Enables or disables naming support.
public  voidstart()
     Prepare for the beginning of active use of the public methods of this component.
public  voidstop()
     Gracefully terminate the active use of the public methods of this component.

Field Detail
await
protected boolean await(Code)
Use await.



engines
protected Engine engines(Code)
The set of Engines that have been deployed in this server. Normally there will only be one.



info
final protected static String info(Code)
Descriptive information about this server implementation.



lifecycle
protected LifecycleSupport lifecycle(Code)
The lifecycle event support for this component.



logger
protected Logger logger(Code)
The default logger to be used by this component itself. Unless this is overridden, log messages will be writted to standard output.



realm
protected Realm realm(Code)
The default realm to be used by all containers associated with this compoennt.



sm
protected static StringManager sm(Code)
The string manager for this package.



socketFactory
protected String socketFactory(Code)
The socket factory that will be used when a secure Connector is created. If a standard Connector is created, the internal (to the Connector class default socket factory class) will be used instead.



started
protected boolean started(Code)
Has this component been started yet?



useNaming
protected boolean useNaming(Code)
Is naming enabled ?




Constructor Detail
Embedded
public Embedded()(Code)
Construct a new instance of this class with default properties.



Embedded
public Embedded(Logger logger, Realm realm)(Code)
Construct a new instance of this class with specified properties.
Parameters:
  logger - Logger implementation to be inherited by all components(unless overridden further down the container hierarchy)
Parameters:
  realm - Realm implementation to be inherited by all components(unless overridden further down the container hierarchy)




Method Detail
addConnector
public synchronized void addConnector(Connector connector)(Code)
Add a new Connector to the set of defined Connectors. The newly added Connector will be associated with the most recently added Engine.
Parameters:
  connector - The connector to be added
exception:
  IllegalStateException - if no engines have been added yet



addEngine
public synchronized void addEngine(Engine engine)(Code)
Add a new Engine to the set of defined Engines.
Parameters:
  engine - The engine to be added



addLifecycleListener
public void addLifecycleListener(LifecycleListener listener)(Code)
Add a lifecycle event listener to this component.
Parameters:
  listener - The listener to add



createConnector
public Connector createConnector(InetAddress address, int port, boolean secure)(Code)
Create, configure, and return a new TCP/IP socket connector based on the specified properties.
Parameters:
  address - InetAddress to bind to, or null if theconnector is supposed to bind to all addresses on this server
Parameters:
  port - Port number to listen to
Parameters:
  secure - true if the generated connector is supposed to beSSL-enabled, and false otherwise



createConnector
public Connector createConnector(String address, int port, boolean secure)(Code)



createConnector
public Connector createConnector(InetAddress address, int port, String protocol)(Code)



createConnector
public Connector createConnector(String address, int port, String protocol)(Code)



createContext
public Context createContext(String path, String docBase)(Code)
Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.

After you have customized the properties, listeners, and Valves for this Context, you must attach it to the corresponding Host by calling:

 host.addChild(context);
 
which will also cause the Context to be started if the Host has already been started.
Parameters:
  path - Context path of this application ("" for the defaultapplication for this host, must start with a slash otherwise)
Parameters:
  docBase - Absolute pathname to the document base directoryfor this web application
exception:
  IllegalArgumentException - if an invalid parameteris specified



createEngine
public Engine createEngine()(Code)
Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.



createHost
public Host createHost(String name, String appBase)(Code)
Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.

After you have customized the properties, listeners, and Valves for this Host, you must attach it to the corresponding Engine by calling:

 engine.addChild(host);
 
which will also cause the Host to be started if the Engine has already been started. If this is the default (or only) Host you will be defining, you may also tell the Engine to pass all requests not assigned to another virtual host to this one:
 engine.setDefaultHost(host.getName());
 

Parameters:
  name - Canonical name of this virtual host
Parameters:
  appBase - Absolute pathname to the application base directoryfor this virtual host
exception:
  IllegalArgumentException - if an invalid parameteris specified



createLoader
public Loader createLoader(ClassLoader parent)(Code)
Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
Parameters:
  parent - ClassLoader that will be the parent of the onecreated by this Loader



findLifecycleListeners
public LifecycleListener[] findLifecycleListeners()(Code)
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.



getCatalinaBase
public String getCatalinaBase()(Code)



getCatalinaHome
public String getCatalinaHome()(Code)



getInfo
public String getInfo()(Code)
Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.



getLogger
public Logger getLogger()(Code)
Return the Logger for this component.



getRealm
public Realm getRealm()(Code)
Return the default Realm for our Containers.



getSocketFactory
public String getSocketFactory()(Code)
Return the secure socket factory class name.



initDirs
protected void initDirs()(Code)



initNaming
protected void initNaming()(Code)
Initialize naming - this should only enable java:env and root naming. If tomcat is embeded in an application that already defines those - it shouldn't do it. XXX The 2 should be separated, you may want to enable java: but not the initial context and the reverse XXX Can we "guess" - i.e. lookup java: and if something is returned assume false ? XXX We have a major problem with the current setting for java: url



isAwait
public boolean isAwait()(Code)



isUseNaming
public boolean isUseNaming()(Code)
Return true if naming is enabled.



removeContext
public synchronized void removeContext(Context context)(Code)
Remove the specified Context from the set of defined Contexts for its associated Host. If this is the last Context for this Host, the Host will also be removed.
Parameters:
  context - The Context to be removed



removeEngine
public synchronized void removeEngine(Engine engine)(Code)
Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts. All associated Connectors are also removed.
Parameters:
  engine - The Engine to be removed



removeHost
public synchronized void removeHost(Host host)(Code)
Remove the specified Host, along with all of its related Contexts, from the set of defined Hosts for its associated Engine. If this is the last Host for this Engine, the Engine will also be removed.
Parameters:
  host - The Host to be removed



removeLifecycleListener
public void removeLifecycleListener(LifecycleListener listener)(Code)
Remove a lifecycle event listener from this component.
Parameters:
  listener - The listener to remove



setAwait
public void setAwait(boolean b)(Code)



setCatalinaBase
public void setCatalinaBase(String s)(Code)



setCatalinaHome
public void setCatalinaHome(String s)(Code)



setLogger
public void setLogger(Logger logger)(Code)
Set the Logger for this component.
Parameters:
  logger - The new logger



setRealm
public void setRealm(Realm realm)(Code)
Set the default Realm for our Containers.
Parameters:
  realm - The new default realm



setSecurityProtection
protected void setSecurityProtection()(Code)
Set the security package access/protection.



setSocketFactory
public void setSocketFactory(String socketFactory)(Code)
Set the secure socket factory class name.
Parameters:
  socketFactory - The new secure socket factory class name



setUseNaming
public void setUseNaming(boolean useNaming)(Code)
Enables or disables naming support.
Parameters:
  useNaming - The new use naming value



start
public void start() throws LifecycleException(Code)
Prepare for the beginning of active use of the public methods of this component. This method should be called after configure(), and before any of the public methods of the component are utilized.
exception:
  LifecycleException - if this component detects a fatal errorthat prevents this component from being used



stop
public void stop() throws LifecycleException(Code)
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component.
exception:
  LifecycleException - if this component detects a fatal errorthat needs to be reported



Fields inherited from org.apache.catalina.core.StandardService
protected Connector connectors(Code)(Java Doc)
protected Container container(Code)(Java Doc)
protected ObjectName controller(Code)(Java Doc)
protected int debug(Code)(Java Doc)
protected String domain(Code)(Java Doc)
protected boolean initialized(Code)(Java Doc)
protected MBeanServer mserver(Code)(Java Doc)
protected ObjectName oname(Code)(Java Doc)
protected String suffix(Code)(Java Doc)
protected PropertyChangeSupport support(Code)(Java Doc)
protected String type(Code)(Java Doc)

Methods inherited from org.apache.catalina.core.StandardService
public void addConnector(Connector connector)(Code)(Java Doc)
public void addLifecycleListener(LifecycleListener listener)(Code)(Java Doc)
public void addPropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public void destroy() throws LifecycleException(Code)(Java Doc)
public Connector[] findConnectors()(Code)(Java Doc)
public LifecycleListener[] findLifecycleListeners()(Code)(Java Doc)
public ObjectName[] getConnectorNames()(Code)(Java Doc)
public Container getContainer()(Code)(Java Doc)
public ObjectName getContainerName()(Code)(Java Doc)
public int getDebug()(Code)(Java Doc)
public String getDomain()(Code)(Java Doc)
public String getInfo()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public ObjectName getObjectName()(Code)(Java Doc)
public Server getServer()(Code)(Java Doc)
public void init()(Code)(Java Doc)
public void initialize() throws LifecycleException(Code)(Java Doc)
public void postDeregister()(Code)(Java Doc)
public void postRegister(Boolean registrationDone)(Code)(Java Doc)
public void preDeregister() throws Exception(Code)(Java Doc)
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception(Code)(Java Doc)
public void removeConnector(Connector connector)(Code)(Java Doc)
public void removeLifecycleListener(LifecycleListener listener)(Code)(Java Doc)
public void removePropertyChangeListener(PropertyChangeListener listener)(Code)(Java Doc)
public void setContainer(Container container)(Code)(Java Doc)
public void setDebug(int debug)(Code)(Java Doc)
public void setName(String name)(Code)(Java Doc)
public void setServer(Server server)(Code)(Java Doc)
public void start() throws LifecycleException(Code)(Java Doc)
public void stop() throws LifecycleException(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.