Skip to content

Commit 41e3bf4

Browse files
committed
Merge branch 'release/1.0.0-rc.1' into develop
2 parents 1b283e1 + e82f473 commit 41e3bf4

File tree

15 files changed

+355
-59
lines changed

15 files changed

+355
-59
lines changed

CHANGELOG.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Change Log
22

3+
## [v1.0.0-rc.1](https://github.com/marklogic/marklogic-data-hub/tree/v1.0.0-rc.1)
4+
5+
[Full Changelog](https://github.com/marklogic/marklogic-data-hub/compare/v1.0.0-beta.6...v1.0.0-rc.1)
6+
7+
**Fixed bugs:**
8+
9+
- Failed test : DataHubTest.testInstallUserModules [\#106](https://github.com/marklogic/marklogic-data-hub/issues/106)
10+
11+
**Closed issues:**
12+
13+
- Unable to run the harmonize flows [\#242](https://github.com/marklogic/marklogic-data-hub/issues/242)
14+
- ML Version is unnaceptable [\#241](https://github.com/marklogic/marklogic-data-hub/issues/241)
15+
- rename config to marklogic-config [\#239](https://github.com/marklogic/marklogic-data-hub/issues/239)
16+
- Allow many developers to share a server, each with their own Data Hub [\#237](https://github.com/marklogic/marklogic-data-hub/issues/237)
17+
- Change colors and icons to match other MarkLogic content/GUIs [\#236](https://github.com/marklogic/marklogic-data-hub/issues/236)
18+
- Tracing UI [\#210](https://github.com/marklogic/marklogic-data-hub/issues/210)
19+
- During install, list the artifacts being created [\#194](https://github.com/marklogic/marklogic-data-hub/issues/194)
20+
- Performance tracing [\#193](https://github.com/marklogic/marklogic-data-hub/issues/193)
21+
- Refactor the Spring Boot API [\#145](https://github.com/marklogic/marklogic-data-hub/issues/145)
22+
- Support index configuration as a part of pushbutton deploy. [\#10](https://github.com/marklogic/marklogic-data-hub/issues/10)
23+
324
## [v1.0.0-beta.6](https://github.com/marklogic/marklogic-data-hub/tree/v1.0.0-beta.6) (2016-06-20)
425
[Full Changelog](https://github.com/marklogic/marklogic-data-hub/compare/v1.0.0-beta.5...v1.0.0-beta.6)
526

@@ -304,4 +325,4 @@
304325

305326

306327

307-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
328+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

marklogic-data-hub/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
id 'idea'
66
id 'maven-publish'
77
id 'com.jfrog.bintray' version '1.6'
8-
id 'com.marklogic.ml-gradle' version '2.2.0'
8+
id 'com.marklogic.ml-gradle' version '2.3.1'
99
}
1010

1111
repositories {

marklogic-data-hub/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ mlSchemasDbName=data-hub-SCHEMAS
3333

3434
hubModulesPath=examples/hr-hub/plugins
3535

36-
version=1.0.0-beta.6
36+
version=1.0.0-rc.1
3737

3838

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import com.marklogic.appdeployer.command.cpf.DeployCpfConfigsCommand;
2727
import com.marklogic.appdeployer.command.cpf.DeployDomainsCommand;
2828
import com.marklogic.appdeployer.command.cpf.DeployPipelinesCommand;
29-
import com.marklogic.appdeployer.command.databases.DeployOtherDatabasesCommand;
3029
import com.marklogic.appdeployer.command.databases.DeploySchemasDatabaseCommand;
3130
import com.marklogic.appdeployer.command.databases.DeployTriggersDatabaseCommand;
3231
import com.marklogic.appdeployer.command.flexrep.DeployConfigsCommand;
@@ -48,6 +47,7 @@
4847
import com.marklogic.client.extensions.ResourceServices.ServiceResultIterator;
4948
import com.marklogic.client.io.JacksonHandle;
5049
import com.marklogic.client.util.RequestParameters;
50+
import com.marklogic.hub.commands.DeployHubDatabasesCommand;
5151
import com.marklogic.hub.commands.LoadHubModulesCommand;
5252
import com.marklogic.hub.commands.LoadUserModulesCommand;
5353
import com.marklogic.mgmt.ManageClient;
@@ -323,7 +323,7 @@ private List<Command> getCommands(AppConfig config) {
323323

324324
// Databases
325325
List<Command> dbCommands = new ArrayList<>();
326-
dbCommands.add(new DeployOtherDatabasesCommand());
326+
dbCommands.add(new DeployHubDatabasesCommand());
327327
dbCommands.add(new DeployTriggersDatabaseCommand());
328328
dbCommands.add(new DeploySchemasDatabaseCommand());
329329
commands.addAll(dbCommands);
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
/*
2+
* Copyright 2012-2016 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.marklogic.hub;
17+
18+
import com.marklogic.mgmt.util.PropertySource;
19+
import com.marklogic.mgmt.util.PropertySourceFactory;
20+
21+
public class DefaultHubConfigFactory extends PropertySourceFactory {
22+
23+
public DefaultHubConfigFactory() {
24+
super();
25+
};
26+
27+
public DefaultHubConfigFactory(PropertySource propertySource) {
28+
super(propertySource);
29+
}
30+
31+
public HubConfig newHubConfig() {
32+
HubConfig c = new HubConfig();
33+
34+
String prop;
35+
String mlUsername = getProperty("mlUsername");
36+
String mlPassword = getProperty("mlPassword");
37+
38+
prop = getProperty("mlAppName");
39+
if (prop != null) {
40+
logger.info("App name: " + prop);
41+
c.name = prop;
42+
}
43+
44+
prop = getProperty("mlHost");
45+
if (prop != null) {
46+
logger.info("App host: " + prop);
47+
c.host = prop;
48+
}
49+
50+
prop = getProperty("mlStagingDbName");
51+
if (prop != null) {
52+
logger.info("mlStagingDbName: " + prop);
53+
c.stagingDbName = prop;
54+
}
55+
56+
prop = getProperty("mlStagingAppserverName");
57+
if (prop != null) {
58+
logger.info("mlStagingAppserverName: " + prop);
59+
c.stagingHttpName = prop;
60+
}
61+
62+
prop = getProperty("mlStagingPort");
63+
if (prop != null) {
64+
logger.info("Staging App REST port: " + prop);
65+
c.stagingPort = Integer.parseInt(prop);
66+
}
67+
68+
prop = getProperty("mlStagingForestsPerHost");
69+
if (prop != null) {
70+
logger.info("Staging Forests Per Host: " + prop);
71+
c.stagingForestsPerHost = Integer.parseInt(prop);
72+
}
73+
74+
prop = getProperty("mlFinalDbName");
75+
if (prop != null) {
76+
logger.info("mlFinalDbName: " + prop);
77+
c.finalDbName = prop;
78+
}
79+
80+
prop = getProperty("mlFinalAppserverName");
81+
if (prop != null) {
82+
logger.info("mlFinalAppserverName: " + prop);
83+
c.finalHttpName = prop;
84+
}
85+
86+
prop = getProperty("mlFinalPort");
87+
if (prop != null) {
88+
logger.info("Final App REST port: " + prop);
89+
c.finalPort = Integer.parseInt(prop);
90+
}
91+
92+
prop = getProperty("mlFinalForestsPerHost");
93+
if (prop != null) {
94+
logger.info("Final Forests Per Host: " + prop);
95+
c.finalForestsPerHost = Integer.parseInt(prop);
96+
}
97+
98+
prop = getProperty("mlTraceDbName");
99+
if (prop != null) {
100+
logger.info("mlTraceDbName: " + prop);
101+
c.traceDbName = prop;
102+
}
103+
104+
prop = getProperty("mlTraceAppserverName");
105+
if (prop != null) {
106+
logger.info("mlTraceAppserverName: " + prop);
107+
c.traceHttpName = prop;
108+
}
109+
110+
prop = getProperty("mlTracePort");
111+
if (prop != null) {
112+
logger.info("Trace App REST port: " + prop);
113+
c.tracePort = Integer.parseInt(prop);
114+
}
115+
116+
prop = getProperty("mlTraceForestsPerHost");
117+
if (prop != null) {
118+
logger.info("Trace Forests Per Host: " + prop);
119+
c.traceForestsPerHost = Integer.parseInt(prop);
120+
}
121+
122+
prop = getProperty("mlJobDbName");
123+
if (prop != null) {
124+
logger.info("mlJobDbName: " + prop);
125+
c.jobDbName = prop;
126+
}
127+
128+
prop = getProperty("mlJobAppserverName");
129+
if (prop != null) {
130+
logger.info("mlJobAppserverName: " + prop);
131+
c.jobHttpName = prop;
132+
}
133+
134+
prop = getProperty("mlJobPort");
135+
if (prop != null) {
136+
logger.info("Job App REST port: " + prop);
137+
c.jobPort = Integer.parseInt(prop);
138+
}
139+
140+
prop = getProperty("mlJobForestsPerHost");
141+
if (prop != null) {
142+
logger.info("Job Forests Per Host: " + prop);
143+
c.jobForestsPerHost = Integer.parseInt(prop);
144+
}
145+
146+
prop = getProperty("mlModulesDbName");
147+
if (prop != null) {
148+
logger.info("mlModulesDbName: " + prop);
149+
c.modulesDbName = prop;
150+
}
151+
152+
prop = getProperty("mlTriggersDbName");
153+
if (prop != null) {
154+
logger.info("mlTriggersDbName: " + prop);
155+
c.triggersDbName = prop;
156+
}
157+
158+
prop = getProperty("mlSchemasDbName");
159+
if (prop != null) {
160+
logger.info("mlSchemasDbName: " + prop);
161+
c.schemasDbName = prop;
162+
}
163+
164+
prop = getProperty("mlAdminUsername");
165+
if (prop != null) {
166+
logger.info("REST admin username: " + prop);
167+
c.username = prop;
168+
} else if (mlUsername != null) {
169+
logger.info("REST admin username: " + mlUsername);
170+
c.username = mlUsername;
171+
}
172+
173+
prop = getProperty("mlAdminPassword");
174+
if (prop != null) {
175+
c.password = prop;
176+
}
177+
else if (mlPassword != null) {
178+
c.password = mlPassword;
179+
}
180+
181+
prop = getProperty("hubModulesPath");
182+
if (prop != null) {
183+
c.projectDir = prop;
184+
}
185+
else {
186+
c.projectDir = ".";
187+
}
188+
logger.info("Hub Project Dir: " + c.projectDir);
189+
190+
prop = getProperty("mlAuth");
191+
if (prop != null) {
192+
logger.info("mlAuth: " + prop);
193+
c.authMethod = prop;
194+
}
195+
196+
return c;
197+
}
198+
}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public HubProject(HubConfig config) {
3434

3535
customTokens.put("%%mlHost%%", hubConfig.host);
3636
customTokens.put("%%mlAppName%%", hubConfig.name);
37+
customTokens.put("%%mlAdminUsername%%", hubConfig.username);
3738
customTokens.put("%%mlStagingAppserverName%%", hubConfig.stagingHttpName);
3839
customTokens.put("%%mlStagingPort%%", hubConfig.stagingPort.toString());
3940
customTokens.put("%%mlStagingDbName%%", hubConfig.stagingDbName);
@@ -105,7 +106,11 @@ private void writeResourceFileWithReplace(String srcFile, Path dstFile) throws I
105106

106107
String fileContents = IOUtils.toString(inputStream);
107108
for (String key : customTokens.keySet()) {
108-
fileContents = fileContents.replace(key, customTokens.get(key));
109+
110+
String value = customTokens.get(key);
111+
if (value != null) {
112+
fileContents = fileContents.replace(key, value);
113+
}
109114
}
110115
FileWriter writer = new FileWriter(dstFile.toFile());
111116
writer.write(fileContents);
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
package com.marklogic.hub.commands;
2+
3+
import java.io.File;
4+
import java.util.*;
5+
6+
import com.marklogic.appdeployer.ConfigDir;
7+
import com.marklogic.appdeployer.command.AbstractUndoableCommand;
8+
import com.marklogic.appdeployer.command.CommandContext;
9+
import com.marklogic.appdeployer.command.ResourceFilenameFilter;
10+
import com.marklogic.appdeployer.command.SortOrderConstants;
11+
import com.marklogic.appdeployer.command.databases.DeployDatabaseCommand;
12+
import com.marklogic.appdeployer.command.databases.DeployDatabaseCommandComparator;
13+
import com.marklogic.appdeployer.command.databases.DeploySchemasDatabaseCommand;
14+
import com.marklogic.appdeployer.command.databases.DeployTriggersDatabaseCommand;
15+
16+
/**
17+
* This commands handles deploying/undeploying every database file except the "default" ones of content-database.json,
18+
* triggers-database.json, and schemas-database.json. Those default ones are supported for ease-of-use, but it's not
19+
* uncommon to need to create additional databases (and perhaps REST API servers to go with them).
20+
* <p>
21+
* A key aspect of this class is its attempt to deploy/undeploy databases in the correct order. For each database file
22+
* that it finds that's not one of the default ones, a DeployDatabaseCommand will be created. All of those commands will
23+
* then be sorted based on the presence of "triggers-database" or "schema-database" within the payload for the command.
24+
* <p>
25+
* If the above strategy doesn't work for you, you can always resort to naming your database files to control the order
26+
* that they're processed in.
27+
* </p>
28+
*/
29+
public class DeployHubDatabasesCommand extends AbstractUndoableCommand {
30+
31+
public DeployHubDatabasesCommand() {
32+
setExecuteSortOrder(SortOrderConstants.DEPLOY_OTHER_DATABASES);
33+
setUndoSortOrder(SortOrderConstants.DELETE_OTHER_DATABASES);
34+
}
35+
36+
@Override
37+
public void execute(CommandContext context) {
38+
List<DeployDatabaseCommand> list = buildDatabaseCommands(context);
39+
sortCommandsBeforeExecute(list, context);
40+
for (DeployDatabaseCommand c : list) {
41+
c.execute(context);
42+
}
43+
}
44+
45+
protected void sortCommandsBeforeExecute(List<DeployDatabaseCommand> list, CommandContext context) {
46+
Collections.sort(list, new DeployDatabaseCommandComparator(context, false));
47+
}
48+
49+
@Override
50+
public void undo(CommandContext context) {
51+
List<DeployDatabaseCommand> list = buildDatabaseCommands(context);
52+
sortCommandsBeforeUndo(list, context);
53+
for (DeployDatabaseCommand c : list) {
54+
c.undo(context);
55+
}
56+
}
57+
58+
protected void sortCommandsBeforeUndo(List<DeployDatabaseCommand> list, CommandContext context) {
59+
Collections.sort(list, new DeployDatabaseCommandComparator(context, true));
60+
}
61+
62+
protected List<DeployDatabaseCommand> buildDatabaseCommands(CommandContext context) {
63+
List<DeployDatabaseCommand> dbCommands = new ArrayList<>();
64+
65+
ConfigDir configDir = context.getAppConfig().getConfigDir();
66+
File dir = configDir.getDatabasesDir();
67+
if (dir != null && dir.exists()) {
68+
Set<String> ignore = new HashSet<>();
69+
for (File f : configDir.getContentDatabaseFiles()) {
70+
ignore.add(f.getName());
71+
}
72+
ignore.add(DeploySchemasDatabaseCommand.DATABASE_FILENAME);
73+
ignore.add(DeployTriggersDatabaseCommand.DATABASE_FILENAME);
74+
75+
ResourceFilenameFilter filter = new ResourceFilenameFilter(ignore);
76+
setResourceFilenameFilter(filter);
77+
78+
for (File f : listFilesInDirectory(dir)) {
79+
if (logger.isDebugEnabled()) {
80+
logger.debug("Will process other database in file: " + f.getName());
81+
}
82+
DeployDatabaseCommand c = new DeployDatabaseCommand();
83+
c.setDatabaseFilename(f.getName());
84+
c.setForestFilename(f.getName().replace("-database", "-forest"));
85+
dbCommands.add(c);
86+
}
87+
}
88+
return dbCommands;
89+
}
90+
}

marklogic-data-hub/src/main/resources/scaffolding/build_gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ plugins {
33
id 'eclipse'
44
id 'idea'
55
id 'net.saliman.properties' version '1.4.5'
6-
id 'com.marklogic.ml-gradle' version '2.1.0'
7-
id 'com.marklogic.ml-data-hub' version '1.0.0-beta.6'
6+
id 'com.marklogic.ml-gradle' version '2.3.1'
7+
id 'com.marklogic.ml-data-hub' version '1.0.0-rc.1'
88
}
99

1010
repositories {

0 commit comments

Comments
 (0)