From c19022ec32e72ec1883dcc19b4216350459479a9 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 27 Aug 2021 17:07:53 +0200 Subject: [PATCH 1/9] Worked on simplified gui structure and advanced features --- cfg/RestBridgeConfigurationWindow.bbj | 260 +++++++++++------------- res/RestBridge.arc | 277 ++++++++++++++++++++++++++ 2 files changed, 393 insertions(+), 144 deletions(-) create mode 100644 res/RestBridge.arc diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index bf11bbe..00586df 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -25,6 +25,9 @@ class public RestBridgeConfigurationWindow field private BBjInputE inpeProgramPrefix! field private BBjInputE inpeProgramSuffix! field private BBjInputE inpeWorkingDirectory! + field private BBjInputE inpeInputHandler! + field private BBjInputE inpeOutputHandler! + field private BBjInputE inpeAdapterTerm! field private BBjCEdit previewField! @@ -39,7 +42,11 @@ class public RestBridgeConfigurationWindow field private BBjButton btnBrowseRequestLogFile! field private BBjButton btnBrowseWorkingDirectory! field private BBjButton btnBrowseAuthenticationFile! + field private BBjButton btnBrowseInputHandler! + field private BBjButton btnBrowseOutputHandler! + field private BBjListButton lbDefaultCharset! + field private BBjAdmin admin! field private RestBridgeConfigurator configurate! @@ -62,182 +69,93 @@ class public RestBridgeConfigurationWindow methodend method private void init() - #sysGui! = BBjApi().openSysGui("X0") - - screenWidth = #sysGui!.getSystemMetrics().getScreenBounds().getWidth() - screenHeight = #sysGui!.getSystemMetrics().getScreenSize().getHeight() - - #window! = #sysGui!.addWindow(#sysGui!.getAvailableContext(), (screenWidth/2)-200, (screenHeight/2)-250, 760, 400, "REST Endpoint Configuration", $00000002$) - - labelWidth = 115 - controlHeight = 25 - space = 10 - y = 25 + #sysGui! = BBjAPI().openSysGui("X0") + resID = #sysGui!.resOpen("RestBridge/res/RestBridge.arc") + #window! = #sysGui!.createTopLevelWindow(resID, 101) - controlWidth = 400 - - xorig = 340 - x = xorig - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Mapping:") - x = x + controlWidth + space - - controlWidth = 150 - controlID = #window!.getAvailableControlID() - #inpeMapping! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeigh) + #inpeMapping! = #window!.getInputE("inpeMapping") #inpeMapping!.setEnabled(0) #inpeMapping!.setInsertMode(1) - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Timeout:") - x = x + controlWidth + space - - controlWidth = 150 - controlID = #window!.getAvailableControlID() - #inpnTimeout! = #window!.addInputN(controlID, x, y-5, controlWidth, controlHeight) + #inpnTimeout! = #window!.getInputN("inpnTimeout") #inpnTimeout!.setValue(1000) #inpnTimeout!.setInsertMode(1) - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Program Prefix:") - x = x + controlWidth + space - - controlWidth = 150 - controlID = #window!.getAvailableControlID() - #inpeProgramPrefix! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + #inpeProgramPrefix! = #window!.getInputE("inpeProgramPrefix") #inpeProgramPrefix!.setInsertMode(1) - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Program Suffix:") - x = x + controlWidth + space - - controlWidth = 150 - controlID = #window!.getAvailableControlID() - #inpeProgramSuffix! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + #inpeProgramSuffix! = #window!.getInputE("inpeProgramSuffix") #inpeProgramSuffix!.setText(".bbj") #inpeProgramSuffix!.setInsertMode(1) + + #chbUseGetAllowedFilters! = #window!.getCheckBox("chbUseGetAllowedFilters") - x = xorig - y = y + 20 - controlWidth = 250 - controlID = #window!.getAvailableControlID() - #chbUseGetAllowedFilters! = #window!.addCheckBox(controlID, x, y, controlWidth, controlHeight, "Use getAllowedFilters() if applicable") - - x = xorig - y = y + 50 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Config File:") - x = x + controlWidth + space - - controlWidth = 200 - controlID = #window!.getAvailableControlID() - #inpeConfigFile! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + #inpeConfigFile! = #window!.getInputE("inpeConfigFile") #inpeConfigFile!.setInsertMode(1) - x = x + controlWidth + space - - controlWidth = 75 - controlID = #window!.getAvailableControlID() - #btnBrowseConfigFile! = #window!.addButton(controlID, x, y-5, 30, controlHeight, "...") + + #btnBrowseConfigFile! = #window!.getButton("btnBrowseConfigFile") #btnBrowseConfigFile!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "browseConfigFileButtonPush") - - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Working Directory:") - x = x + controlWidth + space - - controlWidth = 200 - controlID = #window!.getAvailableControlID() - #inpeWorkingDirectory! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + + #inpeWorkingDirectory! = #window!.getInputE("inpeWorkingDirectory") #inpeWorkingDirectory!.setInsertMode(1) - x = x + controlWidth + space - controlWidth = 75 - controlID = #window!.getAvailableControlID() - #btnBrowseWorkingDirectory! = #window!.addButton(controlID, x, y-5, 30, controlHeight, "...") + #btnBrowseWorkingDirectory! = #window!.getButton("btnBrowseWorkingDirectory") #btnBrowseWorkingDirectory!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "browseWorkingDirectoryButtonPush") - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Auth Program:") - x = x + controlWidth + space - - controlWidth = 200 - controlID = #window!.getAvailableControlID() - #inpeAuthProgram! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + #inpeAuthProgram! = #window!.getInputE("inpeAuthProgram") #inpeAuthProgram!.setInsertMode(1) - x = x + controlWidth + space - controlWidth = 75 - controlID = #window!.getAvailableControlID() - #btnBrowseAuthenticationFile! = #window!.addButton(controlID, x, y-5, 30, controlHeight, "...") + #btnBrowseAuthenticationFile! = #window!.getButton("btnBrowseAuthenticationFile") #btnBrowseAuthenticationFile!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "browseAuthFileButtonPush") - x = xorig - y = y + 30 - controlWidth = labelWidth - controlID = #window!.getAvailableControlID() - #window!.addStaticText(controlID, x, y, controlWidth, controlHeight, "Request Log:") - x = x + controlWidth + space - - controlWidth = 200 - controlID = #window!.getAvailableControlID() - #inpeRequestLog! = #window!.addInputE(controlID, x, y-5, controlWidth, controlHeight) + #inpeRequestLog! = #window!.getInputE("inpeRequestLog") #inpeRequestLog!.setInsertMode(1) - x = x + controlWidth + space - controlWidth = 100 - controlID = #window!.getAvailableControlID() - #btnBrowseRequestLogFile! = #window!.addButton(controlID, x, y-5, 30, controlHeight, "...") + #btnBrowseRequestLogFile! = #window!.getButton("btnBrowseRequestLogFile") #btnBrowseRequestLogFile!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "browseRequestLogButtonPush") - - controlID = #window!.getAvailableControlID() - #btnPreviewCode! = #window!.addButton(controlID, x -30, 20, controlWidth, controlHeight, "Preview Code") + + #inpeInputHandler! = #window!.getInputE("inpeInputHandler") + #inpeInputHandler!.setInsertMode(1) + + #btnBrowseInputHandler! = #window!.getButton("btnBrowseInputHandler") + #btnBrowseInputHandler!.setCallback(BBjButton.ON_BUTTON_PUSH, #this!, "browseInputHandlerButtonPush") + + #inpeOutputHandler! = #window!.getInputE("inpeOutputHandler") + #inpeOutputHandler!.setInsertMode(1) + + #btnBrowseOutputHandler! = #window!.getButton("btnBrowseOutputHandler") + #btnBrowseOutputHandler!.setCallback(BBjButton.ON_BUTTON_PUSH, #this!, "browseOutputHandlerButtonPush") + + #inpeAdapterTerm! = #window!.getInputE("inpeAdapterTerm") + #inpeAdapterTerm!.setText("IO") + #inpeAdapterTerm!.setInsertMode(1) + + #btnPreviewCode! = #window!.getButton("btnPreviewCode") #btnPreviewCode!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "previewCode") - controlID = #window!.getAvailableControlID() - #btnOK! = #window!.addButton(controlID,x-30,365,controlWidth,controlHeight,"OK") + #btnOK! = #window!.getButton("btnOK") #btnOK!.setCallback(BBjButton.ON_BUTTON_PUSH,#this!,"okOnClick") - controlID = #window!.getAvailableControlID() - #btnSave! = #window!.addButton(controlID, x - 30-controlWidth - space, 365, controlWidth, controlHeight, "Save") + #btnSave! = #window!.getButton("btnSave") #btnSave!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "saveClicked") - x = x - controlWidth - space - controlID = #window!.getAvailableControlID() - #btnCancel! = #window!.addButton(controlID, x- 30-controlWidth - space, 365, controlWidth, controlHeight, "Cancel") + #btnCancel! = #window!.getButton("btnCancel") #btnCancel!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "cancelClicked") - controlID = #window!.getAvailableControlID() - #btnAddContext! = #window!.addButton(controlID, 20, 365, controlWidth, controlHeight, "Add Context") + #btnAddContext! = #window!.getButton("btnAddContext") #btnAddContext!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!, "addContextButtonPush") - controlID = #window!.getAvailableControlID() - #btnAddBridge! = #window!.addButton(controlID,130,365,controlWidth,controlHeight, "Add Endpoint") + #btnAddBridge! = #window!.getButton("btnAddBridge") #btnAddBridge!.setCallback(BBjAPI.ON_BUTTON_PUSH, #this!,"addBridge") #btnAddBridge!.setEnabled(0) - controlID = #window!.getAvailableControlID() - #btnRemoveBridge! = #window!.addButton(controlID,240, 365, controlWidth, controlHeight, "Remove Endpoint") + #btnRemoveBridge! = #window!.getButton("btnRemoveBridge") #btnRemoveBridge!.setCallback(BBjButton.ON_BUTTON_PUSH,#this!,"removeBridge") #btnRemoveBridge!.setEnabled(0) - controlID = #window!.getAvailableControlID() - #treeContext! = #window!.addTree(controlID, 20,20,300,335) + #lbDefaultCharset! = #window!.getListButton("lbDefaultCharset") + + #treeContext! = #window!.getTree("treeContext") #treeContext!.setSelectionMode(BBjTree.SINGLE_TREE_SELECTION) #treeContext!.setCallback(BBjTree.ON_TREE_SELECT,#this!,"onSelect") #treeContext!.setRoot(0,"contexts") @@ -315,12 +233,18 @@ class public RestBridgeConfigurationWindow #inpeProgramPrefix!.setEnabled(enable!) #inpeProgramSuffix!.setEnabled(enable!) #inpeWorkingDirectory!.setEnabled(enable!) + #inpeOutputHandler!.setEnabled(enable!) + #inpeInputHandler!.setEnabled(enable!) #inpnTimeout!.setEnabled(enable!) #btnPreviewCode!.setEnabled(enable!) #btnBrowseConfigFile!.setEnabled(enable!) #btnBrowseRequestLogFile!.setEnabled(enable!) #btnBrowseWorkingDirectory!.setEnabled(enable!) #btnBrowseAuthenticationFile!.setEnabled(enable!) + #btnBrowseInputHandler!.setEnabled(enable!) + #btnBrowseOutputHandler!.setEnabled(enable!) + #inpeAdapterTerm!.setEnabled(enable!) + #lbDefaultCharset!.setEnabled(enable!) #chbUseGetAllowedFilters!.setEnabled(enable!) #btnSave!.setEnabled(enable!) methodend @@ -409,7 +333,11 @@ class public RestBridgeConfigurationWindow params!.put("REST_PGM_SUFFIX", #getProgramSuffix()) params!.put("USE_GET_ALLOWED_FILTER", str(int(#useGetAllowedFilters()))) params!.put("REST_REQUESTLOG", #getRequestLogPath()) - + params!.put("REST_INPUT_HANDLER", #getInputHandler()) + params!.put("REST_OUTPUT_HANDLER", #getOutputHandler()) + params!.put("REST_ADAPTERTERM", #getAdapterTerm()) + params!.put("REST_DEFAULT_CHARSET",#getCharset()) + #window!.setCursor(32514) #configurate!.editRestBridgeConfiguration(#selected!.getName(), #selectedBridge!.getMapping(), params!, #getConfigFilePath()) #window!.setCursor(32512) @@ -648,7 +576,19 @@ class public RestBridgeConfigurationWindow logPath! = #browse(path!,"Request Log File Selection", Boolean.FALSE, "","All files"+$0a$+"*.*") #inpeRequestLog!.setText(logPath!) methodend + + method public void browseInputHandlerButtonPush(BBjButtonPushEvent event!) + path! = #inpeRequestLog!.getText() + logPath! = #browse(path!,"Input Handler Selection", Boolean.FALSE, "","All files"+$0a$+"*.*") + #inpeInputHandler!.setText(logPath!) + methodend + method public void browseOutputHandlerButtonPush(BBjButtonPushEvent event!) + path! = #inpeRequestLog!.getText() + logPath! = #browse(path!,"Output Handler Selection", Boolean.FALSE, "","All files"+$0a$+"*.*") + #inpeInputHandler!.setText(logPath!) + methodend + method public void browseWorkingDirectoryButtonPush(BBjButtonPushEvent event!) path! = #inpeWorkingDirectory!.getText() wdPath! = #browse(path!,"Working Directory Selection", Boolean.TRUE, "","") @@ -667,12 +607,17 @@ class public RestBridgeConfigurationWindow #opend! = Boolean.TRUE #prevWindow!.setCallback(BBjWindow.ON_KEYPRESS,#this!,"windowKeypressEvent") #window!.setEnabled(0) - - controlID = #prevWindow!.getAvailableControlID() - #prevWindow!.addStaticText(controlID,20,0,80,20,"Example Code:") - + + declare BBjButton btnCopy! + btnCopy! = #prevWindow!.addButton(#prevWindow!.getAvailableControlID(),10,10,100,25,"Copy to Clipboard") + btnCopy!.setCallback(BBjButton.ON_BUTTON_PUSH , #this!, "onClickCopy") + + declare BBjButton btnSaveAs! + btnSaveAs! = #prevWindow!.addButton(#prevWindow!.getAvailableControlID(),130,10,100,25,"Save as") + btnSaveAs!.setCallback(BBjButton.ON_BUTTON_PUSH, #this!, "onClickSaveAs") + controlID = #prevWindow!.getAvailableControlID() - #previewField! = #prevWindow!.addCEdit(controlID,20,20,#prevWindow!.getWidth() - 40,#prevWindow!.getHeight() - 40,"",$0306$) + #previewField! = #prevWindow!.addCEdit(controlID,0,45,#prevWindow!.getWidth(),#prevWindow!.getHeight() - 45,"",$0306$) declare BBjFont font! font! = #sysGui!.makeFont("Consolas",12,0) @@ -719,6 +664,10 @@ class public RestBridgeConfigurationWindow builder!.append("suffix! = """+#getProgramSuffix()+""""+$0A$) builder!.append("useGetAllowedFilter! = """+str(#useGetAllowedFilters())+""""+$0A$) builder!.append("requestLogPath! = """+#getRequestLogPath()+""""+$0A$+$0A$) + builder!.append("inputHandler! = """+#getInputHandler()+""""+$0A$) + builder!.append("outputHandler! = """+#getOutputHandler()+""""+$0A$) + builder!.append("adapterTerm! = """+#getAdapterTerm()+""""+$0A$) + builder!.append("charset! = """+#getCharset()+""""+$0A$) builder!.append("admin! = BBjAPI().getAdmin(user!,password!)"+$0A$) builder!.append("serverConfig! = admin!.getJettyServerConfig()"+$0A$) builder!.append("directory! = new File(dsk("""") + dir(""""))"+$0A$+$0A$) @@ -755,8 +704,15 @@ class public RestBridgeConfigurationWindow BBjAPI().postCustomEvent("CloseWindowEvent", "") methodend - - + method public void onClickCopy(BBjButtonPushEvent e!) + CLIPFROMSTR 1, #previewField!.getText() + methodret + methodend + + method public void onClickSaveAs(BBjButtonPushEvent e!) + FILE_NAME$=FILESAVE("Save File","","Restconfig","txt",FILTER$) + methodend + rem /** rem * Returns the user entered value for the Timeout property. rem * @@ -851,7 +807,23 @@ class public RestBridgeConfigurationWindow method public String getRequestLogPath() methodret #inpeRequestLog!.getText() methodend - + + method public String getInputHandler() + methodret #inpeInputHandler!.getText() + methodend + + method public String getOutputHandler() + methodret #inpeOutputHandler!.getText() + methodend + + method public String getAdapterTerm() + methodret #inpeAdapterTerm!.getText() + methodend + + method public String getCharset() + methodret #lbDefaultCharset!.getText() + methodend + method public void setRequestLogPath(String path!) if (path! = null()) then path! = "" diff --git a/res/RestBridge.arc b/res/RestBridge.arc new file mode 100644 index 0000000..85e4d14 --- /dev/null +++ b/res/RestBridge.arc @@ -0,0 +1,277 @@ +//#charset: windows-1252 + +VERSION "4.0" + +WINDOW 101 "REST Endpoint Configuration" 200 200 800 464 +BEGIN + EVENTMASK 0 + NAME "Window101" + STATICTEXT 100, "Mapping:", 375, 25, 115, 25 + BEGIN + NAME "Static Text100" + NOT WORDWRAP + END + + INPUTE 102, "", 500, 20, 150, 25 + BEGIN + GROUP + NAME "inpeMapping" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 103, "Timeout:", 375, 55, 115, 25 + BEGIN + NAME "Static Text103" + NOT WORDWRAP + END + + INPUTN 104, "", 500, 50, 150, 25 + BEGIN + GROUP + NAME "inpnTimeout" + RESTORESTRING "0" + NOT DRAGENABLED + NOT INSERTMODE + END + + STATICTEXT 105, "Program Prefix:", 375, 85, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 106, "", 500, 80, 150, 25 + BEGIN + GROUP + NAME "inpeProgramPrefix" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 107, "Program Suffix:", 375, 115, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 108, "", 500, 110, 150, 25 + BEGIN + GROUP + NAME "inpeProgramSuffix" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + CHECKBOX 109, "Use getAllowedFilters() if applicable", 376, 200, 200, 25 + BEGIN + GROUP + NAME "chbUseGetAllowedFilters" + END + + STATICTEXT 110, "Config File:", 375, 235, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 111, "", 500, 230, 241, 25 + BEGIN + GROUP + NAME "inpeConfigFile" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 112, "...", 750, 231, 30, 25 + BEGIN + GROUP + NAME "btnBrowseConfigFile" + END + + STATICTEXT 113, "Working Directory:", 375, 265, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 114, "", 500, 260, 241, 25 + BEGIN + GROUP + NAME "inpeWorkingDirectory" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 115, "...", 750, 261, 30, 25 + BEGIN + GROUP + NAME "btnBrowseWorkingDirectory" + END + + STATICTEXT 116, "Auth Program:", 375, 295, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 117, "", 500, 290, 241, 25 + BEGIN + GROUP + NAME "inpeAuthProgram" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 118, "...", 750, 291, 30, 25 + BEGIN + GROUP + NAME "btnBrowseAuthenticationFile" + END + + STATICTEXT 119, "Request Log:", 375, 325, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 120, "", 500, 320, 241, 25 + BEGIN + GROUP + NAME "inpeRequestLog" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 121, "...", 750, 321, 30, 25 + BEGIN + GROUP + NAME "btnBrowseRequestLogFile" + END + + STATICTEXT 122, "Input Handler:", 375, 355, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 123, "", 500, 350, 241, 25 + BEGIN + GROUP + NAME "inpeInputHandler" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 124, "...", 750, 351, 30, 25 + BEGIN + GROUP + NAME "btnBrowseInputHandler" + END + + STATICTEXT 125, "Output Handler:", 375, 385, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 126, "", 500, 380, 241, 25 + BEGIN + GROUP + NAME "inpeOutputHandler" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 127, "...", 750, 381, 30, 25 + BEGIN + GROUP + NAME "btnBrowseOutputHandler" + END + + STATICTEXT 128, "Default Charset:", 375, 145, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + LISTBUTTON 129, "default\nUS-ASCII\nISO-8859-1\nUTF-8\nUTF-16BE\nUTF-16LE\nUTF-16\n", 500, 140, 150, 150 + BEGIN + GROUP + NAME "lbDefaultCharset" + SELECTIONHEIGHT 25 + END + + STATICTEXT 130, "Adapter Term: ", 375, 175, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 131, "", 500, 170, 150, 25 + BEGIN + GROUP + NAME "inpeAdapterTerm" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 132, "Add Context", 20, 430, 100, 25 + BEGIN + GROUP + NAME "btnAddContext" + END + + BUTTON 133, "Add Endpoint", 130, 430, 100, 25 + BEGIN + GROUP + NAME "btnAddBridge" + END + + BUTTON 134, "Remove Endpoint", 240, 430, 100, 25 + BEGIN + GROUP + NAME "btnRemoveBridge" + END + + BUTTON 135, "Cancel", 460, 430, 100, 25 + BEGIN + GROUP + NAME "btnCancel" + END + + BUTTON 136, "Save", 570, 430, 100, 25 + BEGIN + GROUP + NAME "btnSave" + END + + BUTTON 137, "OK", 680, 430, 100, 25 + BEGIN + GROUP + NAME "btnOK" + END + + BUTTON 138, "Preview Code", 680, 20, 100, 25 + BEGIN + GROUP + NAME "btnPreviewCode" + END + + TREE 139, 20, 20, 320, 385 + BEGIN + NAME "treeContext" + END + +END + From fd2b3597c336fca7db25df506c00288190fa98c0 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Tue, 31 Aug 2021 16:55:34 +0200 Subject: [PATCH 2/9] Added Fields and finalized UI --- cfg/RestBridgeConfigurationWindow.bbj | 204 ++++++++++++++++---------- res/ConfigFile.txt | 60 ++++++++ res/RestBridge.arc | 17 ++- 3 files changed, 193 insertions(+), 88 deletions(-) create mode 100644 res/ConfigFile.txt diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index 00586df..3edee60 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -1,5 +1,8 @@ use java.io.File use java.util.HashMap +use java.util.Scanner +use java.io.FileWriter +use com.basiscomponents.db.constants.SimpleConstantsResolver use ::RestBridge/cfg/ContextNameInputWindow.bbj::ContextNameInputWindow use ::RestBridge/cfg/RestBridgeConfigurator.bbj::RestBridgeConfigurator @@ -45,7 +48,7 @@ class public RestBridgeConfigurationWindow field private BBjButton btnBrowseInputHandler! field private BBjButton btnBrowseOutputHandler! - field private BBjListButton lbDefaultCharset! + field private BBjListEdit leDefaultCharset! field private BBjAdmin admin! @@ -153,7 +156,8 @@ class public RestBridgeConfigurationWindow #btnRemoveBridge!.setCallback(BBjButton.ON_BUTTON_PUSH,#this!,"removeBridge") #btnRemoveBridge!.setEnabled(0) - #lbDefaultCharset! = #window!.getListButton("lbDefaultCharset") + #leDefaultCharset! = #window!.getListEdit("leDefaultCharset") + #fillListEdit() #treeContext! = #window!.getTree("treeContext") #treeContext!.setSelectionMode(BBjTree.SINGLE_TREE_SELECTION) @@ -165,6 +169,18 @@ class public RestBridgeConfigurationWindow #updateUI() methodend + + method public void fillListEdit() + #leDefaultCharset!.addItem(INFO(1,2)) + #leDefaultCharset!.addItem("US-ASCII") + #leDefaultCharset!.addItem("ISO-8859-1") + #leDefaultCharset!.addItem("UTF-8") + #leDefaultCharset!.addItem("UTF-16BE") + #leDefaultCharset!.addItem("UTF-16LE") + #leDefaultCharset!.addItem("UTF-16") + + #leDefaultCharset!.selectIndex(0) + methodend method public void show() BBjAPI().setCustomEventCallback("CloseWindowEvent", "CloseWindow") @@ -244,7 +260,7 @@ class public RestBridgeConfigurationWindow #btnBrowseInputHandler!.setEnabled(enable!) #btnBrowseOutputHandler!.setEnabled(enable!) #inpeAdapterTerm!.setEnabled(enable!) - #lbDefaultCharset!.setEnabled(enable!) + #leDefaultCharset!.setEnabled(enable!) #chbUseGetAllowedFilters!.setEnabled(enable!) #btnSave!.setEnabled(enable!) methodend @@ -270,6 +286,11 @@ class public RestBridgeConfigurationWindow #setAuthProgramPath(servlet!.getParameter("REST_AUTHPGM")) #setRequestLogPath(servlet!.getParameter("REST_REQUESTLOG")) #setConfigFilePath(servlet!.getConfig()) + ?"Servlet Config: "+ str(servlet!.getConfig()) + #setInputHandlerPath(servlet!.getParameter("REST_INPUT_HANDLER")) + #setOutputHandlerPath(servlet!.getParameter("REST_OUTPUT_HANDLER")) + #setAdapterTerm(servlet!.getParameter("REST_ADAPTERTERM")) + #setCharset(servlet!.getParameter("REST_DEFAULT_CHARSET")) error = 1; #setUseGetAllowedFilters(num(servlet!.getParameter("USE_GET_ALLOWED_FILTER")),err=*next); error = 0 if error = 1 then #setUseGetAllowedFilters(0) @@ -602,8 +623,8 @@ class public RestBridgeConfigurationWindow methodend method public void previewCode(BBjButtonPushEvent e!) - - #prevWindow! = #sysGui!.addWindow(#sysGui!.getAvailableContext(), #window!.getX(), #window!.getY(),#window!.getWidth()+100,#window!.getHeight(), "Codepreview", $00000002$) + #prevWindow! = #sysGui!.addWindow(#sysGui!.getAvailableContext(), #window!.getX(), #window!.getY(),#window!.getWidth()+100,#window!.getHeight(), "Codepreview") + #prevWindow!.setCallback(#prevWindow!.ON_RESIZE, #this!, "onPreviewResize") #opend! = Boolean.TRUE #prevWindow!.setCallback(BBjWindow.ON_KEYPRESS,#this!,"windowKeypressEvent") #window!.setEnabled(0) @@ -625,75 +646,45 @@ class public RestBridgeConfigurationWindow #prevWindow!.setCallback(BBjAPI.ON_CLOSE, #this!,"closePrevWindow") - #previewField!.setText(#assembleCode()) - methodend - - method private String assembleCode() - declare java.lang.StringBuilder builder! - builder! = new java.lang.StringBuilder() - - builder!.append("use java.io.File"+$0A$+$0A$) - builder!.append("declare File restBridgeFile!"+$0A$) - builder!.append("declare File directory!"+$0A$) - builder!.append("declare File adapterProgram!"+$0A$) - builder!.append("declare BBjAdmin admin!"+$0A$) - builder!.append("declare BBjJettyContextConfiguration contextConf!"+$0A$) - builder!.append("declare BBjJettyServerConfiguration serverconfig!"+$0A$) - builder!.append("declare BBjspServletConfiguration bridgeConf!"+$0A$+$0A$) - builder!.append("declare String user!"+$0A$) - builder!.append("declare String password!"+$0A$) - builder!.append("declare String contextName!"+$0A$) - builder!.append("declare String bridgeName!"+$0A$) - builder!.append("declare String configFilePath!"+$0A$) - builder!.append("declare String timeOut!"+$0A$) - builder!.append("declare String workingDirectory!"+$0A$) - builder!.append("declare String authPgm!"+$0A$) - builder!.append("declare String preffix!"+$0A$) - builder!.append("declare String suffix!"+$0A$) - builder!.append("declare String useGetAllowedFilter!"+$0A$) - builder!.append("declare String requestLogPath!"+$0A$+$0A$) - builder!.append("user! = """"" +$0A$) - builder!.append("password! = """""+$0A$) - builder!.append("contextName! = """+#selected!.getName()+""""+$0A$) - builder!.append("bridgeName! = """+#selectedBridge!.getMapping()+""""+$0A$) - builder!.append("configFilePath! = """+#getConfigFilePath()+""""+$0A$) - builder!.append("timeOut! = """+str(#getTimeout())+""""+$0A$) - builder!.append("workingDirectory! = """+#getWorkingDirectoryPath()+""""+$0A$) - builder!.append("authPgm! = """+#getAuthProgramPath()+""""+$0A$) - builder!.append("preffix! = """+#getProgramPrefix()+""""+$0A$) - builder!.append("suffix! = """+#getProgramSuffix()+""""+$0A$) - builder!.append("useGetAllowedFilter! = """+str(#useGetAllowedFilters())+""""+$0A$) - builder!.append("requestLogPath! = """+#getRequestLogPath()+""""+$0A$+$0A$) - builder!.append("inputHandler! = """+#getInputHandler()+""""+$0A$) - builder!.append("outputHandler! = """+#getOutputHandler()+""""+$0A$) - builder!.append("adapterTerm! = """+#getAdapterTerm()+""""+$0A$) - builder!.append("charset! = """+#getCharset()+""""+$0A$) - builder!.append("admin! = BBjAPI().getAdmin(user!,password!)"+$0A$) - builder!.append("serverConfig! = admin!.getJettyServerConfig()"+$0A$) - builder!.append("directory! = new File(dsk("""") + dir(""""))"+$0A$+$0A$) - builder!.append("REM Creating a new Context with default DocBase and a WelcomeFile"+$0A$) - builder!.append("contextConf! = serverConfig!.createCustomContext(contextName!)"+$0A$) - builder!.append("contextConf!.setDocBase(""$basis_home/htdocs"")"+$0A$) - builder!.append("contextConf!.addWelcomeFile(""index.html"")"+$0A$) - builder!.append("contextConf!.setPath(""/"" + contextName!)"+$0A$) - builder!.append("serverConfig!.saveConfig()"+$0A$+$0A$) - builder!.append("restBridgeFile! = new File(directory!.getParentFile(),""RestBridge.bbj"")"+$0A$) - builder!.append("bridgeConf! = contextConf!.addBBjspServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath())"+$0A$+$0A$) - builder!.append("bridgeConf!.setConfig(configFilePath!)"+$0A$) - builder!.append("adapterProgram! = new File(directory!.getParentFile(),""RestBCAdapter.bbj"")"+$0A$+$0A$) - builder!.append("REM Here you can add Parameter to your Birdge."+$0A$) - builder!.append("bridgeConf!.addParam(""REST_ADAPTERPGM"", adapterProgram!.getAbsolutePath())"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_ADAPTERTERM"", ""IO"")"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_TIMEOUT"",timeOut!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_WD"",workingDirectory!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_AUTHPGM"",authpgm!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_PGM_PREFIX"",preffix!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_PGM_SUFFIX"",suffix!)"+$0A$) - builder!.append("bridgeConf!.addParam(""USE_GET_ALLOWED_FILTER"",useGetAllowedFilter!)"+$0A$) - builder!.append("bridgeConf!.addParam(""REST_REQUESTLOG"",requestLogPath!)"+$0A$) - builder!.append("serverConfig!.saveConfig()"+$0A$) - - methodret builder!.toString() + #previewField!.setText(#getConfigCode()) + methodend + + method public void onPreviewResize(BBjResizeEvent ev!) + #previewField!.setSize(ev!.getWidth(), ev!.getHeight() - 45) + methodend + + method private String getConfigCode() + declare File file! + file! = new File(DIR("") + "RestBridge/res/ConfigFile.txt") + + declare Scanner scan! + scan! = new Scanner(file!) + + string! = "" + while(scan!.hasNextLine()) + string! = string! + scan!.nextLine() + System.getProperty("line.separator") + wend + + declare SimpleConstantsResolver scr! + scr! = new SimpleConstantsResolver() + scr!.put("CONTEXTNAME", #selected!.getName()) + scr!.put("BRIDGENAME", #selectedBridge!.getMapping()) + scr!.put("CONFIGFILEPATH", #getConfigFilePath()) + scr!.put("TIMEOUT",str(#getTimeout())) + scr!.put("WORKINGDIRECTORYPATH", #getWorkingDirectoryPath()) + scr!.put("AUTHPROGRAMPATH",#getAuthProgramPath()) + scr!.put("PREFIX", #getProgramPrefix()) + scr!.put("SUFFIX", #getProgramSuffix()) + scr!.put("USEGETALLOWEDFILTERS", str(#useGetAllowedFilters())) + scr!.put("REQUESTLOGPATH", #getRequestLogPath()) + scr!.put("INPUTHANDLER", #getInputHandler()) + scr!.put("OUTPUTHANDLER", #getOutputHandler()) + scr!.put("ADAPTERTERM", #getAdapterTerm()) + scr!.put("CHARSET", #getCharset()) + + declare String res! + res! = scr!.resolveConstants(string!) + methodret res! methodend method public void okOnClick(BBjButtonPushEvent e!) @@ -710,7 +701,15 @@ class public RestBridgeConfigurationWindow methodend method public void onClickSaveAs(BBjButtonPushEvent e!) - FILE_NAME$=FILESAVE("Save File","","Restconfig","txt",FILTER$) + FILE_NAME$=FILESAVE("Save File As...",DIR(""),"Restconfig","bbj") + + declare File file! + file! = new File(FILE_NAME$) + + declare FileWriter fw! + fw! = new FileWriter(FILE_NAME$) + fw!.write(#previewField!.getText()) + fw!.close() methodend rem /** @@ -734,7 +733,7 @@ class public RestBridgeConfigurationWindow method public void setMapping(String mapping!) #inpeMapping!.setText(mapping!) methodend - + method public String getProgramPrefix() methodret #inpeProgramPrefix!.getText() methodend @@ -763,12 +762,12 @@ class public RestBridgeConfigurationWindow methodend method public void setConfigFilePath(String path!) - if (path! = null()) then - path! = "" + if (path! = "") then + path! = BBjAPI().getConfig().getConfigFileName() endif #inpeConfigFile!.setText(path!) methodend - + method public String getWorkingDirectoryPath() methodret #inpeWorkingDirectory!.getText() methodend @@ -786,12 +785,55 @@ class public RestBridgeConfigurationWindow method public void setAuthProgramPath(String path!) if (path! = null()) then - path! = "" + path! = dsk("") + DIR("") + "RestBridge/res/ConfigFile.txt" endif #inpeAuthProgram!.setText(path!) methodend + + method public void setInputHandlerPath(String path!) + if (path! = null()) then + path! = "" + endif + + #inpeInputHandler!.setText(path!) + methodend + + method public void setOutputHandlerPath(String path!) + if (path! = null()) then + path! = "" + endif + #inpeOutputHandler!.setText(path!) + methodend + + method public void setAdapterTerm(String string!) + if (string! = null()) then + string! = "" + endif + + #inpeAdapterTerm!.setText(string!) + methodend + + method public void setCharset(String charset!) + if (charset! = null()) then + charset! = "" + #leDefaultCharset!.selectIndex(0) + methodret + endif + + i% = 0 + WHILE (i% < #leDefaultCharset!.getAllItems().size() - 1) + if (#leDefaultCharset!.getItemAt(i%) = charset!) then + break + endif + + i% = i% + 1 + WEND + + #leDefaultCharset!.selectIndex(i%) + methodend + method public Boolean useGetAllowedFilters() methodret #chbUseGetAllowedFilters!.isSelected() methodend @@ -821,7 +863,7 @@ class public RestBridgeConfigurationWindow methodend method public String getCharset() - methodret #lbDefaultCharset!.getText() + methodret #leDefaultCharset!.getText() methodend method public void setRequestLogPath(String path!) diff --git a/res/ConfigFile.txt b/res/ConfigFile.txt new file mode 100644 index 0000000..c7c12b0 --- /dev/null +++ b/res/ConfigFile.txt @@ -0,0 +1,60 @@ +use java.io.File +declare File restBridgeFile! +declare File directory! +declare File adapterProgram! +declare BBjAdmin admin! +declare BBjJettyContextConfiguration contextConf! +declare BBjJettyServerConfiguration serverconfig! +declare BBjspServletConfiguration bridgeConf! +declare String user! +declare String password! +declare String contextName! +declare String bridgeName! +declare String configFilePath! +declare String timeOut! +declare String workingDirectory! +declare String authPgm! +declare String preffix! +declare String suffix! +declare String useGetAllowedFilter! +declare String requestLogPath! +user! = "" +password! = "" +contextName! = "[[CONTEXTNAME]]" +bridgeName! = "[[BRIDGENAME]]" +configFilePath! = "[[CONFIGFILEPATH]]" +timeOut! = "[[TIMEOUT]]" +workingDirectory! = "[[WORKINGDIRECTORYPATH]]" +authPgm! = "[[AUTHPROGRAMPATH]]" +prefix! = "[[PREFIX]]" +suffix! = "[[SUFFIX]]" +useGetAllowedFilters! = [[USEGETALLOWEDFILTERS]] +requestLogPath! = "[[REQUESTLOGPATH]]" +inputHandler! = "[[INPUTHANDLER]]" +outputHandler! = "[[OUTPUTHANDLER]]" +adapterTerm! = "[[ADAPTERTERM]]" +charset! = "[[CHARSET]]" +admin! = BBjAPI().getAdmin(user!,password!) +serverConfig! = admin!.getJettyServerConfig() +directory! = new File(dsk("") + dir("")) +REM Creating a new Context with default DocBase and a WelcomeFile +contextConf! = serverConfig!.createCustomContext(contextName!) +contextConf!.setDocBase("$basis_home/htdocs") +contextConf!.addWelcomeFile("index.html") +contextConf!.setPath("/" + contextName!) +serverConfig!.saveConfig() +restBridgeFile! = new File(directory!.getParentFile(),"RestBridge.bbj") +bridgeConf! = contextConf!.addBBjspServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath()) +bridgeConf!.setConfig(configFilePath!) +adapterProgram! = new File(directory!.getParentFile(),"RestBCAdapter.bbj") +REM Here you can add Parameter to your Bridge. +bridgeConf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) +bridgeConf!.addParam("REST_ADAPTERTERM", "IO") +bridgeConf!.addParam("REST_TIMEOUT",timeOut!) +bridgeConf!.addParam("REST_WD",workingDirectory!) +bridgeConf!.addParam("REST_AUTHPGM",authpgm!) +bridgeConf!.addParam("REST_PGM_PREFIX",prefix!) +bridgeConf!.addParam("REST_PGM_SUFFIX",suffix!) +bridgeConf!.addParam("USE_GET_ALLOWED_FILTER"",useGetAllowedFilter!) +bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!) +serverConfig!.saveConfig() \ No newline at end of file diff --git a/res/RestBridge.arc b/res/RestBridge.arc index 85e4d14..e91e944 100644 --- a/res/RestBridge.arc +++ b/res/RestBridge.arc @@ -5,7 +5,9 @@ VERSION "4.0" WINDOW 101 "REST Endpoint Configuration" 200 200 800 464 BEGIN EVENTMASK 0 + NOT MAXIMIZABLE NAME "Window101" + NOT SIZABLE STATICTEXT 100, "Mapping:", 375, 25, 115, 25 BEGIN NAME "Static Text100" @@ -204,13 +206,6 @@ BEGIN NOT WORDWRAP END - LISTBUTTON 129, "default\nUS-ASCII\nISO-8859-1\nUTF-8\nUTF-16BE\nUTF-16LE\nUTF-16\n", 500, 140, 150, 150 - BEGIN - GROUP - NAME "lbDefaultCharset" - SELECTIONHEIGHT 25 - END - STATICTEXT 130, "Adapter Term: ", 375, 175, 115, 25 BEGIN NAME "Static Text105" @@ -273,5 +268,13 @@ BEGIN NAME "treeContext" END + LISTEDIT 140, "", 500, 140, 150, 150 + BEGIN + NAME "leDefaultCharset" + SELECTIONHEIGHT 25 + SPELLCHECKED + NOT DRAGENABLED + END + END From 42081e79b0de8f2254ea371fbddefe7b64925405 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 3 Sep 2021 10:05:05 +0200 Subject: [PATCH 3/9] Implemented check to prevent double parameter --- cfg/RestBridgeConfigurator.bbj | 12 +- res/ConfigFile.txt | 60 ------- res/RestBridge.arc | 280 --------------------------------- 3 files changed, 9 insertions(+), 343 deletions(-) delete mode 100644 res/ConfigFile.txt delete mode 100644 res/RestBridge.arc diff --git a/cfg/RestBridgeConfigurator.bbj b/cfg/RestBridgeConfigurator.bbj index 59d34d4..d36e03a 100644 --- a/cfg/RestBridgeConfigurator.bbj +++ b/cfg/RestBridgeConfigurator.bbj @@ -157,9 +157,15 @@ class public RestBridgeConfigurator declare File adapterProgram! adapterProgram! = new File(#pluginDirectory!, "RestBCAdapter.bbj") - conf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) - conf!.addParam("REST_ADAPTERTERM", "IO") - + + if params!.get("REST_ADAPTERPGM") = null() then + conf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) + endif + + if params!.get("REST_ADAPTERTERM") = null() then + conf!.addParam("REST_ADAPTERTERM", "IO") + endif + declare Iterator it! it! = params!.entrySet().iterator() while(it!.hasNext()) diff --git a/res/ConfigFile.txt b/res/ConfigFile.txt deleted file mode 100644 index c7c12b0..0000000 --- a/res/ConfigFile.txt +++ /dev/null @@ -1,60 +0,0 @@ -use java.io.File -declare File restBridgeFile! -declare File directory! -declare File adapterProgram! -declare BBjAdmin admin! -declare BBjJettyContextConfiguration contextConf! -declare BBjJettyServerConfiguration serverconfig! -declare BBjspServletConfiguration bridgeConf! -declare String user! -declare String password! -declare String contextName! -declare String bridgeName! -declare String configFilePath! -declare String timeOut! -declare String workingDirectory! -declare String authPgm! -declare String preffix! -declare String suffix! -declare String useGetAllowedFilter! -declare String requestLogPath! -user! = "" -password! = "" -contextName! = "[[CONTEXTNAME]]" -bridgeName! = "[[BRIDGENAME]]" -configFilePath! = "[[CONFIGFILEPATH]]" -timeOut! = "[[TIMEOUT]]" -workingDirectory! = "[[WORKINGDIRECTORYPATH]]" -authPgm! = "[[AUTHPROGRAMPATH]]" -prefix! = "[[PREFIX]]" -suffix! = "[[SUFFIX]]" -useGetAllowedFilters! = [[USEGETALLOWEDFILTERS]] -requestLogPath! = "[[REQUESTLOGPATH]]" -inputHandler! = "[[INPUTHANDLER]]" -outputHandler! = "[[OUTPUTHANDLER]]" -adapterTerm! = "[[ADAPTERTERM]]" -charset! = "[[CHARSET]]" -admin! = BBjAPI().getAdmin(user!,password!) -serverConfig! = admin!.getJettyServerConfig() -directory! = new File(dsk("") + dir("")) -REM Creating a new Context with default DocBase and a WelcomeFile -contextConf! = serverConfig!.createCustomContext(contextName!) -contextConf!.setDocBase("$basis_home/htdocs") -contextConf!.addWelcomeFile("index.html") -contextConf!.setPath("/" + contextName!) -serverConfig!.saveConfig() -restBridgeFile! = new File(directory!.getParentFile(),"RestBridge.bbj") -bridgeConf! = contextConf!.addBBjspServlet(""RestBridge"",bridgeName!,restBridgeFile!.getAbsolutePath()) -bridgeConf!.setConfig(configFilePath!) -adapterProgram! = new File(directory!.getParentFile(),"RestBCAdapter.bbj") -REM Here you can add Parameter to your Bridge. -bridgeConf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) -bridgeConf!.addParam("REST_ADAPTERTERM", "IO") -bridgeConf!.addParam("REST_TIMEOUT",timeOut!) -bridgeConf!.addParam("REST_WD",workingDirectory!) -bridgeConf!.addParam("REST_AUTHPGM",authpgm!) -bridgeConf!.addParam("REST_PGM_PREFIX",prefix!) -bridgeConf!.addParam("REST_PGM_SUFFIX",suffix!) -bridgeConf!.addParam("USE_GET_ALLOWED_FILTER"",useGetAllowedFilter!) -bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!) -serverConfig!.saveConfig() \ No newline at end of file diff --git a/res/RestBridge.arc b/res/RestBridge.arc deleted file mode 100644 index e91e944..0000000 --- a/res/RestBridge.arc +++ /dev/null @@ -1,280 +0,0 @@ -//#charset: windows-1252 - -VERSION "4.0" - -WINDOW 101 "REST Endpoint Configuration" 200 200 800 464 -BEGIN - EVENTMASK 0 - NOT MAXIMIZABLE - NAME "Window101" - NOT SIZABLE - STATICTEXT 100, "Mapping:", 375, 25, 115, 25 - BEGIN - NAME "Static Text100" - NOT WORDWRAP - END - - INPUTE 102, "", 500, 20, 150, 25 - BEGIN - GROUP - NAME "inpeMapping" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - STATICTEXT 103, "Timeout:", 375, 55, 115, 25 - BEGIN - NAME "Static Text103" - NOT WORDWRAP - END - - INPUTN 104, "", 500, 50, 150, 25 - BEGIN - GROUP - NAME "inpnTimeout" - RESTORESTRING "0" - NOT DRAGENABLED - NOT INSERTMODE - END - - STATICTEXT 105, "Program Prefix:", 375, 85, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 106, "", 500, 80, 150, 25 - BEGIN - GROUP - NAME "inpeProgramPrefix" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - STATICTEXT 107, "Program Suffix:", 375, 115, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 108, "", 500, 110, 150, 25 - BEGIN - GROUP - NAME "inpeProgramSuffix" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - CHECKBOX 109, "Use getAllowedFilters() if applicable", 376, 200, 200, 25 - BEGIN - GROUP - NAME "chbUseGetAllowedFilters" - END - - STATICTEXT 110, "Config File:", 375, 235, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 111, "", 500, 230, 241, 25 - BEGIN - GROUP - NAME "inpeConfigFile" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 112, "...", 750, 231, 30, 25 - BEGIN - GROUP - NAME "btnBrowseConfigFile" - END - - STATICTEXT 113, "Working Directory:", 375, 265, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 114, "", 500, 260, 241, 25 - BEGIN - GROUP - NAME "inpeWorkingDirectory" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 115, "...", 750, 261, 30, 25 - BEGIN - GROUP - NAME "btnBrowseWorkingDirectory" - END - - STATICTEXT 116, "Auth Program:", 375, 295, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 117, "", 500, 290, 241, 25 - BEGIN - GROUP - NAME "inpeAuthProgram" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 118, "...", 750, 291, 30, 25 - BEGIN - GROUP - NAME "btnBrowseAuthenticationFile" - END - - STATICTEXT 119, "Request Log:", 375, 325, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 120, "", 500, 320, 241, 25 - BEGIN - GROUP - NAME "inpeRequestLog" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 121, "...", 750, 321, 30, 25 - BEGIN - GROUP - NAME "btnBrowseRequestLogFile" - END - - STATICTEXT 122, "Input Handler:", 375, 355, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 123, "", 500, 350, 241, 25 - BEGIN - GROUP - NAME "inpeInputHandler" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 124, "...", 750, 351, 30, 25 - BEGIN - GROUP - NAME "btnBrowseInputHandler" - END - - STATICTEXT 125, "Output Handler:", 375, 385, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 126, "", 500, 380, 241, 25 - BEGIN - GROUP - NAME "inpeOutputHandler" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 127, "...", 750, 381, 30, 25 - BEGIN - GROUP - NAME "btnBrowseOutputHandler" - END - - STATICTEXT 128, "Default Charset:", 375, 145, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - STATICTEXT 130, "Adapter Term: ", 375, 175, 115, 25 - BEGIN - NAME "Static Text105" - NOT WORDWRAP - END - - INPUTE 131, "", 500, 170, 150, 25 - BEGIN - GROUP - NAME "inpeAdapterTerm" - PADCHARACTER 32 - SPELLCHECKED - NOT DRAGENABLED - END - - BUTTON 132, "Add Context", 20, 430, 100, 25 - BEGIN - GROUP - NAME "btnAddContext" - END - - BUTTON 133, "Add Endpoint", 130, 430, 100, 25 - BEGIN - GROUP - NAME "btnAddBridge" - END - - BUTTON 134, "Remove Endpoint", 240, 430, 100, 25 - BEGIN - GROUP - NAME "btnRemoveBridge" - END - - BUTTON 135, "Cancel", 460, 430, 100, 25 - BEGIN - GROUP - NAME "btnCancel" - END - - BUTTON 136, "Save", 570, 430, 100, 25 - BEGIN - GROUP - NAME "btnSave" - END - - BUTTON 137, "OK", 680, 430, 100, 25 - BEGIN - GROUP - NAME "btnOK" - END - - BUTTON 138, "Preview Code", 680, 20, 100, 25 - BEGIN - GROUP - NAME "btnPreviewCode" - END - - TREE 139, 20, 20, 320, 385 - BEGIN - NAME "treeContext" - END - - LISTEDIT 140, "", 500, 140, 150, 150 - BEGIN - NAME "leDefaultCharset" - SELECTIONHEIGHT 25 - SPELLCHECKED - NOT DRAGENABLED - END - -END - From b9bd0f8c37f10dc2224f6730c6951cdbf11f03e4 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 3 Sep 2021 10:07:33 +0200 Subject: [PATCH 4/9] Cleaned code up, added comments --- cfg/RestBridgeConfigurationWindow.bbj | 45 +++++++++++++++++++-------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index 3edee60..f3c1848 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -73,8 +73,9 @@ class public RestBridgeConfigurationWindow method private void init() #sysGui! = BBjAPI().openSysGui("X0") - resID = #sysGui!.resOpen("RestBridge/res/RestBridge.arc") + resID = #sysGui!.resOpen("RestBridge/cfg/RestBridge.arc") #window! = #sysGui!.createTopLevelWindow(resID, 101) + #window!.setEnterAsTab(1) #inpeMapping! = #window!.getInputE("inpeMapping") #inpeMapping!.setEnabled(0) @@ -286,7 +287,6 @@ class public RestBridgeConfigurationWindow #setAuthProgramPath(servlet!.getParameter("REST_AUTHPGM")) #setRequestLogPath(servlet!.getParameter("REST_REQUESTLOG")) #setConfigFilePath(servlet!.getConfig()) - ?"Servlet Config: "+ str(servlet!.getConfig()) #setInputHandlerPath(servlet!.getParameter("REST_INPUT_HANDLER")) #setOutputHandlerPath(servlet!.getParameter("REST_OUTPUT_HANDLER")) #setAdapterTerm(servlet!.getParameter("REST_ADAPTERTERM")) @@ -452,17 +452,23 @@ class public RestBridgeConfigurationWindow name! = name!.replaceAll(" ","") buffer! = System.getProperty("basis.BBjHome") + "\plugins\RestBridge\authenticate.bbj" + bbjHome! = new File(buffer!) - auth! = bbjHome!.getAbsolutePath().replaceAll("\\|\/", java.io.File.separator,err=*next) + auth! = bbjHome!.getAbsolutePath().replaceAll("\|/", java.io.File.separator,err=*next) params! = new HashMap() params!.put("REST_TIMEOUT","1000") params!.put("REST_WD", "") + params!.put("REST_AUTHPGM",auth!) params!.put("REST_PGM_PREFIX","") params!.put("REST_PGM_SUFFIX",".bbj") params!.put("USE_GET_ALLOWED_FILTER","0") params!.put("REST_REQUESTLOG","") + params!.put("REST_INPUT_HANDLER", "") + params!.put("REST_OUTPUT_HANDLER", "") + params!.put("REST_ADAPTERTERM", "IO") + params!.put("REST_DEFAULT_CHARSET", INFO(1,2)) if (#selected!.getBridge(name!) = null()) then #configurate!.configureRestBridge(#selected!.getName(),name!,params!,"") @@ -655,7 +661,7 @@ class public RestBridgeConfigurationWindow method private String getConfigCode() declare File file! - file! = new File(DIR("") + "RestBridge/res/ConfigFile.txt") + file! = new File(DIR("") + "RestBridge/cfg/ConfigFile.txt") declare Scanner scan! scan! = new Scanner(file!) @@ -694,22 +700,33 @@ class public RestBridgeConfigurationWindow BBjAPI().postCustomEvent("CloseWindowEvent", "") methodend - + + rem /** + rem * Copy Config Code to Clipboard. + rem */ method public void onClickCopy(BBjButtonPushEvent e!) CLIPFROMSTR 1, #previewField!.getText() - methodret methodend + rem /** + rem * Saves the Code as an actual Config to run. + rem */ method public void onClickSaveAs(BBjButtonPushEvent e!) FILE_NAME$=FILESAVE("Save File As...",DIR(""),"Restconfig","bbj") declare File file! - file! = new File(FILE_NAME$) + file! = new File(FILE_NAME!) declare FileWriter fw! - fw! = new FileWriter(FILE_NAME$) + fw! = new FileWriter(FILE_NAME!) + + setErr Error fw!.write(#previewField!.getText()) fw!.close() + M=MSGBOX("Save successfull. admin! und user! have to be set before launching the Code!") + + Error: + M=MSGBOX("Error occured. File couldn't be saved to " + FILE_NAME!.replace("Restconfig.bbj", "")) methodend rem /** @@ -724,8 +741,7 @@ class public RestBridgeConfigurationWindow method public void setTimeout(BBjInt timeout%) #inpnTimeout!.setValue(timeout%) methodend - - + method public String getMapping() methodret #inpeMapping!.getText() methodend @@ -785,9 +801,13 @@ class public RestBridgeConfigurationWindow method public void setAuthProgramPath(String path!) if (path! = null()) then - path! = dsk("") + DIR("") + "RestBridge/res/ConfigFile.txt" + buffer! = System.getProperty("basis.BBjHome") + "\plugins\RestBridge\authenticate.bbj" + + declare File bbjHome! + bbjHome! = new File(buffer!) + + path! = bbjHome!.getAbsolutePath().replaceAll("\|/", java.io.File.separator,err=*next) endif - #inpeAuthProgram!.setText(path!) methodend @@ -873,5 +893,4 @@ class public RestBridgeConfigurationWindow #inpeRequestLog!.setText(path!) methodend - classend \ No newline at end of file From 62a8698e98c05ea458c733ede7628f7d9f19be56 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Thu, 11 Nov 2021 08:47:03 +0100 Subject: [PATCH 5/9] Committed missing Restbridge.arc and ConfigFile.txt --- cfg/ConfigFile.txt | 74 ++++++++++++ cfg/RestBridge.arc | 281 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 355 insertions(+) create mode 100644 cfg/ConfigFile.txt create mode 100644 cfg/RestBridge.arc diff --git a/cfg/ConfigFile.txt b/cfg/ConfigFile.txt new file mode 100644 index 0000000..651dbe5 --- /dev/null +++ b/cfg/ConfigFile.txt @@ -0,0 +1,74 @@ +use java.io.File +declare File restBridgeFile! +declare File directory! +declare File adapterProgram! +declare BBjAdmin admin! +declare BBjJettyContextConfiguration contextConf! +declare BBjJettyServerConfiguration serverconfig! +declare BBjspServletConfiguration bridgeConf! + +user! = "" +password! = "" + +if (user! = "") then + if (password! = "") then + M=MSGBOX("No Username and Password set.") + bye + else + M=MSGBOX("No Username set.") + bye + endif +else + if (password! = "") then + M=MSGBOX("No Password and Password set.") + bye + endif +endif + +contextName! = "[[CONTEXTNAME]]" +bridgeName! = "[[BRIDGENAME]]" +configFilePath! = "[[CONFIGFILEPATH]]" +timeOut! = "[[TIMEOUT]]" +workingDirectory! = "[[WORKINGDIRECTORYPATH]]" +authPgm! = "[[AUTHPROGRAMPATH]]" +prefix! = "[[PREFIX]]" +suffix! = "[[SUFFIX]]" +useGetAllowedFilters! = [[USEGETALLOWEDFILTERS]] +requestLogPath! = "[[REQUESTLOGPATH]]" +inputHandler! = "[[INPUTHANDLER]]" +outputHandler! = "[[OUTPUTHANDLER]]" +adapterTerm! = "[[ADAPTERTERM]]" +charset! = "[[CHARSET]]" + +admin! = BBjAPI().getAdmin(user!,password!) + +serverConfig! = admin!.getJettyServerConfig() +directory! = new File(dsk("") + dir("")) + +REM Creating a new Context with default DocBase and a WelcomeFile +contextConf! = serverConfig!.createCustomContext(contextName!) +contextConf!.setDocBase("$basis_home/htdocs") +contextConf!.addWelcomeFile("index.html") +contextConf!.setPath("/" + contextName!) + +serverConfig!.saveConfig() + +restBridgeFile! = new File(directory!.getParentFile(),"RestBridge.bbj") + +bridgeConf! = contextConf!.addBBjspServlet("RestBridge",bridgeName!,restBridgeFile!.getAbsolutePath()) +bridgeConf!.setConfig(configFilePath!) + +adapterProgram! = new File(directory!.getParentFile(),"RestBCAdapter.bbj") + +REM Here you can add Parameter to your Bridge. +bridgeConf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) +bridgeConf!.addParam("REST_ADAPTERTERM", "IO") +bridgeConf!.addParam("REST_TIMEOUT",timeOut!) +bridgeConf!.addParam("REST_WD",workingDirectory!) +bridgeConf!.addParam("REST_AUTHPGM",authpgm!) +bridgeConf!.addParam("REST_PGM_PREFIX",prefix!) +bridgeConf!.addParam("REST_PGM_SUFFIX",suffix!) +bridgeConf!.addParam("USE_GET_ALLOWED_FILTER",useGetAllowedFilter!) +bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!) + +serverConfig!.saveConfig() \ No newline at end of file diff --git a/cfg/RestBridge.arc b/cfg/RestBridge.arc new file mode 100644 index 0000000..591ed5d --- /dev/null +++ b/cfg/RestBridge.arc @@ -0,0 +1,281 @@ +//#charset: windows-1252 + +VERSION "4.0" + +WINDOW 101 "REST Endpoint Configuration" 200 200 800 464 +BEGIN + EVENTMASK 0 + KEYBOARDNAVIGATION + NOT MAXIMIZABLE + NAME "Window101" + NOT SIZABLE + STATICTEXT 100, "Mapping:", 375, 25, 115, 25 + BEGIN + NAME "Static Text100" + NOT WORDWRAP + END + + INPUTE 102, "", 500, 20, 150, 25 + BEGIN + NAME "inpeMapping" + PADCHARACTER 32 + NOT TABTRAVERSABLE + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 103, "Timeout:", 375, 55, 115, 25 + BEGIN + NAME "Static Text103" + NOT WORDWRAP + END + + INPUTN 104, "", 500, 50, 150, 25 + BEGIN + GROUP + NAME "inpnTimeout" + RESTORESTRING "0" + NOT DRAGENABLED + NOT INSERTMODE + END + + STATICTEXT 105, "Program Prefix:", 375, 85, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 106, "", 500, 80, 150, 25 + BEGIN + GROUP + NAME "inpeProgramPrefix" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 107, "Program Suffix:", 375, 115, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 108, "", 500, 110, 150, 25 + BEGIN + GROUP + NAME "inpeProgramSuffix" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 109, "Adapter Term: ", 375, 175, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 110, "", 500, 170, 150, 25 + BEGIN + GROUP + NAME "inpeAdapterTerm" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + STATICTEXT 111, "Default Charset:", 375, 145, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + LISTEDIT 112, "", 500, 140, 150, 150 + BEGIN + NAME "leDefaultCharset" + SELECTIONHEIGHT 25 + SPELLCHECKED + NOT DRAGENABLED + END + + CHECKBOX 113, "Use getAllowedFilters() if applicable", 376, 200, 200, 25 + BEGIN + GROUP + NAME "chbUseGetAllowedFilters" + END + + STATICTEXT 114, "Config File:", 375, 235, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 115, "", 500, 230, 241, 25 + BEGIN + GROUP + NAME "inpeConfigFile" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 116, "...", 750, 231, 30, 25 + BEGIN + GROUP + NAME "btnBrowseConfigFile" + END + + STATICTEXT 117, "Working Directory:", 375, 265, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 118, "", 500, 260, 241, 25 + BEGIN + GROUP + NAME "inpeWorkingDirectory" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 119, "...", 750, 261, 30, 25 + BEGIN + GROUP + NAME "btnBrowseWorkingDirectory" + END + + STATICTEXT 120, "Auth Program:", 375, 295, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 121, "", 500, 290, 241, 25 + BEGIN + GROUP + NAME "inpeAuthProgram" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 122, "...", 750, 291, 30, 25 + BEGIN + GROUP + NAME "btnBrowseAuthenticationFile" + END + + STATICTEXT 123, "Request Log:", 375, 325, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 124, "", 500, 320, 241, 25 + BEGIN + GROUP + NAME "inpeRequestLog" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 125, "...", 750, 321, 30, 25 + BEGIN + GROUP + NAME "btnBrowseRequestLogFile" + END + + STATICTEXT 126, "Input Handler:", 375, 355, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 127, "", 500, 350, 241, 25 + BEGIN + GROUP + NAME "inpeInputHandler" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 128, "...", 750, 351, 30, 25 + BEGIN + GROUP + NAME "btnBrowseInputHandler" + END + + STATICTEXT 129, "Output Handler:", 375, 385, 115, 25 + BEGIN + NAME "Static Text105" + NOT WORDWRAP + END + + INPUTE 130, "", 500, 380, 241, 25 + BEGIN + GROUP + NAME "inpeOutputHandler" + PADCHARACTER 32 + SPELLCHECKED + NOT DRAGENABLED + END + + BUTTON 131, "...", 750, 381, 30, 25 + BEGIN + GROUP + NAME "btnBrowseOutputHandler" + END + + BUTTON 132, "Add Context", 20, 430, 100, 25 + BEGIN + GROUP + NAME "btnAddContext" + END + + BUTTON 133, "Add Endpoint", 130, 430, 100, 25 + BEGIN + GROUP + NAME "btnAddBridge" + END + + BUTTON 134, "Remove Endpoint", 240, 430, 100, 25 + BEGIN + GROUP + NAME "btnRemoveBridge" + END + + BUTTON 135, "Cancel", 460, 430, 100, 25 + BEGIN + GROUP + NAME "btnCancel" + END + + BUTTON 136, "Save", 570, 430, 100, 25 + BEGIN + GROUP + NAME "btnSave" + END + + BUTTON 137, "OK", 680, 430, 100, 25 + BEGIN + GROUP + NAME "btnOK" + END + + BUTTON 138, "Preview Code", 680, 20, 100, 25 + BEGIN + GROUP + NAME "btnPreviewCode" + END + + TREE 139, 20, 20, 320, 385 + BEGIN + NAME "treeContext" + END + +END + From 71b9ac0bd781bf179cc1da458c28842a921fdb65 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 12 Nov 2021 12:57:18 +0100 Subject: [PATCH 6/9] Now closing scanner after preview --- cfg/RestBridgeConfigurationWindow.bbj | 1 + 1 file changed, 1 insertion(+) diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index f3c1848..0fdbd86 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -670,6 +670,7 @@ class public RestBridgeConfigurationWindow while(scan!.hasNextLine()) string! = string! + scan!.nextLine() + System.getProperty("line.separator") wend + scan!.close() declare SimpleConstantsResolver scr! scr! = new SimpleConstantsResolver() From 97bd6d308a2ec16b520958d1b64a952aa2a3e05b Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 12 Nov 2021 13:00:15 +0100 Subject: [PATCH 7/9] Removed spellcheck property from Inputs --- cfg/RestBridge.arc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/cfg/RestBridge.arc b/cfg/RestBridge.arc index 591ed5d..121293e 100644 --- a/cfg/RestBridge.arc +++ b/cfg/RestBridge.arc @@ -20,7 +20,6 @@ BEGIN NAME "inpeMapping" PADCHARACTER 32 NOT TABTRAVERSABLE - SPELLCHECKED NOT DRAGENABLED END @@ -50,7 +49,6 @@ BEGIN GROUP NAME "inpeProgramPrefix" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -65,7 +63,6 @@ BEGIN GROUP NAME "inpeProgramSuffix" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -80,7 +77,6 @@ BEGIN GROUP NAME "inpeAdapterTerm" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -94,7 +90,6 @@ BEGIN BEGIN NAME "leDefaultCharset" SELECTIONHEIGHT 25 - SPELLCHECKED NOT DRAGENABLED END @@ -115,7 +110,6 @@ BEGIN GROUP NAME "inpeConfigFile" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -136,7 +130,6 @@ BEGIN GROUP NAME "inpeWorkingDirectory" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -157,7 +150,6 @@ BEGIN GROUP NAME "inpeAuthProgram" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -178,7 +170,6 @@ BEGIN GROUP NAME "inpeRequestLog" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -199,7 +190,6 @@ BEGIN GROUP NAME "inpeInputHandler" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -220,7 +210,6 @@ BEGIN GROUP NAME "inpeOutputHandler" PADCHARACTER 32 - SPELLCHECKED NOT DRAGENABLED END @@ -277,5 +266,4 @@ BEGIN NAME "treeContext" END -END - +END \ No newline at end of file From 5af0d181bd6221aa704a9dee356add3f9a891fa2 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 12 Nov 2021 16:12:21 +0100 Subject: [PATCH 8/9] Change requests mentioned in #41 --- cfg/ConfigFile.txt | 60 +++++++++++++++++++++++---- cfg/RestBridgeConfigurationWindow.bbj | 16 +++---- 2 files changed, 60 insertions(+), 16 deletions(-) diff --git a/cfg/ConfigFile.txt b/cfg/ConfigFile.txt index 651dbe5..900d650 100644 --- a/cfg/ConfigFile.txt +++ b/cfg/ConfigFile.txt @@ -61,14 +61,56 @@ bridgeConf!.setConfig(configFilePath!) adapterProgram! = new File(directory!.getParentFile(),"RestBCAdapter.bbj") REM Here you can add Parameter to your Bridge. -bridgeConf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) -bridgeConf!.addParam("REST_ADAPTERTERM", "IO") -bridgeConf!.addParam("REST_TIMEOUT",timeOut!) -bridgeConf!.addParam("REST_WD",workingDirectory!) -bridgeConf!.addParam("REST_AUTHPGM",authpgm!) -bridgeConf!.addParam("REST_PGM_PREFIX",prefix!) -bridgeConf!.addParam("REST_PGM_SUFFIX",suffix!) -bridgeConf!.addParam("USE_GET_ALLOWED_FILTER",useGetAllowedFilter!) -bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!) +if !timeOut!.trim().isEmpty() then + bridgeConf!.addParam("REST_TIMEOUT",timeOut!.trim()) +endif + +if !workingDirectory!.trim().isEmpty() then + bridgeConf!.addParam("REST_WD",workingDirectory!.trim()) +endif + +if !authpgm!.trim().isEmpty() then + bridgeConf!.addParam("REST_AUTHPGM",authpgm!) +endif + +if !prefix!.trim().isEmpty() then + bridgeConf!.addParam("REST_PGM_PREFIX",prefix!) +endif + +if !suffix!.trim().isEmpty() then + bridgeConf!.addParam("REST_PGM_SUFFIX",suffix!) +endif + +if !useGetAllowedFilter!.trim().isEmpty() then + bridgeConf!.addParam("USE_GET_ALLOWED_FILTER",useGetAllowedFilter!) +endif + +if !requestLogPath!.trim().isEmpty() then + bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!.trim()) +endif + +if !requestLogPath!.trim().isEmpty() then + bridgeConf!.addParam("REST_REQUESTLOG",requestLogPath!.trim()) +endif + +if !inputHandler!.trim().isEmpty() then + bridgeConf!.addParam("REST_REQUESTLOG",inputHandler!.trim()) +endif + +if !outputHandler!.trim().isEmpty() then + bridgeConf!.addParam("REST_REQUESTLOG",outputHandler!.trim()) +endif + +if !adapterTerm!.trim().isEmpty() then + bridgeConf!.addParam("REST_ADAPTERTERM", adapterTerm!.trim()) +endif + +if !charset!.trim().isEmpty then + bridgeConf!.addParam("REST_DEFAULT_CHARSET", charset!.trim()) +endif + +if adapterProgram!.exists() then + bridgeConf!.addParam("REST_ADAPTERPGM", adapterProgram!.getAbsolutePath()) +endif serverConfig!.saveConfig() \ No newline at end of file diff --git a/cfg/RestBridgeConfigurationWindow.bbj b/cfg/RestBridgeConfigurationWindow.bbj index c452ff1..c354a9a 100644 --- a/cfg/RestBridgeConfigurationWindow.bbj +++ b/cfg/RestBridgeConfigurationWindow.bbj @@ -678,16 +678,16 @@ class public RestBridgeConfigurationWindow scr! = new SimpleConstantsResolver() scr!.put("CONTEXTNAME", #selected!.getName()) scr!.put("BRIDGENAME", #selectedBridge!.getMapping()) - scr!.put("CONFIGFILEPATH", #getConfigFilePath()) + scr!.put("CONFIGFILEPATH", #getConfigFilePath().replace("\", "\\")) scr!.put("TIMEOUT",str(#getTimeout())) - scr!.put("WORKINGDIRECTORYPATH", #getWorkingDirectoryPath()) - scr!.put("AUTHPROGRAMPATH",#getAuthProgramPath()) + scr!.put("WORKINGDIRECTORYPATH", #getWorkingDirectoryPath().replace("\", "\\")) + scr!.put("AUTHPROGRAMPATH",#getAuthProgramPath().replace("\", "\\")) scr!.put("PREFIX", #getProgramPrefix()) scr!.put("SUFFIX", #getProgramSuffix()) scr!.put("USEGETALLOWEDFILTERS", str(#useGetAllowedFilters())) - scr!.put("REQUESTLOGPATH", #getRequestLogPath()) - scr!.put("INPUTHANDLER", #getInputHandler()) - scr!.put("OUTPUTHANDLER", #getOutputHandler()) + scr!.put("REQUESTLOGPATH", #getRequestLogPath().replace("\", "\\")) + scr!.put("INPUTHANDLER", #getInputHandler().replace("\", "\\")) + scr!.put("OUTPUTHANDLER", #getOutputHandler().replace("\", "\\")) scr!.put("ADAPTERTERM", #getAdapterTerm()) scr!.put("CHARSET", #getCharset()) @@ -715,7 +715,7 @@ class public RestBridgeConfigurationWindow rem * Saves the Code as an actual Config to run. rem */ method public void onClickSaveAs(BBjButtonPushEvent e!) - FILE_NAME$=FILESAVE("Save File As...",DIR(""),"Restconfig","bbj") + FILE_NAME!=FILESAVE("Save File As...",DIR(""),"Restconfig","bbj") declare File file! file! = new File(FILE_NAME!) @@ -728,6 +728,8 @@ class public RestBridgeConfigurationWindow fw!.close() M=MSGBOX("Save successfull. admin! und user! have to be set before launching the Code!") + methodret + Error: M=MSGBOX("Error occured. File couldn't be saved to " + FILE_NAME!.replace("Restconfig.bbj", "")) methodend From 7aa2b3ac78ee4b1aa3a106da1e28aaa5bfbe2126 Mon Sep 17 00:00:00 2001 From: Christopher Kochaneck Date: Fri, 12 Nov 2021 17:00:36 +0100 Subject: [PATCH 9/9] Fixed Tab Control Order --- cfg/RestBridge.arc | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cfg/RestBridge.arc b/cfg/RestBridge.arc index 121293e..6de34a8 100644 --- a/cfg/RestBridge.arc +++ b/cfg/RestBridge.arc @@ -58,7 +58,7 @@ BEGIN NOT WORDWRAP END - INPUTE 108, "", 500, 110, 150, 25 + INPUTE 108, "", 500, 111, 150, 25 BEGIN GROUP NAME "inpeProgramSuffix" @@ -66,30 +66,30 @@ BEGIN NOT DRAGENABLED END - STATICTEXT 109, "Adapter Term: ", 375, 175, 115, 25 + STATICTEXT 109, "Default Charset:", 375, 145, 115, 25 BEGIN NAME "Static Text105" NOT WORDWRAP END - INPUTE 110, "", 500, 170, 150, 25 + LISTEDIT 110, "", 500, 140, 150, 150 BEGIN - GROUP - NAME "inpeAdapterTerm" - PADCHARACTER 32 + NAME "leDefaultCharset" + SELECTIONHEIGHT 25 NOT DRAGENABLED END - STATICTEXT 111, "Default Charset:", 375, 145, 115, 25 + STATICTEXT 111, "Adapter Term: ", 375, 175, 115, 25 BEGIN NAME "Static Text105" NOT WORDWRAP END - LISTEDIT 112, "", 500, 140, 150, 150 + INPUTE 112, "", 500, 170, 150, 25 BEGIN - NAME "leDefaultCharset" - SELECTIONHEIGHT 25 + GROUP + NAME "inpeAdapterTerm" + PADCHARACTER 32 NOT DRAGENABLED END @@ -266,4 +266,5 @@ BEGIN NAME "treeContext" END -END \ No newline at end of file +END +