Skip to content

Commit fe5bb46

Browse files
committed
merging fixes from 2.x branch
1 parent d7560d7 commit fe5bb46

File tree

44 files changed

+848
-803
lines changed

Some content is hidden

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

44 files changed

+848
-803
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ marklogic-data-hub/bin/
99
marklogic-data-hub/src/main/resources/ml-modules/root/trace-ui
1010
quick-start/bin/
1111
build/
12+
out/
1213
releases/
1314
.classpath
1415
.project

.travis/Dockerfile-java

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis/Dockerfile-ml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
FROM centos:centos7
22

33
ENV LANG C.UTF-8
4-
ENV JAVA_VERSION 8u131
5-
ENV BUILD_VERSION b11
6-
ENV SUM d54c1d3a095b4ff2b6607d096fa80163
4+
ENV JAVA_VERSION 8u141
5+
ENV BUILD_VERSION b15
6+
ENV SUM 336fa29ff2bb4ef291e347e091f7f4a7
7+
8+
# Get any CentOS updates then clear the Docker cache
9+
RUN yum makecache fast && \
10+
yum -y update && yum clean all
11+
12+
# Install MarkLogic dependencies
713
RUN yum -y install glibc.i686 \
814
gdb.x86_64 redhat-lsb.x86_64 vim \
915
bzip2 \
1016
unzip \
11-
wget \
12-
xz-utils 2>&1 > /dev/null
17+
xz-utils 2>&1 > /dev/null \
18+
&& yum clean all
19+
20+
# Install the initscripts package so MarkLogic starts ok
21+
RUN yum -y install initscripts && yum clean all
1322

1423
# Downloading Java
15-
RUN wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/$SUM/jdk-$JAVA_VERSION-linux-x64.rpm" -O /tmp/jdk-8-linux-x64.rpm
24+
RUN curl -s -L -C - -b "oraclelicense=accept-securebackup-cookie" -o /tmp/jdk-8-linux-x64.rpm http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/$SUM/jdk-$JAVA_VERSION-linux-x64.rpm
1625
RUN yum -y install /tmp/jdk-8-linux-x64.rpm
1726

1827
RUN alternatives --install /usr/bin/java jar /usr/java/latest/bin/java 200000
@@ -21,6 +30,9 @@ RUN alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000
2130

2231
ENV JAVA_HOME /usr/java/latest
2332

33+
# Set the Path
34+
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/MarkLogic/mlcmd/bin
35+
2436
# Install MarkLogic
2537
COPY ./MarkLogic.rpm /tmp/MarkLogic.rpm
2638

@@ -29,6 +41,7 @@ RUN yum -y install /tmp/MarkLogic.rpm 2>&1 > /dev/null
2941
# Expose MarkLogic Server ports - add additional ones for your REST, etc
3042
# endpoints
3143
EXPOSE 7997-8020
44+
EXPOSE 5005
3245

3346
# init
3447
COPY .travis/startml.sh /tmp/startml.sh
@@ -41,7 +54,7 @@ VOLUME /marklogic-data-hub
4154
ADD ./ /marklogic-data-hub
4255
WORKDIR /marklogic-data-hub
4356

44-
RUN ./gradlew build -x test 2>&1 > /dev/null
57+
RUN ./gradlew resolveAllDependencies
4558

4659
# Define default command (which avoids immediate shutdown)
47-
CMD /tmp/startml.sh && ./gradlew test
60+
CMD /tmp/startml.sh && ./gradlew clean && ./gradlew test

build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
allprojects {
2+
task resolveAllDependencies {
3+
doLast {
4+
configurations.all { it.resolve() }
5+
}
6+
}
7+
}
8+
19
subprojects {
210
apply plugin: 'java'
311

docker-compose.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ version: '2'
22
services:
33
marklogic:
44
image: marklogiccommunity/marklogic-datahub-1x
5+
build:
6+
context: .
7+
dockerfile: ./.travis/Dockerfile-ml
58
ports:
6-
- "8000-8020"
9+
- "5005:5005"
10+
- "8000-8020:8000-8020"
711
volumes:
812
- .:/marklogic-data-hub

marklogic-data-hub/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'java'
44
id 'maven-publish'
55
id 'com.jfrog.bintray' version '1.7.2'
6-
id 'com.marklogic.ml-gradle' version '2.6.0'
6+
id 'com.marklogic.ml-gradle' version '2.8.0'
77
id 'com.moowork.node' version '1.1.1'
88
}
99

