Skip to content

Commit 16c1a9d

Browse files
committed
Merge pull request #95 from paxtonhare/94_add_mlcp_attrs
fixed #92
2 parents 70bc829 + 91d3b15 commit 16c1a9d

File tree

24 files changed

+1021
-975
lines changed

24 files changed

+1021
-975
lines changed

data-hub/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies {
2626
compile 'com.marklogic:ml-javaclient-util:2.6.1'
2727
compile 'com.marklogic:ml-app-deployer:2.0'
2828
compile 'commons-io:commons-io:2.4'
29-
compile 'com.google.code.gson:gson:2.6.1'
29+
compile 'org.apache.commons:commons-csv:1.2'
3030
compile("com.marklogic:mlcp:8.0-4") {
3131
exclude module : 'servlet-api'
3232
exclude group: 'com.google.guava', module: 'guava'

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected void initializeDefaultSpringBatchComponents() {
117117

118118
/**
119119
* Retrieves a list of flows installed on the MarkLogic server
120-
*
120+
*
121121
* @param entityName
122122
* - the entity from which to fetch the flows
123123
* @return - a list of flows for the given entity
@@ -151,7 +151,7 @@ public List<Flow> getFlows(String entityName) {
151151

152152
/**
153153
* Retrieves a named flow from a given entity
154-
*
154+
*
155155
* @param entityName
156156
* - the entity that the flow belongs to
157157
* @param flowName
@@ -199,7 +199,7 @@ public JobExecution runFlow(Flow flow, int batchSize) {
199199
* @param flow - the flow to run
200200
* @param batchSize - the size to use for batching transactions
201201
* @param listener - the JobExecutionListener to receive status updates about the job
202-
* @return
202+
* @return
203203
*/
204204
public JobExecution runFlow(Flow flow, int batchSize, JobExecutionListener listener) {
205205
Collector c = flow.getCollector();

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ public List<String> getMlcpArguments() throws IOException {
134134
arguments.add(sourceOptions.getInputFilePattern());
135135
}
136136

137+
if (sourceOptions.getCollection() != null) {
138+
arguments.add("-output_collections");
139+
arguments.add(sourceOptions.getCollection());
140+
}
141+
137142
// by default, cut the source directory path to make URIs shorter
138143
String uriReplace = canonicalPath + ",''";
139144
uriReplace = uriReplace.replaceAll("\\\\", "/");
@@ -157,6 +162,7 @@ public static class SourceOptions {
157162
private String flowType;
158163
private String inputFileType;
159164
private String inputFilePattern;
165+
private String collection;
160166

161167
public SourceOptions(String entityName, String flowName, String flowType) {
162168
this.entityName = entityName;
@@ -192,6 +198,14 @@ public void setInputFilePattern(String inputFilePattern) {
192198
this.inputFilePattern = inputFilePattern;
193199
}
194200

201+
public String getCollection() {
202+
return collection;
203+
}
204+
205+
public void setCollection(String collection) {
206+
this.collection = collection;
207+
}
208+
195209
protected String getTransformParams() {
196210
return String
197211
.format("<params><entity-name>%s</entity-name><flow-name>%s</flow-name><flow-type>%s</flow-type></params>",

quick-start/build.gradle

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ buildscript {
44
maven {url 'http://developer.marklogic.com/maven2/'}
55
}
66
dependencies {
7-
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
7+
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE')
88
}
99
}
1010

11-
apply plugin: 'java'
12-
apply plugin: 'eclipse'
13-
apply plugin: 'idea'
11+
plugins {
12+
id 'java'
13+
id 'eclipse'
14+
id 'idea'
15+
id 'com.eriwen.gradle.js' version '1.12.1'
16+
}
17+
1418
apply plugin: 'spring-boot'
1519

1620
repositories {
@@ -26,10 +30,28 @@ configurations {
2630
}
2731

2832
dependencies {
29-
compile("org.springframework.boot:spring-boot-starter")
30-
compile("org.springframework.boot:spring-boot-starter-web")
33+
compile('org.springframework.boot:spring-boot-starter')
34+
compile('org.springframework.boot:spring-boot-starter-web')
3135
compile project(':data-hub')
32-
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
33-
testCompile("junit:junit")
36+
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
37+
testCompile('junit:junit')
3438
}
3539

40+
41+
javascript.source {
42+
dev {
43+
js {
44+
srcDir "src/main/resources/static/app"
45+
include "**/*.js"
46+
}
47+
}
48+
}
49+
50+
jshint {
51+
tasks.jshint.source = javascript.source.dev.js.files
52+
tasks.jshint.dest = file("${buildDir}/jshint.out")
53+
tasks.jshint.ignoreExitCode = false
54+
tasks.jshint.outputToStdOut = true
55+
tasks.jshint.reporter = 'checkstyle'
56+
options = ["--config":"src/main/resources/static/.jshintrc"]
57+
}

quick-start/src/main/java/com/marklogic/hub/model/RunFlowModel.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ public class RunFlowModel {
44
private String entityName;
55
private String flowName;
66
private String inputPath;
7+
private String collection;
8+
private String dataFormat;
79

810
public String getEntityName() {
911
return entityName;
@@ -16,4 +18,12 @@ public String getFlowName() {
1618
public String getInputPath() {
1719
return inputPath;
1820
}
21+
22+
public String getCollection() {
23+
return collection;
24+
}
25+
26+
public String getDataFormat() {
27+
return dataFormat;
28+
}
1929
}

quick-start/src/main/java/com/marklogic/hub/service/SyncStatusService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th
7777

7878
@Override
7979
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
80-
synched = synched && isSynched(file.normalize().toAbsolutePath().toFile());
81-
if (!synched) {
82-
return FileVisitResult.TERMINATE;
80+
// don't look at hidden files like .DS_Store
81+
if (!file.getFileName().toString().startsWith(".")) {
82+
synched = synched && isSynched(file.normalize().toAbsolutePath().toFile());
83+
if (!synched) {
84+
return FileVisitResult.TERMINATE;
85+
}
8386
}
8487

8588
return FileVisitResult.CONTINUE;

quick-start/src/main/java/com/marklogic/hub/web/controller/api/FlowApiController.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ public void run(BasicFuture<?> resultFuture) {
192192
SourceOptions sourceOptions = new SourceOptions(
193193
runFlow.getEntityName(), runFlow.getFlowName(),
194194
FlowType.INPUT.toString());
195+
sourceOptions.setInputFileType(runFlow.getDataFormat());
196+
sourceOptions.setCollection(runFlow.getCollection());
195197
mlcp.addSourceDirectory(runFlow.getInputPath(), sourceOptions);
196198
mlcp.loadContent();
197199

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"browser": true,
3+
"node": true,
4+
"camelcase": true,
5+
"curly": true,
6+
"eqeqeq": true,
7+
"immed": true,
8+
"indent": 2,
9+
"latedef": "nofunc",
10+
"newcap": true,
11+
"quotmark": "single",
12+
"undef": true,
13+
"unused": "vars",
14+
"strict": true,
15+
"trailing": true,
16+
"globals": {
17+
"angular": false,
18+
"google": false,
19+
"$": false,
20+
"Highcharts": false,
21+
"_": false,
22+
"moment": false,
23+
"MLSearchController": false
24+
}
25+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<div id="footer" class="container-fluid">
2-
<span>&copy;2016.&nbsp;Data Hub in a Box.</span>
3-
</div>
1+
<div id="footer" class="container-fluid">
2+
<span>&copy;2016.&nbsp;<a href="http://www.marklogic.com">MarkLogic</a></span>
3+
</div>
Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
var dependencies = [
2-
];
3-
var module = angular.module('dhib.quickstart.directives.footer', dependencies);
4-
module.directive('footer', [
5-
'$http'
6-
,'$location'
7-
,function(
8-
$http
9-
,$location
10-
) {
11-
return {
12-
restrict: 'E'
13-
,scope : {
14-
activeTab : '='
15-
}
16-
,transclude: true
17-
,templateUrl : function(element, attrs) {
18-
return attrs.templateUrl || 'app/directives/footer.html';
19-
}
20-
,link : function(scope, element, attrs) {
21-
}
22-
,controller : function($scope, $element, $attrs, $transclude) {
23-
}
24-
};
25-
}
26-
]);
1+
(function () {
2+
3+
'use strict';
4+
5+
angular.module('dhib.quickstart.directives.footer', [])
6+
.directive('footer', FooterDirective);
7+
8+
function FooterDirective($http, $location) {
9+
return {
10+
restrict: 'E',
11+
scope : {
12+
activeTab : '='
13+
},
14+
transclude: true,
15+
templateUrl : function(element, attrs) {
16+
return attrs.templateUrl || 'app/directives/footer.html';
17+
}
18+
};
19+
}
20+
})();

0 commit comments

Comments
 (0)