Permalink
Browse files

Merge branch 'develop' into feature/setuid

Conflicts:
	test/src/org/exist/security/XMLDBSecurityTest.java
  • Loading branch information...
2 parents 29b91c3 + 558c479 commit 111302ce462f3dd2a672271b4e967fb2a477eb41 @adamretter adamretter committed Feb 13, 2014
Showing with 5,052 additions and 2,787 deletions.
  1. +1 −2 conf.xml.tmpl
  2. BIN extensions/betterform/main/lib/betterform.jar
  3. +0 −4 extensions/build.properties
  4. +5 −16 ...ions/exquery/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/RestXqServiceImpl.java
  5. +9 −3 extensions/exquery/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/RestXqServlet.java
  6. +7 −88 extensions/fluent/src/org/exist/fluent/ListenerManager.java
  7. +421 −427 extensions/fluent/src/org/exist/fluent/Node.java
  8. +24 −22 extensions/fluent/src/org/exist/fluent/Trigger.java
  9. +122 −67 extensions/indexes/lucene/src/org/exist/indexing/lucene/AnalyzerConfig.java
  10. +10 −1 extensions/indexes/lucene/src/org/exist/indexing/lucene/LuceneIndexWorker.java
  11. +1 −1 extensions/indexes/ngram/src/org/exist/indexing/ngram/NGramIndexWorker.java
  12. +13 −5 extensions/indexes/range/src/org/exist/indexing/range/RangeIndexWorker.java
  13. +71 −4 extensions/indexes/range/src/org/exist/xquery/modules/range/Lookup.java
  14. +207 −0 extensions/indexes/range/src/org/exist/xquery/modules/range/OptimizeFieldPragma.java
  15. +63 −178 extensions/indexes/range/src/org/exist/xquery/modules/range/RangeQueryRewriter.java
  16. +8 −0 extensions/indexes/range/test/src/xquery/suite-updates.xql
  17. +232 −0 extensions/indexes/range/test/src/xquery/updates.xql
  18. +1 −1 extensions/indexes/sort/src/org/exist/indexing/sort/SortIndexWorker.java
  19. +1 −1 extensions/indexes/spatial/src/org/exist/indexing/spatial/AbstractGMLJDBCIndexWorker.java
  20. +1 −26 extensions/modules/build.xml
  21. +20 −12 extensions/modules/src/org/exist/xquery/modules/file/SerializeToFile.java
  22. +0 −112 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/ProcessFunction.java
  23. +0 −39 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/XMLCalabashModule.java
  24. +0 −64 extensions/modules/src/org/exist/xquery/modules/xmlcalabash/readme.txt
  25. +1 −1 extensions/versioning/src/org/exist/versioning/VersioningTrigger.java
  26. +107 −101 src/org/exist/Database.java
  27. +4 −3 src/org/exist/backup/restore/SystemImportHandler.java
  28. +35 −75 src/org/exist/collections/Collection.java
  29. +2 −2 src/org/exist/collections/CollectionCache.java
  30. +34 −42 src/org/exist/collections/CollectionConfiguration.java
  31. +3 −2 src/org/exist/collections/CollectionConfigurationManager.java
  32. +14 −16 src/org/exist/collections/IndexInfo.java
  33. +0 −56 src/org/exist/collections/triggers/AbstractTriggerProxies.java
  34. +18 −50 src/org/exist/collections/triggers/AbstractTriggerProxy.java
  35. +11 −14 src/org/exist/collections/triggers/AbstractTriggersVisitor.java
  36. +1 −3 src/org/exist/collections/triggers/CollectionTrigger.java
  37. +0 −36 src/org/exist/collections/triggers/CollectionTriggerProxies.java
  38. +4 −4 src/org/exist/collections/triggers/CollectionTriggerProxy.java
  39. +155 −0 src/org/exist/collections/triggers/CollectionTriggers.java
  40. +4 −72 src/org/exist/collections/triggers/CollectionTriggersVisitor.java
  41. +0 −96 src/org/exist/collections/triggers/ContentHandlerWrapper.java
  42. +3 −50 src/org/exist/collections/triggers/DocumentTrigger.java
  43. +0 −36 src/org/exist/collections/triggers/DocumentTriggerProxies.java
  44. +5 −8 src/org/exist/collections/triggers/DocumentTriggerProxy.java
  45. +364 −0 src/org/exist/collections/triggers/DocumentTriggers.java
  46. +4 −315 src/org/exist/collections/triggers/DocumentTriggersVisitor.java
  47. +3 −162 src/org/exist/collections/triggers/FilteringTrigger.java
  48. +0 −74 src/org/exist/collections/triggers/LexicalHandlerWrapper.java
  49. +211 −0 src/org/exist/collections/triggers/SAXTrigger.java
  50. +9 −10 src/org/exist/collections/triggers/STXTransformerTrigger.java
  51. +38 −40 src/org/exist/collections/triggers/Trigger.java
  52. +3 −4 src/org/exist/collections/triggers/TriggerProxy.java
  53. +65 −65 src/org/exist/collections/triggers/XQueryTrigger.java
  54. +6 −3 src/org/exist/config/ConfigurationImpl.java
  55. +18 −8 src/org/exist/dom/DocumentImpl.java
  56. +0 −6 src/org/exist/dom/ElementImpl.java
  57. +1 −1 src/org/exist/fulltext/FTIndexWorker.java
  58. +18 −3 src/org/exist/http/urlrewrite/XQueryURLRewrite.java
  59. +2 −2 src/org/exist/indexing/IndexController.java
  60. +1 −1 src/org/exist/indexing/IndexWorker.java
  61. +21 −49 src/org/exist/storage/BrokerPool.java
  62. +130 −108 src/org/exist/storage/NativeBroker.java
  63. +1 −1 src/org/exist/storage/statistics/IndexStatisticsWorker.java
  64. +1 −1 src/org/exist/storage/structural/NativeStructuralIndexWorker.java
  65. +11 −10 src/org/exist/xmldb/LocalCollectionManagementService.java
  66. +88 −0 src/org/exist/xmldb/LocalUserManagementService.java
  67. +108 −31 src/org/exist/xmldb/RemoteUserManagementService.java
  68. +47 −12 src/org/exist/xmldb/UserManagementService.java
  69. +23 −13 src/org/exist/xmlrpc/RpcAPI.java
  70. +37 −1 src/org/exist/xmlrpc/RpcConnection.java
  71. +1 −3 src/org/exist/xquery/ExtensionExpression.java
  72. +19 −4 src/org/exist/xquery/Optimizer.java
  73. +4 −4 src/org/exist/xquery/QueryRewriter.java
  74. +0 −7 src/org/exist/xquery/functions/fn/FunDoc.java
  75. +4 −26 src/org/exist/xquery/functions/fn/FunSerialize.java
  76. +22 −14 src/org/exist/xquery/functions/util/Serialize.java
  77. +1 −1 src/org/exist/xquery/lib/test.xq
  78. +4 −2 src/org/exist/xquery/lib/xqsuite/xqsuite.xql
  79. +23 −15 src/org/exist/xquery/update/Modification.java
  80. +56 −0 src/org/exist/xquery/util/SerializerUtils.java
  81. +7 −1 src/org/exist/xupdate/Modification.java
  82. +1 −3 test/src/org/exist/collections/triggers/AllTriggerTests.java
  83. +134 −0 test/src/org/exist/collections/triggers/AnotherTrigger.java
  84. +232 −0 test/src/org/exist/collections/triggers/SAXTriggerTest.java
  85. +100 −0 test/src/org/exist/collections/triggers/StoreTrigger.java
  86. +2 −5 test/src/org/exist/collections/triggers/TestTrigger.java
  87. +1 −3 test/src/org/exist/collections/triggers/TriggerConfigTest.java
  88. +2 −4 test/src/org/exist/collections/triggers/XQueryTriggerTest.java
  89. +3 −3 test/src/org/exist/dom/DocumentImplTest.java
  90. +907 −32 test/src/org/exist/security/XMLDBSecurityTest.java
  91. +701 −0 test/src/org/exist/storage/NativeBrokerTest.java
