Skip to content

Commit 1a0af61

Browse files
committed
Merge branch 'master' into 67-InputFlowReportFailure
2 parents ee65006 + 138491a commit 1a0af61

File tree

77 files changed

+1022
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1022
-614
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,50 @@ To generate eclipse project files run:
3939
`./gradlew eclipse`
4040

4141
Then import the project into eclipse
42+
43+
####Available Transforms
44+
Data Hub has provided several transforms that can be used when installed along with the created entities and flows in the MarkLogic server.
45+
####run-flow
46+
This transform can be used to run the flow when inserting document. It accepts the following `entity-name` and `flow-name`.
47+
48+
#####Use Cases:
49+
50+
1. Using [MarkLogic REST API PUT /v1/documents](http://docs.marklogic.com/REST/PUT/v1/documents)
51+
52+
`curl --anyauth --user <user>:<password> -X PUT -T <documentDirectory> -H "Content-type:<contentType>" 'http://<mlHost>:<port>/<version>/documents?uri=<uri>&transform=run-flow&trans:entity-name=<entityName>&trans:flow-name=<flowName>'`
53+
54+
Example:
55+
56+
`cat ./documents/employee1.xml`
57+
58+
`<employee xmlns="http://company.com/ns/employee">`
59+
`<id>1</id>`
60+
`</employee>`
61+
62+
To insert/update this document with uri '/employee1.xml' into the database 'data-hub-STAGING' (with host 'localhost' and port '8010'), given a user 'admin' with password 'admin' and rest-writer role AND to be able to run the flow 'IngestFlow' of the 'Customer' entity, run the following:
63+
64+
`curl --anyauth --user admin:admin -X PUT -T ./documents/employee1.xml -H "Content-type:application/xml" 'http://localhost:8010/LATEST/documents?uri=/employee1.xml&transform=run-flow&trans:entity-name=Customer&trans:flow-name=IngestFlow'`
65+
66+
This will create a document with uri '/employee1.xml'. The content will depend on the data format of the entity.
67+
68+
If it is JSON ('application/json'), the content will be:
69+
70+
`{`
71+
`"identifier": "/employee1.xml", `
72+
`"content": "<employee xmlns=\"http://company.com/ns/employee\">\n <id>1</id>\n</employee>"`
73+
`}`
74+
75+
Else if it is XML ('application/xml'), it will be:
76+
77+
`<?xml version="1.0" encoding="UTF-8"?>`
78+
`<envelope xmlns="http://marklogic.com/data-hub/envelope">`
79+
`<headers>`
80+
`</headers>`
81+
`<triples>`
82+
`</triples>`
83+
`<content>`
84+
`<employee xmlns="http://company.com/ns/employee">`
85+
`<id>1</id>`
86+
`</employee>`
87+
`</content>`
88+
`</envelope>`

marklogic-data-hub/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ mlFinalRestPort=8011
66
mlUsername=admin
77
mlPassword=admin
88
mlHost=localhost
9-
mlAppName=data-hub-in-a-box
9+
mlAppName=data-hub
1010
auth=digest
1111
version=1.0.0-alpha.2

marklogic-data-hub/src/main/java/com/marklogic/hub/DataHub.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@
6464
public class DataHub {
6565

6666
static final private Logger LOGGER = LoggerFactory.getLogger(DataHub.class);
67-
static final public String STAGING_NAME = "data-hub-in-a-box-STAGING";
68-
static final public String FINAL_NAME = "data-hub-in-a-box-FINAL";
69-
static final public String MODULES_DB_NAME = "data-hub-in-a-box-modules";
67+
static final public String STAGING_NAME = "data-hub-STAGING";
68+
static final public String FINAL_NAME = "data-hub-FINAL";
69+
static final public String MODULES_DB_NAME = "data-hub-modules";
7070
private ManageConfig config;
7171
private ManageClient client;
72-
public static String HUB_NAME = "data-hub-in-a-box";
72+
public static String HUB_NAME = "data-hub";
7373
public static int FORESTS_PER_HOST = 4;
7474
private String host;
7575
private int stagingRestPort;

marklogic-data-hub/src/main/java/com/marklogic/hub/FlowManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
import com.marklogic.spring.batch.hub.FlowWriter;
6464

6565
public class FlowManager extends ResourceManager {
66-
private static final String HUB_NS = "http://marklogic.com/hub-in-a-box";
66+
private static final String HUB_NS = "http://marklogic.com/data-hub";
6767
private static final String NAME = "flow";
6868
private static final int DEFAULT_THREAD_COUNT = 8;
6969

marklogic-data-hub/src/main/java/com/marklogic/hub/Mlcp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public List<String> getMlcpArguments() throws IOException {
140140
arguments.add("-transform_module");
141141
arguments.add("/com.marklogic.hub/mlcp-flow-transform.xqy");
142142
arguments.add("-transform_namespace");
143-
arguments.add("http://marklogic.com/hub-in-a-box/mlcp-flow-transform");
143+
arguments.add("http://marklogic.com/data-hub/mlcp-flow-transform");
144144
arguments.add("-transform_param");
145145
arguments.add("\"" + sourceOptions.getTransformParams() + "\"");
146146
return arguments;

marklogic-data-hub/src/main/java/com/marklogic/hub/flow/AbstractFlow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ protected XMLStreamWriter makeXMLSerializer(OutputStream out) {
246246

247247
try {
248248
XMLStreamWriter serializer = factory.createXMLStreamWriter(out, "UTF-8");
249-
serializer.setDefaultNamespace("http://marklogic.com/hub-in-a-box");
249+
serializer.setDefaultNamespace("http://marklogic.com/data-hub");
250250
return serializer;
251251
} catch (Exception e) {
252252
throw new MarkLogicIOException(e);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"database-name": "data-hub-in-a-box-FINAL",
2+
"database-name": "data-hub-FINAL",
33
"triple-index": true,
44
"collection-lexicon":true
55
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"database-name": "data-hub-in-a-box-STAGING",
2+
"database-name": "data-hub-STAGING",
33
"triple-index": true,
44
"collection-lexicon":true
55
}

marklogic-data-hub/src/main/resources/ml-config/rest-api.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"rest-api" : {
3-
"name" : "data-hub-in-a-box-STAGING",
3+
"name" : "data-hub-STAGING",
44
"group" : "%%GROUP%%",
5-
"database" : "data-hub-in-a-box-STAGING",
5+
"database" : "data-hub-STAGING",
66
"modules-database" : "%%MODULES_DATABASE%%",
77
"port" : %%PORT%%,
88
"xdbc-enabled" : true,

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/collectors/query.xqy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
xquery version "1.0-ml";
1818

19-
module namespace plugin = "http://marklogic.com/hub-in-a-box/plugins/query";
19+
module namespace plugin = "http://marklogic.com/data-hub/plugins/query";
2020

2121
import module namespace ast = "http://marklogic.com/appservices/search-ast" at
2222
"/MarkLogic/appservices/search/ast.xqy";

0 commit comments

Comments
 (0)