Skip to content

Commit c55829d

Browse files
committed
adding trace server, db, forests
1 parent a8b0681 commit c55829d

File tree

24 files changed

+125
-21
lines changed

24 files changed

+125
-21
lines changed

examples/gradle-advanced/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ ext {
4242
customTokens.put("%%FINAL_SERVER_PORT%%", mlFinalAppserverPort)
4343
customTokens.put("%%FINAL_DB_NAME%%", mlFinalDbName)
4444

45+
customTokens.put("%%TRACE_SERVER_NAME%%", mlTraceAppserverName)
46+
customTokens.put("%%TRACE_SERVER_PORT%%", mlTraceAppserverPort)
47+
customTokens.put("%%TRACE_DB_NAME%%", mlTraceDbName)
48+
4549
customTokens.put("%%MODULES_DB_NAME%%", mlModulesDbName)
4650
}
4751
}
@@ -66,6 +70,11 @@ ext {
6670
mlAppDeployer.commands.add(finalDbCommand)
6771
mlDatabaseCommands.add(finalDbCommand)
6872

73+
// install the trace database
74+
def traceDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("trace-database.json")
75+
mlAppDeployer.commands.add(traceDbCommand)
76+
mlDatabaseCommands.add(traceDbCommand)
77+
6978
// install the modules database
7079
def modulesDbCommand = new com.marklogic.appdeployer.command.databases.DeployDatabaseCommand("modules-database.json")
7180
mlAppDeployer.commands.add(modulesDbCommand)

examples/gradle-advanced/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ mlFinalAppserverName=data-hub-FINAL
99
mlFinalAppserverPort=8101
1010
mlFinalDbName=data-hub-FINAL
1111

12+
mlTraceAppserverName=data-hub-TRACING
13+
mlTraceAppserverPort=8102
14+
mlTraceDbName=data-hub-TRACING
15+
1216
mlModulesDbName=data-hub-MODULES
1317
mlTriggersDbName=data-hub-TRIGGERS
1418
mlSchemasDbName=data-hub-SCHEMAS
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"database-name": "%%TRACE_DB_NAME%%",
3+
"range-element-index": [],
4+
"schema-database": "%%SCHEMAS_DATABASE%%",
5+
"triggers-database": "%%TRIGGERS_DATABASE%%",
6+
"triple-index": true,
7+
"collection-lexicon": true,
8+
"uri-lexicon": true
9+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"server-name": "%%TRACE_SERVER_NAME%%",
3+
"server-type": "http",
4+
"root": "/",
5+
"group-name": "%%GROUP%%",
6+
"port": %%TRACE_SERVER_PORT%%,
7+
"modules-database": "%%MODULES_DB_NAME%%",
8+
"content-database": "%%TRACE_DB_NAME%%",
9+
"authentication": "digest",
10+
"default-error-format": "json",
11+
"error-handler": "/MarkLogic/rest-api/error-handler.xqy",
12+
"url-rewriter": "/MarkLogic/rest-api/rewriter.xml",
13+
"rewrite-resolves-globally": true
14+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mlHost=localhost
22
mlStagingPort=8100
33
mlFinalPort=8101
4+
mlTracePort=8102
45
hubModulesPath=./plugins

marklogic-data-hub/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mlConfigDir=marklogic-data-hub/src/main/resources/ml-config
33
publishUrl=file:../marklogic-data-hub/releases
44
mlStagingRestPort=8010
55
mlFinalRestPort=8011
6+
mlTraceRestPort=8012
67
mlUsername=admin
78
mlPassword=admin
89
mlHost=localhost

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class DataHub {
7272
static final private Logger LOGGER = LoggerFactory.getLogger(DataHub.class);
7373
static final public String STAGING_NAME = "data-hub-STAGING";
7474
static final public String FINAL_NAME = "data-hub-FINAL";
75+
static final public String TRACING_NAME = "data-hub-TRACING";
7576
static final public String MODULES_DB_NAME = "data-hub-modules";
7677
private ManageConfig config;
7778
private ManageClient client;
@@ -80,28 +81,31 @@ public class DataHub {
8081
private String host;
8182
private int stagingRestPort;
8283
private int finalRestPort;
84+
private int tracingRestPort;
8385
private String username;
8486
private String password;
8587

8688
private File assetInstallTimeFile = new File("./assetInstallTime.properties");
8789

8890
private final static int DEFAULT_STAGING_REST_PORT = 8010;
8991
private final static int DEFAULT_FINAL_REST_PORT = 8011;
92+
private final static int DEFAULT_TRACING_REST_PORT = 8012;
9093

9194
public DataHub(HubConfig config) {
92-
this(config.getHost(), config.getStagingPort(), config.getFinalPort(), config.getAdminUsername(), config.getAdminPassword());
95+
this(config.getHost(), config.getStagingPort(), config.getFinalPort(), config.getTracePort(), config.getAdminUsername(), config.getAdminPassword());
9396
}
9497

9598
public DataHub(String host, String username, String password) {
96-
this(host, DEFAULT_STAGING_REST_PORT, DEFAULT_FINAL_REST_PORT, username, password);
99+
this(host, DEFAULT_STAGING_REST_PORT, DEFAULT_FINAL_REST_PORT, DEFAULT_TRACING_REST_PORT, username, password);
97100
}
98101

99-
public DataHub(String host, int stagingRestPort, int finalRestPort, String username, String password) {
102+
public DataHub(String host, int stagingRestPort, int finalRestPort, int tracingRestPort, String username, String password) {
100103
config = new ManageConfig(host, 8002, username, password);
101104
client = new ManageClient(config);
102105
this.host = host;
103106
this.stagingRestPort = stagingRestPort;
104107
this.finalRestPort = finalRestPort;
108+
this.tracingRestPort = tracingRestPort;
105109
this.username = username;
106110
this.password = password;
107111
}
@@ -214,6 +218,7 @@ private DatabaseClient getDatabaseClient(int port) {
214218
config.getRestAuthentication(), config.getRestSslContext(), config.getRestSslHostnameVerifier());
215219
return client;
216220
}
221+
217222
/**
218223
* Installs User Provided modules into the Data Hub
219224
*
@@ -298,6 +303,9 @@ private List<Command> getCommands(AppConfig config) {
298303
finalDb.setForestsPerHost(FORESTS_PER_HOST);
299304
dbCommands.add(finalDb);
300305

306+
DeployHubDatabaseCommand tracingDb = new DeployHubDatabaseCommand(TRACING_NAME);
307+
dbCommands.add(tracingDb);
308+
301309
dbCommands.add(new DeployModulesDatabaseCommand(MODULES_DB_NAME));
302310
dbCommands.add(new DeployTriggersDatabaseCommand());
303311
dbCommands.add(new DeploySchemasDatabaseCommand());
@@ -306,6 +314,7 @@ private List<Command> getCommands(AppConfig config) {
306314
// App Servers
307315
commands.add(new DeployRestApiCommand(STAGING_NAME, stagingRestPort));
308316
commands.add(new DeployRestApiCommand(FINAL_NAME, finalRestPort));
317+
commands.add(new DeployRestApiCommand(TRACING_NAME, tracingRestPort));
309318

310319
// Modules
311320
commands.add(new LoadModulesCommand());

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public HubConfig newHubConfig() {
5959
c.setFinalPort(Integer.parseInt(prop));
6060
}
6161

62+
prop = getProperty("mlTracePort");
63+
if (prop != null) {
64+
logger.info("Trace App REST port: " + prop);
65+
c.setTracePort(Integer.parseInt(prop));
66+
}
67+
6268
prop = getProperty("mlAdminUsername");
6369
if (prop != null) {
6470
logger.info("REST admin username: " + prop);

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class HubConfig {
2222
public static final String DEFAULT_HOST = "localhost";
2323
public static final Integer DEFAULT_STAGING_PORT = 8010;
2424
public static final Integer DEFAULT_FINAL_PORT = 8011;
25+
public static final Integer DEFAULT_TRACE_PORT = 8012;
2526
public static final String DEFAULT_APP_NAME = "my-data-hub";
2627
public final static String DEFAULT_MODULES_PATH = "src/data-hub";
2728
public static final String DEFAULT_AUTH_METHOD = "digest";
@@ -32,6 +33,7 @@ public class HubConfig {
3233
private String host = DEFAULT_HOST;
3334
private Integer stagingPort = DEFAULT_STAGING_PORT;
3435
private Integer finalPort = DEFAULT_FINAL_PORT;
36+
private Integer tracePort = DEFAULT_TRACE_PORT;
3537
private String authMethod = DEFAULT_AUTH_METHOD;
3638

3739
private String modulesPath;
@@ -111,6 +113,17 @@ public void setFinalPort(Integer port) {
111113
this.finalPort = port;
112114
}
113115

116+
/**
117+
* @return the port of the Final REST API server used for loading modules
118+
*/
119+
public Integer getTracePort() {
120+
return tracePort;
121+
}
122+
123+
public void setTracePort(Integer port) {
124+
this.tracePort = port;
125+
}
126+
114127
public String getModulesPath() {
115128
return this.modulesPath;
116129
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ declare %private function flow:get-flow(
279279
return
280280
fn:doc($uri)/hub:flow
281281
})
282-
where $flow
283282
return
284283
<flow xmlns="http://marklogic.com/data-hub">
285284
<name>{$flow-name}</name>

0 commit comments

Comments
 (0)