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...@locus.apache.org on 2000/09/02 04:42:33 UTC
cvs commit: jakarta-slide/src/share/org/apache/slide/webdav WebdavServlet.java
remm 00/09/01 19:42:32
Modified: . build.xml
src/share/org/apache/slide/common Domain.java Namespace.java
src/share/org/apache/slide/security NodePermission.java
src/share/org/apache/slide/webdav WebdavServlet.java
Log:
- Packaging as a web application now works
Revision Changes Path
1.39 +21 -16 jakarta-slide/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/build.xml,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- build.xml 2000/08/31 22:08:50 1.38
+++ build.xml 2000/09/02 02:42:27 1.39
@@ -47,9 +47,9 @@
<echo message="Distribution targets" />
<echo message="--------------------" />
<echo message="" />
- <echo message="cataliana-dist : Builds a Tomcat Catalina based DAV server" />
- <echo message="webapp-dist : Builds a Web Application Archive, compliant with servlet 2.2 specification, with Slide" />
- <echo message="avalon-dist : Builds a content server running on top of Avalon" />
+ <echo message="standalone-dist : Builds a standalone content management server server with an embedded HTTP server" />
+ <echo message="webapp-dist : Builds a Slide Web Application Archive, compliant with servlet 2.2 specification" />
+ <echo message="avalon-dist : Builds a content management server running on top of Avalon" />
<echo message="jmx-dist : Builds a JMX ready content server (not implemented yet)" />
<echo message="" />
<echo message="Packaging" />
@@ -91,7 +91,8 @@
<copyfile src="${ant.home}/lib/ant.jar" dest="${slide.build}/lib/ant.jar"/>
<copydir src="src/conf" dest="${slide.build}/conf"/>
- <available property="jmx.present" classname="javax.management.MBeanServer" />
+ <available property="jmx.present"
+ classname="javax.management.MBeanServer" />
</target>
@@ -332,7 +333,8 @@
<echo message="Copying documentation" />
<copydir src="${slide.build}/doc" dest="${slide.dist}/doc" />
<copydir src="." dest="${slide.dist}"
- includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html" />
+ includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html"
+ />
</target>
@@ -379,9 +381,9 @@
<!-- =================================================================== -->
<!-- Build a standalone Slide server -->
- <!-- This target requires Catalina -->
+ <!-- This target requires Tomcat 4.0 -->
<!-- =================================================================== -->
- <target name="catalina-dist" depends="no-debug, doc, javadoc,
+ <target name="standalone-dist" depends="no-debug, doc, javadoc,
prepare-dav-dist">
<!-- Building the Catalina-based server -->
@@ -451,7 +453,7 @@
<!-- =================================================================== -->
<!-- Build an Avalon-enabled Catalina - Slide server -->
<!-- =================================================================== -->
- <target name="avalon-dist" depends="catalina-dist">
+ <target name="avalon-dist" depends="standalone-dist">
<!-- Building Avalon blocks -->
@@ -544,15 +546,16 @@
<deltree dir="${slide.release}" />
</target>
+
<!-- =================================================================== -->
<!-- Release Prepare -->
<!-- =================================================================== -->
<target name="release-prepare">
<mkdir dir="${slide.release}" />
- <mkdir dir="${slide.release}/avalon" />
+ <mkdir dir="${slide.release}/standalone-avalon" />
<mkdir dir="${slide.release}/slide" />
- <mkdir dir="${slide.release}/webdavclient" />
- <mkdir dir="${slide.release}/catalina" />
+ <mkdir dir="${slide.release}/client" />
+ <mkdir dir="${slide.release}/standalone" />
<mkdir dir="${slide.release}/webapp" />
</target>
@@ -560,16 +563,18 @@
<!-- =================================================================== -->
<!-- Release -->
<!-- =================================================================== -->
- <target name="release" depends="dist, doc, catalina-dist,
+ <target name="release" depends="dist, doc, standalone-dist,
webdav-client-dist, webapp-dist, release-prepare">
- <!--copydir src="${avalon.dist}" dest="${slide.release}/avalon" /-->
- <copydir src="${webdavclient.dist}" dest="${slide.release}/webdavclient" />
+ <!--copydir src="${avalon.dist}"
+ dest="${slide.release}/standalone-avalon" /-->
+ <copydir src="${webdavclient.dist}" dest="${slide.release}/client" />
<copydir src="${slide.dist}" dest="${slide.release}/slide" />
- <copydir src="${dav.dist}" dest="${slide.release}/catalina" />
+ <copydir src="${dav.dist}" dest="${slide.release}/standalone" />
<jar jarfile="${slide.release}/webapp/slide.war"
basedir="${webapp.dist}" includes="**"/>
<copydir src="." dest="${slide.release}"
- includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html" />
+ includes="LICENSE,README,CHANGELOG,RELEASE-INFO,RELEASE-PLAN,STATUS.html"
+ />
</target>
1.12 +60 -43 jakarta-slide/src/share/org/apache/slide/common/Domain.java
Index: Domain.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Domain.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Domain.java 2000/08/29 18:55:02 1.11
+++ Domain.java 2000/09/02 02:42:29 1.12
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Domain.java,v 1.11 2000/08/29 18:55:02 remm Exp $
- * $Revision: 1.11 $
- * $Date: 2000/08/29 18:55:02 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Domain.java,v 1.12 2000/09/02 02:42:29 remm Exp $
+ * $Revision: 1.12 $
+ * $Date: 2000/09/02 02:42:29 $
*
* ====================================================================
*
@@ -89,7 +89,7 @@
* For now, does not implement access control on Namespaces.
*
* @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
- * @version $Revision: 1.11 $
+ * @version $Revision: 1.12 $
*/
public final class Domain {
@@ -113,6 +113,18 @@
/**
+ * Tests if the domain has been initialized before.
+ *
+ * @return boolean True if the domain has already been initialized
+ */
+ public static boolean isInitialized() {
+
+ return (namespaces != null);
+
+ }
+
+
+ /**
* Access a Namespace.
*
* @param token Entity which wants access
@@ -122,7 +134,7 @@
public static NamespaceAccessToken accessNamespace(SecurityToken token,
String namespaceName) {
- if (namespaces == null)
+ if (!isInitialized())
selfInit();
Namespace namespace = (Namespace) namespaces.get(namespaceName);
@@ -172,6 +184,49 @@
}
+ /**
+ * Domain initialization routine using Avalon configuration parser.
+ *
+ * @param configuration Avalon configuration object
+ */
+ public static void init(Configuration configuration) {
+
+ if (isInitialized())
+ return;
+
+ if (logger == null) {
+ logger = new SimpleLogger();
+ ((SimpleLogger) logger).setLoggerLevel(Logger.INFO);
+ ((SimpleLogger) logger).useHttpDateFormat();
+ }
+
+ info("Initializing Domain");
+
+ namespaces = new Hashtable();
+
+ // Now initializing the domain
+
+ // Loading configuration
+ Properties properties =
+ org.apache.slide.util.Configuration.getDefault();
+ info("Domain configuration : " + properties.toString());
+
+ Enumeration namespaceDefinitions =
+ configuration.getConfigurations("namespace");
+
+ while (namespaceDefinitions.hasMoreElements()) {
+
+ initNamespace((Configuration) namespaceDefinitions.nextElement());
+
+ }
+
+ if (namespaces.isEmpty()) {
+ throw new DomainInitializationFailedError();
+ }
+
+ }
+
+
// --------------------------------------------------------- Logger Methods
@@ -295,43 +350,6 @@
/**
- * Domain initialization routine using Avalon configuration parser.
- *
- * @param configuration Avalon configuration object
- */
- static void init(Configuration configuration) {
-
- if (logger == null)
- logger = new SimpleLogger();
-
- info("Initializing Domain");
-
- namespaces = new Hashtable();
-
- // Now initializing the domain
-
- // Loading configuration
- Properties properties =
- org.apache.slide.util.Configuration.getDefault();
- info("Domain configuration : " + properties.toString());
-
- Enumeration namespaceDefinitions =
- configuration.getConfigurations("namespace");
-
- while (namespaceDefinitions.hasMoreElements()) {
-
- initNamespace((Configuration) namespaceDefinitions.nextElement());
-
- }
-
- if (namespaces.isEmpty()) {
- throw new DomainInitializationFailedError();
- }
-
- }
-
-
- /**
* Default initialization of the domain.
*/
static void selfInit() {
@@ -343,7 +361,6 @@
}
info("Auto-Initializing Domain");
- namespaces = new Hashtable();
// Now initializing the domain
1.8 +4 -14 jakarta-slide/src/share/org/apache/slide/common/Namespace.java
Index: Namespace.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Namespace.java 2000/08/13 02:41:33 1.7
+++ Namespace.java 2000/09/02 02:42:29 1.8
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v 1.7 2000/08/13 02:41:33 remm Exp $
- * $Revision: 1.7 $
- * $Date: 2000/08/13 02:41:33 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/Namespace.java,v 1.8 2000/09/02 02:42:29 remm Exp $
+ * $Revision: 1.8 $
+ * $Date: 2000/09/02 02:42:29 $
*
* ====================================================================
*
@@ -87,7 +87,7 @@
* Namespace class.
*
* @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public final class Namespace {
@@ -804,8 +804,6 @@
}
}
} catch (Exception e) {
- // TEMP
- e.printStackTrace();
}
// Loading security store (if any)
@@ -825,8 +823,6 @@
}
}
} catch (Exception e) {
- // TEMP
- e.printStackTrace();
}
// Loading lock store (if any)
@@ -846,8 +842,6 @@
}
}
} catch (Exception e) {
- // TEMP
- e.printStackTrace();
}
// Loading revision descriptors store (if any)
@@ -870,8 +864,6 @@
}
}
} catch (Exception e) {
- // TEMP
- e.printStackTrace();
}
// Loading revision descriptor store (if any)
@@ -894,8 +886,6 @@
}
}
} catch (Exception e) {
- // TEMP
- e.printStackTrace();
}
descriptorsChildStores.put(descriptorsStoreName,
1.2 +11 -4 jakarta-slide/src/share/org/apache/slide/security/NodePermission.java
Index: NodePermission.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/NodePermission.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NodePermission.java 2000/05/09 02:47:27 1.1
+++ NodePermission.java 2000/09/02 02:42:30 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/NodePermission.java,v 1.1 2000/05/09 02:47:27 remm Exp $
- * $Revision: 1.1 $
- * $Date: 2000/05/09 02:47:27 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/security/NodePermission.java,v 1.2 2000/09/02 02:42:30 remm Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/09/02 02:42:30 $
*
* ====================================================================
*
@@ -72,7 +72,7 @@
* Permission object.
*
* @author <a href="mailto:remm@exoffice.com">Remy Maucherat</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public final class NodePermission implements Serializable, Cloneable {
@@ -99,6 +99,7 @@
this.actionUri = actionUri;
}
inheritable = true;
+ negative = false;
}
@@ -170,6 +171,12 @@
* Inheritance flag. True if permission is inheritable.
*/
protected boolean inheritable;
+
+
+ /**
+ * Negative permission flag.
+ */
+ protected boolean negative;
// ------------------------------------------------------------- Properties
1.4 +57 -5 jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java
Index: WebdavServlet.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WebdavServlet.java 2000/05/16 23:58:23 1.3
+++ WebdavServlet.java 2000/09/02 02:42:32 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.3 2000/05/16 23:58:23 remm Exp $
- * $Revision: 1.3 $
- * $Date: 2000/05/16 23:58:23 $
+ * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/webdav/WebdavServlet.java,v 1.4 2000/09/02 02:42:32 remm Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/09/02 02:42:32 $
*
* ====================================================================
*
@@ -70,10 +70,15 @@
import java.text.SimpleDateFormat;
import javax.servlet.*;
import javax.servlet.http.*;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.xml.sax.*;
+import org.xml.sax.helpers.*;
import org.apache.slide.webdav.method.*;
import org.apache.slide.webdav.common.*;
import org.apache.slide.structure.*;
import org.apache.slide.common.*;
+import org.apache.slide.util.conf.*;
import org.apache.slide.authenticate.SecurityToken;
/**
@@ -390,8 +395,55 @@
*/
public void init()
throws ServletException {
- // TODO : Read the name of the namespace from a property somewhere ...
- token = Domain.accessNamespace(new SecurityToken(this), "webdav");
+
+ String namespaceName = "webdav";
+ String domainConfigFile = "/Domain.xml";
+
+ String value = null;
+ try {
+ value = getServletConfig().getInitParameter("namespace");
+ if (value != null)
+ namespaceName = value;
+ } catch (Throwable t) {
+ ;
+ }
+ try {
+ value = getServletConfig().getInitParameter("domain");
+ if (value != null)
+ domainConfigFile = value;
+ } catch (Throwable t) {
+ ;
+ }
+
+ if (!Domain.isInitialized()) {
+
+ try {
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ factory.setNamespaceAware(false);
+ factory.setValidating(false);
+ SAXParser parser = factory.newSAXParser();
+
+ InputStream is =
+ getServletContext().getResourceAsStream(domainConfigFile);
+ if (is == null)
+ throw new ServletException("Can't find init file");
+ Populate pop = new Populate();
+ Configuration slideConfiguration =
+ new ConfigurationElement(pop.load(new InputSource(is),
+ parser.getParser()));
+
+ Domain.init(slideConfiguration);
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw new ServletException(t.getMessage());
+ }
+
+ }
+
+ token = Domain.accessNamespace(new SecurityToken(this), namespaceName);
+
}