You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(57) |
Apr
(103) |
May
(164) |
Jun
(139) |
Jul
(173) |
Aug
(196) |
Sep
(221) |
Oct
(333) |
Nov
(214) |
Dec
(88) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(163) |
Feb
(165) |
Mar
(98) |
Apr
(93) |
May
(199) |
Jun
(118) |
Jul
(200) |
Aug
(212) |
Sep
(185) |
Oct
(297) |
Nov
(437) |
Dec
(272) |
2006 |
Jan
(542) |
Feb
(329) |
Mar
(267) |
Apr
(332) |
May
(267) |
Jun
(130) |
Jul
(161) |
Aug
(348) |
Sep
(166) |
Oct
(305) |
Nov
(173) |
Dec
(173) |
2007 |
Jan
(199) |
Feb
(118) |
Mar
(133) |
Apr
(200) |
May
(208) |
Jun
(146) |
Jul
(198) |
Aug
(146) |
Sep
(187) |
Oct
(182) |
Nov
(181) |
Dec
(83) |
2008 |
Jan
(252) |
Feb
(124) |
Mar
(124) |
Apr
(101) |
May
(143) |
Jun
(122) |
Jul
(129) |
Aug
(60) |
Sep
(80) |
Oct
(89) |
Nov
(54) |
Dec
(112) |
2009 |
Jan
(88) |
Feb
(145) |
Mar
(105) |
Apr
(164) |
May
(123) |
Jun
(154) |
Jul
(374) |
Aug
(341) |
Sep
(219) |
Oct
(137) |
Nov
(373) |
Dec
(240) |
2010 |
Jan
(197) |
Feb
(270) |
Mar
(253) |
Apr
(150) |
May
(102) |
Jun
(51) |
Jul
(300) |
Aug
(512) |
Sep
(254) |
Oct
(258) |
Nov
(288) |
Dec
(143) |
2011 |
Jan
(238) |
Feb
(179) |
Mar
(253) |
Apr
(332) |
May
(248) |
Jun
(255) |
Jul
(216) |
Aug
(282) |
Sep
(146) |
Oct
(77) |
Nov
(86) |
Dec
(69) |
2012 |
Jan
(172) |
Feb
(234) |
Mar
(229) |
Apr
(101) |
May
(212) |
Jun
(267) |
Jul
(129) |
Aug
(210) |
Sep
(239) |
Oct
(271) |
Nov
(368) |
Dec
(220) |
2013 |
Jan
(179) |
Feb
(155) |
Mar
(59) |
Apr
(47) |
May
(99) |
Jun
(158) |
Jul
(185) |
Aug
(16) |
Sep
(16) |
Oct
(7) |
Nov
(20) |
Dec
(12) |
2014 |
Jan
(21) |
Feb
(17) |
Mar
(18) |
Apr
(13) |
May
(27) |
Jun
(15) |
Jul
(19) |
Aug
(22) |
Sep
(30) |
Oct
(16) |
Nov
(19) |
Dec
(16) |
2015 |
Jan
(14) |
Feb
(24) |
Mar
(33) |
Apr
(41) |
May
(14) |
Jun
(80) |
Jul
(53) |
Aug
(8) |
Sep
(7) |
Oct
(15) |
Nov
(13) |
Dec
(2) |
2016 |
Jan
(22) |
Feb
(12) |
Mar
(30) |
Apr
(6) |
May
(33) |
Jun
(16) |
Jul
(8) |
Aug
(20) |
Sep
(12) |
Oct
(18) |
Nov
(12) |
Dec
(11) |
2017 |
Jan
(24) |
Feb
(26) |
Mar
(47) |
Apr
(23) |
May
(19) |
Jun
(14) |
Jul
(28) |
Aug
(30) |
Sep
(17) |
Oct
|
Nov
|
Dec
|
2019 |
Jan
(1) |
Feb
(73) |
Mar
(90) |
Apr
(42) |
May
(116) |
Jun
(90) |
Jul
(127) |
Aug
(103) |
Sep
(56) |
Oct
(42) |
Nov
(95) |
Dec
(58) |
2020 |
Jan
(102) |
Feb
(31) |
Mar
(93) |
Apr
(60) |
May
(57) |
Jun
(45) |
Jul
(29) |
Aug
(32) |
Sep
(44) |
Oct
(86) |
Nov
(51) |
Dec
(71) |
2021 |
Jan
(44) |
Feb
(25) |
Mar
(78) |
Apr
(130) |
May
(64) |
Jun
(74) |
Jul
(21) |
Aug
(64) |
Sep
(40) |
Oct
(43) |
Nov
(21) |
Dec
(99) |
2022 |
Jan
(154) |
Feb
(64) |
Mar
(45) |
Apr
(95) |
May
(62) |
Jun
(48) |
Jul
(73) |
Aug
(37) |
Sep
(71) |
Oct
(27) |
Nov
(40) |
Dec
(65) |
2023 |
Jan
(89) |
Feb
(130) |
Mar
(124) |
Apr
(50) |
May
(93) |
Jun
(46) |
Jul
(45) |
Aug
(68) |
Sep
(62) |
Oct
(71) |
Nov
(108) |
Dec
(82) |
2024 |
Jan
(53) |
Feb
(76) |
Mar
(64) |
Apr
(75) |
May
(36) |
Jun
(54) |
Jul
(98) |
Aug
(137) |
Sep
(58) |
Oct
(177) |
Nov
(84) |
Dec
(52) |
2025 |
Jan
(70) |
Feb
(53) |
Mar
(72) |
Apr
(47) |
May
(88) |
Jun
(49) |
Jul
(82) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:10
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/http Modified Files: RESTServer.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: RESTServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/RESTServer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RESTServer.java 23 Apr 2004 13:07:47 -0000 1.8 --- RESTServer.java 27 Apr 2004 15:46:59 -0000 1.9 *************** *** 464,468 **** long queryTime = System.currentTimeMillis() - startTime; LOG.debug("Found " + resultSequence.getLength() + " in " + queryTime + "ms."); - startTime = System.currentTimeMillis(); return printResults(broker, resultSequence, howmany, start, queryTime, outputProperties); --- 464,467 ---- |
From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:39:03
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage/store In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26634/src/org/exist/storage/store Modified Files: DOMFileIterator.java Log Message: An exception occurred when recreating a previously removed collection. Index: DOMFileIterator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/store/DOMFileIterator.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DOMFileIterator.java 15 Apr 2004 09:23:04 -0000 1.5 --- DOMFileIterator.java 27 Apr 2004 15:38:54 -0000 1.6 *************** *** 252,257 **** } else return false; ! } else if (page > -1) ! p = db.getCurrentPage(page); return true; } --- 252,258 ---- } else return false; ! } else if (page == -1) ! return false; ! p = db.getCurrentPage(page); return true; } |
From: Giulio V. <gva...@us...> - 2004-04-26 14:08:19
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19937/src/org/exist/xquery/functions/xmldb Added Files: XMLDBGroup.java XMLDBOwner.java XMLDBPermissions.java Log Message: Add get-resource-owner, get-resource-group, get-resource-permissions to xmldb extensions --- NEW FILE: XMLDBPermissions.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-03 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.exist.xquery.functions.xmldb; import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.StringValue; import org.exist.xquery.value.IntegerValue; import org.exist.xquery.value.Type; import org.exist.security.Permission; import org.exist.security.User; /** * @author Wolfgang Meier (wol...@ex...) * */ public class XMLDBPermissions extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("get-resource-permissions", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), "Returns document permissions", new SequenceType[] { new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE) }, new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)); public XMLDBPermissions(XQueryContext context) { super(context, signature); } /* (non-Javadoc) * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) */ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { Permission perm = null; NodeValue node = (NodeValue)args[0].itemAt(0); if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; perm = proxy.doc.getPermissions(); if(perm == null) return Sequence.EMPTY_SEQUENCE; else return new IntegerValue(perm.getPermissions(), Type.INT); } return Sequence.EMPTY_SEQUENCE; } } --- NEW FILE: XMLDBOwner.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-03 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.exist.xquery.functions.xmldb; import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.StringValue; import org.exist.xquery.value.Type; import org.exist.security.Permission; import org.exist.security.User; /** * @author Wolfgang Meier (wol...@ex...) * */ public class XMLDBOwner extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("get-resource-owner", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), "Returns document owner", new SequenceType[] { new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE) }, new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)); public XMLDBOwner(XQueryContext context) { super(context, signature); } /* (non-Javadoc) * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) */ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { Permission perm = null; NodeValue node = (NodeValue)args[0].itemAt(0); if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; perm = proxy.doc.getPermissions(); if(perm == null) return Sequence.EMPTY_SEQUENCE; else return new StringValue(perm.getOwner()); } return Sequence.EMPTY_SEQUENCE; } } --- NEW FILE: XMLDBGroup.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-03 Wolfgang M. Meier * wol...@ex... * http://exist.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ package org.exist.xquery.functions.xmldb; import org.exist.dom.NodeProxy; import org.exist.dom.QName; import org.exist.xquery.BasicFunction; import org.exist.xquery.Cardinality; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.value.NodeValue; import org.exist.xquery.value.Sequence; import org.exist.xquery.value.SequenceType; import org.exist.xquery.value.StringValue; import org.exist.xquery.value.Type; import org.exist.security.Permission; import org.exist.security.User; /** * @author Wolfgang Meier (wol...@ex...) * */ public class XMLDBGroup extends BasicFunction { public final static FunctionSignature signature = new FunctionSignature( new QName("get-resource-group", ModuleImpl.NAMESPACE_URI, ModuleImpl.PREFIX), "Returns document group", new SequenceType[] { new SequenceType(Type.NODE, Cardinality.EXACTLY_ONE) }, new SequenceType(Type.STRING, Cardinality.ZERO_OR_ONE)); public XMLDBGroup(XQueryContext context) { super(context, signature); } /* (non-Javadoc) * @see org.exist.xquery.BasicFunction#eval(org.exist.xquery.value.Sequence[], org.exist.xquery.value.Sequence) */ public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException { Permission perm = null; NodeValue node = (NodeValue)args[0].itemAt(0); if(node.getImplementationType() == NodeValue.PERSISTENT_NODE) { NodeProxy proxy = (NodeProxy)node; perm = proxy.doc.getPermissions(); if(perm == null) return Sequence.EMPTY_SEQUENCE; else return new StringValue(perm.getOwnerGroup()); } return Sequence.EMPTY_SEQUENCE; } } |
From: Giulio V. <gva...@us...> - 2004-04-26 14:07:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19638/src/org/exist/xquery/functions/xmldb Modified Files: ModuleImpl.java Log Message: Add get-resource-owner, get-resource-group, get-resource-permissions to xmldb extensions Index: ModuleImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/xmldb/ModuleImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ModuleImpl.java 26 Mar 2004 11:04:01 -0000 1.5 --- ModuleImpl.java 26 Apr 2004 14:06:54 -0000 1.6 *************** *** 21,24 **** --- 21,25 ---- * $Id$ */ + package org.exist.xquery.functions.xmldb; *************** *** 45,49 **** new FunctionDef(XMLDBHasLock.signature, XMLDBHasLock.class), new FunctionDef(XMLDBCreated.signature, XMLDBCreated.class), ! new FunctionDef(XMLDBLastModified.signature, XMLDBLastModified.class) }; --- 46,53 ---- new FunctionDef(XMLDBHasLock.signature, XMLDBHasLock.class), new FunctionDef(XMLDBCreated.signature, XMLDBCreated.class), ! new FunctionDef(XMLDBLastModified.signature, XMLDBLastModified.class), ! new FunctionDef(XMLDBPermissions.signature, XMLDBPermissions.class), ! new FunctionDef(XMLDBGroup.signature, XMLDBGroup.class), ! new FunctionDef(XMLDBOwner.signature, XMLDBOwner.class) }; |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 18:50:14
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27795/src/org/exist/http/servlets Modified Files: EXistServlet.java Log Message: Check if an XmldbPrincipal has been passed. Index: EXistServlet.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets/EXistServlet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EXistServlet.java 15 Apr 2004 09:19:05 -0000 1.3 --- EXistServlet.java 24 Apr 2004 18:50:06 -0000 1.4 *************** *** 30,33 **** --- 30,34 ---- import java.io.Reader; import java.io.StringWriter; + import java.security.Principal; import java.util.Enumeration; import java.util.HashMap; *************** *** 51,54 **** --- 52,56 ---- import org.exist.security.SecurityManager; import org.exist.security.User; + import org.exist.security.XmldbPrincipal; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; *************** *** 287,290 **** --- 289,313 ---- private User authenticate(HttpServletRequest request) { + // First try to validate the principial if passed from the servlet engine + Principal principal = request.getUserPrincipal(); + + if(principal instanceof XmldbPrincipal){ + String username = ((XmldbPrincipal)principal).getName(); + String password = ((XmldbPrincipal)principal).getPassword(); + + this.log("Validating Principle: " + principal.getName()); + User user = pool.getSecurityManager().getUser(username); + + if (user != null){ + if (password.equalsIgnoreCase(user.getPassword())){ + this.log("Valid User: " + user.getName()); + return user; + }else{ + this.log( "Password invalid for user: " + username ); + } + this.log("User not found: " + principal.getName()); + } + } + String auth = request.getHeader("Authorization"); if(auth == null) |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:03
|
Update of /cvsroot/exist/eXist-1.0/webapp/stylesheets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226/webapp/stylesheets Modified Files: xmldb-collection.xsl Log Message: Added XmldbRealm for Tomcat Index: xmldb-collection.xsl =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/stylesheets/xmldb-collection.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** xmldb-collection.xsl 2 Feb 2004 15:30:37 -0000 1.2 --- xmldb-collection.xsl 24 Apr 2004 13:45:54 -0000 1.3 *************** *** 1,3 **** ! <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet --- 1,3 ---- ! <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:03
|
Update of /cvsroot/exist/eXist-1.0/webapp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226/webapp Modified Files: sitemap.xmap Log Message: Added XmldbRealm for Tomcat Index: sitemap.xmap =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/sitemap.xmap,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** sitemap.xmap 10 Feb 2004 20:21:50 -0000 1.24 --- sitemap.xmap 24 Apr 2004 13:45:54 -0000 1.25 *************** *** 534,539 **** <map:transform src="stylesheets/xmldb-collection.xsl"> <map:parameter name="collection" value="{1}"/> ! </map:transform> ! <map:serialize type="html"/> </map:match> --- 534,540 ---- <map:transform src="stylesheets/xmldb-collection.xsl"> <map:parameter name="collection" value="{1}"/> ! </map:transform> ! <map:transform type="encodeURL"/> ! <map:serialize type="html" encoding="UTF-8"/> </map:match> *************** *** 564,568 **** <map:serialize type="html"/> </map:match> ! <map:generate src="xmldb:exist:///{1}"/> <map:select type="browser"> <map:when test="explorer"> --- 565,570 ---- <map:serialize type="html"/> </map:match> ! <map:generate src="xmldb:exist:///{1}"/> ! <map:transform type="encodeURL"/> <map:select type="browser"> <map:when test="explorer"> *************** *** 571,575 **** <map:otherwise> <map:transform src="stylesheets/system/xml2html.xslt"/> ! <map:serialize type="html"/> </map:otherwise> </map:select> --- 573,577 ---- <map:otherwise> <map:transform src="stylesheets/system/xml2html.xslt"/> ! <map:serialize type="html" encoding="UTF-8"/> </map:otherwise> </map:select> |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:03
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/realm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226/src/org/exist/http/realm Added Files: XmldbRealm.java XmldbPrincipal.java Log Message: Added XmldbRealm for Tomcat --- NEW FILE: XmldbRealm.java --- package org.exist.http.realm; import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.security.Principal; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.catalina.LifecycleException; import org.apache.catalina.Realm; import org.apache.catalina.realm.GenericPrincipal; import org.exist.EXistException; import org.exist.security.User; import org.exist.security.SecurityManager; import org.exist.storage.BrokerPool; import org.exist.util.Configuration; import org.exist.util.DatabaseConfigurationException; import org.exist.xmldb.UserManagementService; import org.xmldb.api.DatabaseManager; import org.xmldb.api.base.Collection; import org.xmldb.api.base.Database; import org.xmldb.api.base.XMLDBException; public class XmldbRealm extends org.apache.catalina.realm.RealmBase { private String basedir = "."; private String configuration = "conf.xml"; private String uri = "xmldb:exist:///db"; private String driver = "org.exist.xmldb.DatabaseImpl"; private UserManagementService service = null; private User defaultUser = null; /** * Descriptive information about this Realm implementation. */ protected final String info = "XMLDBRealm/1.0"; /** * Descriptive information about this Realm implementation. */ protected static final String name = "XMLDBRealm"; /** * Return descriptive information about this Realm implementation and the * corresponding version number, in the format <code><description>/<version></code>. */ public String getInfo() { return info; } /** * Return the Principal associated with the specified username and * credentials, if there is one; otherwise return <code>null</code>. * * @param username * Username of the Principal to look up * @param credentials * Password or other credentials to use in authenticating this * username */ public Principal authenticate(String username, String credentials) { GenericPrincipal principal = (GenericPrincipal) getPrincipal(username); boolean validated = false; if (principal != null) { if (hasMessageDigest()) { // Hex hashes should be compared case-insensitive validated = (digest(credentials).equalsIgnoreCase(principal .getPassword())); } else { validated = (digest(credentials) .equals(principal.getPassword())); } } if (validated) { if (debug >= 2) log(sm.getString("userDatabaseRealm.authenticateSuccess", username)); return (principal); } else { if (debug >= 2) log(sm.getString("userDatabaseRealm.authenticateFailure", username)); return (null); } } /** * Return a short name for this Realm implementation. */ protected String getName() { return name; } /** * Return the password associated with the given principal's user name. */ protected String getPassword(String username) { GenericPrincipal principal = (GenericPrincipal) getPrincipal(username); if (principal != null) { return (principal.getPassword()); } else { return (null); } } /** * Return the Principal associated with the given user name. */ protected Principal getPrincipal(String username) { User user = null; try { user = service.getUser(username); } catch (XMLDBException e) { } if (user == null) { user = defaultUser; } // Accumulate the list of roles for this user ArrayList list = new ArrayList(); Iterator groups = user.getGroups(); while (groups.hasNext()) { list.add(groups.next()); } return (Principal) new DefaultXmldbPrinciple(this, username, user.getPassword(), list); } protected class DefaultXmldbPrinciple extends GenericPrincipal implements XmldbPrincipal { public DefaultXmldbPrinciple(Realm arg0, String arg1, String arg2, List arg3) { super(arg0, arg1, arg2, arg3); } } /** * Prepare for active use of the public methods of this Component. * * @exception LifecycleException * if this component detects a fatal error that prevents it * from being started */ public synchronized void start() throws LifecycleException { try { URI existURI = new URI(uri); if("".equals(existURI.getHost()) || existURI.getHost() == null){ this.startExistDb(); } String driver = "org.exist.xmldb.DatabaseImpl"; Class cl = Class.forName(driver); DatabaseManager.registerDatabase((Database) cl.newInstance()); // try to get collection Collection collection = DatabaseManager.getCollection(uri); if (collection == null) { throw new LifecycleException("unable to resolve"); } service = (UserManagementService) collection .getService("UserManagementService", "1.0"); defaultUser = service.getUser(SecurityManager.GUEST_USER); /* initialize security */ boolean admin = true; if(admin){ User adminUser = service.getUser(SecurityManager.DBA_USER); if(adminUser.getPassword() == null){ adminUser.setPassword("admin"); log("Update Admin User on inital start"); } } } catch (ClassNotFoundException e) { throw new LifecycleException(e.getMessage(),e); } catch (XMLDBException e) { throw new LifecycleException(e.getMessage(),e); } catch (InstantiationException e) { throw new LifecycleException(e.getMessage(),e); } catch (IllegalAccessException e) { throw new LifecycleException(e.getMessage(),e); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Perform normal superclass initialization super.start(); } /* (non-Javadoc) * @see org.apache.catalina.Lifecycle#stop() */ public void stop() throws LifecycleException { super.stop(); BrokerPool.stopAll(false); } public synchronized void startExistDb() throws LifecycleException { try { if (!BrokerPool.isConfigured()) { this.log("Starting Database"); this.log("exist.home=" + basedir); File f = new File(basedir + File.separator + configuration); this.log("reading configuration from " + f.getAbsolutePath()); if (!f.canRead()) throw new LifecycleException("configuration file " + configuration + " not found or not readable"); Configuration conf = new Configuration(configuration, basedir); BrokerPool.configure(1, 5, conf); } } catch (EXistException e) { throw new LifecycleException(e.getMessage(),e); } catch (DatabaseConfigurationException e) { throw new LifecycleException(e.getMessage(),e); } } /** * @return Returns the basedir. */ public String getBasedir() { return basedir; } /** * @param basedir The basedir to set. */ public void setBasedir(String basedir) { this.basedir = basedir; } /** * @return Returns the configuration. */ public String getConfiguration() { return configuration; } /** * @param configuration The configuration to set. */ public void setConfiguration(String configuration) { this.configuration = configuration; } /** * @return Returns the driver. */ public String getDriver() { return driver; } /** * @param driver The driver to set. */ public void setDriver(String driver) { this.driver = driver; } /** * @return Returns the uri. */ public String getUri() { return uri; } /** * @param uri The uri to set. */ public void setUri(String uri) { this.uri = uri; } } --- NEW FILE: XmldbPrincipal.java --- package org.exist.http.realm; import java.security.Principal; /** * @author mdiggory */ public interface XmldbPrincipal extends Principal { public String getName(); public String getPassword(); public boolean hasRole(String role); } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:02
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226 Modified Files: .classpath build.properties build.xml Log Message: Added XmldbRealm for Tomcat Index: .classpath =================================================================== RCS file: /cvsroot/exist/eXist-1.0/.classpath,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** .classpath 23 Feb 2004 09:36:04 -0000 1.18 --- .classpath 24 Apr 2004 13:45:53 -0000 1.19 *************** *** 60,63 **** --- 60,64 ---- <classpathentry kind="lib" path="lib/core/javax.servlet.jar"/> <classpathentry kind="lib" path="lib/endorsed/xerces-2.6.1.jar"/> + <classpathentry kind="lib" path="/home/wolf/Java/jakarta-tomcat-5.0.19/server/lib/catalina.jar"/> <classpathentry kind="output" path="build/classes"/> </classpath> Index: build.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.xml,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** build.xml 23 Apr 2004 13:07:46 -0000 1.46 --- build.xml 24 Apr 2004 13:45:53 -0000 1.47 *************** *** 31,36 **** <property name="xmldb.src" value="undefined"/> ! <property name="dist.dir" value="${dist}/${project.name}-${project.version}"/> <available file="${xmldb.src}" type="dir" property="has.xmldb.src"/> <path id="classpath.core"> --- 31,39 ---- <property name="xmldb.src" value="undefined"/> ! <property name="dist.dir" value="${dist}/${project.name}-${project.version}"/> ! <available file="${xmldb.src}" type="dir" property="has.xmldb.src"/> + + <available file="${catalina.home}/server/lib" property="catalina.present"/> <path id="classpath.core"> *************** *** 49,53 **** <pathelement path="exist.jar"/> <pathelement path="exist-optional.jar"/> ! <pathelement path="${java.class.path}"/> </path> --- 52,56 ---- <pathelement path="exist.jar"/> <pathelement path="exist-optional.jar"/> ! <pathelement path="${java.class.path}"/> </path> *************** *** 98,101 **** --- 101,106 ---- destdir="${build.classes}" encoding="UTF-8" optimize="${build.optimize}" srcdir="${src}" target="1.4"> + <include name="org/**"/> + <exclude name="org/exist/http/realm/**"/> <classpath> <path refid="classpath.core"/> *************** *** 104,108 **** </javac> </target> ! <!-- =================================================================== --> <!-- Run antlr parser generator --> --- 109,134 ---- </javac> </target> ! ! <!-- =================================================================== --> ! <!-- Compile the Tomcat realm --> ! <!-- =================================================================== --> ! <target name="compile-tomcat-realm" if="catalina.present"> ! <echo message="Compiling Tomcat Realm"/> ! <javac debug="${build.debug}" deprecation="${build.deprecation}" ! destdir="${build.classes}" encoding="UTF-8" ! optimize="${build.optimize}" srcdir="${src}" target="1.4"> ! <include name="org/exist/http/realm/**"/> ! <classpath> ! <path refid="classpath.core"/> ! <fileset dir="${catalina.home}/server/lib"> ! <include name="*.jar"/> ! </fileset> ! <fileset dir="${catalina.home}/common/lib"> ! <include name="*.jar"/> ! </fileset> ! </classpath> ! </javac> ! </target> ! <!-- =================================================================== --> <!-- Run antlr parser generator --> *************** *** 150,154 **** <!-- Create jar file --> <!-- =================================================================== --> ! <target name="jar" depends="compile"> <copy file="${src}/CatalogManager.properties" todir="${build.classes}"/> <copy todir="${build.classes}/org/exist/client"> --- 176,180 ---- <!-- Create jar file --> <!-- =================================================================== --> ! <target name="jar" depends="compile, compile-tomcat-realm"> <copy file="${src}/CatalogManager.properties" todir="${build.classes}"/> <copy todir="${build.classes}/org/exist/client"> Index: build.properties =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.properties,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** build.properties 23 Apr 2004 13:07:46 -0000 1.18 --- build.properties 24 Apr 2004 13:45:53 -0000 1.19 *************** *** 25,26 **** --- 25,29 ---- # sources of the XML:DB API. Needed for javadoc xmldb.src = /home/wolf/Java/xmldb/xapi/src/api + + # Tomcat home directory. Required for building the XmldbRealm + catalina.home = /home/wolf/Java/jakarta-tomcat-5.0.19 |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:02
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xmldb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226/src/org/exist/xmldb Modified Files: DatabaseImpl.java Log Message: Added XmldbRealm for Tomcat Index: DatabaseImpl.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xmldb/DatabaseImpl.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DatabaseImpl.java 14 Apr 2004 12:17:22 -0000 1.12 --- DatabaseImpl.java 24 Apr 2004 13:45:54 -0000 1.13 *************** *** 166,175 **** if ( user != null ) { u = pool.getSecurityManager().getUser( user ); ! if ( u == null ) ! throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "user " + user + " does not exist" ); ! if ( !u.validate( password ) ) ! throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "invalid password" ); } try { --- 166,177 ---- if ( user != null ) { u = pool.getSecurityManager().getUser( user ); ! if ( u == null ) { ! throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "user " + user + " does not exist" ); ! } ! if ( !u.validate( password ) ) { ! throw new XMLDBException( ErrorCodes.PERMISSION_DENIED, "invalid password" ); + } } try { |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:46:02
|
Update of /cvsroot/exist/eXist-1.0/webapp/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7226/webapp/WEB-INF Modified Files: web.xml Log Message: Added XmldbRealm for Tomcat Index: web.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/webapp/WEB-INF/web.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** web.xml 23 Apr 2004 13:07:45 -0000 1.16 --- web.xml 24 Apr 2004 13:45:54 -0000 1.17 *************** *** 49,53 **** </init-param> ! <load-on-startup>2</load-on-startup> </servlet> --- 49,53 ---- </init-param> ! <load-on-startup>1</load-on-startup> </servlet> |
From: Wolfgang M. M. <wol...@us...> - 2004-04-24 13:43:05
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/realm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7143/src/org/exist/http/realm Log Message: Directory /cvsroot/exist/eXist-1.0/src/org/exist/http/realm added to the repository |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 14:07:20
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/cocoon In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15015/src/org/exist/cocoon Modified Files: XQueryGenerator.java Log Message: XQueryGenerator now registers the XMLDB driver during initialization. Index: XQueryGenerator.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/cocoon/XQueryGenerator.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** XQueryGenerator.java 15 Apr 2004 09:20:54 -0000 1.13 --- XQueryGenerator.java 23 Apr 2004 14:07:11 -0000 1.14 *************** *** 53,56 **** --- 53,57 ---- import org.xmldb.api.DatabaseManager; import org.xmldb.api.base.Collection; + import org.xmldb.api.base.Database; import org.xmldb.api.base.ResourceSet; import org.xmldb.api.base.XMLDBException; *************** *** 79,82 **** --- 80,85 ---- public class XQueryGenerator extends ServiceableGenerator { + public final static String DRIVER = "org.exist.xmldb.DatabaseImpl"; + private Source inputSource = null; private Map objectModel = null; *************** *** 142,145 **** --- 145,156 ---- } } + try { + Class driver = Class.forName(DRIVER); + Database database = (Database)driver.newInstance(); + database.setProperty("create-database", "true"); + DatabaseManager.registerDatabase(database); + } catch(Exception e) { + throw new ProcessingException("Failed to initialize database driver: " + e.getMessage(), e); + } } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:14:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3779/src/org/exist/http/webdav/methods Added Files: Delete.java Get.java Options.java Put.java Head.java Propfind.java Log Message: New WebDAV module (initial check in) --- NEW FILE: Get.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Get.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.dom.BinaryDocument; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAV; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.storage.serializers.Serializer; import org.xml.sax.SAXException; /** * @author wolf */ public class Get implements WebDAVMethod { private BrokerPool pool; public Get(BrokerPool pool) { this.pool = pool; } /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { if(resource == null) { // GET is not available on collections response.sendError(HttpServletResponse.SC_FORBIDDEN, "GET is not available on collections"); return; } String contentType; if(resource.getResourceType() == DocumentImpl.XML_FILE) contentType = WebDAV.XML_CONTENT; else contentType = WebDAV.BINARY_CONTENT; response.setContentType(contentType); response.addDateHeader("Last-Modified", resource.getLastModified()); byte[] contentData = null; DBBroker broker = null; try { broker = pool.get(); if(resource.getResourceType() == DocumentImpl.XML_FILE) { Serializer serializer = broker.getSerializer(); serializer.reset(); try { serializer.setProperties(WebDAV.OUTPUT_PROPERTIES); String content = serializer.serialize(resource); contentData = content.getBytes("UTF-8"); } catch (SAXException e) { throw new ServletException("Error while serializing document: " + e.getMessage(), e); } } else contentData = broker.getBinaryResourceData((BinaryDocument)resource); } catch (EXistException e) { throw new ServletException("Error while serializing document: " + e.getMessage(), e); } finally { pool.release(broker); } if(contentData == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } response.setContentLength(contentData.length); ServletOutputStream os = response.getOutputStream(); os.write(contentData); os.flush(); } } --- NEW FILE: Put.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Put.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URI; import java.net.URISyntaxException; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.collections.triggers.TriggerException; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.util.LockException; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * @author wolf */ public class Put implements WebDAVMethod { private BrokerPool pool; public Put(BrokerPool pool) { this.pool = pool; } /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { File tempFile = saveRequestContent(request); String url; try { url = new URI(tempFile.toURL().toString()).toASCIIString(); } catch (URISyntaxException e1) { url = tempFile.toString(); } String contentType = request.getContentType(); String path = request.getPathInfo(); DBBroker broker = null; try { broker = pool.get(); if(collection == null) { if(path == null) path = ""; if(path.endsWith("/")) path = path.substring(0, path.length() - 1); int p = path.lastIndexOf('/'); if(p < 1) { response.sendError(HttpServletResponse.SC_CONFLICT, "No collection specified for PUT"); return; } String collectionName = path.substring(0, p); path = path.substring(p + 1); collection = broker.getCollection(collectionName); if(collection == null) { response.sendError(HttpServletResponse.SC_CONFLICT, "Parent collection " + collectionName + " not found"); return; } } else path = path.substring(collection.getName().length() + 1); LOG.debug("storing document " + path + "; content-type = " + contentType); if(contentType == null || contentType.equalsIgnoreCase("text/xml")) { DocumentImpl doc = collection.addDocument(broker, path, new InputSource(url)); } else { byte[] chunk = new byte[4096]; ByteArrayOutputStream os = new ByteArrayOutputStream(); FileInputStream is = new FileInputStream(tempFile); int l; while((l = is.read(chunk)) > -1) { os.write(chunk, 0, l); } collection.addBinaryResource(broker, path, os.toByteArray()); } } catch (EXistException e) { throw new ServletException("Failed to store resource: " + e.getMessage(), e); } catch (PermissionDeniedException e) { response.sendError(HttpServletResponse.SC_FORBIDDEN); } catch (TriggerException e) { response.sendError(HttpServletResponse.SC_FORBIDDEN); } catch (SAXException e) { response.sendError(HttpServletResponse.SC_BAD_REQUEST); } catch (LockException e) { response.sendError(HttpServletResponse.SC_CONFLICT); } finally { pool.release(broker); } response.setStatus(HttpServletResponse.SC_CREATED); } private File saveRequestContent(HttpServletRequest request) throws IOException { ServletInputStream is = request.getInputStream(); int len = request.getContentLength(); // put may send a lot of data, so save it // to a temporary file first. File tempFile = File.createTempFile("exist", ".tmp"); OutputStream os = new FileOutputStream(tempFile); byte[] buffer = new byte[4096]; int count, l = 0; do { count = is.read(buffer); if (count > 0) os.write(buffer, 0, count); l += count; } while (l < len); os.close(); return tempFile; } } --- NEW FILE: Options.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Options.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.User; /** * @author wolf */ public class Options implements WebDAVMethod { /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { response.addHeader("DAV", "1"); response.addHeader("Allow", "OPTIONS, GET, HEAD, PUT, PROPFIND"); // MS specific response.addHeader("MS-Author-Via", "DAV"); } } --- NEW FILE: Head.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Head.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAV; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.User; /** * @author wolf */ public class Head implements WebDAVMethod { /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(org.exist.security.User, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { if(resource == null) { // GET is not available on collections response.sendError(HttpServletResponse.SC_FORBIDDEN, "GET is not available on collections"); return; } String contentType; if(resource.getResourceType() == DocumentImpl.XML_FILE) contentType = WebDAV.XML_CONTENT; else contentType = WebDAV.BINARY_CONTENT; response.setContentType(contentType); response.addDateHeader("Last-Modified", resource.getLastModified()); } } --- NEW FILE: Delete.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Delete.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.collections.triggers.TriggerException; import org.exist.dom.DocumentImpl; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.util.LockException; /** * @author wolf */ public class Delete implements WebDAVMethod { private BrokerPool pool; public Delete(BrokerPool pool) { this.pool = pool; } /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.exist.collections.Collection, org.exist.dom.DocumentImpl) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { if(collection == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } DBBroker broker = null; try { broker = pool.get(); if(resource == null) broker.removeCollection(collection.getName()); else { String path = resource.getFileName(); int p = path.lastIndexOf('/'); String docName = path.substring(p + 1); if(resource.getResourceType() == DocumentImpl.BINARY_FILE) resource.getCollection().removeBinaryResource(broker, docName); else resource.getCollection().removeDocument(broker, docName); } } catch (EXistException e) { response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage()); } catch (PermissionDeniedException e) { response.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage()); } catch (LockException e) { response.sendError(HttpServletResponse.SC_CONFLICT, e.getMessage()); } catch (TriggerException e) { response.sendError(HttpServletResponse.SC_CONFLICT, e.getMessage()); } finally { pool.release(broker); } } } --- NEW FILE: Propfind.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Propfind.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav.methods; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.dom.QName; import org.exist.http.webdav.WebDAV; import org.exist.http.webdav.WebDAVMethod; import org.exist.security.Permission; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.util.serializer.SAXSerializer; import org.exist.util.serializer.SAXSerializerPool; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; /** * @author wolf */ public class Propfind implements WebDAVMethod { // error messages private final static String PARSE_ERR = "Request content could not be parsed: "; private final static String XML_CONFIGURATION_ERR = "Failed to create XML parser: "; private final static String UNEXPECTED_ELEMENT_ERR = "Unexpected element found: "; // search types private final static int FIND_ALL_PROPERTIES = 0; private final static int FIND_BY_PROPERTY = 1; private final static int FIND_PROPERTY_NAMES = 2; private final static SimpleDateFormat creationDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US); private final static SimpleDateFormat modificationDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); static { creationDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); modificationDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); } // default prefix for the webdav namespace private final static String PREFIX = "D"; // constants for known properties private final static QName DISPLAY_NAME_PROP = new QName("displayname", WebDAV.DAV_NS, PREFIX); private final static QName CREATION_DATE_PROP = new QName("creationdate", WebDAV.DAV_NS, PREFIX); private final static QName RESOURCE_TYPE_PROP = new QName("resourcetype", WebDAV.DAV_NS, PREFIX); private final static QName CONTENT_TYPE_PROP = new QName("getcontenttype", WebDAV.DAV_NS, PREFIX); private final static QName CONTENT_LENGTH_PROP = new QName("getcontentlength", WebDAV.DAV_NS, PREFIX); private final static QName LAST_MODIFIED_PROP = new QName("getlastmodified", WebDAV.DAV_NS, PREFIX); private final static QName ETAG_PROP = new QName("etag", WebDAV.DAV_NS, PREFIX); private final static QName STATUS_PROP = new QName("status", WebDAV.DAV_NS, PREFIX); private final static QName COLLECTION_PROP = new QName("collection", WebDAV.DAV_NS, PREFIX); private DocumentBuilderFactory docFactory; private BrokerPool pool; public Propfind(BrokerPool pool) { this.pool = pool; docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true); } /* (non-Javadoc) * @see org.exist.http.webdav.WebDAVMethod#process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException { if(collection == null) { LOG.debug("No resource or collection found"); response.sendError(HttpServletResponse.SC_NOT_FOUND, "No resource or collection found"); return; } if(!collection.getPermissions().validate(user, Permission.READ)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } if(resource != null && (!resource.getPermissions().validate(user, Permission.READ))) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } Document doc = parseRequestContent(request, response); if(doc == null) return; Element propfind = doc.getDocumentElement(); if(!(propfind.getLocalName().equals("propfind") && propfind.getNamespaceURI().equals(WebDAV.DAV_NS))) { LOG.debug(UNEXPECTED_ELEMENT_ERR + propfind.getNodeName()); response.sendError(HttpServletResponse.SC_BAD_REQUEST, UNEXPECTED_ELEMENT_ERR + propfind.getNodeName()); return; } int type = FIND_ALL_PROPERTIES; DAVProperties searchedProperties = new DAVProperties(); NodeList childNodes = propfind.getChildNodes(); for(int i = 0; i < childNodes.getLength(); i++) { Node currentNode = childNodes.item(i); if(currentNode.getNodeType() == Node.ELEMENT_NODE) { if(currentNode.getNamespaceURI().equals(WebDAV.DAV_NS)) { if(currentNode.getLocalName().equals("prop")) { type = FIND_BY_PROPERTY; getPropertyNames(currentNode, searchedProperties); } if(currentNode.getLocalName().equals("allprop")) type = FIND_ALL_PROPERTIES; if(currentNode.getLocalName().equals("propname")) type = FIND_PROPERTY_NAMES; } else { // Found an unknown element: return with 400 Bad Request LOG.debug("Unexpected child: " + currentNode.getNodeName()); response.sendError(HttpServletResponse.SC_BAD_REQUEST, UNEXPECTED_ELEMENT_ERR + currentNode.getNodeName()); return; } } } String servletPath = getServletPath(request); int depth = getDepth(request); StringWriter os = new StringWriter(); SAXSerializer serializer = SAXSerializerPool.getInstance().borrowSAXSerializer(); try { serializer.setWriter(os); serializer.setOutputProperties(WebDAV.OUTPUT_PROPERTIES); AttributesImpl attrs = new AttributesImpl(); serializer.startDocument(); serializer.startPrefixMapping(PREFIX, WebDAV.DAV_NS); serializer.startElement(WebDAV.DAV_NS, "multistatus", "D:multistatus", attrs); if(type == FIND_ALL_PROPERTIES || type == FIND_BY_PROPERTY) { if(resource != null) writeResourceProperties(user, searchedProperties, type, resource, serializer, servletPath); else writeCollectionProperties(user, searchedProperties, type, collection, serializer, servletPath, depth, 0); } serializer.endElement(WebDAV.DAV_NS, "multistatus", "D:multistatus"); serializer.endPrefixMapping(PREFIX); serializer.endDocument(); } catch (SAXException e) { throw new ServletException("Exception while writing multistatus response: " + e.getMessage(), e); } finally { SAXSerializerPool.getInstance().returnSAXSerializer(serializer); } String content = os.toString(); LOG.debug("response:\n" + content); writeResponse(response, content); } private void writeCollectionProperties(User user, DAVProperties searchedProperties, int type, Collection collection, SAXSerializer serializer, String servletPath, int maxDepth, int currentDepth) throws SAXException { if(!collection.getPermissions().validate(user, Permission.READ)) return; AttributesImpl attrs = new AttributesImpl(); searchedProperties.reset(); serializer.startElement(WebDAV.DAV_NS, "response", "D:response", attrs); // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); serializer.characters(servletPath + collection.getName()); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs); serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs); if(shouldIncludeProperty(type, searchedProperties, DISPLAY_NAME_PROP)) { // write D:displayname String displayName = collection.getName(); int p = displayName.lastIndexOf('/'); if(p > -1) displayName = displayName.substring(p + 1); writeSimpleElement(DISPLAY_NAME_PROP, displayName, serializer); } if(shouldIncludeProperty(type, searchedProperties, RESOURCE_TYPE_PROP)) { serializer.startElement(WebDAV.DAV_NS, "resourcetype", "D:resourcetype", attrs); writeEmptyElement(COLLECTION_PROP, serializer); serializer.endElement(WebDAV.DAV_NS, "resourcetype", "D:resourcetype"); } if(shouldIncludeProperty(type, searchedProperties, CREATION_DATE_PROP)) { long created = collection.getCreationTime(); writeSimpleElement(CREATION_DATE_PROP, creationDateFormat.format(new Date(created)), serializer); } serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop"); writeSimpleElement(STATUS_PROP, "HTTP/1.1 200 OK", serializer); serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat"); if(type == FIND_BY_PROPERTY) { List unvisited = searchedProperties.unvisitedProperties(); if(unvisited.size() > 0) { // there were unsupported properties. Report these to the client. serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs); serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs); for(Iterator i = unvisited.iterator(); i.hasNext(); ) { writeEmptyElement((QName)i.next(), serializer); } serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop"); writeSimpleElement(STATUS_PROP, "HTTP/1.1 404 Not Found", serializer); serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat"); } } serializer.endElement(WebDAV.DAV_NS, "response", "D:response"); if(currentDepth++ < maxDepth) { if(collection.getDocumentCount() > 0) { DBBroker broker = null; try { broker = pool.get(); for(Iterator i = collection.iterator(broker); i.hasNext(); ) { DocumentImpl doc = (DocumentImpl)i.next(); writeResourceProperties(user, searchedProperties, type, doc, serializer, servletPath); } } catch (EXistException e) { } finally { pool.release(broker); } } if(collection.getChildCollectionCount() > 0) { for(Iterator i = collection.collectionIterator(); i.hasNext(); ) { String child = (String)i.next(); Collection childCollection = null; DBBroker broker = null; try { broker = pool.get(); childCollection = broker.getCollection(collection.getName() + '/' + child); } catch (Exception e) { } finally { pool.release(broker); } if(childCollection != null) writeCollectionProperties(user, searchedProperties, type, childCollection, serializer, servletPath, maxDepth, currentDepth); } } } } private void writeResourceProperties(User user, DAVProperties searchedProperties, int type, DocumentImpl resource, SAXSerializer serializer, String servletPath) throws SAXException { if(!resource.getPermissions().validate(user, Permission.READ)) return; AttributesImpl attrs = new AttributesImpl(); searchedProperties.reset(); serializer.startElement(WebDAV.DAV_NS, "response", "D:response", attrs); // write D:href serializer.startElement(WebDAV.DAV_NS, "href", "D:href", attrs); serializer.characters(servletPath + resource.getFileName()); serializer.endElement(WebDAV.DAV_NS, "href", "D:href"); serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs); serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs); if(shouldIncludeProperty(type, searchedProperties, DISPLAY_NAME_PROP)) { // write D:displayname String displayName = resource.getFileName(); int p = displayName.lastIndexOf('/'); if(p > -1) displayName = displayName.substring(p + 1); writeSimpleElement(DISPLAY_NAME_PROP, displayName, serializer); } if(shouldIncludeProperty(type, searchedProperties, RESOURCE_TYPE_PROP)) { writeEmptyElement(RESOURCE_TYPE_PROP, serializer); } if(shouldIncludeProperty(type, searchedProperties, CREATION_DATE_PROP)) { long created = resource.getCreated(); writeSimpleElement(CREATION_DATE_PROP, creationDateFormat.format(new Date(created)), serializer); } if(shouldIncludeProperty(type, searchedProperties, LAST_MODIFIED_PROP)) { long modified = resource.getLastModified(); writeSimpleElement(LAST_MODIFIED_PROP, modificationDateFormat.format(new Date(modified)), serializer); } if(shouldIncludeProperty(type, searchedProperties, CONTENT_TYPE_PROP)) { if(resource.getResourceType() == DocumentImpl.XML_FILE) writeSimpleElement(CONTENT_TYPE_PROP, WebDAV.XML_CONTENT, serializer); else writeSimpleElement(CONTENT_TYPE_PROP, WebDAV.BINARY_CONTENT, serializer); } serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop"); writeSimpleElement(STATUS_PROP, "HTTP/1.1 200 OK", serializer); serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat"); if(type == FIND_BY_PROPERTY) { List unvisited = searchedProperties.unvisitedProperties(); if(unvisited.size() > 0) { // there were unsupported properties. Report these to the client. serializer.startElement(WebDAV.DAV_NS, "propstat", "D:propstat", attrs); serializer.startElement(WebDAV.DAV_NS, "prop", "D:prop", attrs); for(Iterator i = unvisited.iterator(); i.hasNext(); ) { writeEmptyElement((QName)i.next(), serializer); } serializer.endElement(WebDAV.DAV_NS, "prop", "D:prop"); writeSimpleElement(STATUS_PROP, "HTTP/1.1 404 Not Found", serializer); serializer.endElement(WebDAV.DAV_NS, "propstat", "D:propstat"); } } serializer.endElement(WebDAV.DAV_NS, "response", "D:response"); } private boolean shouldIncludeProperty(int type, DAVProperties properties, QName name) { if(type == FIND_ALL_PROPERTIES) return true; return properties.includeProperty(name); } private void writeEmptyElement(QName qname, SAXSerializer serializer) throws SAXException { serializer.startElement(WebDAV.DAV_NS, qname.getLocalName(), qname.toString(), new AttributesImpl()); serializer.endElement(WebDAV.DAV_NS, qname.getLocalName(), qname.toString()); } private void writeSimpleElement(QName element, String content, SAXSerializer serializer) throws SAXException { serializer.startElement(WebDAV.DAV_NS, element.getLocalName(), element.toString(), new AttributesImpl()); serializer.characters(content); serializer.endElement(WebDAV.DAV_NS, element.getLocalName(), element.toString()); } private void writeResponse(HttpServletResponse response, String content) throws IOException { response.setStatus(WebDAV.SC_MULTI_STATUS); response.setContentType("text/xml; charset=UTF-8"); byte[] data = content.getBytes("UTF-8"); response.setContentLength(data.length); OutputStream os = response.getOutputStream(); os.write(data); os.flush(); } private String getServletPath(HttpServletRequest request) { String servletPath = request.getContextPath(); if(servletPath.endsWith("/")) { servletPath = servletPath.substring(0, servletPath.length()-1); } servletPath += request.getServletPath(); if(servletPath.endsWith("/")) { servletPath = servletPath.substring(0, servletPath.length()-1); } return servletPath; } protected int getDepth(HttpServletRequest req) { int depth = 1; // Depth: infitiy String depthStr = req.getHeader("Depth"); if (depthStr != null && depthStr.equals("0")) { depth = 0; } return depth; } private Document parseRequestContent(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String content = getRequestContent(request); LOG.debug("request:\n" + content); DocumentBuilder docBuilder =docFactory.newDocumentBuilder(); return docBuilder.parse(new InputSource(new StringReader(content))); } catch (ParserConfigurationException e) { throw new ServletException(XML_CONFIGURATION_ERR + e.getMessage(), e); } catch (SAXException e) { LOG.debug(e.getMessage(), e); response.sendError(HttpServletResponse.SC_BAD_REQUEST, PARSE_ERR + e.getMessage()); return null; } } private String getRequestContent(HttpServletRequest request) throws IOException { String encoding = request.getCharacterEncoding(); if(encoding == null) encoding = "UTF-8"; try { ServletInputStream is = request.getInputStream(); Reader reader = new InputStreamReader(is, encoding); StringWriter content = new StringWriter(); char ch[] = new char[4096]; int len = 0; while((len = reader.read(ch)) > -1) content.write(ch, 0, len); return content.toString(); } catch (UnsupportedEncodingException e) { throw new IOException("Unsupported character encoding in request content: " + encoding); } } private void getPropertyNames(Node propNode, DAVProperties properties) { NodeList childList = propNode.getChildNodes(); for(int i = 0; i < childList.getLength(); i++) { Node currentNode = childList.item(i); if(currentNode.getNodeType() == Node.ELEMENT_NODE) { properties.add(currentNode); } } } private static class Visited { boolean visited = false; boolean isVisited() { return visited; } void setVisited(boolean visit) { visited = visit; } } private static class DAVProperties extends HashMap { DAVProperties() { super(); } void add(Node node) { QName qname = new QName(node.getLocalName(), node.getNamespaceURI()); if(node.getNamespaceURI().equals(WebDAV.DAV_NS)) qname.setPrefix(PREFIX); else qname.setPrefix(node.getPrefix()); if(!containsKey(qname)) put(qname, new Visited()); } boolean includeProperty(QName property) { Visited visited = (Visited)get(property); if(visited == null) return false; boolean include = !visited.isVisited(); visited.setVisited(true); return include; } List unvisitedProperties() { List list = new ArrayList(5); for(Iterator i = entrySet().iterator(); i.hasNext(); ) { Map.Entry entry = (Map.Entry)i.next(); if(!((Visited)entry.getValue()).visited) list.add(entry.getKey()); } return list; } void reset() { for(Iterator i = values().iterator(); i.hasNext(); ) { Visited visited = (Visited)i.next(); visited.setVisited(false); } } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:14:11
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3779/src/org/exist/http/webdav Added Files: WebDAVMethod.java WebDAV.java Log Message: New WebDAV module (initial check in) --- NEW FILE: WebDAVMethod.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: WebDAVMethod.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.security.User; /** * @author wolf */ public interface WebDAVMethod { final static Logger LOG = Logger.getLogger(WebDAVMethod.class); void process(User user, HttpServletRequest request, HttpServletResponse response, Collection collection, DocumentImpl resource) throws ServletException, IOException; } --- NEW FILE: WebDAV.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: WebDAV.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.webdav; import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.Properties; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.transform.OutputKeys; import org.apache.log4j.Logger; import org.exist.EXistException; import org.exist.collections.Collection; import org.exist.dom.DocumentImpl; import org.exist.http.servlets.Authenticator; import org.exist.http.servlets.BasicAuthenticator; import org.exist.http.servlets.DigestAuthenticator; import org.exist.http.webdav.methods.*; import org.exist.security.Permission; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.BrokerPool; import org.exist.storage.DBBroker; import org.exist.storage.serializers.EXistOutputKeys; /** * @author wolf */ public class WebDAV { public final static String DAV_NS = "DAV:"; // default content types public final static String BINARY_CONTENT = "application/octet-stream"; public final static String XML_CONTENT = "text/xml"; // default output properties for the XML serialization public final static Properties OUTPUT_PROPERTIES = new Properties(); static { OUTPUT_PROPERTIES.setProperty(OutputKeys.INDENT, "yes"); OUTPUT_PROPERTIES.setProperty(OutputKeys.ENCODING, "UTF-8"); OUTPUT_PROPERTIES.setProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); OUTPUT_PROPERTIES.setProperty(EXistOutputKeys.EXPAND_XINCLUDES, "no"); OUTPUT_PROPERTIES.setProperty(EXistOutputKeys.PROCESS_XSL_PI, "no"); } // additional response codes public final static int SC_MULTI_STATUS = 207; private final static Logger LOG = Logger.getLogger(WebDAV.class); private Authenticator digestAuth, basicAuth; private Map supportedMethods = new HashMap(); private BrokerPool pool; public WebDAV() throws ServletException { try { pool = BrokerPool.getInstance(); } catch (EXistException e) { throw new ServletException("Error found while initializing database: " + e.getMessage(), e); } supportedMethods.put("OPTIONS", new Options()); supportedMethods.put("GET", new Get(pool)); supportedMethods.put("HEAD", new Head()); supportedMethods.put("PROPFIND", new Propfind(pool)); supportedMethods.put("PUT", new Put(pool)); supportedMethods.put("DELETE", new Delete(pool)); digestAuth = new DigestAuthenticator(pool); basicAuth = new BasicAuthenticator(pool); } public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = authenticate(request, response); if(user == null) return; String path = request.getPathInfo(); if(path == null || path.length() == 0 || path.equals("/")) path = "/db"; if(path.endsWith("/")) path = path.substring(0, path.length() - 1); LOG.debug("path = " + path + "; method = " + request.getMethod()); DocumentImpl resource = null; Collection collection = null; WebDAVMethod method = null; DBBroker broker = null; try { broker = pool.get(user); collection = broker.getCollection(path); if(collection == null) { resource = (DocumentImpl)broker.getDocument(path); if(resource != null) collection = resource.getCollection(); } method = (WebDAVMethod)supportedMethods.get(request.getMethod()); if(method == null) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "Method is not supported: " + request.getMethod()); return; } } catch (EXistException e) { throw new ServletException("An error occurred while retrieving resource: " + e.getMessage(), e); } catch (PermissionDeniedException e) { response.sendError(HttpServletResponse.SC_FORBIDDEN, "Not allowed to access resource " + path); } finally { pool.release(broker); } method.process(user, request, response, collection, resource); } private User authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException { String credentials = request.getHeader("Authorization"); if(credentials == null) { digestAuth.sendChallenge(request, response); return null; } if(credentials.toUpperCase().startsWith("DIGEST")) { return digestAuth.authenticate(request, response); } else { LOG.debug("Falling back to basic authentication"); return basicAuth.authenticate(request, response); } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:14:10
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3779/src/org/exist/http/servlets Added Files: Authenticator.java BasicAuthenticator.java WebDAVServlet.java DigestAuthenticator.java Log Message: New WebDAV module (initial check in) --- NEW FILE: BasicAuthenticator.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: BasicAuthenticator.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.servlets; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.xmlrpc.Base64; import org.exist.security.SecurityManager; import org.exist.security.User; import org.exist.storage.BrokerPool; /** * @author wolf */ public class BasicAuthenticator implements Authenticator { private BrokerPool pool; public BasicAuthenticator(BrokerPool pool) { this.pool = pool; } /* (non-Javadoc) * @see org.exist.http.servlets.Authenticator#authenticate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public User authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException { String credentials = request.getHeader("Authorization"); if(credentials == null) { sendChallenge(request, response); return null; } byte[] c = Base64.decode(credentials.substring("Basic ".length()).getBytes()); String s = new String(c); int p = s.indexOf(':'); String username = s.substring(0, p); String password = s.substring(p + 1); SecurityManager secman = pool.getSecurityManager(); User user = secman.getUser(username); if(user == null) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } if (!user.validate(password)) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED); return null; } return user; } /* (non-Javadoc) * @see org.exist.http.servlets.Authenticator#sendChallenge(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public void sendChallenge(HttpServletRequest request, HttpServletResponse response) throws IOException { // TODO Auto-generated method stub } } --- NEW FILE: DigestAuthenticator.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: DigestAuthenticator.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.servlets; import java.io.IOException; import java.security.MessageDigest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.security.MD5; import org.exist.security.SecurityManager; import org.exist.security.User; import org.exist.storage.BrokerPool; /** * @author wolf */ public class DigestAuthenticator implements Authenticator { private BrokerPool pool; public DigestAuthenticator(BrokerPool pool) { this.pool = pool; } public User authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException { String credentials = request.getHeader("Authorization"); if(credentials == null) { sendChallenge(request, response); return null; } Digest digest = new Digest(request.getMethod()); parseCredentials(digest, credentials); SecurityManager secman = pool.getSecurityManager(); User user = secman.getUser(digest.username); if(user == null) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User unknown"); return null; } if(!digest.check(user.getPassword())) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Password check failed"); return null; } return user; } public void sendChallenge(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setHeader("WWW-Authenticate", "Digest realm=\"exist\", " + "nonce=\"" + createNonce(request) + "\", " + "domain=\"" + request.getContextPath() + "\", " + "opaque=\"" + MD5.md(Integer.toString(hashCode(), 27)) + '"'); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } private String createNonce(HttpServletRequest request) { return MD5.md(request.getRemoteAddr() + ':' + Long.toString(System.currentTimeMillis()) + ':' + Integer.toString(hashCode())); } private static void parseCredentials(Digest digest, String credentials) { credentials = credentials.substring("Digest ".length()); StringBuffer current = new StringBuffer(); String name = null, value; boolean inQuotedString = false; for(int i = 0; i < credentials.length(); i++) { char ch = credentials.charAt(i); switch(ch) { case ' ': break; case '"': case '\'': if(inQuotedString) { value = current.toString(); current.setLength(0); inQuotedString = false; if("username".equalsIgnoreCase(name)) digest.username = value; else if("realm".equalsIgnoreCase(name)) digest.realm = value; else if("nonce".equalsIgnoreCase(name)) digest.nonce = value; else if("uri".equalsIgnoreCase(name)) digest.uri = value; else if("response".equalsIgnoreCase(name)) digest.response = value; } else { value = null; inQuotedString = true; } break; case ',': name = null; break; case '=': name = current.toString(); current.setLength(0); break; default: current.append(ch); break; } } } private static class Digest { String method=null; String username = null; String realm = null; String nonce = null; String uri = null; String response=null; public Digest(String method) { this.method = method; } public boolean check(String credentials) throws IOException { try{ MessageDigest md = MessageDigest.getInstance("MD5"); // calc A2 digest md.reset(); md.update(method.getBytes("ISO-8859-1")); md.update((byte)':'); md.update(uri.getBytes("ISO-8859-1")); byte[] ha2=md.digest(); // calc digest md.update(credentials.getBytes("ISO-8859-1")); md.update((byte)':'); md.update(nonce.getBytes("ISO-8859-1")); md.update((byte)':'); md.update(MD5.byteArrayToHex(ha2).getBytes("ISO-8859-1")); byte[] digest=md.digest(); // check digest System.out.println(MD5.byteArrayToHex(digest) + " = " + response); return (MD5.byteArrayToHex(digest).equalsIgnoreCase(response)); } catch (Exception e) { throw new IOException("Internal error while checking digest"); } } } } --- NEW FILE: Authenticator.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: Authenticator.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.servlets; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.security.User; /** * @author wolf */ public interface Authenticator { public User authenticate(HttpServletRequest request, HttpServletResponse response) throws IOException; public void sendChallenge(HttpServletRequest request, HttpServletResponse response) throws IOException; } --- NEW FILE: WebDAVServlet.java --- /* * eXist Open Source Native XML Database * Copyright (C) 2001-04 Wolfgang M. Meier * wol...@ex... * http://exist-db.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: WebDAVServlet.java,v 1.1 2004/04/23 13:14:02 wolfgang_m Exp $ */ package org.exist.http.servlets; import java.io.IOException; import java.util.Enumeration; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.exist.http.webdav.WebDAV; public class WebDAVServlet extends HttpServlet { private WebDAV webdav; /* (non-Javadoc) * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig) */ public void init(ServletConfig config) throws ServletException { super.init(config); webdav = new WebDAV(); } /* (non-Javadoc) * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { dumpHeaders(request); webdav.process(request, response); } private void dumpHeaders(HttpServletRequest request) { System.out.println("-------------------------------------------------------"); for(Enumeration e = request.getHeaderNames(); e.hasMoreElements(); ) { String header = (String)e.nextElement(); System.out.println(header + " = " + request.getHeader(header)); } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:13:57
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3730/src/org/exist/http/webdav/methods Log Message: Directory /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav/methods added to the repository |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:13:56
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3730/src/org/exist/http/webdav Log Message: Directory /cvsroot/exist/eXist-1.0/src/org/exist/http/webdav added to the repository |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/src/org/exist/http Modified Files: HttpServerConnection.java RESTServer.java Log Message: A large number of XUpdate bugs has been fixed. Index: RESTServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/RESTServer.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RESTServer.java 1 Apr 2004 14:12:45 -0000 1.7 --- RESTServer.java 23 Apr 2004 13:07:47 -0000 1.8 *************** *** 29,32 **** --- 29,34 ---- import java.io.StringReader; import java.io.StringWriter; + import java.net.URI; + import java.net.URISyntaxException; import java.net.URL; import java.text.DateFormat; *************** *** 338,345 **** broker.saveCollection(collection); } ! URL url = tempFile.toURL(); if(contentType == null || contentType.equalsIgnoreCase("text/xml")) { DocumentImpl doc = collection.addDocument(broker, docPath, ! new InputSource(url.toString())); response = new Response(); response.setDescription("Document " + docPath + " stored."); --- 340,352 ---- broker.saveCollection(collection); } ! String url; ! try { ! url = new URI(tempFile.toURL().toString()).toASCIIString(); ! } catch (URISyntaxException e1) { ! url = tempFile.toString(); ! } if(contentType == null || contentType.equalsIgnoreCase("text/xml")) { DocumentImpl doc = collection.addDocument(broker, docPath, ! new InputSource(url)); response = new Response(); response.setDescription("Document " + docPath + " stored."); Index: HttpServerConnection.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/HttpServerConnection.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** HttpServerConnection.java 29 Jan 2004 15:06:46 -0000 1.17 --- HttpServerConnection.java 23 Apr 2004 13:07:47 -0000 1.18 *************** *** 206,210 **** msg.append(content.length()); msg.append("\n\n"); ! msg.append(content); try { LOG.warn("BAD_REQUEST"); --- 206,210 ---- msg.append(content.length()); msg.append("\n\n"); ! msg.append(content.toString()); try { LOG.warn("BAD_REQUEST"); |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:27
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xupdate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/src/org/exist/xupdate Modified Files: Modification.java Log Message: A large number of XUpdate bugs has been fixed. Index: Modification.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xupdate/Modification.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Modification.java 14 Apr 2004 12:17:23 -0000 1.20 --- Modification.java 23 Apr 2004 13:07:47 -0000 1.21 *************** *** 80,84 **** throw new RuntimeException(treeParser.getErrorMessage()); } - LOG.info("modification select: " + expr.pprint()); long start = System.currentTimeMillis(); --- 80,83 ---- *************** *** 132,137 **** final long address = node.getInternalAddress(); for (int i = 0; i < nodes.length; i++) { ! if (StorageAddress.equals(nodes[i].getInternalAddress(), address)) nodes[i] = node; } } --- 131,137 ---- final long address = node.getInternalAddress(); for (int i = 0; i < nodes.length; i++) { ! if (StorageAddress.equals(nodes[i].getInternalAddress(), address)) { nodes[i] = node; + } } } |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:26
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/src/org/exist/xquery/parser Modified Files: XQueryTreeParser.java XQuery.g Log Message: A large number of XUpdate bugs has been fixed. Index: XQueryTreeParser.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQueryTreeParser.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** XQueryTreeParser.java 16 Apr 2004 14:44:24 -0000 1.6 --- XQueryTreeParser.java 23 Apr 2004 13:07:48 -0000 1.7 *************** *** 1986,1989 **** --- 1986,1990 ---- org.exist.xquery.parser.XQueryAST xpath_AST_in = (org.exist.xquery.parser.XQueryAST)_t; + context.setRootExpression(path); try { // for error handling Index: XQuery.g =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/parser/XQuery.g,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** XQuery.g 16 Apr 2004 14:40:54 -0000 1.8 --- XQuery.g 23 Apr 2004 13:07:48 -0000 1.9 *************** *** 1006,1009 **** --- 1006,1010 ---- xpath [PathExpr path] + { context.setRootExpression(path); } : module [path] |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:26
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/src/org/exist/util/serializer Modified Files: SAXSerializer.java Log Message: A large number of XUpdate bugs has been fixed. Index: SAXSerializer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/util/serializer/SAXSerializer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SAXSerializer.java 9 Feb 2004 08:40:11 -0000 1.5 --- SAXSerializer.java 23 Apr 2004 13:07:46 -0000 1.6 *************** *** 233,236 **** --- 233,244 ---- } } + + public void characters(CharSequence seq) throws SAXException { + try { + receiver.characters(seq); + } catch (TransformerException e) { + throw new SAXException(e.getMessage(), e); + } + } /* (non-Javadoc) |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:25
|
Update of /cvsroot/exist/eXist-1.0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156 Modified Files: build.xml conf.xml build.properties Log Message: A large number of XUpdate bugs has been fixed. Index: conf.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/conf.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** conf.xml 16 Apr 2004 14:44:24 -0000 1.48 --- conf.xml 23 Apr 2004 13:07:46 -0000 1.49 *************** *** 48,52 **** - max: maximum number of connections allowed. --> ! <pool min="1" max="20" sync-period="300000"/> </db-connection> --- 48,52 ---- - max: maximum number of connections allowed. --> ! <pool min="1" max="20" sync-period="300000"/> </db-connection> *************** *** 103,107 **** --> <indexer stemming="no" caseSensitive="no" suppress-whitespace="both" ! index-depth="1" tokenizer="org.exist.storage.analysis.SimpleTokenizer" validation="no"> --- 103,107 ---- --> <indexer stemming="no" caseSensitive="no" suppress-whitespace="both" ! index-depth="1" tokenizer="org.exist.storage.analysis.SimpleTokenizer" validation="no"> Index: build.xml =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.xml,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** build.xml 16 Apr 2004 14:44:24 -0000 1.45 --- build.xml 23 Apr 2004 13:07:46 -0000 1.46 *************** *** 151,155 **** <!-- =================================================================== --> <target name="jar" depends="compile"> ! <copy file="${src}/CatalogManager.properties" todir="${build.classes}"/> <copy todir="${build.classes}/org/exist/client"> <fileset dir="${src}/org/exist/client"> --- 151,155 ---- <!-- =================================================================== --> <target name="jar" depends="compile"> ! <copy file="${src}/CatalogManager.properties" todir="${build.classes}"/> <copy todir="${build.classes}/org/exist/client"> <fileset dir="${src}/org/exist/client"> *************** *** 168,172 **** todir="${build.classes}/org/exist"/> <copy file="${src}/org/exist/start/MANIFEST.MF" todir="${build.classes}/org/exist/start"/> ! <copy file="${src}/org/exist/start/start.config" todir="${build.classes}/org/exist/start"/> <echo message="Creating exist.jar ..."/> --- 168,173 ---- todir="${build.classes}/org/exist"/> <copy file="${src}/org/exist/start/MANIFEST.MF" todir="${build.classes}/org/exist/start"/> ! <copy file="${src}/org/exist/start/start.config" todir="${build.classes}/org/exist/start"/> ! <copy file="${src}/org/exist/security/security.properties" todir="${build.classes}/org/exist/security"/> <echo message="Creating exist.jar ..."/> *************** *** 198,201 **** --- 199,217 ---- </target> + <target name="standalone" depends="jar"> + <echo message="Creating exist-standalone.jar ..."/> + <jar basedir="${build.classes}" compress="true" + jarfile="exist-standalone.jar"> + <exclude name="org/exist/start/**"/> + <exclude name="org/exist/soap/**"/> + <exclude name="org/exist/ant/**"/> + <exclude name="org/exist/http/servlets/**"/> + <exclude name="org/exist/xquery/functions/request/**"/> + <exclude name="org/exist/cocoon/**"/> + <exclude name="org/exist/*.xsl"/> + <exclude name="org/exist/client/**"/> + <exclude name="org/exist/backup/**"/> + </jar> + </target> <!-- ================================================================== --> <!-- Build all --> Index: build.properties =================================================================== RCS file: /cvsroot/exist/eXist-1.0/build.properties,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** build.properties 1 Mar 2004 13:20:35 -0000 1.17 --- build.properties 23 Apr 2004 13:07:46 -0000 1.18 *************** *** 21,25 **** # IZPack is required to create the installer package ! izpack.dir = /home/wolf/Java/IzPac # sources of the XML:DB API. Needed for javadoc --- 21,25 ---- # IZPack is required to create the installer package ! izpack.dir = /home/wolf/Java/IzPack # sources of the XML:DB API. Needed for javadoc |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:25
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/src/org/exist/xquery Modified Files: XQueryContext.java XPathException.java FunctionCall.java UserDefinedFunction.java Log Message: A large number of XUpdate bugs has been fixed. Index: UserDefinedFunction.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/UserDefinedFunction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UserDefinedFunction.java 29 Jan 2004 15:06:42 -0000 1.1 --- UserDefinedFunction.java 23 Apr 2004 13:07:46 -0000 1.2 *************** *** 42,46 **** private Sequence[] currentArguments = null; ! private boolean isReset = true; public UserDefinedFunction(XQueryContext context, FunctionSignature signature) { --- 42,46 ---- private Sequence[] currentArguments = null; ! private boolean isReset = false; public UserDefinedFunction(XQueryContext context, FunctionSignature signature) { *************** *** 81,86 **** context.declareVariable(var); } ! isReset = false; ! return body.eval(contextSequence, contextItem); } --- 81,86 ---- context.declareVariable(var); } ! Sequence result = body.eval(contextSequence, contextItem); ! return result; } *************** *** 115,123 **** */ public void resetState() { ! if(isReset) ! return; ! isReset = true; ! body.resetState(); ! } } --- 115,123 ---- */ public void resetState() { ! if(!isReset) { ! isReset = true; ! body.resetState(); ! isReset = false; ! } } } Index: XQueryContext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XQueryContext.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** XQueryContext.java 14 Apr 2004 12:17:23 -0000 1.10 --- XQueryContext.java 23 Apr 2004 13:07:45 -0000 1.11 *************** *** 28,31 **** --- 28,32 ---- import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; + import java.net.URI; import java.net.URL; import java.util.HashMap; *************** *** 130,133 **** --- 131,136 ---- private Stack fragmentStack = new Stack(); + private Expression rootExpression; + public XQueryContext(DBBroker broker) { this.broker = broker; *************** *** 135,138 **** --- 138,149 ---- } + public void setRootExpression(Expression expr) { + this.rootExpression = expr; + } + + public Expression getRootExpression() { + return rootExpression; + } + /** * Declare a user-defined prefix/namespace mapping. *************** *** 700,704 **** throw new XPathException("cannot read module source from file at " + f.getAbsolutePath()); } ! location = f.toURI().toASCIIString(); } LOG.debug("Loading module from " + location); --- 711,718 ---- throw new XPathException("cannot read module source from file at " + f.getAbsolutePath()); } ! try { ! location = new URI(f.toURL().toString()).toASCIIString(); ! } catch (Exception e1) { ! } } LOG.debug("Loading module from " + location); Index: XPathException.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/XPathException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XPathException.java 23 Feb 2004 09:36:11 -0000 1.3 --- XPathException.java 23 Apr 2004 13:07:46 -0000 1.4 *************** *** 47,54 **** public void setASTNode(XQueryAST ast) { - System.out.println(ast); this.astNode = ast; } /* (non-Javadoc) * @see java.lang.Throwable#getMessage() --- 47,57 ---- public void setASTNode(XQueryAST ast) { this.astNode = ast; } + public XQueryAST getASTNode() { + return astNode; + } + /* (non-Javadoc) * @see java.lang.Throwable#getMessage() Index: FunctionCall.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/FunctionCall.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FunctionCall.java 2 Mar 2004 12:51:15 -0000 1.2 --- FunctionCall.java 23 Apr 2004 13:07:46 -0000 1.3 *************** *** 111,115 **** return returnSeq; } catch(XPathException e) { ! e.setASTNode(getASTNode()); throw e; } finally { --- 111,116 ---- return returnSeq; } catch(XPathException e) { ! if(e.getASTNode() == null) ! e.setASTNode(getASTNode()); throw e; } finally { |
From: Wolfgang M. M. <wol...@us...> - 2004-04-23 13:08:25
|
Update of /cvsroot/exist/eXist-1.0/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2156/bin Modified Files: client.sh Log Message: A large number of XUpdate bugs has been fixed. Index: client.sh =================================================================== RCS file: /cvsroot/exist/eXist-1.0/bin/client.sh,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** client.sh 29 Mar 2004 14:15:13 -0000 1.34 --- client.sh 23 Apr 2004 13:07:46 -0000 1.35 *************** *** 32,36 **** # set java options if [ -z "$JAVA_OPTIONS" ]; then ! export JAVA_OPTIONS="-Xms64m -Xmx256m -Dfile.encoding=UTF-8" fi --- 32,36 ---- # set java options if [ -z "$JAVA_OPTIONS" ]; then ! export JAVA_OPTIONS="-Xms64m -Xmx384m -Dfile.encoding=UTF-8" fi |