@@ -49,7 +49,6 @@ public class HubConfig {
4949 public static final String OLD_HUB_CONFIG_DIR = "marklogic-config" ;
5050 public static final String HUB_CONFIG_DIR = "hub-internal-config" ;
5151 public static final String USER_CONFIG_DIR = "user-config" ;
52- public static final String SEARCH_OPTIONS_FILE = "all-search-options.xml" ;
5352
5453 public static final String DEFAULT_HOST = "localhost" ;
5554
@@ -79,6 +78,8 @@ public class HubConfig {
7978
8079 public static final Integer DEFAULT_FORESTS_PER_HOST = 4 ;
8180
81+ public static final String DEFAULT_CUSTOM_FOREST_PATH = "forests" ;
82+
8283 private static final String GRADLE_PROPERTIES_FILENAME = "gradle.properties" ;
8384
8485 private String username ;
@@ -120,8 +121,13 @@ public class HubConfig {
120121 public String jobAuthMethod = DEFAULT_AUTH_METHOD ;
121122
122123 public String modulesDbName = DEFAULT_MODULES_DB_NAME ;
124+ public Integer modulesForestsPerHost = 1 ;
125+
123126 public String triggersDbName = DEFAULT_TRIGGERS_DB_NAME ;
127+ public Integer triggersForestsPerHost = 1 ;
128+
124129 public String schemasDbName = DEFAULT_SCHEMAS_DB_NAME ;
130+ public Integer schemasForestsPerHost = 1 ;
125131
126132 public Integer appServicesPort = DEFAULT_APP_SERVICES_PORT ;
127133 public Integer adminPort = DEFAULT_ADMIN_PORT ;
@@ -130,6 +136,8 @@ public class HubConfig {
130136 public String hubRoleName = DEFAULT_ROLE_NAME ;
131137 public String hubUserName = DEFAULT_USER_NAME ;
132138
139+ public String customForestPath = DEFAULT_CUSTOM_FOREST_PATH ;
140+
133141 public String projectDir ;
134142
135143 private Properties environmentProperties ;
@@ -208,9 +216,16 @@ public void loadConfigurationFromProperties(Properties environmentProperties) {
208216 jobPort = getEnvPropInteger (environmentProperties , "mlJobPort" , jobPort );
209217 jobAuthMethod = getEnvPropString (environmentProperties , "mlJobAuth" , jobAuthMethod );
210218
219+ customForestPath = getEnvPropString (environmentProperties , "mlCustomForestPath" , customForestPath );
220+
211221 modulesDbName = getEnvPropString (environmentProperties , "mlModulesDbName" , modulesDbName );
222+ modulesForestsPerHost = getEnvPropInteger (environmentProperties , "mlModulesForestsPerHost" , modulesForestsPerHost );
223+
212224 triggersDbName = getEnvPropString (environmentProperties , "mlTriggersDbName" , triggersDbName );
225+ triggersForestsPerHost = getEnvPropInteger (environmentProperties , "mlTriggersForestsPerHost" , triggersForestsPerHost );
226+
213227 schemasDbName = getEnvPropString (environmentProperties , "mlSchemasDbName" , schemasDbName );
228+ schemasForestsPerHost = getEnvPropInteger (environmentProperties , "mlSchemasForestsPerHost" , schemasForestsPerHost );
214229
215230 hubRoleName = getEnvPropString (environmentProperties , "mlHubUserRole" , hubRoleName );
216231 hubUserName = getEnvPropString (environmentProperties , "mlHubUserName" , hubUserName );
@@ -521,35 +536,7 @@ public AppConfig getAppConfig() {
521536 return config ;
522537 }
523538
524- public void updateAppConfig (AppConfig config ) {
525- config .setHost (host );
526- config .setRestPort (stagingPort );
527- config .setAppServicesPort (appServicesPort );
528- config .setRestAdminUsername (getRestAdminUsername ());
529- config .setRestAdminPassword (getRestAdminPassword ());
530- config .setModulesDatabaseName (modulesDbName );
531-
532- config .setTriggersDatabaseName (triggersDbName );
533- config .setSchemasDatabaseName (schemasDbName );
534- config .setModulesDatabaseName (modulesDbName );
535-
536- config .setReplaceTokensInModules (true );
537- config .setUseRoxyTokenPrefix (false );
538-
539- HashMap <String , Integer > forestCounts = new HashMap <>();
540- forestCounts .put (stagingDbName , stagingForestsPerHost );
541- forestCounts .put (finalDbName , finalForestsPerHost );
542- forestCounts .put (traceDbName , traceForestsPerHost );
543- forestCounts .put (modulesDbName , 1 );
544- config .setForestCounts (forestCounts );
545-
546- ConfigDir configDir = new ConfigDir (getUserConfigDir ().toFile ());
547- config .setConfigDir (configDir );
548-
549- config .setSchemasPath (getUserConfigDir ().resolve ("schemas" ).toString ());
550-
551- Map <String , String > customTokens = config .getCustomTokens ();
552-
539+ public Map <String , String > getCustomTokens (Map <String , String > customTokens ) {
553540 customTokens .put ("%%mlStagingAppserverName%%" , stagingHttpName );
554541 customTokens .put ("\" %%mlStagingPort%%\" " , stagingPort .toString ());
555542 customTokens .put ("%%mlStagingDbName%%" , stagingDbName );
@@ -571,12 +558,64 @@ public void updateAppConfig(AppConfig config) {
571558 customTokens .put ("%%mlJobForestsPerHost%%" , jobForestsPerHost .toString ());
572559
573560 customTokens .put ("%%mlModulesDbName%%" , modulesDbName );
561+ customTokens .put ("%%mlModulesForestsPerHost%%" , modulesForestsPerHost .toString ());
562+
574563 customTokens .put ("%%mlTriggersDbName%%" , triggersDbName );
564+ customTokens .put ("%%mlTriggersForestsPerHost%%" , triggersForestsPerHost .toString ());
565+
575566 customTokens .put ("%%mlSchemasDbName%%" , schemasDbName );
567+ customTokens .put ("%%mlSchemasForestsPerHost%%" , schemasForestsPerHost .toString ());
576568
577569 customTokens .put ("%%mlHubUserRole%%" , hubRoleName );
578570 customTokens .put ("%%mlHubUserName%%" , hubUserName );
579571
572+ customTokens .put ("%%mlCustomForestPath%%" , customForestPath );
573+
574+ if (environmentProperties != null ) {
575+ Enumeration keyEnum = environmentProperties .propertyNames ();
576+ while (keyEnum .hasMoreElements ()) {
577+ String key = (String ) keyEnum .nextElement ();
578+ if (key .matches ("^ml[A-Z].+" ) && !customTokens .containsKey (key )) {
579+ customTokens .put ("%%" + key + "%%" , (String ) environmentProperties .get (key ));
580+ }
581+ }
582+ }
583+
584+ return customTokens ;
585+ }
586+
587+ public void updateAppConfig (AppConfig config ) {
588+ config .setHost (host );
589+ config .setRestPort (stagingPort );
590+ config .setAppServicesPort (appServicesPort );
591+ config .setRestAdminUsername (getRestAdminUsername ());
592+ config .setRestAdminPassword (getRestAdminPassword ());
593+ config .setModulesDatabaseName (modulesDbName );
594+
595+ config .setTriggersDatabaseName (triggersDbName );
596+ config .setSchemasDatabaseName (schemasDbName );
597+ config .setModulesDatabaseName (modulesDbName );
598+
599+ config .setReplaceTokensInModules (true );
600+ config .setUseRoxyTokenPrefix (false );
601+
602+ HashMap <String , Integer > forestCounts = new HashMap <>();
603+ forestCounts .put (stagingDbName , stagingForestsPerHost );
604+ forestCounts .put (finalDbName , finalForestsPerHost );
605+ forestCounts .put (traceDbName , traceForestsPerHost );
606+ forestCounts .put (jobDbName , jobForestsPerHost );
607+ forestCounts .put (modulesDbName , modulesForestsPerHost );
608+ forestCounts .put (triggersDbName , triggersForestsPerHost );
609+ forestCounts .put (schemasDbName , schemasForestsPerHost );
610+ config .setForestCounts (forestCounts );
611+
612+ ConfigDir configDir = new ConfigDir (getUserConfigDir ().toFile ());
613+ config .setConfigDir (configDir );
614+
615+ config .setSchemasPath (getUserConfigDir ().resolve ("schemas" ).toString ());
616+
617+ Map <String , String > customTokens = getCustomTokens (config .getCustomTokens ());
618+
580619 if (environmentProperties != null ) {
581620 Enumeration keyEnum = environmentProperties .propertyNames ();
582621 while (keyEnum .hasMoreElements ()) {
@@ -655,8 +694,13 @@ public String toString() {
655694 .append ("jobAuthMethod: " + jobAuthMethod + "\n " )
656695 .append ("\n " )
657696 .append ("modulesDbName: " + modulesDbName + "\n " )
697+ .append ("modulesForestsPerHost: " + modulesForestsPerHost + "\n " )
698+ .append ("\n " )
658699 .append ("triggersDbName: " + triggersDbName + "\n " )
700+ .append ("triggersForestsPerHost: " + triggersForestsPerHost + "\n " )
701+ .append ("\n " )
659702 .append ("schemasDbName: " + schemasDbName + "\n " )
703+ .append ("schemasForestsPerHost: " + schemasForestsPerHost + "\n " )
660704 .append ("\n " )
661705 .append ("projectDir: " + projectDir + "\n " )
662706 .append ("\n " );
0 commit comments