You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@apache.org on 2001/11/11 21:11:30 UTC
cvs commit: jakarta-slide/src/wrappers/catalina AdminHostConfig.java BaseHostConfig.java SlideHostConfig.java WebdavHostConfig.java server.xml SlideServerListener.java AdminHost.java manager.xml SlideHost.java WebdavHost.java
remm 01/11/11 12:11:30
Modified: src/wrappers/catalina server.xml SlideServerListener.java
Added: src/wrappers/catalina AdminHostConfig.java
BaseHostConfig.java SlideHostConfig.java
WebdavHostConfig.java
Removed: src/wrappers/catalina AdminHost.java manager.xml
SlideHost.java WebdavHost.java
Log:
- Update the code to Tomcat 4.1, which provides many improvements
over 4.0.
- Use listeners (actually, config classes) to deploy the Slide namespaces. That
allows more flexible integration (and it should be compatible with mod_webapp).
- Added Slide namespaces will be auto-deployed along with other contexts.
- The mapping bugs on the WebDAV host are back. This is a Catalina mapping
bug, and the workaround used before can't be used anymore.
Revision Changes Path
1.9 +5 -22 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- server.xml 2001/10/13 03:37:52 1.8
+++ server.xml 2001/11/11 20:11:29 1.9
@@ -1,5 +1,7 @@
<Server port="8005" shutdown="SHUTDOWN" debug="0">
+ <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
+ debug="0" port="-1" login="admin" password="admin"/>
<Listener className="wrappers.catalina.SlideServerListener"
logLevel="6" />
@@ -33,7 +35,7 @@
<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="false"
- configPath="slide" className="wrappers.catalina.SlideHost">
+ hostConfigClass="wrappers.catalina.SlideHostConfig">
<Realm className="org.apache.catalina.realm.MemoryRealm" />
@@ -45,15 +47,6 @@
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
- <!-- Tomcat Root Context -->
- <!--
- <Context path="" docBase="ROOT" debug="0"/>
- -->
-
- <!-- Tomcat Manager Context -->
- <Context path="/tomcat-manager" docBase="tomcat-manager.war"
- debug="0" privileged="true"/>
-
</Host>
</Engine>
@@ -90,7 +83,7 @@
<!-- Define the default virtual host -->
<Host name="localhost8081" debug="0" appBase="blank" unpackWARs="false"
- className="wrappers.catalina.WebdavHost">
+ hostConfigClass="wrappers.catalina.WebdavHostConfig">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="webdav_access_log." suffix=".txt"
@@ -100,11 +93,6 @@
directory="logs" prefix="webdav_log." suffix=".txt"
timestamp="true"/>
- <!-- Tomcat Root Context -->
- <!--
- <Context path="" docBase="ROOT" debug="0"/>
- -->
-
</Host>
</Engine>
@@ -141,7 +129,7 @@
<!-- Define the default virtual host -->
<Host name="localhost8082" debug="0" appBase="blank" unpackWARs="false"
- className="wrappers.catalina.AdminHost">
+ hostConfigClass="wrappers.catalina.AdminHostConfig">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="admin_access_log." suffix=".txt"
@@ -150,11 +138,6 @@
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="admin_log." suffix=".txt"
timestamp="true"/>
-
- <!-- Tomcat Root Context -->
- <!--
- <Context path="" docBase="ROOT" debug="0"/>
- -->
</Host>
1.6 +21 -38 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SlideServerListener.java 2001/10/11 05:49:56 1.5
+++ SlideServerListener.java 2001/11/11 20:11:30 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/SlideServerListener.java,v 1.5 2001/10/11 05:49:56 remm Exp $
- * $Revision: 1.5 $
- * $Date: 2001/10/11 05:49:56 $
+ * $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/SlideServerListener.java,v 1.6 2001/11/11 20:11:30 remm Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/11/11 20:11:30 $
*
* ====================================================================
*
@@ -99,11 +99,14 @@
import org.apache.slide.util.conf.Populate;
import org.apache.slide.util.logger.SimpleLogger;
+import wrappers.jmx.MBeanUtils;
+
+
/**
* Server listener responsible for setting up the Slide domain.
*
* @author Remy Maucherat
- * @version $Revision: 1.5 $ $Date: 2001/10/11 05:49:56 $
+ * @version $Revision: 1.6 $ $Date: 2001/11/11 20:11:30 $
*/
public class SlideServerListener
implements LifecycleListener {
@@ -147,18 +150,23 @@
logger.setLoggerLevel(6);
domain.setLogger(logger);
- setHosts();
System.out.println("Starting Slide");
initializeDomain();
domain.start();
System.out.println("Slide started");
+ // Register the domain as a MBean
+ MBeanUtils.createMBean(domain);
+
} else if (event.getType() == Lifecycle.STOP_EVENT) {
System.out.println("Stopping Slide");
domain.stop();
System.out.println("Slide stopped");
+ // Unregister the domain as a MBean
+ MBeanUtils.destroyMBean(domain);
+
}
} catch (Throwable t) {
@@ -221,6 +229,14 @@
/**
+ * Get the domain.
+ */
+ public EmbeddedDomain getDomain() {
+ return domain;
+ }
+
+
+ /**
* Logging level setter.
*/
public void setLogLevel(int logLevel) {
@@ -339,39 +355,6 @@
domain.addNamespace(name, nsLogger, definition,
configuration, baseData);
-
- }
-
-
- /**
- * Associate the hosts with the embedded domain.
- */
- protected void setHosts() {
-
- Service[] services = server.findServices();
- for (int i = 0; i < services.length; i++) {
-
- Container container = services[i].getContainer();
- Container[] children = container.findChildren();
-
- for (int j = 0; j < children.length; j++) {
-
- Host host = (Host) children[j];
-
- if (host instanceof SlideHost) {
- System.out.println("Set domain for Slide host");
- ((SlideHost) host).setDomain(domain);
- } else if (host instanceof WebdavHost) {
- System.out.println("Set domain for Webdav host");
- ((WebdavHost) host).setDomain(domain);
- } else if (host instanceof AdminHost) {
- System.out.println("Set domain for Slide admin host");
- ((AdminHost) host).setDomain(domain);
- }
-
- }
-
- }
}
1.1 jakarta-slide/src/wrappers/catalina/AdminHostConfig.java
Index: AdminHostConfig.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/AdminHostConfig.java,v 1.1 2001/11/11 20:11:29 remm Exp $
* $Revision: 1.1 $
* $Date: 2001/11/11 20:11:29 $
*
* ====================================================================
*
* 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 apache@apache.org.
*
* 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.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Deployer;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.logger.FileLogger;
import org.apache.catalina.startup.HostConfig;
import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.Namespace;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.webdav.WebdavServlet;
import wrappers.jndi.SlideDirContext;
/**
* Host listener configuration classes for the Admin host.
*
* @author Remy Maucherat
* @version $Revision: 1.1 $ $Date: 2001/11/11 20:11:29 $
*/
public class AdminHostConfig
extends BaseHostConfig {
// ------------------------------------------------------ Protected Methods
/**
* Return the full path to the admin webapp.
*/
protected String getAdminWebappPath()
throws IOException {
File file = new File(System.getProperty("catalina.base"));
file = new File(file, "slide/slide-admin.war");
return file.getCanonicalPath();
}
/**
* Install specified namespace.
*/
protected void installNamespace(String path, String name) {
try {
Class clazz = Class.forName(getContextClass());
Context context = (Context) clazz.newInstance();
context.setPath(path);
context.setDocBase(getAdminWebappPath());
NamespaceAccessToken accessToken = domain.getNamespaceToken(name);
Namespace namespace = domain.getNamespace(name);
SlideRealm slideRealm = new SlideRealm();
slideRealm.setAccessToken(accessToken);
slideRealm.setNamespace(name);
context.setRealm(slideRealm);
context.getServletContext().setAttribute
("org.apache.slide.Namespace", namespace);
context.getServletContext().setAttribute
("org.apache.slide.NamespaceName", name);
context.getServletContext().setAttribute
(WebdavServlet.ATTRIBUTE_NAME, accessToken);
if (context instanceof Lifecycle) {
clazz = Class.forName(getConfigClass());
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
((Lifecycle) context).addLifecycleListener(listener);
}
host.addChild(context);
} catch (Exception e) {
}
}
}
1.1 jakarta-slide/src/wrappers/catalina/BaseHostConfig.java
Index: BaseHostConfig.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/BaseHostConfig.java,v 1.1 2001/11/11 20:11:29 remm Exp $
* $Revision: 1.1 $
* $Date: 2001/11/11 20:11:29 $
*
* ====================================================================
*
* 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 apache@apache.org.
*
* 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.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.Enumeration;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.catalina.Container;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.core.StandardHost;
import org.apache.catalina.logger.FileLogger;
import org.apache.catalina.startup.HostConfig;
import org.apache.slide.common.Domain;
import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.Namespace;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.util.conf.Configuration;
import org.apache.slide.util.conf.ConfigurationElement;
import org.apache.slide.util.conf.ConfigurationException;
import org.apache.slide.util.conf.Populate;
import org.apache.slide.util.logger.SimpleLogger;
/**
* Base class for host listener configuration classes.
*
* @author Remy Maucherat
* @version $Revision: 1.1 $ $Date: 2001/11/11 20:11:29 $
*/
public abstract class BaseHostConfig
extends HostConfig {
// ----------------------------------------------------------- Constructors
/**
* Acknowledge the occurrence of the specified event.
*
* @param event LifecycleEvent that has occurred
*/
public void lifecycleEvent(LifecycleEvent event) {
if (domain == null) {
host = (Host) event.getLifecycle();
getDomain();
}
super.lifecycleEvent(event);
}
// ----------------------------------------------------- Instance Variables
/**
* Slide domain.
*/
protected EmbeddedDomain domain = null;
// ------------------------------------------------------------- Properties
public void setDomain(EmbeddedDomain domain) {
this.domain = domain;
}
// --------------------------------------------------------- Public Methods
// ------------------------------------------------------ Protected Methods
/**
* Get the Slide domain from the server listener.
*/
protected void getDomain() {
if (!(host instanceof Container))
return;
Container current = (Container) host;
while ((current.getParent() != null)
&& (!(current instanceof Engine))) {
current = current.getParent();
}
if (current == null)
return;
Service service = ((Engine) current).getService();
if (service == null)
return;
Server server = service.getServer();
if (!(server instanceof Lifecycle))
return;
LifecycleListener[] listeners =
((Lifecycle) server).findLifecycleListeners();
for (int i = 0; i < listeners.length; i++) {
if (listeners[i] instanceof SlideServerListener) {
domain = ((SlideServerListener) listeners[i]).getDomain();
}
}
}
/**
* Deploy applications for Slide namespaces.
*/
protected void deployApps() {
super.deployApps();
String defaultNamespace = domain.getDefaultNamespace();
Enumeration namespaceNames = domain.enumerateNamespaces();
while (namespaceNames.hasMoreElements()) {
String name = (String) namespaceNames.nextElement();
String contextPath = "/" + name;
if (host.findChild(contextPath) == null)
installNamespace(contextPath, name);
if (name.equals(defaultNamespace)) {
// Also install the deafult namespace as the root context
if (host.findChild("") == null)
installNamespace("", name);
}
}
}
/**
* Install specified namespace.
*/
protected abstract void installNamespace(String path, String name);
}
1.1 jakarta-slide/src/wrappers/catalina/SlideHostConfig.java
Index: SlideHostConfig.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/SlideHostConfig.java,v 1.1 2001/11/11 20:11:30 remm Exp $
* $Revision: 1.1 $
* $Date: 2001/11/11 20:11:30 $
*
* ====================================================================
*
* 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 apache@apache.org.
*
* 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.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Deployer;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.logger.FileLogger;
import org.apache.catalina.startup.HostConfig;
import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.Namespace;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.webdav.WebdavServlet;
import wrappers.jndi.SlideDirContext;
/**
* Host listener configuration classes for the Slide host, which provides a
* web application view of a Slide namespace.
*
* @author Remy Maucherat
* @version $Revision: 1.1 $ $Date: 2001/11/11 20:11:30 $
*/
public class SlideHostConfig
extends BaseHostConfig {
// ------------------------------------------------------ Protected Methods
/**
* Deploy applications for Slide namespaces.
*/
protected void deployApps() {
if (host.findChild("") == null) {
try {
URL welcomeWar = getWelcomeWebappURL();
((Deployer) host).install("", welcomeWar);
} catch (IOException e) {
}
}
super.deployApps();
}
/**
* Return the full path to the welcome webapp.
*/
protected URL getWelcomeWebappURL()
throws IOException {
File file = new File(System.getProperty("catalina.base"));
file = new File(file, "slide/slide-welcome.war");
if (!file.exists())
throw new IOException();
return new URL("file", null, file.getCanonicalPath());
}
/**
* Install specified namespace.
*/
protected void installNamespace(String path, String name) {
try {
Class clazz = Class.forName(getContextClass());
Context context = (Context) clazz.newInstance();
context.setPath(path);
context.setDocBase(name);
NamespaceAccessToken accessToken = domain.getNamespaceToken(name);
SlideRealm slideRealm = new SlideRealm();
slideRealm.setAccessToken(accessToken);
slideRealm.setNamespace(name);
context.setRealm(slideRealm);
context.getServletContext().setAttribute
(WebdavServlet.ATTRIBUTE_NAME, accessToken);
SlideDirContext resources = new SlideDirContext();
resources.setAccessToken(accessToken);
resources.setNamespaceName(name);
context.setResources(resources);
if (context instanceof Lifecycle) {
clazz = Class.forName(getConfigClass());
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
((Lifecycle) context).addLifecycleListener(listener);
}
host.addChild(context);
} catch (Exception e) {
}
}
}
1.1 jakarta-slide/src/wrappers/catalina/WebdavHostConfig.java
Index: WebdavHostConfig.java
===================================================================
/*
* $Header: /home/cvs/jakarta-slide/src/wrappers/catalina/WebdavHostConfig.java,v 1.1 2001/11/11 20:11:30 remm Exp $
* $Revision: 1.1 $
* $Date: 2001/11/11 20:11:30 $
*
* ====================================================================
*
* 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 apache@apache.org.
*
* 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.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Deployer;
import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Server;
import org.apache.catalina.Service;
import org.apache.catalina.logger.FileLogger;
import org.apache.catalina.startup.HostConfig;
import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.Namespace;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.webdav.WebdavServlet;
import wrappers.jndi.SlideDirContext;
/**
* Host listener configuration classes for the WebDAV host, which provides
* the WebDAV view of a Slide namespace.
*
* @author Remy Maucherat
* @version $Revision: 1.1 $ $Date: 2001/11/11 20:11:30 $
*/
public class WebdavHostConfig
extends BaseHostConfig {
// ------------------------------------------------------ Protected Methods
/**
* Return the full path to the WebDAV webapp.
*/
protected String getWebDAVWebappPath()
throws IOException {
File file = new File(System.getProperty("catalina.base"));
file = new File(file, "slide/slide-webdav.war");
return file.getCanonicalPath();
}
/**
* Install specified namespace.
*/
protected void installNamespace(String path, String name) {
try {
Class clazz = Class.forName(getContextClass());
Context context = (Context) clazz.newInstance();
context.setPath(path);
context.setDocBase(getWebDAVWebappPath());
NamespaceAccessToken accessToken = domain.getNamespaceToken(name);
SlideRealm slideRealm = new SlideRealm();
slideRealm.setAccessToken(accessToken);
slideRealm.setNamespace(name);
context.setRealm(slideRealm);
context.getServletContext().setAttribute
(WebdavServlet.ATTRIBUTE_NAME, accessToken);
if (context instanceof Lifecycle) {
clazz = Class.forName(getConfigClass());
LifecycleListener listener =
(LifecycleListener) clazz.newInstance();
((Lifecycle) context).addLifecycleListener(listener);
}
host.addChild(context);
} catch (Exception e) {
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>