@@ -20,8 +20,10 @@ targetCompatibility = 1.8
2020

2121
dependencies {
2222
compile 'com.marklogic:marklogic-client-api:4.0.1'
23-
compile 'com.marklogic:ml-javaclient-util:4.0.alpha4'
24-
compile 'com.marklogic:ml-app-deployer:2.6.0'
23+
compile('com.marklogic:ml-javaclient-util:4.0.alpha4') {
24+
exclude group: 'com.marklogic', module: 'marklogic-xcc'
25+
}
26+
compile 'com.marklogic:ml-app-deployer:2.8.0'
2527
compile 'commons-io:commons-io:2.4'
2628
testCompile 'junit:junit:4.12'
2729
testCompile 'xmlunit:xmlunit:1.3'

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.springframework.web.client.ResourceAccessException;
5656

5757
import java.io.File;
58+
import java.io.FileOutputStream;
5859
import java.io.IOException;
5960
import java.nio.file.*;
6061
import java.nio.file.attribute.BasicFileAttributes;
@@ -448,7 +449,10 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
448449
JsonNode xored = JsonXor.xor(hubFile, file.toFile());
449450
if (xored.size() > 0) {
450451
ObjectMapper objectMapper = new ObjectMapper();
451-
objectMapper.writerWithDefaultPrettyPrinter().writeValue(file.toFile(), xored);
452+
FileOutputStream fileOutputStream = new FileOutputStream(file.toFile());
453+
objectMapper.writerWithDefaultPrettyPrinter().writeValue(fileOutputStream, xored);
454+
fileOutputStream.flush();
455+
fileOutputStream.close();
452456
}
453457
else {
454458
FileUtils.forceDelete(file.toFile());

marklogic-data-hub/src/main/java/com/marklogic/hub/deploy/commands/LoadHubModulesCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void initializeActiveSession(CommandContext context) {
9494

9595
this.modulesLoader = new DefaultModulesLoader(xccAssetLoader);
9696
this.threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
97-
this.threadPoolTaskExecutor.setCorePoolSize(16);
97+
this.threadPoolTaskExecutor.setCorePoolSize(2);
9898

9999
// 10 minutes should be plenty of time to wait for REST API modules to be loaded
100100
this.threadPoolTaskExecutor.setAwaitTerminationSeconds(60 * 10);

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,13 @@ public AbstractFlow(String entityName, String flowName, FlowType type,
9090

9191
public static AbstractFlow loadFromFile(File file) {
9292
AbstractFlow entity = null;
93+
FileInputStream is = null;
9394
try {
94-
FileInputStream is = new FileInputStream(file);
95+
is = new FileInputStream(file);
9596
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
9697
factory.setNamespaceAware(true);
97-
DocumentBuilder builder = null;
98-
builder = factory.newDocumentBuilder();
98+
DocumentBuilder builder = factory.newDocumentBuilder();
9999
Document doc = builder.parse(is);
100-
is.close();
101100
entity = new SimpleFlow(doc.getDocumentElement());
102101
} catch (FileNotFoundException e) {
103102
e.printStackTrace();
@@ -108,6 +107,15 @@ public static AbstractFlow loadFromFile(File file) {
108107
} catch (IOException e) {
109108
e.printStackTrace();
110109
}
110+
finally {
111+
if (is != null) {
112+
try {
113+
is.close();
114+
}
115+
catch(IOException e) {}
116+
}
117+
118+
}
111119
return entity;
112120
}
113121

marklogic-data-hub/src/main/resources/ml-modules/root/com.marklogic.hub/lib/debug-lib.xqy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ declare function debug:enable($enabled as xs:boolean)
3030
3131
xdmp:document-insert(
3232
"/com.marklogic.hub/settings/__debug_enabled__.xml",
33-
element debug:is-debugging-enabled { if ($enabled) then 1 else 0 })
33+
element debug:is-debugging-enabled { if ($enabled) then 1 else 0 },
34+
xdmp:default-permissions(),
35+
"hub-core-module")
3436
',
3537
map:new((map:entry("enabled", $enabled))),
3638
map:new(map:entry("database", xdmp:modules-database()))

0 commit comments

Comments
 (0)