Skip to content

Commit 736ab12

Browse files
author
Vladimir Kotal
authored
make the config set/setconf message use the interactive flag (#2157)
1 parent da7d984 commit 736ab12

File tree

2 files changed

+25
-8
lines changed

2 files changed

+25
-8
lines changed

src/org/opensolaris/opengrok/configuration/RuntimeEnvironment.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ public void setRepositories(String dir) {
787787

788788
/**
789789
* Add repositories to the list.
790-
* @param repositories
790+
* @param repositories list of repositories
791791
*/
792792
public void addRepositories(List<RepositoryInfo> repositories) {
793793
threadConfig.get().addRepositories(repositories);
@@ -1508,7 +1508,22 @@ public void populateGroups(Set<Group> groups, Set<Project> projects) {
15081508
public void setConfiguration(Configuration configuration) {
15091509
setConfiguration(configuration, null, false);
15101510
}
1511+
1512+
/**
1513+
* Sets the configuration and performs necessary actions.
1514+
* @param configuration new configuration
1515+
* @param interactive true if in interactive mode
1516+
*/
1517+
public void setConfiguration(Configuration configuration, boolean interactive) {
1518+
setConfiguration(configuration, null, interactive);
1519+
}
15111520

1521+
/**
1522+
* Sets the configuration and performs necessary actions.
1523+
* @param configuration new configuration
1524+
* @param subFileList list of repositories
1525+
* @param interactive true if in interactive mode
1526+
*/
15121527
public void setConfiguration(Configuration configuration, List<String> subFileList, boolean interactive) {
15131528
this.configuration = configuration;
15141529
// HistoryGuru constructor uses environment properties so register()
@@ -1843,10 +1858,11 @@ public void stopConfigurationListenerThread() {
18431858
*
18441859
* @param m message containing the configuration
18451860
* @param reindex is the message result of reindex
1861+
* @param interactive true if in interactive mode
18461862
* @see #applyConfig(org.opensolaris.opengrok.configuration.Configuration,
1847-
* boolean) applyConfig(config, reindex)
1863+
* boolean, boolean) applyConfig(config, reindex, interactive)
18481864
*/
1849-
public void applyConfig(Message m, boolean reindex) {
1865+
public void applyConfig(Message m, boolean reindex, boolean interactive) {
18501866
Configuration config;
18511867
try {
18521868
config = makeXMLStringAsConfiguration(m.getText());
@@ -1855,7 +1871,7 @@ public void applyConfig(Message m, boolean reindex) {
18551871
return;
18561872
}
18571873

1858-
applyConfig(config, reindex);
1874+
applyConfig(config, reindex, interactive);
18591875
}
18601876

18611877
/**
@@ -1865,11 +1881,12 @@ public void applyConfig(Message m, boolean reindex) {
18651881
*
18661882
* @param config the incoming configuration
18671883
* @param reindex is the message result of reindex
1884+
* @param interactive true if in interactive mode
18681885
*
18691886
*/
1870-
public void applyConfig(Configuration config, boolean reindex) {
1887+
public void applyConfig(Configuration config, boolean reindex, boolean interactive) {
18711888

1872-
setConfiguration(config);
1889+
setConfiguration(config, interactive);
18731890
LOGGER.log(Level.INFO, "Configuration updated: {0}",
18741891
configuration.getSourceRoot());
18751892

src/org/opensolaris/opengrok/configuration/messages/ConfigMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected byte[] applyMessage(RuntimeEnvironment env) throws IOException {
6767
matcher.group(2) // value
6868
);
6969
// apply the configuration - let the environment reload the configuration if necessary
70-
env.applyConfig(env.getConfiguration(), false);
70+
env.applyConfig(env.getConfiguration(), false, true);
7171
return String.format("Variable \"%s\" set to \"%s\".", matcher.group(1), matcher.group(2)).getBytes();
7272
} else {
7373
// invalid pattern
@@ -79,7 +79,7 @@ protected byte[] applyMessage(RuntimeEnvironment env) throws IOException {
7979
} else if (hasTag("get")) {
8080
return ClassUtil.invokeGetter(env.getConfiguration(), getText()).getBytes();
8181
} else if (hasTag("setconf")) {
82-
env.applyConfig(this, hasTag("reindex"));
82+
env.applyConfig(this, hasTag("reindex"), !hasTag("reindex"));
8383
}
8484

8585
return null;

0 commit comments

Comments
 (0)