GetInputPera return null when declare outside ExecuteBusinessLogic : How to Solve It

1
0
-1

i m creating one custom connector . in this connector i want to use method calling structure. but when i declare variables with get parameter it always return null. i have to declare parameter into ExecutebusinessLogic() but that can't be reference outside that method . so i want to publicly define variable i tried different , but still same : null return . pl do something

code :

  1. package org.mycompany.connector;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bonitasoft.engine.connector.AbstractConnector;
  6. import org.bonitasoft.engine.connector.ConnectorException;
  7. import org.bonitasoft.engine.connector.ConnectorValidationException;
  8.  
  9. public class Log_TestImpl extends AbstractConnector {
  10.  
  11. Logger logger = Logger.getLogger("org.bonitasoft");
  12. private Logger LOGGER = Logger.getLogger(this.getClass().getName());
  13. protected final static String IP1_INPUT_PARAMETER = "ip1";
  14. protected final static String IP2_INPUT_PARAMETER = "ip2";
  15. protected final static String IP3_INPUT_PARAMETER = "ip3";
  16. String s1 = (String) getInputParameter(IP1_INPUT_PARAMETER);
  17. String s2 = (String) getInputParameter(IP2_INPUT_PARAMETER);
  18. String s3 = (String) getInputParameter(IP3_INPUT_PARAMETER);
  19.  
  20. @Override
  21. public void validateInputParameters() throws ConnectorValidationException {
  22. try {
  23. getInputParameter(IP1_INPUT_PARAMETER);
  24. } catch (ClassCastException cce) {
  25. throw new ConnectorValidationException("ip1 type is invalid");
  26. }
  27. try {
  28. getInputParameter(IP2_INPUT_PARAMETER);
  29.  
  30. } catch (ClassCastException cce) {
  31. throw new ConnectorValidationException("ip2 type is invalid");
  32. }
  33. try {
  34. getInputParameter(IP3_INPUT_PARAMETER);
  35. } catch (ClassCastException cce) {
  36. throw new ConnectorValidationException("ip3 type is invalid");
  37. }
  38.  
  39. }
  40.  
  41. @Override
  42. protected void executeBusinessLogic() throws ConnectorException {
  43. // Get access to the connector input parameters
  44. // getIp1();
  45. // getIp2();
  46. // getIp3();
  47.  
  48. logger.severe("THIS IS FROM WITH OUT ABSTRACT ");
  49. logger.severe(s1);
  50. logger.severe(s2);
  51. logger.severe(s3);
  52.  
  53. // TODO execute your business logic here
  54.  
  55. // WARNING : Set the output of the connector execution. If outputs are
  56. // not set, connector fails
  57. try {
  58. validateInputParameters();
  59. } catch (ConnectorValidationException e) {
  60. // TODO Auto-generated catch block
  61. e.printStackTrace();
  62. }
  63. logger.severe("CALLING LOG PERA");
  64. logInputParameters();
  65. logger.severe("BACK TO ORGINAL CLASS IT DONE ");
  66. }
  67.  
  68. private void logInputParameters() {
  69. logInputParameter(IP1_INPUT_PARAMETER);
  70. logInputParameter(IP2_INPUT_PARAMETER);
  71. logInputParameter(IP3_INPUT_PARAMETER);
  72.  
  73. }
  74.  
  75. private void logInputParameter(String parameterName) {
  76. LOGGER.severe(parameterName + " "
  77. + String.valueOf(getInputParameter(parameterName)));
  78. }
  79.  
  80. @Override
  81. public void connect() throws ConnectorException {
  82. // [Optional] Open a connection to remote server
  83.  
  84. }
  85.  
  86. @Override
  87. public void disconnect() throws ConnectorException {
  88. // [Optional] Close connection to remote server
  89.  
  90. }
  91.  
  92. }
No answers yet.
Notifications