File Generator Connector

1
0
-1

hello , I create one custom connector for generate PDFs file after task completed . for initial test i dnt take any input for this when i execute process connector not executed pro pare it goes to failed stage . how can i recover and how can i show error .

Pl see following detail :

  1. in Connector defination : no input , no output
  2. Connector implementation : following code which just create simple pdf file .
  1. /**
  2.  *
  3.  */
  4. package org.mycompany.connector;
  5.  
  6. import org.bonitasoft.engine.connector.ConnectorException;
  7. import com.itextpdf.text.Document;
  8. import com.itextpdf.text.Paragraph;
  9. import com.itextpdf.text.pdf.PdfWriter;
  10. import java.io.FileOutputStream;
  11.  
  12.  
  13. public class GeneratePDFImpl extends AbstractGeneratePDFImpl {
  14.  
  15.  
  16.  
  17. Document document = new Document();
  18.  
  19. @Override
  20. protected void executeBusinessLogic() throws ConnectorException{
  21. try{
  22. PdfWriter.getInstance(document, new FileOutputStream("ThisisTest.pdf"));
  23. document.add(new Paragraph("A Hello World PDF document."));
  24. }
  25. catch(Exception e)
  26. {
  27. throw new ConnectorException(e);
  28. }
  29. }
  30.  
  31. @Override
  32. public void connect() throws ConnectorException{
  33. document.open();
  34.  
  35. }
  36.  
  37. @Override
  38. public void disconnect() throws ConnectorException{
  39. document.close();
  40. }
  41.  
  42. }

Comments

Submitted by matthieu.chaffotte on Tue, 04/22/2014 - 11:31

Do you get a stacktrace in the engine logs?

Submitted by kppatel on Tue, 04/22/2014 - 11:35

I don't know how to get , severlogs .

1 answer

1
0
-1

Hi,

for error recovering of a connector execution, you need to use the Subscription version.

Are you sure that the "ThisisTest.pdf" file is the jar of the connector? Are yoiu sure that you can call .open() on a Document that created without parameter?

The logs are available in engine logs: Help--> SHow engine logs.

Regards,

Notifications