Permalink
Browse files

[ignore] Merge in trunk up to rev 18405.

svn path=/branches/rangeindex/; revision=18406
  • Loading branch information...
2 parents 36311db + 94cb255 commit 9b8748ae7470e1087c02a4a196cd27c79f8c6aeb @wolfgangmm wolfgangmm committed May 7, 2013
View
@@ -19,24 +19,21 @@
<sourceFolder url="file://$MODULE_DIR$/tools/izpack/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/tools/requestlog/src" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tools/wrapper/src" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/extensions/indexes/range/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/cqlparser" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/jfreechart" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/memcached" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/oracle" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/xmlcalabash" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/xmpp" />
<excludeFolder url="file://$MODULE_DIR$/extensions/modules/src/org/exist/xquery/modules/xslfo" />
- <excludeFolder url="file://$MODULE_DIR$/test/junit" />
- <excludeFolder url="file://$MODULE_DIR$/test/temp" />
<excludeFolder url="file://$MODULE_DIR$/tools/jetty/logs" />
<excludeFolder url="file://$MODULE_DIR$/tools/jetty/work" />
<excludeFolder url="file://$MODULE_DIR$/webapp/WEB-INF/data" />
<excludeFolder url="file://$MODULE_DIR$/webapp/WEB-INF/logs" />
</content>
- <orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
+ <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" exported="" name="optional libs" level="project" />
- <orderEntry type="library" exported="" name="core libs" level="project" />
<orderEntry type="library" exported="" name="tools" level="project" />
<orderEntry type="library" exported="" name="core" level="project" />
<orderEntry type="library" exported="" name="optional" level="project" />
View
@@ -1,30 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
- <defaultAnt bundledAnt="true" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
- <additionalClassPath />
- <antReference projectDefault="true" />
<customJdkName value="1.6" />
- <maximumHeapSize value="128" />
<maximumStackSize value="32" />
- <properties />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/test/src/ant/build.xml">
- <additionalClassPath />
- <antReference projectDefault="true" />
<customJdkName value="1.5" />
- <maximumHeapSize value="128" />
<maximumStackSize value="32" />
- <properties />
</buildFile>
<buildFile url="file://$PROJECT_DIR$/extensions/xprocxq/main/build.xml">
- <additionalClassPath />
- <antReference projectDefault="true" />
<customJdkName value="1.5" />
- <maximumHeapSize value="128" />
<maximumStackSize value="32" />
- <properties />
</buildFile>
</component>
<component name="BuildJarProjectSettings">
@@ -116,23 +103,8 @@
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
- <component name="FacetAutodetectingManager">
- <autodetection-disabled>
- <facet-type id="android" />
- <facet-type id="JRailsFacetType" />
- <facet-type id="JRUBY" />
- <facet-type id="RailsFacetType" />
- <facet-type id="web">
- <modules>
- <module name="eXist">
- <files>
- <file url="file://$PROJECT_DIR$/tools/jetty/etc/standalone/WEB-INF/web.xml" />
- <file url="file://$PROJECT_DIR$/webapp/WEB-INF/web.xml" />
- </files>
- </module>
- </modules>
- </facet-type>
- </autodetection-disabled>
+ <component name="GradleSettings">
+ <option name="gradleHome" value="$USER_HOME$/Apps/gradle" />
</component>
<component name="IdProvider" IDEtalkID="EDCB317F9C51C9BBC9F54E158B17D480" />
<component name="JavacSettings">
@@ -354,14 +326,6 @@
<JAVADOC />
<SOURCES />
</library>
- <library name="cocoon">
- <CLASSES>
- <root url="file://$PROJECT_DIR$/lib/cocoon" />
- </CLASSES>
- <JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib/cocoon" recursive="false" />
- </library>
<library name="core">
<CLASSES>
<root url="file://$PROJECT_DIR$/lib/core" />
@@ -375,9 +339,7 @@
<root url="file://$PROJECT_DIR$/lib/endorsed" />
</CLASSES>
<JAVADOC />
- <SOURCES>
- <root url="file://$USER_HOME$/Applications/xerces-2_9_1/src" />
- </SOURCES>
+ <SOURCES />
<jarDirectory url="file://$PROJECT_DIR$/lib/endorsed" recursive="false" />
</library>
<library name="exquery-core">
@@ -404,12 +366,14 @@
<root url="file://$PROJECT_DIR$/extensions/indexes/lucene/lib" />
<root url="file://$PROJECT_DIR$/lib/extensions" />
<root url="file://$PROJECT_DIR$/extensions/xqdoc/lib" />
+ <root url="file://$PROJECT_DIR$/extensions/webdav/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
<jarDirectory url="file://$PROJECT_DIR$/extensions/fluent/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/extensions/indexes/lucene/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/extensions/indexes/spatial/lib" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/extensions/webdav/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/extensions/xqdoc/lib" recursive="false" />
<jarDirectory url="file://$PROJECT_DIR$/lib/extensions" recursive="false" />
</library>
@@ -29,6 +29,7 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.log4j.Logger;
+import org.exist.replication.shared.JmsConnectionHelper;
import org.exist.replication.shared.MessageSender;
import org.exist.replication.shared.TransportException;
import org.exist.replication.shared.eXistMessage;
@@ -123,11 +124,14 @@ public void sendMessage(eXistMessage em) throws TransportException {
context = new InitialContext(contextProps);
// Lookup connection factory
- ConnectionFactory cf = (ConnectionFactory) context.lookup(parameters.getConnectionFactory());
+ ConnectionFactory cf = (ConnectionFactory) context.lookup(parameters.getConnectionFactory());
+
+ // Set specific properties on the connection factory
+ JmsConnectionHelper.configureConnectionFactory(cf, parameters);
// Setup connection
connection = cf.createConnection();
-
+
// Set clientId if present
String clientId = parameters.getClientId();
if (clientId != null) {
@@ -197,14 +201,9 @@ public void sendMessage(eXistMessage em) throws TransportException {
}
}
-
// Send message
producer.send(message);
- // Close connection
- // DW: connection could be re-used?
- //connection.close();
-
if(LOG.isDebugEnabled()){
LOG.debug("Message sent with id '" + message.getJMSMessageID() + "'");
}
@@ -53,7 +53,7 @@
// Document Triggers
//
private void afterUpdateCreateDocument(DBBroker broker, Txn transaction,
- DocumentImpl document, eXistMessage.ResourceOperation operation) throws TriggerException {
+ DocumentImpl document, eXistMessage.ResourceOperation operation) /* throws TriggerException */ {
if (LOG.isDebugEnabled()) {
LOG.debug(document.getURI().toString());
@@ -77,11 +77,12 @@ private void afterUpdateCreateDocument(DBBroker broker, Txn transaction,
// Serialize document
try {
- msg.setPayload(MessageHelper.serialize(broker, document));
+ msg.setPayload(MessageHelper.gzipSerialize(broker, document));
- } catch (IOException ex) {
- LOG.error(ex);
- throw new TriggerException("Unable to retrieve message payload: " + ex.getMessage());
+ } catch (Throwable ex) {
+ LOG.error("Problem while serializing document (contentLength="
+ + document.getContentLength() + ") to compressed message:" + ex.getMessage(), ex);
+ //throw new TriggerException("Unable to retrieve message payload: " + ex.getMessage());
}
// Send Message
@@ -172,6 +173,7 @@ public void afterDeleteDocument(DBBroker broker, Txn transaction,
@Override
public void afterCreateCollection(DBBroker broker, Txn transaction,
Collection collection) throws TriggerException {
+
if (LOG.isDebugEnabled()) {
LOG.debug(collection.getURI().toString());
}
@@ -283,15 +285,19 @@ public void configure(DBBroker broker, Collection parent, Map<String, List<?>> p
* Send 'trigger' message with parameters set using
* {@link #configure(org.exist.storage.DBBroker, org.exist.collections.Collection, java.util.Map)}
*/
- private void sendMessage(eXistMessage msg) throws TriggerException {
+ private void sendMessage(eXistMessage msg) /* throws TriggerException */ {
// Send Message
JMSMessageSender sender = new JMSMessageSender(parameters);
try {
sender.sendMessage(msg);
} catch (TransportException ex) {
LOG.error(ex.getMessage(), ex);
- throw new TriggerException(ex.getMessage(), ex);
+ //throw new TriggerException(ex.getMessage(), ex);
+
+ } catch (Throwable ex) {
+ LOG.error(ex.getMessage(), ex);
+ //throw new TriggerException(ex.getMessage(), ex);
}
}
@@ -30,6 +30,7 @@
import javax.naming.NamingException;
import org.apache.log4j.Logger;
import org.exist.replication.shared.JmsConnectionExceptionListener;
+import org.exist.replication.shared.JmsConnectionHelper;
import org.exist.storage.DBBroker;
import org.exist.storage.StartupTrigger;
@@ -121,11 +122,14 @@ public void execute(final DBBroker broker, final Map<String, List<? extends Obje
if (!(destination instanceof Topic)) {
String errorText = "'" + parameters.getTopic() + "' is not a Topic.";
LOG.error(errorText);
- throw new Exception(errorText);
+ throw new Exception(errorText); //TODO better exception?
}
// Lookup connection factory
ConnectionFactory cf = (ConnectionFactory) context.lookup(parameters.getConnectionFactory());
+
+ // Set specific properties on the connection factory
+ JmsConnectionHelper.configureConnectionFactory(cf, parameters);
// Setup connection
connection = cf.createConnection();
@@ -38,6 +38,7 @@
public static final String CONNECTION_FACTORY = "connectionfactory";
public static final String TOPIC = "topic";
public static final String CLIENT_ID = "client-id";
+ public static final String PARAMETER_GROUPING = "..";
protected String connectionFactory = null;
protected String clientId = null;
@@ -138,7 +139,8 @@ protected void fillActiveMQbrokerDefaults() {
/**
* Retrieve initial context properties, e.g. {@link Context.INITIAL_CONTEXT_FACTORY}
- * and {@link Context.PROVIDER_URL}
+ * and {@link Context.PROVIDER_URL}. Only properties with key starting with
+ * ".java" are added to the result.
*/
public Properties getInitialContextProps(){
Properties contextProps = new Properties();
@@ -181,4 +183,12 @@ public String getProviderUrl() {
return providerUrl;
}
+ public String getParameterValue(String key){
+ return props.getProperty(key);
+ }
+
+ public String getParameterValue(String group, String key){
+ return props.getProperty(group + PARAMETER_GROUPING + key);
+ }
+
}
@@ -0,0 +1,55 @@
+/*
+ * eXist Open Source Native XML Database
+ * Copyright (C) 2013 The eXist Project
+ * 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+package org.exist.replication.shared;
+
+import java.lang.reflect.InvocationTargetException;
+import javax.jms.ConnectionFactory;
+import org.apache.commons.lang3.reflect.MethodUtils;
+
+/**
+ * Helper methods for setting up connections to a broker.
+ *
+ * @author Dannes Wessels <dannes@exist-db.org>
+ */
+
+
+public class JmsConnectionHelper {
+
+ /**
+ * Set properties on the ConnectionFactory.
+ *
+ * @param cf The connection factory
+ * @throws NoSuchMethodException if there is no such accessible method
+ * @throws IllegalAccessException wraps an exception thrown by the method invoked
+ * @throws InvocationTargetException if the requested method is not accessible via reflection
+ */
+ public static void configureConnectionFactory(ConnectionFactory cf, ClientParameters params) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ String group = "connectionfactory";
+ String[] allMethods = {"setUserName", "setPassword"};
+ for (String method : allMethods) {
+ String value = params.getParameterValue(group, method);
+ if (value != null) {
+ MethodUtils.invokeMethod(cf, method, value);
+ }
+ }
+ }
+
+}
@@ -284,13 +284,18 @@ public int returnsType()
*/
public int getDependencies()
{
+ final Expression left = getLeft();
+
+ // variable dependencies should be reported to caller, so remember them here
+ final int deps = left.getDependencies() & Dependency.VARS;
+
// left expression returns node set
- if( Type.subTypeOf( getLeft().returnsType(), Type.NODE ) &&
+ if( Type.subTypeOf( left.returnsType(), Type.NODE ) &&
// and does not depend on the context item
- !Dependency.dependsOn( getLeft(), Dependency.CONTEXT_ITEM ) && ( !inWhereClause || !Dependency.dependsOn( getLeft(), Dependency.CONTEXT_VARS ) ) ) {
- return( Dependency.CONTEXT_SET );
+ !Dependency.dependsOn( left, Dependency.CONTEXT_ITEM ) && ( !inWhereClause || !Dependency.dependsOn( left, Dependency.CONTEXT_VARS ) ) ) {
+ return( deps + Dependency.CONTEXT_SET );
} else {
- return( Dependency.CONTEXT_SET + Dependency.CONTEXT_ITEM );
+ return ( deps + Dependency.CONTEXT_SET + Dependency.CONTEXT_ITEM );
}
}

0 comments on commit 9b8748a

Please sign in to comment.