Show TOC

Dokumentation zur VorgehensweiseDestination definieren Dieses Dokument in der Navigationsstruktur finden

 

In einem ersten Schritt werden Destinationsnamen und -eigenschaften definiert.

Hinweis Hinweis

Für dieses Beispiel wird die Destinationskonfiguration in einer Datei abgelegt, die durch das Programm aufgerufen wird. Dies sollte in der Praxis aus Sicherheitsgründen vermieden werden.

Ende des Hinweises.

Vorgehensweise

Syntax Syntax

Destination definieren

  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.     }
Ende des Codes