View
@@ -865,7 +865,6 @@
<module uri="http://exist-db.org/xquery/versioning/svn" class="org.exist.versioning.svn.xquery.SVNModule" />
<module uri="http://exist-db.org/xquery/xmldiff" class="org.exist.xquery.modules.xmldiff.XmlDiffModule" />
<module uri="http://exist-db.org/xquery/xmpp" class="org.exist.xquery.modules.xmpp.XMPPModule" />
- <module uri="http://xmlcalabash.com" class="org.exist.xquery.modules.xmlcalabash.XMLCalabashModule" />
-->
<!--
@@ -912,6 +911,6 @@
containing valid nodes.
-->
- <xupdate allowed-fragmentation="100" enable-consistency-checks="no"/>
+ <xupdate allowed-fragmentation="10000" enable-consistency-checks="no"/>
</exist>
Binary file not shown.
@@ -154,10 +154,6 @@ include.module.simpleql = false
# SQL module
include.module.sql = true
-# XML Calabash
-include.module.xmlcalabash = true
-include.module.xmlcalabash.url=http://xmlcalabash.com/download/calabash-1.0.9-94.zip
-
# Utility module to compare XML fragments; based on xmlunit
include.module.xmldiff = true
@@ -133,10 +133,8 @@ protected Sequence extractRequestBody(final HttpRequest request) throws RestXqSe
//first, get the content of the request
is = new CloseShieldInputStream(request.getInputStream());
-
- //if the content length is unknown or 0, return
- final int contentLength = request.getContentLength();
- if(contentLength == -1 || contentLength == 0) {
+
+ if(is.available() <= 0) {
return null;
}
@@ -162,18 +160,7 @@ public String getCacheClass() {
try {
//was there any POST content?
-
-
- /**
- * There is a bug in HttpInput.available() in Jetty 7.2.2.v20101205
- * This has been filed as Bug 333415 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=333415
- * It is expected to be fixed in the Jetty 7.3.0 release
- */
-
- //TODO reinstate call to .available() when Jetty 7.3.0 is released, use of .getContentLength() is not reliable because of http mechanics
- //if(is != null && is.available() > 0) {
- final int contentLength = request.getContentLength();
- if(is != null && contentLength > 0) {
+ if(is != null && is.available() > 0) {
String contentType = request.getContentType();
// 1) determine if exists mime database considers this binary data
if(contentType != null) {
@@ -227,6 +214,8 @@ public String getCacheClass() {
}
}
}
+ } catch (IOException e) {
+ throw new RestXqServiceException(e.getMessage());
} finally {
if(cache != null) {
@@ -36,6 +36,8 @@
import org.exist.extensions.exquery.restxq.impl.adapters.HttpServletRequestAdapter;
import org.exist.extensions.exquery.restxq.impl.adapters.HttpServletResponseAdapter;
import org.exist.http.servlets.AbstractExistHttpServlet;
+import org.exist.http.servlets.BasicAuthenticator;
+import org.exist.security.PermissionDeniedException;
import org.exist.security.Subject;
import org.exist.storage.DBBroker;
import org.exist.util.Configuration;
@@ -114,9 +116,13 @@ public String getCacheClass() {
getLog().error(ee.getMessage(), ee);
throw new ServletException(ee.getMessage(), ee);
} catch(RestXqServiceException rqse) {
- //TODO should probably be caught higher up and returned as a HTTP Response? maybe need two different types of exception to differentiate critical vs processing exception
- getLog().error(rqse.getMessage(), rqse);
- throw new ServletException(rqse.getMessage(), rqse);
+ if (rqse.getCause() instanceof PermissionDeniedException) {
+ getAuthenticator().sendChallenge(request, response);
+ } else {
+ //TODO should probably be caught higher up and returned as a HTTP Response? maybe need two different types of exception to differentiate critical vs processing exception
+ getLog().error(rqse.getMessage(), rqse);
+ throw new ServletException(rqse.getMessage(), rqse);
+ }
} finally {
if(broker != null) {
getPool().release(broker);
@@ -7,16 +7,12 @@
import org.exist.collections.Collection;
import org.exist.collections.triggers.CollectionTrigger;
import org.exist.collections.triggers.DocumentTrigger;
+import org.exist.collections.triggers.SAXTrigger;
import org.exist.collections.triggers.TriggerException;
import org.exist.dom.DocumentImpl;
import org.exist.storage.DBBroker;
import org.exist.storage.txn.Txn;
import org.exist.xmldb.XmldbURI;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
/**
* Internal class not for public use; needs to be public due to external instantiation requirements.
@@ -247,96 +243,15 @@ private void fire(List<ListenerWrapper> list, EventKey key, DocumentImpl doc, or
*
* @author <a href="mailto:piotr@ideanest.com">Piotr Kaminski</a>
*/
- public static class TriggerDispatcher implements DocumentTrigger, CollectionTrigger {
+ public static class TriggerDispatcher extends SAXTrigger implements DocumentTrigger, CollectionTrigger {
private static final Logger LOG = Logger.getLogger(TriggerDispatcher.class);
- private boolean validating;
- private ContentHandler contentHandler;
- private LexicalHandler lexicalHandler;
- public void configure(DBBroker broker, org.exist.collections.Collection parent, Map parameters) {
+ public void configure(DBBroker broker, org.exist.collections.Collection parent, Map<String, List<? extends Object>> parameters) {
// nothing to do
}
- public boolean isValidating() {
- return validating;
- }
- public void setValidating(boolean validating) {
- this.validating = validating;
- }
- public void setOutputHandler(ContentHandler handler) {
- this.contentHandler = handler;
- }
- public void setLexicalOutputHandler(LexicalHandler handler) {
- this.lexicalHandler = handler;
- }
- public ContentHandler getOutputHandler() {
- return contentHandler;
- }
- public ContentHandler getInputHandler() {
- return this;
- }
- public LexicalHandler getLexicalOutputHandler() {
- return lexicalHandler;
- }
- public LexicalHandler getLexicalInputHandler() {
- return this;
- }
public Logger getLogger() {
return LOG;
}
- public void characters(char[] ch, int start, int length) throws SAXException {
- contentHandler.characters(ch, start, length);
- }
- public void endDocument() throws SAXException {
- contentHandler.endDocument();
- }
- public void endElement(String uri, String localName, String qName) throws SAXException {
- contentHandler.endElement(uri, localName, qName);
- }
- public void endPrefixMapping(String prefix) throws SAXException {
- contentHandler.endPrefixMapping(prefix);
- }
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- public void processingInstruction(String target, String data) throws SAXException {
- contentHandler.processingInstruction(target, data);
- }
- public void setDocumentLocator(Locator locator) {
- contentHandler.setDocumentLocator(locator);
- }
- public void skippedEntity(String name) throws SAXException {
- contentHandler.skippedEntity(name);
- }
- public void startDocument() throws SAXException {
- contentHandler.startDocument();
- }
- public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
- contentHandler.startElement(uri, localName, qName, atts);
- }
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- contentHandler.startPrefixMapping(prefix, uri);
- }
- public void comment(char[] ch, int start, int length) throws SAXException {
- lexicalHandler.comment(ch, start, length);
- }
- public void endCDATA() throws SAXException {
- lexicalHandler.endCDATA();
- }
- public void endDTD() throws SAXException {
- lexicalHandler.endDTD();
- }
- public void endEntity(String name) throws SAXException {
- lexicalHandler.endEntity(name);
- }
- public void startCDATA() throws SAXException {
- lexicalHandler.startCDATA();
- }
- public void startDTD(String name, String publicId, String systemId) throws SAXException {
- lexicalHandler.startDTD(name, publicId, systemId);
- }
- public void startEntity(String name) throws SAXException {
- lexicalHandler.startEntity(name);
- }
@Override
public void beforeCreateCollection(DBBroker broker, Txn transaction, XmldbURI uri) throws TriggerException {
@@ -432,10 +347,14 @@ public void afterDeleteDocument(DBBroker broker, Txn transaction, XmldbURI uri)
@Override
public void beforeUpdateDocumentMetadata(DBBroker broker, Txn txn, DocumentImpl document) throws TriggerException {
+ EventKey key = new EventKey(document.getURI().toString(), Trigger.BEFORE_UPDATE_META);
+ INSTANCE.fire(key, document, null, true);
}
@Override
public void afterUpdateDocumentMetadata(DBBroker broker, Txn txn, DocumentImpl document) throws TriggerException {
+ EventKey key = new EventKey(document.getURI().toString(), Trigger.AFTER_UPDATE_META);
+ INSTANCE.fire(key, document, null, true);
}
}
}
Oops, something went wrong.

0 comments on commit 111302c

Please sign in to comment.