You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by pi...@locus.apache.org on 2000/12/08 10:40:56 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp WarpEngine.java
pier 00/12/08 01:40:56
Modified: catalina/src/share/org/apache/catalina/connector/warp
WarpEngine.java
Log:
Added methods for invoking requests within Catalina.
Revision Changes Path
1.5 +67 -9 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngine.java
Index: WarpEngine.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/warp/WarpEngine.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WarpEngine.java 2000/12/08 02:57:04 1.4
+++ WarpEngine.java 2000/12/08 09:40:55 1.5
@@ -75,7 +75,7 @@
* @author <a href="mailto:pier.fumagalli@eng.sun.com">Pier Fumagalli</a>
* @author Copyright © 1999, 2000 <a href="http://www.apache.org">The
* Apache Software Foundation.
- * @version CVS $Id: WarpEngine.java,v 1.4 2000/12/08 02:57:04 pier Exp $
+ * @version CVS $Id: WarpEngine.java,v 1.5 2000/12/08 09:40:55 pier Exp $
*/
public class WarpEngine extends StandardEngine {
@@ -90,6 +90,10 @@
/** The Java class name of the default Mapper class for this Container. */
private String mapper="org.apache.catalina.connector.warp.WarpEngineMapper";
+ /** The root path for web applications. */
+ private String appbase="";
+ /** The Host ID to use for the next dynamically configured host. */
+ private int hostid=0;
// ------------------------------------------------------------ CONSTRUCTOR
@@ -111,14 +115,68 @@
}
/**
- * Add a default Mapper implementation if none have been configured
- * explicitly.
- *
- * @param mapperClass Java class name of the default Mapper
- */
- public void addDefaultMapper(String mapper) {
- if (DEBUG) this.debug("Adding default mapper "+mapper);
- super.addDefaultMapper(this.mapper);
+ * Create a new WarpHost with the specified host name, setup the appropriate
+ * values and add it to the list of children.
+ */
+ public synchronized WarpHost setupChild(String name) {
+ WarpHost host=(WarpHost)this.findChild(name);
+ if (host==null) {
+ this.debug("Creating new host "+name);
+ host=new WarpHost();
+ host.setName(name);
+ host.setHostID(this.hostid++);
+ host.setAppBase(this.appbase);
+ this.addChild(host);
+ }
+ return(host);
+ }
+
+ /**
+ * Add a child WarpHost to the current WarpEngine.
+ */
+ public void addChild(Container child) {
+ if (child instanceof WarpHost) {
+ WarpHost byid=this.findChild(((WarpHost)child).getHostID());
+ if (byid!=null) {
+ throw new IllegalArgumentException("Host "+byid.getName()+
+ " already configured with ID="+byid.getHostID());
+ } else {
+ super.addChild(child);
+ }
+ } else throw new IllegalArgumentException("Child is not a WarpHost");
+ }
+
+ /**
+ * Find a child WarpHost associated with the specified Host ID.
+ */
+ public WarpHost findChild(int id) {
+ Container children[]=this.findChildren();
+ for (int x=0; x<children.length; x++) {
+ WarpHost curr=(WarpHost)children[x];
+ if (curr.getHostID()==id) return(curr);
+ }
+ return(null);
+ }
+
+ // ----------------------------------------------------------- BEAN METHODS
+
+ /**
+ * Return the application root for this Connector. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ */
+ public String getAppBase() {
+ return (this.appbase);
+ }
+
+ /**
+ * Set the application root for this Connector. This can be an absolute
+ * pathname, a relative pathname, or a URL.
+ */
+ public void setAppBase(String appbase) {
+ if (appbase==null) return;
+ if (DEBUG) this.debug("Setting application root to "+appbase);
+ String old=this.appbase;
+ this.appbase=appbase;
}
// ------------------------------------------------------ DEBUGGING METHODS