Skip to content

Commit

Permalink
added DBN INPUT JSON GENERATION service to preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
awcrapo committed Oct 22, 2019
1 parent 4116b1e commit 202fd56
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,10 @@ public Map<String, String> getPreferences(URI uri) {
if (dbncgsburl != null) {
map.put(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), dbncgsburl);
}
String dbnjsongensburl = preferenceValues.getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI);
if (dbnjsongensburl != null) {
map.put(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), dbnjsongensburl);
}
String usedbn = preferenceValues.getPreference(DialogPreferences.USE_DBN_CG_SERVICE);
if (usedbn != null) {
map.put(DialogPreferences.USE_DBN_CG_SERVICE.getId(), usedbn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,10 @@ protected Map<String, String> getPreferences(URI uri) {
if (dbncgsburl != null) {
map.put(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), dbncgsburl);
}
String dbnjsongensburl = preferenceValues.getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI);
if (dbnjsongensburl != null) {
map.put(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), dbnjsongensburl);
}
String usedbn = preferenceValues.getPreference(DialogPreferences.USE_DBN_CG_SERVICE);
if (usedbn != null) {
map.put(DialogPreferences.USE_DBN_CG_SERVICE.getId(), usedbn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected void createFieldEditors() {
Composite computationalGraphSettings = createSettingsGroup(generalSettings, SWT.NONE, "Computational Graph Settings");
addField(new BooleanFieldEditorExt(DialogPreferences.USE_DBN_CG_SERVICE.getId(), "Use DBN", computationalGraphSettings));
addField(new StringFieldEditorExt(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), "DBN Service Host and Port:", computationalGraphSettings));
addField(new StringFieldEditorExt(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), "DBN Json Generation Service Host and Port:", computationalGraphSettings));
addField(new BooleanFieldEditorExt(DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getId(), "Use K-CHAIN", computationalGraphSettings));
addField(new StringFieldEditorExt(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getId(), "K-CHAIN Service Host and Port:", computationalGraphSettings));
// addField(new StringFieldEditorExt(DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getId(), "Code Extraction KBase Root:", generalSettings));
Expand All @@ -160,6 +161,10 @@ private void initializeDefaultPreferences() {
//General Settings
store.setDefault(DialogPreferences.ANSWER_TEXT_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_TEXT_SERVICE_BASE_URI.getDefaultValue());
store.setDefault(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI.getDefaultValue());
store.setDefault(DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getId(), DialogPreferences.USE_ANSWER_KCHAIN_CG_SERVICE.getDefaultValue());
store.setDefault(DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_DBN_CG_SERVICE_BASE_URI.getDefaultValue());
store.setDefault(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getId(), DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI.getDefaultValue());
store.setDefault(DialogPreferences.USE_DBN_CG_SERVICE.getId(), DialogPreferences.USE_DBN_CG_SERVICE.getDefaultValue());
store.setDefault(DialogPreferences.ANSWER_JAVA_TO_PYTHON_SERVICE_BASE_URI.getId(), DialogPreferences.ANSWER_JAVA_TO_PYTHON_SERVICE_BASE_URI.getDefaultValue());
store.setDefault(DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getId(), DialogPreferences.ANSWER_CODE_EXTRACTION_KBASE_ROOT.getDefaultValue());
setPreferenceStore(store);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public class DialogPreferences {
public static final PreferenceKey USE_ANSWER_KCHAIN_CG_SERVICE = new PreferenceKey("useKChainCgService", String.valueOf(false));
public static final PreferenceKey ANSWER_KCHAIN_CG_SERVICE_BASE_URI = new PreferenceKey("kChainCgServiceBaseUri", "http://localhost:12345");
public static final PreferenceKey USE_DBN_CG_SERVICE = new PreferenceKey("useDbnCgService", String.valueOf(true));
public static final PreferenceKey ANSWER_DBN_CG_SERVICE_BASE_URI = new PreferenceKey("dbnCgServiceBaseUri", "http://localhost:46000");
public static final PreferenceKey ANSWER_DBN_CG_SERVICE_BASE_URI = new PreferenceKey("dbnCgServiceBaseUri", "http://localhost:5000");
public static final PreferenceKey DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI = new PreferenceKey("DbnInputJsonGenerationServiceBaseUri", "http://localhost:46000");
public static final PreferenceKey ANSWER_CODE_EXTRACTION_KBASE_ROOT = new PreferenceKey("codeExtractionKbaseRoot", "resources/CodeModel");

private static final PreferenceKey[] allKeys = {
Expand All @@ -58,6 +59,7 @@ public class DialogPreferences {
ANSWER_KCHAIN_CG_SERVICE_BASE_URI,
USE_DBN_CG_SERVICE,
ANSWER_DBN_CG_SERVICE_BASE_URI,
DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI,
ANSWER_CODE_EXTRACTION_KBASE_ROOT
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public class JenaBasedDialogModelProcessor extends JenaBasedSadlModelProcessor {

private String textServiceUrl = null;
private String dbnCgServiceUrl = null;
private String dbninputjsongenerationserviceurl = null;
private boolean useDbn = true;
private String kchainCgServiceUrl = null;
private boolean useKchain = false;
Expand Down Expand Up @@ -1367,6 +1368,10 @@ public void initializePreferences(ProcessorContext context) {
if (dbncgserviceurl != null) {
setDbnCgServiceUrl(dbncgserviceurl);
}
String dbninputjsongenerationserviceurl = context.getPreferenceValues().getPreference(DialogPreferences.DBN_INPUT_JSON_GENERATION_SERVICE_BASE_URI);
if (dbninputjsongenerationserviceurl != null) {
setDbnInputJsonGenerationServiceUrl(dbninputjsongenerationserviceurl);
}
String kchaincgserviceurl = context.getPreferenceValues().getPreference(DialogPreferences.ANSWER_KCHAIN_CG_SERVICE_BASE_URI);
if (kchaincgserviceurl != null) {
setKchainCgServiceUrl(kchaincgserviceurl);
Expand Down Expand Up @@ -1395,6 +1400,15 @@ private void setDbnCgServiceUrl(String cgServiceUrl) {
this.dbnCgServiceUrl = cgServiceUrl;
}

private void setDbnInputJsonGenerationServiceUrl(String dbninputjsongenerationserviceurl) {
this.dbninputjsongenerationserviceurl = dbninputjsongenerationserviceurl;

}

public String getDbnInputJsonGenerationServiceUrl() {
return dbninputjsongenerationserviceurl;
}

public String getKchainCgServiceUrl() {
return kchainCgServiceUrl;
}
Expand Down

0 comments on commit 202fd56

Please sign in to comment.