Show TOC

Procedure documentationDefining Destinations Locate this document in the navigation structure

 

The first step defines destination names and properties.

Note Note

For this example the destination configuration is stored in a file that is called by the program. In practice you should avoid this for security reasons.

End of the note.

Procedure

Syntax Syntax

Defining Destinations

  1. public class StepByStepClient
  2. {
  3.     static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";
  4.     static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL";
  5.     static
  6.     {
  7.         Properties connectProperties = new Properties();
  8.         connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "ls4065");
  9.         connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,  "85");
  10.         connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
  11.         connectProperties.setProperty(DestinationDataProvider.JCO_USER,   "homofarber");
  12.         connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "laska");
  13.         connectProperties.setProperty(DestinationDataProvider.JCO_LANG,   "en");
  14.         createDestinationDataFile(DESTINATION_NAME1, connectProperties);
  15.         connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
  16.         connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT,    "10");
  17.         createDestinationDataFile(DESTINATION_NAME2, connectProperties);
  18.         
  19.     }
  20.     
  21.     static void createDestinationDataFile(String destinationName, Properties connectProperties)
  22.     {
  23.         File destCfg = new File(destinationName+".jcoDestination");
  24.         try
  25.         {
  26.             FileOutputStream fos = new FileOutputStream(destCfg, false);
  27.             connectProperties.store(fos, "for tests only !");
  28.             fos.close();
  29.         }
  30.         catch (Exception e)
  31.         {
  32.             throw new RuntimeException("Unable to create the destination files", e);
  33.         }
  34.     }
End of the code.