remm 01/09/23 18:40:34
Modified: src/wrappers/catalina SlideServerListener.java server.xml
Added: src/wrappers/catalina AdminHost.java
Removed: src/wrappers/catalina ManagerHost.java
Log:
- Update manager host -> admin host.
Revision Changes Path
1.3 +7 -7 jakarta-slide/src/wrappers/catalina/SlideServerListener.java
Index: SlideServerListener.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/wrappers/catalina/SlideServerListener.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SlideServerListener.java 2001/09/08 21:46:14 1.2
+++ SlideServerListener.java 2001/09/24 01:40:34 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/wrappers/catalina/SlideServerListener.java,v 1.2
2001/09/08 21:46:14 remm Exp $
- * $Revision: 1.2 $
- * $Date: 2001/09/08 21:46:14 $
+ * $Header:
/home/cvs/jakarta-slide/src/wrappers/catalina/SlideServerListener.java,v 1.3
2001/09/24 01:40:34 remm Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/09/24 01:40:34 $
*
* ====================================================================
*
@@ -103,7 +103,7 @@
* Server listener responsible for setting up the Slide domain.
*
* @author Remy Maucherat
- * @version $Revision: 1.2 $ $Date: 2001/09/08 21:46:14 $
+ * @version $Revision: 1.3 $ $Date: 2001/09/24 01:40:34 $
*/
public class SlideServerListener
implements LifecycleListener {
@@ -336,9 +336,9 @@
} else if (host instanceof WebdavHost) {
System.out.println("Set domain for Webdav host");
((WebdavHost) host).setDomain(domain);
- } else if (host instanceof ManagerHost) {
- System.out.println("Set domain for Slide manager host");
- ((ManagerHost) host).setDomain(domain);
+ } else if (host instanceof AdminHost) {
+ System.out.println("Set domain for Slide admin host");
+ ((AdminHost) host).setDomain(domain);
}
}
1.4 +7 -7 jakarta-slide/src/wrappers/catalina/server.xml
Index: server.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/wrappers/catalina/server.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- server.xml 2001/09/08 21:46:14 1.3
+++ server.xml 2001/09/24 01:40:34 1.4
@@ -106,8 +106,8 @@
</Service>
- <!-- Define the Slide Manager Service -->
- <Service name="Slide Manager">
+ <!-- Define the Slide Admin Service -->
+ <Service name="Slide Admin">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8082 -->
<Connector className="org.apache.catalina.connector.http.HttpConnector"
@@ -127,23 +127,23 @@
-->
<!-- Define the top level container in our container hierarchy -->
- <Engine name="Manager" defaultHost="localhost" debug="0">
+ <Engine name="Admin" defaultHost="localhost" debug="0">
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
- prefix="catalina_manager_log." suffix=".txt"
+ prefix="catalina_admin_log." suffix=".txt"
timestamp="true"/>
<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="blank" unpackWARs="false"
- className="wrappers.catalina.ManagerHost">
+ className="wrappers.catalina.AdminHost">
<Valve className="org.apache.catalina.valves.AccessLogValve"
- directory="logs" prefix="manager_access_log." suffix=".txt"
+ directory="logs" prefix="admin_access_log." suffix=".txt"
pattern="common"/>
<Logger className="org.apache.catalina.logger.FileLogger"
- directory="logs" prefix="manager_log." suffix=".txt"
+ directory="logs" prefix="admin_log." suffix=".txt"
timestamp="true"/>
<!-- Tomcat Root Context -->
1.1 jakarta-slide/src/wrappers/catalina/AdminHost.java
Index: AdminHost.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/AdminHost.java,v 1.1
2001/09/24 01:40:34 remm Exp $
* $Revision: 1.1 $
* $Date: 2001/09/24 01:40:34 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package wrappers.catalina;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Deployer;
import org.apache.catalina.Globals;
import org.apache.catalina.HttpRequest;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Request;
import org.apache.catalina.Response;
import org.apache.catalina.core.DefaultContext;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.core.ApplicationContext;
import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.Namespace;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.webdav.WebdavServlet;
/**
* Slide administrator implementation of Host.
*
* @author Remy Maucherat
* @version $Revision: 1.1 $ $Date: 2001/09/24 01:40:34 $
*/
public class AdminHost
extends StandardHost
implements Deployer, Host {
// ----------------------------------------------------------- Constructors
/**
* Create a new AdminHost component with the default basic Valve.
*/
public AdminHost() {
super();
}
// ----------------------------------------------------- Instance Variables
/**
* Slide domain.
*/
EmbeddedDomain domain;
// ------------------------------------------------------------- Properties
/**
* Domain setter.
*/
public void setDomain(EmbeddedDomain domain) {
this.domain = domain;
}
/**
* Domain getter.
*/
public EmbeddedDomain getDomain() {
return domain;
}
// --------------------------------------------------------- Public Methods
/**
* Prepare for active use of the public methods of this Component.
*
* @exception IllegalStateException if this component has already been
* started
* @exception LifecycleException if this component detects a fatal error
* that prevents it from being started
*/
public synchronized void start() throws LifecycleException {
String defaultNamespace = domain.getDefaultNamespace();
Enumeration namespaceNames = domain.enumerateNamespaces();
while (namespaceNames.hasMoreElements()) {
String name = (String) namespaceNames.nextElement();
try {
File managerWar = new File("admin/slide-admin.war");
install("/" + name, managerWar.toURL());
if (name.equals(defaultNamespace)) {
// Also install the deafult namespace as the root context
install("", managerWar.toURL());
}
} catch (IOException e) {
// Can't happen
e.printStackTrace();
}
}
super.start();
}
// ------------------------------------------------------- Deployer Methods
/**
* Install a new web application, whose web application archive is at the
* specified URL, into this container with the specified context path.
* A context path of "" (the empty string) should be used for the root
* application for this container. Otherwise, the context path must
* start with a slash.
* <p>
* If this application is successfully installed, a ContainerEvent of type
* <code>INSTALL_EVENT</code> will be sent to all registered listeners,
* with the newly created <code>Context</code> as an argument.
*
* @param contextPath The context path to which this application should
* be installed (must be unique)
* @param war A URL of type "jar:" that points to a WAR file, or type
* "file:" that points to an unpacked directory structure containing
* the web application to be installed
*
* @exception IllegalArgumentException if the specified context path
* is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path
* is already attached to an existing web application
* @exception IOException if an input/output error was encountered
* during install
*/
public void install(String contextPath, URL war) throws IOException {
// Validate the format and state of our arguments
if (contextPath == null)
throw new IllegalArgumentException
(sm.getString("standardHost.pathRequired"));
if (!contextPath.equals("") && !contextPath.startsWith("/"))
throw new IllegalArgumentException
(sm.getString("standardHost.pathFormat", contextPath));
if (findDeployedApp(contextPath) != null)
throw new IllegalArgumentException
(sm.getString("standardHost.pathUsed", contextPath));
if (war == null)
throw new IllegalArgumentException
(sm.getString("standardHost.warRequired"));
// Prepare the local variables we will require
String url = war.toString();
String docBase = null;
log(sm.getString("standardHost.installing", contextPath, url));
if (url.startsWith("jar:")) {
url = url.substring(4, url.length() - 2);
}
if (url.startsWith("file://"))
docBase = url.substring(7);
else if (url.startsWith("file:"))
docBase = url.substring(5);
else
throw new IllegalArgumentException
(sm.getString("standardHost.warURL", url));
// Install this new web application
try {
Class clazz = Class.forName(getContextClass());
Context context = (Context) clazz.newInstance();
context.setPath(contextPath);
context.setDocBase(docBase);
String namespaceName = contextPath;
while (namespaceName.startsWith("/")) {
namespaceName = namespaceName.substring(1);
}
if (namespaceName.equals("")) {
namespaceName = domain.getDefaultNamespace();
}
context.getServletContext().setAttribute
("org.apache.slide.NamespaceName", namespaceName);
((ApplicationContext) context.getServletContext())
.setAttributeReadOnly("org.apache.slide.NamespaceName");
NamespaceAccessToken accessToken =
domain.getNamespaceToken(namespaceName);
SlideRealm slideRealm = new SlideRealm();
slideRealm.setAccessToken(accessToken);
slideRealm.setNamespace(namespaceName);
context.setRealm(slideRealm);
context.getServletContext().setAttribute
(WebdavServlet.ATTRIBUTE_NAME, accessToken);
((ApplicationContext) context.getServletContext())
.setAttributeReadOnly(WebdavServlet.ATTRIBUTE_NAME);
Namespace namespace = domain.getNamespace(namespaceName);
context.getServletContext().setAttribute
("org.apache.slide.Namespace", namespace);
((ApplicationContext) context.getServletContext())
.setAttributeReadOnly("org.apache.slide.Namespace");
if (context instanceof Lifecycle) {
clazz = Class.forName(getConfigClass());
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
((Lifecycle) context).addLifecycleListener(listener);
}
addChild(context);
fireContainerEvent(INSTALL_EVENT, context);
} catch (Exception e) {
log(sm.getString("standardHost.installError", contextPath), e);
throw new IOException(e.toString());
}
}
}