This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
AppConfig.java
1885 lines (1524 loc) · 53.7 KB
/
AppConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2023 MarkLogic Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.marklogic.appdeployer;
import com.marklogic.appdeployer.command.forests.ForestNamingStrategy;
import com.marklogic.appdeployer.command.forests.ReplicaBuilderStrategy;
import com.marklogic.appdeployer.util.MapPropertiesSource;
import com.marklogic.client.DatabaseClient;
import com.marklogic.client.DatabaseClientFactory;
import com.marklogic.client.DatabaseClientFactory.SSLHostnameVerifier;
import com.marklogic.client.ext.ConfiguredDatabaseClientFactory;
import com.marklogic.client.ext.DatabaseClientConfig;
import com.marklogic.client.ext.DefaultConfiguredDatabaseClientFactory;
import com.marklogic.client.ext.SecurityContextType;
import com.marklogic.client.ext.modulesloader.impl.PropertiesModuleManager;
import com.marklogic.client.ext.modulesloader.ssl.SimpleX509TrustManager;
import com.marklogic.client.ext.ssl.SslUtil;
import com.marklogic.client.ext.tokenreplacer.DefaultTokenReplacer;
import com.marklogic.client.ext.tokenreplacer.PropertiesSource;
import com.marklogic.client.ext.tokenreplacer.RoxyTokenReplacer;
import com.marklogic.client.ext.tokenreplacer.TokenReplacer;
import org.springframework.util.StringUtils;
import javax.net.ssl.SSLContext;
import javax.net.ssl.X509TrustManager;
import java.io.File;
import java.io.FileFilter;
import java.util.*;
import java.util.regex.Pattern;
/**
* Encapsulates common configuration properties for an application deployed to MarkLogic. These properties include not
* just names of application resources - such as app servers and databases - but also connection information for loading
* modules into an application as well as paths for modules and configuration files.
*
* An instance of this class is passed in as the main argument to the methods in the {@code AppDeployer} interface,
* meaning that you're free to not just configure this as needed but also subclass it and add anything that you would
* like.
*
* Additionally, the additionalProperties Map can used for storing any additional properties that a client of this class
* may use, without having to define them as attributes of this class.
*/
public class AppConfig {
/**
* This is set purely for development purposes so that an app can be created without specifying an app name.
*/
public static final String DEFAULT_APP_NAME = "my-app";
/**
* This is set purely for development purposes so that an app can be configured without specifying a port. The
* v1/rest-apis endpoint will select an open port if none is provided, but some work is then required to figure out
* what that port is before modules are loaded.
*/
public static final Integer DEFAULT_PORT = 8003;
/**
* The default path from which modules will be loaded into a modules database.
*/
public final static String DEFAULT_MODULES_PATH = "src/main/ml-modules";
public final static String DEFAULT_SCHEMAS_PATH = "src/main/ml-schemas";
public final static String DEFAULT_HOST = "localhost";
public final static String DEFAULT_GROUP = "Default";
private String name = DEFAULT_APP_NAME;
/**
* @deprecated since 4.5.0; will be removed in 5.0.0
*/
@Deprecated
public static final String DEFAULT_USERNAME = "admin";
/**
* @deprecated since 4.5.0; will be removed in 5.0.0
*/
@Deprecated
public static final String DEFAULT_PASSWORD = "admin";
private String host = DEFAULT_HOST;
private String cloudApiKey;
private boolean catchDeployExceptions = false;
private boolean catchUndeployExceptions = false;
private CmaConfig cmaConfig;
private boolean mergeResources = true;
private boolean addHostNameTokens = false;
// Used to construct DatabaseClient instances based on inputs defined in this class
private ConfiguredDatabaseClientFactory configuredDatabaseClientFactory = new DefaultConfiguredDatabaseClientFactory();
// Connection info for using the client REST API - e.g. to load modules
private DatabaseClient.ConnectionType restConnectionType;
private SecurityContextType restSecurityContextType = SecurityContextType.DIGEST;
private String restAdminUsername;
private String restAdminPassword;
private SSLContext restSslContext;
private SSLHostnameVerifier restSslHostnameVerifier;
private String restCertFile;
private String restCertPassword;
private String restExternalName;
private String restSamlToken;
private X509TrustManager restTrustManager;
private boolean restUseDefaultKeystore;
private String restSslProtocol;
private String restTrustManagementAlgorithm;
private String restBasePath;
// Added in 4.7.0
private String restKeyStorePath;
private String restKeyStorePassword;
private String restKeyStoreType;
private String restKeyStoreAlgorithm;
private String restTrustStorePath;
private String restTrustStorePassword;
private String restTrustStoreType;
private String restTrustStoreAlgorithm;
private Integer restPort = DEFAULT_PORT;
private Integer testRestPort;
private String testRestBasePath;
// Connection info for using the App Services client REST API - e.g. to load non-REST API modules
private DatabaseClient.ConnectionType appServicesConnectionType;
private SecurityContextType appServicesSecurityContextType = SecurityContextType.DIGEST;
private String appServicesUsername;
private String appServicesPassword;
private Integer appServicesPort = 8000;
private SSLContext appServicesSslContext;
private SSLHostnameVerifier appServicesSslHostnameVerifier;
private String appServicesCertFile;
private String appServicesCertPassword;
private String appServicesExternalName;
private String appServicesSamlToken;
private X509TrustManager appServicesTrustManager;
private boolean appServicesUseDefaultKeystore;
private String appServicesSslProtocol;
private String appServicesTrustManagementAlgorithm;
private String appServicesBasePath;
// Added in 4.7.0
private String appServicesKeyStorePath;
private String appServicesKeyStorePassword;
private String appServicesKeyStoreType;
private String appServicesKeyStoreAlgorithm;
private String appServicesTrustStorePath;
private String appServicesTrustStorePassword;
private String appServicesTrustStoreType;
private String appServicesTrustStoreAlgorithm;
// These can all be set to override the default names that are generated off of the "name" attribute.
private String groupName = DEFAULT_GROUP;
private boolean noRestServer = false;
private String restServerName;
private String testRestServerName;
private String contentDatabaseName;
private String testContentDatabaseName;
private String modulesDatabaseName;
private String triggersDatabaseName;
private String cpfDatabaseName;
private String schemasDatabaseName;
// Since 4.6.0; affects loading of modules, schemas, and data.
// Disabled by default for backwards compatibility; will likely default to true in 5.0.0 release.
private boolean cascadeCollections;
private boolean cascadePermissions;
private List<String> modulePaths;
private boolean staticCheckAssets = false;
private boolean staticCheckLibraryAssets = false;
private boolean bulkLoadAssets = true;
private String moduleTimestampsPath;
private boolean moduleTimestampsUseHost = true;
private boolean deleteTestModules = false;
private String deleteTestModulesPattern = "/test/**";
private int modulesLoaderThreadCount = 1;
private Integer modulesLoaderBatchSize;
private String moduleUriPrefix;
// As defined by the REST API
private String modulePermissions = "rest-admin,read,rest-admin,update,rest-extension-user,execute";
private boolean incrementalDeploy = false;
private List<String> schemaPaths;
private boolean tdeValidationEnabled = true;
private List<ConfigDir> configDirs;
// Passed into the PayloadTokenReplacer that subclasses of AbstractCommand use
private Map<String, String> customTokens = new HashMap<>();
// Controls whether forests are created when a database is created
private boolean createForests = true;
// Controls whether forests are deleted when a database is deleted
private boolean deleteForests = true;
// Controls whether replicas are deleted or not when undeploying a database
private boolean deleteReplicas = true;
private boolean sortOtherDatabaseByDependencies = true;
private FileFilter assetFileFilter;
private FileFilter schemasFileFilter;
// Additional module extensions that should be loaded as binaries into the modules database
private String[] additionalBinaryExtensions;
// Will override the number of forests that DeployContentDatabasesCommand creates
private Integer contentForestsPerHost;
// Comma-delimited string used for configuring forest replicas
private Map<String, Integer> databaseNamesAndReplicaCounts;
// Comma-delimited string of database names that should only have forests (most likely just one) created on one host
private Set<String> databasesWithForestsOnOneHost;
private Map<String, List<String>> databaseHosts;
private Map<String, List<String>> databaseGroups;
private Map<String, String> hostGroups;
// Data/fast/large directories for default forests
private String forestDataDirectory;
private String forestFastDataDirectory;
private String forestLargeDataDirectory;
// Comma-delimited string of database names and data directories
private Map<String, List<String>> databaseDataDirectories;
private Map<String, String> databaseFastDataDirectories;
private Map<String, String> databaseLargeDataDirectories;
private Map<String, List<String>> databaseReplicaDataDirectories;
private Map<String, String> databaseReplicaFastDataDirectories;
private Map<String, String> databaseReplicaLargeDataDirectories;
// Configures the data-directory for replica forests built dynamically
private String replicaForestDataDirectory;
private String replicaForestLargeDataDirectory;
private String replicaForestFastDataDirectory;
// Allows for customizing how forests are named per database
private Map<String, ForestNamingStrategy> forestNamingStrategies = new HashMap<>();
// Allows for customizing how replicas are built for all databases
private ReplicaBuilderStrategy replicaBuilderStrategy;
// Path to use for DeployFlexrepCommand
private String flexrepPath;
// Whether or not to replace tokens in modules
private boolean replaceTokensInModules = true;
// Whether or not to prefix each module token with "@ml."
private boolean useRoxyTokenPrefix = false;
private Pattern moduleFilenamesIncludePattern;
private Map<String, Integer> forestCounts = new HashMap<>();
// Entity Services properties
private String modelsPath = "data/entity-services";
private String instanceConverterPath = "ext/entity-services";
private boolean generateInstanceConverter = true;
private boolean generateSchema = true;
private boolean generateDatabaseProperties = true;
private boolean generateExtractionTemplate = true;
private boolean generateSearchOptions = true;
private String modelsDatabase;
private String[] resourceFilenamesToIgnore;
private Pattern resourceFilenamesExcludePattern;
private Pattern resourceFilenamesIncludePattern;
// Properties to exclude from resource payloads
private String[] excludeProperties;
// Properties to include in resource payloads
private String[] includeProperties;
private boolean updateMimetypeWhenPropertiesAreEqual = false;
private Map<String, Object> additionalProperties = new HashMap<>();
private File projectDir;
private DataConfig dataConfig;
private PluginConfig pluginConfig;
public AppConfig() {
this(null);
}
public AppConfig(File projectDir) {
this.projectDir = projectDir;
dataConfig = new DataConfig(projectDir);
pluginConfig = new PluginConfig(projectDir);
// As of 3.15.0, defaulting everything except servers to use CMA. Changes to servers, such as changing group or
// port number, cause conflicts with CMA.
cmaConfig = new CmaConfig(true);
cmaConfig.setDeployServers(false);
modulePaths = new ArrayList<>();
String path = projectDir != null ? new File(projectDir, DEFAULT_MODULES_PATH).getAbsolutePath() : DEFAULT_MODULES_PATH;
modulePaths.add(path);
String defaultSchemasPath = projectDir != null ? new File(projectDir, DEFAULT_SCHEMAS_PATH).getAbsolutePath() : DEFAULT_SCHEMAS_PATH;
schemaPaths = new ArrayList<>();
schemaPaths.add(defaultSchemasPath);
configDirs = new ArrayList<>();
configDirs.add(ConfigDir.withProjectDir(projectDir));
moduleTimestampsPath = projectDir != null ? new File(projectDir, PropertiesModuleManager.DEFAULT_FILE_PATH).getAbsolutePath()
: PropertiesModuleManager.DEFAULT_FILE_PATH;
}
public void populateCustomTokens(PropertiesSource propertiesSource) {
populateCustomTokens(propertiesSource, "%%", "%%");
}
/**
* Populate the customTokens map in this class with the properties from the given properties source.
* @param propertiesSource
* @param prefix optional; if set, then each token key that is added has the prefix prepended to it
* @param suffix optional; if set, then each token key that is added has the suffix appended to it
*/
public void populateCustomTokens(PropertiesSource propertiesSource, String prefix, String suffix) {
Properties props = propertiesSource.getProperties();
if (props != null) {
if (customTokens == null) {
customTokens = new HashMap<>();
}
for (Object key : props.keySet()) {
String skey = (String)key;
String value = props.getProperty(skey);
if (value != null) {
String token = skey;
if (prefix != null) {
token = prefix + token;
}
if (suffix != null) {
token = token + suffix;
}
customTokens.put(token, value);
}
}
}
}
/**
* Builds a TokenReplacer based on the customTokens map held by this class.
*
* @return
*/
public TokenReplacer buildTokenReplacer() {
DefaultTokenReplacer r = isUseRoxyTokenPrefix() ? new RoxyTokenReplacer() : new DefaultTokenReplacer();
final Map<String, String> customTokens = getCustomTokens();
if (customTokens != null) {
r.addPropertiesSource(new MapPropertiesSource(customTokens));
}
return r;
}
public void setSimpleSslConfig() {
setSimpleSslConfig(null);
}
/**
* @param protocol the name of the SSL/TLS protocol to use; if null, will use whatever SimpleX509TrustManager defaults to
*/
public void setSimpleSslConfig(String protocol) {
setRestSslContext(protocol != null ? SimpleX509TrustManager.newSSLContext(protocol) : SimpleX509TrustManager.newSSLContext());
setRestSslHostnameVerifier(DatabaseClientFactory.SSLHostnameVerifier.ANY);
setRestTrustManager(new SimpleX509TrustManager());
}
public void setAppServicesSimpleSslConfig() {
setAppServicesSimpleSslConfig(null);
}
/**
* @param protocol the name of the SSL/TLS protocol to use; if null, will use whatever SimpleX509TrustManager defaults to
*/
public void setAppServicesSimpleSslConfig(String protocol) {
setAppServicesSslContext(protocol != null ? SimpleX509TrustManager.newSSLContext(protocol) : SimpleX509TrustManager.newSSLContext());
setAppServicesSslHostnameVerifier(DatabaseClientFactory.SSLHostnameVerifier.ANY);
setAppServicesTrustManager(new SimpleX509TrustManager());
}
/**
* Convenience method for constructing a MarkLogic Java API DatabaseClient based on the the host and rest*
* properties defined on this class.
*
* @return
*/
public DatabaseClient newDatabaseClient() {
return configuredDatabaseClientFactory.newDatabaseClient(newRestDatabaseClientConfig(getRestPort()));
}
/**
* Just like newDatabaseClient, but uses testRestPort.
*
* @return
*/
public DatabaseClient newTestDatabaseClient() {
DatabaseClientConfig config = newRestDatabaseClientConfig(getTestRestPort());
if (StringUtils.hasText(getTestRestBasePath())) {
config.setBasePath(getTestRestBasePath());
}
return configuredDatabaseClientFactory.newDatabaseClient(config);
}
public DatabaseClientConfig newRestDatabaseClientConfig(int port) {
DatabaseClientConfig config = new DatabaseClientConfig(host, port, restAdminUsername, restAdminPassword);
config.setCertFile(restCertFile);
config.setCertPassword(restCertPassword);
config.setConnectionType(restConnectionType);
config.setExternalName(restExternalName);
config.setSamlToken(restSamlToken);
config.setSecurityContextType(restSecurityContextType);
config.setCloudApiKey(cloudApiKey);
config.setBasePath(restBasePath);
config.setKeyStorePath(restKeyStorePath);
config.setKeyStorePassword(restKeyStorePassword);
config.setKeyStoreType(restKeyStoreType);
config.setKeyStoreAlgorithm(restKeyStoreAlgorithm);
config.setTrustStorePath(restTrustStorePath);
config.setTrustStorePassword(restTrustStorePassword);
config.setTrustStoreType(restTrustStoreType);
config.setTrustStoreAlgorithm(restTrustStoreAlgorithm);
if (restUseDefaultKeystore) {
config.setSslProtocol(StringUtils.hasText(restSslProtocol) ? restSslProtocol : SslUtil.DEFAULT_SSL_PROTOCOL);
config.setTrustManagementAlgorithm(restTrustManagementAlgorithm);
config.setSslHostnameVerifier(restSslHostnameVerifier != null ? restSslHostnameVerifier : SSLHostnameVerifier.ANY);
}
else {
config.setSslContext(restSslContext);
config.setTrustManager(restTrustManager);
config.setSslHostnameVerifier(restSslHostnameVerifier);
}
return config;
}
/**
* Constructs a DatabaseClient based on host, the appServices* properties, and the modules database name.
* @return
*/
public DatabaseClient newModulesDatabaseClient() {
return newAppServicesDatabaseClient(getModulesDatabaseName());
}
/**
* Like newModulesDatabaseClient, but connects to schemas database.
*
* @return
*/
public DatabaseClient newSchemasDatabaseClient() {
return newAppServicesDatabaseClient(getSchemasDatabaseName());
}
public DatabaseClient newAppServicesDatabaseClient(String databaseName) {
DatabaseClientConfig config = new DatabaseClientConfig(host, appServicesPort, appServicesUsername, appServicesPassword);
config.setCertFile(appServicesCertFile);
config.setCertPassword(appServicesCertPassword);
config.setConnectionType(appServicesConnectionType);
config.setDatabase(databaseName);
config.setExternalName(appServicesExternalName);
config.setSamlToken(appServicesSamlToken);
config.setSecurityContextType(appServicesSecurityContextType);
config.setCloudApiKey(cloudApiKey);
config.setBasePath(appServicesBasePath);
config.setKeyStorePath(appServicesKeyStorePath);
config.setKeyStorePassword(appServicesKeyStorePassword);
config.setKeyStoreType(appServicesKeyStoreType);
config.setKeyStoreAlgorithm(appServicesKeyStoreAlgorithm);
config.setTrustStorePath(appServicesTrustStorePath);
config.setTrustStorePassword(appServicesTrustStorePassword);
config.setTrustStoreType(appServicesTrustStoreType);
config.setTrustStoreAlgorithm(appServicesTrustStoreAlgorithm);
if (appServicesUseDefaultKeystore) {
config.setSslProtocol(StringUtils.hasText(appServicesSslProtocol) ? appServicesSslProtocol : SslUtil.DEFAULT_SSL_PROTOCOL);
config.setTrustManagementAlgorithm(appServicesTrustManagementAlgorithm);
config.setSslHostnameVerifier(appServicesSslHostnameVerifier != null ? appServicesSslHostnameVerifier : SSLHostnameVerifier.ANY);
}
else {
config.setSslContext(appServicesSslContext);
config.setTrustManager(appServicesTrustManager);
config.setSslHostnameVerifier(appServicesSslHostnameVerifier);
}
return configuredDatabaseClientFactory.newDatabaseClient(config);
}
/**
* @return true if {@code testRestPort} is set and greater than zero. This is used as an indicator that an
* application wants test resources - most likely a separate app server and content database - created as
* part of a deployment.
*/
public boolean isTestPortSet() {
return testRestPort != null && testRestPort > 0;
}
/**
* @return {@code restServerName} if it is set; {@code name} otherwise
*/
public String getRestServerName() {
return restServerName != null ? restServerName : name;
}
public void setRestServerName(String restServerName) {
this.restServerName = restServerName;
}
/**
* @return {@code testRestServerName} if it is set; {@code name}-test otherwise
*/
public String getTestRestServerName() {
return testRestServerName != null ? testRestServerName : name + "-test";
}
public void setTestRestServerName(String testRestServerName) {
this.testRestServerName = testRestServerName;
}
/**
* @return {@code contentDatabaseName} if it is set; {@code name}-content otherwise
*/
public String getContentDatabaseName() {
return contentDatabaseName != null ? contentDatabaseName : name + "-content";
}
public void setContentDatabaseName(String contentDatabaseName) {
this.contentDatabaseName = contentDatabaseName;
}
/**
* @return {@code testContentDatabaseName} if it is set; {@code name}-test-content otherwise
*/
public String getTestContentDatabaseName() {
return testContentDatabaseName != null ? testContentDatabaseName : name + "-test-content";
}
public void setTestContentDatabaseName(String testContentDatabaseName) {
this.testContentDatabaseName = testContentDatabaseName;
}
/**
* @return {@code modulesDatabaseName} if it is set; {@code name}-modules otherwise
*/
public String getModulesDatabaseName() {
return modulesDatabaseName != null ? modulesDatabaseName : name + "-modules";
}
public void setModulesDatabaseName(String modulesDatabaseName) {
this.modulesDatabaseName = modulesDatabaseName;
}
/**
* @return {@code triggersDatabaseName} if it is set; {@code name}-triggers otherwise
*/
public String getTriggersDatabaseName() {
return triggersDatabaseName != null ? triggersDatabaseName : name + "-triggers";
}
public void setTriggersDatabaseName(String triggersDatabaseName) {
this.triggersDatabaseName = triggersDatabaseName;
}
/**
* @return {@code schemasDatabaseName} if it is set; {@code name}-schemas otherwise
*/
public String getSchemasDatabaseName() {
return schemasDatabaseName != null ? schemasDatabaseName : name + "-schemas";
}
public void setSchemasDatabaseName(String schemasDatabaseName) {
this.schemasDatabaseName = schemasDatabaseName;
}
/**
* @return the name of the application, which is then used to generate app server and database names unless those
* are set via their respective properties
*/
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* @return the host that clients using this class will connect to
*/
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
/**
* @return the name of a MarkLogic user with the rest-admin role who can then load modules via a REST API server
*/
public String getRestAdminUsername() {
return restAdminUsername;
}
public void setRestAdminUsername(String username) {
this.restAdminUsername = username;
}
/**
* @return the password for the user identified by {@code restAdminUsername}
*/
public String getRestAdminPassword() {
return restAdminPassword;
}
public void setRestAdminPassword(String password) {
this.restAdminPassword = password;
}
/**
* @return the port of the REST API server used for loading modules
*/
public Integer getRestPort() {
return restPort;
}
public void setRestPort(Integer restPort) {
this.restPort = restPort;
}
/**
* @return the post of the REST API server used for loading modules that are specific to a test server (currently,
* just search options)
*/
public Integer getTestRestPort() {
return testRestPort;
}
public void setTestRestPort(Integer testRestPort) {
this.testRestPort = testRestPort;
}
/**
* @return a list of all the paths from which modules should be loaded into a REST API server modules database
*/
public List<String> getModulePaths() {
return modulePaths;
}
public void setModulePaths(List<String> modulePaths) {
this.modulePaths = modulePaths;
}
/**
* @return the name of the group in which the application associated with this configuration should have its app
* servers and other group-specific resources
*/
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* Starting in 3.3.0, use this when you only care about the first ConfigDir in the List of ConfigDirs maintained by
* this class.
*
* @return
*/
public ConfigDir getFirstConfigDir() {
if (configDirs == null || configDirs.isEmpty()) {
this.configDirs = new ArrayList<>();
this.configDirs.add(ConfigDir.withProjectDir(this.projectDir));
}
return configDirs.get(0);
}
/**
* As of 3.3.0, this is instead clearing and adding the ConfigDir to the List of ConfigDirs that this class now
* maintains.
*
* @param configDir
*/
public void setConfigDir(ConfigDir configDir) {
this.configDirs = new ArrayList<>();
this.configDirs.add(configDir);
}
/**
* @return a map of tokens that are intended to be replaced with their associated values in configuration files.
* This map allows for externalized properties to be passed into configuration files - e.g. Gradle
* properties can be swapped in for tokens in configuration files at deploy time.
*/
public Map<String, String> getCustomTokens() {
return customTokens;
}
public void setCustomTokens(Map<String, String> customTokens) {
this.customTokens = customTokens;
}
/**
* @return a Java {@code SSLContext} for making an SSL connection with the REST API server for loading modules; null
* if an SSL connection is not required
*/
public SSLContext getRestSslContext() {
return restSslContext;
}
public void setRestSslContext(SSLContext restSslContext) {
this.restSslContext = restSslContext;
}
/**
* @return a MarkLogic Java Client {@code SSLHostnameVerifier} that is used to make an SSL connection to the REST
* API server for loading modules; null if an SSL connection is not required
*/
public SSLHostnameVerifier getRestSslHostnameVerifier() {
return restSslHostnameVerifier;
}
public void setRestSslHostnameVerifier(SSLHostnameVerifier restSslHostnameVerifier) {
this.restSslHostnameVerifier = restSslHostnameVerifier;
}
public String[] getAdditionalBinaryExtensions() {
return additionalBinaryExtensions;
}
public void setAdditionalBinaryExtensions(String[] additionalBinaryExtensions) {
this.additionalBinaryExtensions = additionalBinaryExtensions;
}
public Integer getContentForestsPerHost() {
return contentForestsPerHost;
}
public void setContentForestsPerHost(Integer contentForestsPerHost) {
this.contentForestsPerHost = contentForestsPerHost;
}
public String getModulePermissions() {
return modulePermissions;
}
public void setModulePermissions(String assetPermissions) {
this.modulePermissions = assetPermissions;
}
public FileFilter getAssetFileFilter() {
return assetFileFilter;
}
public void setAssetFileFilter(FileFilter assetFileFilter) {
this.assetFileFilter = assetFileFilter;
}
public FileFilter getSchemasFileFilter() {
return schemasFileFilter;
}
public void setSchemasFileFilter(FileFilter schemasFileFilter) {
this.schemasFileFilter = schemasFileFilter;
}
public String getFlexrepPath() {
return flexrepPath;
}
public void setFlexrepPath(String flexrepPath) {
this.flexrepPath = flexrepPath;
}
public Map<String, Integer> getForestCounts() {
return forestCounts;
}
public void setForestCounts(Map<String, Integer> forestCounts) {
this.forestCounts = forestCounts;
}
public Integer getAppServicesPort() {
return appServicesPort;
}
public void setAppServicesPort(Integer appServicesPort) {
this.appServicesPort = appServicesPort;
}
public boolean isReplaceTokensInModules() {
return replaceTokensInModules;
}
public void setReplaceTokensInModules(boolean replaceTokensInModules) {
this.replaceTokensInModules = replaceTokensInModules;
}
public boolean isUseRoxyTokenPrefix() {
return useRoxyTokenPrefix;
}
public void setUseRoxyTokenPrefix(boolean useRoxyTokenPrefix) {
this.useRoxyTokenPrefix = useRoxyTokenPrefix;
}
public boolean isStaticCheckAssets() {
return staticCheckAssets;
}
public void setStaticCheckAssets(boolean staticCheckAssets) {
this.staticCheckAssets = staticCheckAssets;
}
public boolean isStaticCheckLibraryAssets() {
return staticCheckLibraryAssets;
}
public void setStaticCheckLibraryAssets(boolean staticCheckLibraryAssets) {
this.staticCheckLibraryAssets = staticCheckLibraryAssets;
}
public boolean isBulkLoadAssets() {
return bulkLoadAssets;
}
public void setBulkLoadAssets(boolean bulkLoadAssets) {
this.bulkLoadAssets = bulkLoadAssets;
}
public String getModelsPath() {
return modelsPath;
}
public void setModelsPath(String modelsPath) {
this.modelsPath = modelsPath;
}
public String getInstanceConverterPath() {
return instanceConverterPath;
}
public void setInstanceConverterPath(String instanceConverterPath) {
this.instanceConverterPath = instanceConverterPath;
}
public void setGenerateInstanceConverter(boolean generateInstanceConverter) {
this.generateInstanceConverter = generateInstanceConverter;
}
public void setGenerateSchema(boolean generateSchema) {
this.generateSchema = generateSchema;
}
public void setGenerateDatabaseProperties(boolean generateDatabaseProperties) {
this.generateDatabaseProperties = generateDatabaseProperties;
}
public void setGenerateExtractionTemplate(boolean generateExtractionTemplate) {
this.generateExtractionTemplate = generateExtractionTemplate;
}
public void setGenerateSearchOptions(boolean generateSearchOptions) {
this.generateSearchOptions = generateSearchOptions;
}
public boolean isGenerateInstanceConverter() {
return generateInstanceConverter;
}
public boolean isGenerateSchema() {
return generateSchema;
}
public boolean isGenerateDatabaseProperties() {
return generateDatabaseProperties;
}
public boolean isGenerateExtractionTemplate() {
return generateExtractionTemplate;
}
public boolean isGenerateSearchOptions() {
return generateSearchOptions;
}
public String getModuleTimestampsPath() {
return moduleTimestampsPath;
}
public void setModuleTimestampsPath(String moduleTimestampsPath) {
this.moduleTimestampsPath = moduleTimestampsPath;
}
public String[] getResourceFilenamesToIgnore() {
return resourceFilenamesToIgnore;
}
public void setResourceFilenamesToIgnore(String... resourceFilenamesToIgnore) {
this.resourceFilenamesToIgnore = resourceFilenamesToIgnore;
}
public boolean isDeleteReplicas() {
return deleteReplicas;
}
public void setDeleteReplicas(boolean deleteReplicas) {
this.deleteReplicas = deleteReplicas;
}
public boolean isDeleteForests() {
return deleteForests;
}
public void setDeleteForests(boolean deleteForests) {
this.deleteForests = deleteForests;
}
public boolean isCreateForests() {
return createForests;
}
public void setCreateForests(boolean createForests) {
this.createForests = createForests;
}
public boolean isNoRestServer() {
return noRestServer;
}
public void setNoRestServer(boolean noRestServer) {
this.noRestServer = noRestServer;
}
public SSLContext getAppServicesSslContext() {
return appServicesSslContext;
}
public void setAppServicesSslContext(SSLContext appServicesSslContext) {
this.appServicesSslContext = appServicesSslContext;
}
public SSLHostnameVerifier getAppServicesSslHostnameVerifier() {
return appServicesSslHostnameVerifier;
}
public void setAppServicesSslHostnameVerifier(SSLHostnameVerifier appServicesSslHostnameVerifier) {
this.appServicesSslHostnameVerifier = appServicesSslHostnameVerifier;
}
public String getReplicaForestDataDirectory() {
return replicaForestDataDirectory;
}
public void setReplicaForestDataDirectory(String replicaForestDataDirectory) {
this.replicaForestDataDirectory = replicaForestDataDirectory;
}
public String getReplicaForestLargeDataDirectory() {
return replicaForestLargeDataDirectory;
}
public void setReplicaForestLargeDataDirectory(String replicaForestLargeDataDirectory) {
this.replicaForestLargeDataDirectory = replicaForestLargeDataDirectory;
}
public String getReplicaForestFastDataDirectory() {
return replicaForestFastDataDirectory;
}
public void setReplicaForestFastDataDirectory(String replicaForestFastDataDirectory) {
this.replicaForestFastDataDirectory = replicaForestFastDataDirectory;
}