Skip to content

Commit 8063d88

Browse files
committed
Merge branch 'release/1.1.5' into 1.0-master
2 parents 7ca173c + 4e5f16f commit 8063d88

File tree

34 files changed

+633
-161
lines changed

34 files changed

+633
-161
lines changed

CHANGELOG.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
# Change Log
22

3-
## [v1.1.4](https://github.com/marklogic-community/marklogic-data-hub/tree/v1.1.4)
3+
## [v1.1.5](https://github.com/marklogic-community/marklogic-data-hub/tree/v1.1.5)
44

5-
[Full Changelog](https://github.com/marklogic-community/marklogic-data-hub/compare/v2.0.0-rc.1...v1.1.4)
5+
[Full Changelog](https://github.com/marklogic-community/marklogic-data-hub/compare/v1.1.4...v1.1.5)
6+
7+
**Implemented enhancements:**
8+
9+
- Update Quickstart Ready message [\#478](https://github.com/marklogic-community/marklogic-data-hub/issues/478)
10+
- Example: Migrating a RDBMS to Data Hub using Spring Batch [\#473](https://github.com/marklogic-community/marklogic-data-hub/issues/473)
611

712
**Fixed bugs:**
813

14+
- Providing different source/dest DB for the hubRunFlow does not work [\#488](https://github.com/marklogic-community/marklogic-data-hub/issues/488)
15+
- Path to code has wrong slash on Windows [\#467](https://github.com/marklogic-community/marklogic-data-hub/issues/467)
16+
- Job status stuck on STARTED for Input Flows [\#466](https://github.com/marklogic-community/marklogic-data-hub/issues/466)
917
- File not saving properly from quickstart to fix a bug [\#430](https://github.com/marklogic-community/marklogic-data-hub/issues/430)
18+
- Error on initial run of QuickStart GUI [\#394](https://github.com/marklogic-community/marklogic-data-hub/issues/394)
19+
- Error saving entity - collation not legal [\#337](https://github.com/marklogic-community/marklogic-data-hub/issues/337)
1020

1121
**Closed issues:**
1222

23+
- collection name is hard coded in online store example [\#474](https://github.com/marklogic-community/marklogic-data-hub/issues/474)
24+
- add \(rest-extension-user,read\) to XML documents in modules-db [\#470](https://github.com/marklogic-community/marklogic-data-hub/issues/470)
25+
- column-width, or tooltip with full "Identifier" in traces table [\#469](https://github.com/marklogic-community/marklogic-data-hub/issues/469)
26+
- Initializing DHF Project against existing DB is dropping indexes [\#468](https://github.com/marklogic-community/marklogic-data-hub/issues/468)
1327
- Saving the changes in a flow code never finishes \*sometimes\* [\#462](https://github.com/marklogic-community/marklogic-data-hub/issues/462)
28+
- Sometimes a trace for a failed Harmonize job is not available/not existing [\#461](https://github.com/marklogic-community/marklogic-data-hub/issues/461)
29+
- Unable to ingest image \(.png\) documents using DHF Quick-Start application [\#420](https://github.com/marklogic-community/marklogic-data-hub/issues/420)
30+
- Load files into the data hub schemas database [\#288](https://github.com/marklogic-community/marklogic-data-hub/issues/288)
31+
- Ability to override uri for input flows [\#182](https://github.com/marklogic-community/marklogic-data-hub/issues/182)
32+
- Create concept of a domain [\#82](https://github.com/marklogic-community/marklogic-data-hub/issues/82)
33+
34+
**Merged pull requests:**
35+
36+
- Feature/473 msb example [\#480](https://github.com/marklogic-community/marklogic-data-hub/pull/480) ([sastafford](https://github.com/sastafford))
37+
- Some typos and suggestions [\#475](https://github.com/marklogic-community/marklogic-data-hub/pull/475) ([patrickmcelwee](https://github.com/patrickmcelwee))
38+
39+
## [v1.1.4](https://github.com/marklogic-community/marklogic-data-hub/tree/v1.1.4) (2017-07-25)
40+
[Full Changelog](https://github.com/marklogic-community/marklogic-data-hub/compare/v2.0.0-rc.1...v1.1.4)
1441

1542
## [v2.0.0-rc.1](https://github.com/marklogic-community/marklogic-data-hub/tree/v2.0.0-rc.1) (2017-07-24)
1643
[Full Changelog](https://github.com/marklogic-community/marklogic-data-hub/compare/v2.0.0-beta.1...v2.0.0-rc.1)

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ plugins {
7171
...
7272
7373
// comment out this line. It pulls the version from the cloud
74-
// id 'com.marklogic.ml-data-hub' version '1.1.4'
74+
// id 'com.marklogic.ml-data-hub' version '1.1.5'
7575
}
7676
7777
// this tells gradle to apply the plugin you included above in the buildscript section

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ _The Data Hub Framework is free and open source under the [Apache 2 License](htt
44

55
| OS | Status |
66
| --- | --- |
7-
| Linux/Mac | [![Build Status](https://travis-ci.org/marklogic-community/marklogic-data-hub.svg?branch=1.0-develop)](https://travis-ci.org/marklogic-community/marklogic-data-hub) |
8-
| Windows | [![Windows Build status](https://ci.appveyor.com/api/projects/status/kgj0k5na59uhkvbv/branch/1.0-develop?svg=true)](https://ci.appveyor.com/project/paxtonhare/marklogic-data-hub) |
7+
| Linux/Mac | [![Build Status](https://travis-ci.org/marklogic-community/marklogic-data-hub.svg?branch=1.0-master)](https://travis-ci.org/marklogic-community/marklogic-data-hub) |
8+
| Windows | [![Windows Build status](https://ci.appveyor.com/api/projects/status/kgj0k5na59uhkvbv/branch/1.0-master?svg=true)](https://ci.appveyor.com/project/paxtonhare/marklogic-data-hub) |
99

1010
# MarkLogic Data Hub
1111

@@ -46,7 +46,7 @@ Alternatively you can include the jar file as a build dependency in your Java pr
4646
**Gradle**
4747

4848
```groovy
49-
compile('com.marklogic:marklogic-data-hub:1.1.4')
49+
compile('com.marklogic:marklogic-data-hub:1.1.5')
5050
```
5151

5252
**Maven**
@@ -55,15 +55,15 @@ compile('com.marklogic:marklogic-data-hub:1.1.4')
5555
<dependency>
5656
<groupId>com.marklogic</groupId>
5757
<artifactId>marklogic-data-hub</artifactId>
58-
<version>1.1.4</version>
58+
<version>1.1.5</version>
5959
<type>pom</type>
6060
</dependency>
6161
```
6262

6363
**Ivy**
6464

6565
```xml
66-
<dependency org='com.marklogic' name='marklogic-data-hub' rev='1.1.4'>
66+
<dependency org='com.marklogic' name='marklogic-data-hub' rev='1.1.5'>
6767
<artifact name='$AID' ext='pom'></artifact>
6868
</dependency>
6969
```
@@ -74,7 +74,7 @@ If you prefer to use gradle for all of your hub interactions then you can includ
7474

7575
```groovy
7676
plugins {
77-
id 'com.marklogic.ml-data-hub' version '1.1.4'
77+
id 'com.marklogic.ml-data-hub' version '1.1.5'
7878
}
7979
```
8080

examples/spring-batch/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'java'
33
id 'application'
44
id 'net.saliman.properties' version '1.4.6'
5-
id 'com.marklogic.ml-data-hub' version '1.1.4'
5+
id 'com.marklogic.ml-data-hub' version '1.1.5'
66
}
77

88
repositories {
@@ -12,7 +12,7 @@ repositories {
1212
}
1313

1414
dependencies {
15-
compile 'com.marklogic:marklogic-data-hub:1.1.4'
15+
compile 'com.marklogic:marklogic-data-hub:1.1.5'
1616
compile "com.marklogic:marklogic-spring-batch-core:0.7.4"
1717
compile 'com.marklogic:ml-javaclient-util:4.0.alpha4'
1818

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.1.4
1+
version=1.1.5

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public class HubConfig {
140140

141141
public String customForestPath = DEFAULT_CUSTOM_FOREST_PATH;
142142

143-
public String modulePermissions = "rest-admin,read,rest-admin,update,rest-extension-user,execute";
143+
public String modulePermissions = "rest-extension-user,read,rest-extension-user,execute,rest-admin,read,rest-admin,update";
144144

145145
public String projectDir;
146146

@@ -281,6 +281,7 @@ public DatabaseClient newStagingClient() {
281281
return DatabaseClientFactory.newClient(
282282
host,
283283
stagingPort,
284+
stagingDbName,
284285
username,
285286
password,
286287
DatabaseClientFactory.Authentication.valueOf(stagingAuthMethod.toUpperCase()));
@@ -308,6 +309,7 @@ public DatabaseClient newFinalClient() {
308309
return DatabaseClientFactory.newClient(
309310
host,
310311
finalPort,
312+
finalDbName,
311313
username,
312314
password,
313315
DatabaseClientFactory.Authentication.valueOf(finalAuthMethod.toUpperCase()));
@@ -321,6 +323,7 @@ public DatabaseClient newJobDbClient() {
321323
return DatabaseClientFactory.newClient(
322324
host,
323325
jobPort,
326+
jobDbName,
324327
username,
325328
password,
326329
DatabaseClientFactory.Authentication.valueOf(jobAuthMethod.toUpperCase()));
@@ -348,6 +351,7 @@ public DatabaseClient newTraceDbClient() {
348351
return DatabaseClientFactory.newClient(
349352
host,
350353
tracePort,
354+
traceDbName,
351355
username,
352356
password,
353357
DatabaseClientFactory.Authentication.valueOf(stagingAuthMethod.toUpperCase()));

marklogic-data-hub/src/main/java/com/marklogic/hub/collector/ServerCollector.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import com.fasterxml.jackson.databind.ObjectMapper;
1919
import com.marklogic.client.DatabaseClient;
2020
import com.marklogic.hub.HubConfig;
21-
import com.marklogic.hub.HubDatabase;
2221
import com.marklogic.hub.plugin.PluginType;
2322
import com.marklogic.xcc.*;
2423
import org.slf4j.Logger;
@@ -33,7 +32,6 @@ public class ServerCollector extends AbstractCollector {
3332
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
3433
private DatabaseClient client = null;
3534
private HubConfig hubConfig = null;
36-
private HubDatabase sourceDb = null;
3735

3836
private String module;
3937

@@ -43,7 +41,6 @@ public ServerCollector(PluginType type, String module) {
4341
}
4442

4543
public void setHubConfig(HubConfig config) { this.hubConfig = config; }
46-
public void setHubDatabase(HubDatabase sourceDb) { this.sourceDb = sourceDb; }
4744

4845
public DatabaseClient getClient() {
4946
return this.client;
@@ -68,15 +65,8 @@ public void serialize(XMLStreamWriter serializer) throws XMLStreamException {
6865

6966
@Override
7067
public DiskQueue<String> run(String jobId, int threadCount, Map<String, Object> options) {
71-
int port = hubConfig.stagingPort;
72-
String dbName = hubConfig.stagingDbName;
73-
if (sourceDb.equals(HubDatabase.FINAL)) {
74-
port = hubConfig.finalPort;
75-
dbName = hubConfig.finalDbName;
76-
}
77-
7868
try {
79-
ContentSource cs = ContentSourceFactory.newContentSource(hubConfig.host, port, hubConfig.getUsername(), hubConfig.getPassword(), dbName);
69+
ContentSource cs = ContentSourceFactory.newContentSource(client.getHost(), client.getPort(), hubConfig.getUsername(), hubConfig.getPassword(), client.getDatabase());
8070
Session activeSession = cs.newSession();
8171
RequestOptions requestOptions = new RequestOptions();
8272
requestOptions.setCacheResult(false);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.marklogic.hub.flow;
22

3+
import com.marklogic.client.DatabaseClient;
34
import com.marklogic.client.datamovement.JobTicket;
45
import com.marklogic.hub.HubDatabase;
56

@@ -11,8 +12,8 @@ public interface FlowRunner {
1112
FlowRunner withFlow(Flow flow);
1213
FlowRunner withBatchSize(int batchSize);
1314
FlowRunner withThreadCount(int threadCount);
14-
FlowRunner withSourceDatabase(HubDatabase sourceDatabase);
15-
FlowRunner withDestinationDatabase(HubDatabase destinationDatabase);
15+
FlowRunner withSourceClient(DatabaseClient sourceClient);
16+
FlowRunner withDestinationDatabase(String destinationDatabase);
1617
FlowRunner withOptions(Map<String, Object> options);
1718

1819
FlowRunner onItemComplete(FlowItemCompleteListener listener);

marklogic-data-hub/src/main/java/com/marklogic/hub/flow/impl/FlowRunnerImpl.java

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public class FlowRunnerImpl implements FlowRunner {
3232
private Flow flow;
3333
private int batchSize = DEFAULT_BATCH_SIZE;
3434
private int threadCount = DEFAULT_THREAD_COUNT;
35-
private HubDatabase sourceDatabase = HubDatabase.STAGING;
36-
private HubDatabase destinationDatabase = HubDatabase.FINAL;
35+
private DatabaseClient sourceClient;
36+
private String destinationDatabase;
3737
private Map<String, Object> options;
3838
private int previousPercentComplete;
3939

@@ -47,6 +47,8 @@ public class FlowRunnerImpl implements FlowRunner {
4747

4848
public FlowRunnerImpl(HubConfig hubConfig) {
4949
this.hubConfig = hubConfig;
50+
this.sourceClient = hubConfig.newStagingClient();
51+
this.destinationDatabase = hubConfig.finalDbName;
5052
}
5153

5254
@Override
@@ -68,13 +70,13 @@ public FlowRunner withThreadCount(int threadCount) {
6870
}
6971

7072
@Override
71-
public FlowRunner withSourceDatabase(HubDatabase sourceDatabase) {
72-
this.sourceDatabase = sourceDatabase;
73+
public FlowRunner withSourceClient(DatabaseClient sourceClient) {
74+
this.sourceClient = sourceClient;
7375
return this;
7476
}
7577

7678
@Override
77-
public FlowRunner withDestinationDatabase(HubDatabase destinationDatabase) {
79+
public FlowRunner withDestinationDatabase(String destinationDatabase) {
7880
this.destinationDatabase = destinationDatabase;
7981
return this;
8082
}
@@ -122,17 +124,6 @@ public void awaitCompletion(long timeout, TimeUnit unit) throws InterruptedExcep
122124
runningThread.join(unit.convert(timeout, TimeUnit.MILLISECONDS));
123125
}
124126

125-
private DatabaseClient getSourceClient() {
126-
DatabaseClient srcClient;
127-
if (sourceDatabase.equals(HubDatabase.STAGING)) {
128-
srcClient = hubConfig.newStagingClient();
129-
}
130-
else {
131-
srcClient = hubConfig.newFinalClient();
132-
}
133-
return srcClient;
134-
}
135-
136127
@Override
137128
public JobTicket run() {
138129
String jobId = UUID.randomUUID().toString();
@@ -142,13 +133,10 @@ public JobTicket run() {
142133
.withJobId(jobId);
143134
jobManager.saveJob(job);
144135

145-
DatabaseClient srcClient = getSourceClient();
146-
147136
Collector c = flow.getCollector();
148137
if (c instanceof ServerCollector) {
149138
((ServerCollector)c).setHubConfig(hubConfig);
150-
((ServerCollector)c).setHubDatabase(sourceDatabase);
151-
((ServerCollector)c).setClient(srcClient);
139+
((ServerCollector)c).setClient(sourceClient);
152140
}
153141

154142
AtomicLong successfulEvents = new AtomicLong(0);
@@ -176,7 +164,7 @@ public JobTicket run() {
176164

177165
ArrayList<String> errorMessages = new ArrayList<>();
178166

179-
DataMovementManager dataMovementManager = srcClient.newDataMovementManager();
167+
DataMovementManager dataMovementManager = sourceClient.newDataMovementManager();
180168

181169
double batchCount = Math.ceil((double)uris.size() / (double)batchSize);
182170

@@ -185,7 +173,7 @@ public JobTicket run() {
185173
.withThreadCount(threadCount)
186174
.onUrisReady((QueryBatch batch) -> {
187175
try {
188-
FlowResource flowRunner = new FlowResource(batch.getClient(), batch.getClient().getDatabase(), flow);
176+
FlowResource flowRunner = new FlowResource(batch.getClient(), destinationDatabase, flow);
189177
RunFlowResponse response = flowRunner.run(jobId, batch.getItems(), options);
190178
failedEvents.addAndGet(response.errorCount);
191179
successfulEvents.addAndGet(response.totalCount - response.errorCount);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.marklogic.hub.util;
2+
3+
import com.marklogic.hub.flow.FlowStatusListener;
4+
5+
import java.util.List;
6+
import java.util.concurrent.atomic.AtomicLong;
7+
import java.util.function.Consumer;
8+
import java.util.regex.Matcher;
9+
import java.util.regex.Pattern;
10+
11+
public class MlcpConsumer implements Consumer<String> {
12+
private int currentPc = 0;
13+
private final Pattern completedPattern = Pattern.compile("^.+completed (\\d+)%$");
14+
private final Pattern successfulEventsPattern = Pattern.compile("^.+OUTPUT_RECORDS_COMMITTED:\\s+(\\d+).*$");
15+
private final Pattern failedEventsPattern = Pattern.compile("^.+OUTPUT_RECORDS_FAILED\\s+(\\d+).*$");
16+
private AtomicLong successfulEvents;
17+
private AtomicLong failedEvents;
18+
private FlowStatusListener statusListener;
19+
private String jobId;
20+
21+
public MlcpConsumer(AtomicLong successfulEvents, AtomicLong failedEvents, FlowStatusListener statusListener,
22+
String jobId)
23+
{
24+
this.successfulEvents = successfulEvents;
25+
this.failedEvents = failedEvents;
26+
this.statusListener = statusListener;
27+
this.jobId = jobId;
28+
}
29+
30+
@Override
31+
public void accept(String status) {
32+
Matcher m = completedPattern.matcher(status);
33+
if (m.matches()) {
34+
int pc = Integer.parseInt(m.group(1));
35+
36+
// don't send 100% because more stuff happens after 100% is reported here
37+
if (pc > currentPc && pc != 100) {
38+
currentPc = pc;
39+
}
40+
}
41+
42+
m = successfulEventsPattern.matcher(status);
43+
if (m.matches()) {
44+
successfulEvents.addAndGet(Long.parseLong(m.group(1)));
45+
}
46+
47+
m = failedEventsPattern.matcher(status);
48+
if (m.matches()) {
49+
failedEvents.addAndGet(Long.parseLong(m.group(1)));
50+
}
51+
52+
statusListener.onStatusChange(jobId, currentPc, status);
53+
}
54+
}

0 commit comments

Comments
 (0)