Skip to content

Instantly share code, notes, and snippets.

View rjrudin's full-sized avatar

Rob Rudin rjrudin

  • Progress Software / MarkLogic
  • Falls Church, VA
View GitHub Profile
@rjrudin
rjrudin / gist:c462946de32e92fd44ac
Created February 26, 2015 13:30
Camel configuation for ml-camel-client
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<!-- The URIs are expected to be system properties, which are configured via the Gradle "camelRun" task -->
<route>
<from uri="{{fileUri}}" />
<to uri="{{mlcpUri}}" />
</route>
</camelContext>
@rjrudin
rjrudin / gist:00b83a1f1d3a0a374329
Created February 26, 2015 13:36
Gradle properties for ml-camel-client
fileUri=file://inbox
mlcpUri=mlcp:localhost:8003?username=admin&password=admin&output_collections=sample-collection
@rjrudin
rjrudin / gist:1536aa85f6a560527bd1
Created February 26, 2015 13:38
Task for running Camel
task camelRun(type: JavaExec) {
main = 'org.apache.camel.spring.Main'
classpath = sourceSets.main.runtimeClasspath
systemProperties = [
"fileUri": fileUri,
"mlcpUri": mlcpUri
]
}
@rjrudin
rjrudin / build.gradle
Last active September 7, 2023 07:05
Gradle tasks for setting up test resources in your MarkLogic Data Hub Framework project
// Paste everything below this comment block into the bottom of the build.gradle file in your DHF project.
// Read the comments to see how this works and what properties you'll need to define.
// Note - this only works on DHF 3 projects, and it should work as well on 4.0.x projects.
// For 4.1 projects, see https://gist.github.com/rjrudin/df0ff09f5bff67833048e67f1ebaa5d6
/**
* Tasks for setting up a test database and a test app server that mirror either your final or staging database and
* app server, and then loading hub and user modules via the test app server so that REST options are accessible to it.
* Depends on the following properties being set:
@rjrudin
rjrudin / permission-query.xqy
Created September 6, 2018 16:33
MarkLogic permission query
declare function permission-query($role, $capability)
{
cts:term-query(
xdmp:add64(
xdmp:mul64(xdmp:add64(xdmp:mul64(xdmp:role($role), 5), xdmp:hash64($capability)), 5),
xdmp:hash64("permission()")
)
)
};
@rjrudin
rjrudin / build.gradle
Last active April 2, 2019 17:13
Gradle configuration for setting up test resources on a MarkLogic Data Hub Framework (DHF) 4.1 project
// Paste everything below this comment block into the bottom of the build.gradle file in your DHF project.
// Read the comments to see how this works and what properties you'll need to define.
// Note - this works on DHF 4.1 projects. See https://gist.github.com/rjrudin/ce347cd657b3768332c17641fdb12907 for
// DHF 3 and 4.0.x projects.
/**
* Tasks for setting up a test database and a test app server that mirror either your final or staging database and
* app server, and then loading hub and user modules via the test app server so that REST options are accessible to it.
* Depends on the following properties being set:
@rjrudin
rjrudin / dhf5-test-resources.gradle
Created July 23, 2019 16:19
Deploying test resources for a DHF 5 application
/**
* The below tasks are used for deploying and undeploying test resources for a DHF 5 application. Just copy everything below
* this comment into the build.gradle file in your DHF application - no properties need to be set for these tasks to work.
*
* The task "hubDeployTestResources" will deploy test versions of your staging and final databases and app servers. You
* can customize these tasks if you don't like the resource names and ports that are used by them. Note that mlDeploy
* does not depend on this task by default - you'll need to invoke it in order to create test resources.
*
* The task "hubUndeployTestResources" will undeploy any test resources that were created. mlUndeploy does depend on
* this task as there's typically no downside to undeploying these resources - if they don't exist, the task will
@rjrudin
rjrudin / gist:28898afaf0a0aa6772aeaac1ae890e6a
Last active July 12, 2021 19:47
Bare minimum build.gradle file for publishing to Maven Central
// In addition to what's in this file, you'll need to define the following properties in your
// gradle.properties file:
//
// mavenCentralUsername=
// mavenCentralPassword=
// mavenCentralUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
//
// In order for the "signing" plugin to work correctly, you'll also need to define the following properties, either
// in your gradle.properties file or at runtime:
//
batch = DocumentBatch()
# Document with every type of metadata supplied
batch.add(
Document(
uri="/example1.json",
content={"some": "data"},
content_type="application/json",
metadata=Metadata(
quality=1.2,
collections=["coll1", "coll2"],