Destination definieren
In einem ersten Schritt werden Destinationsnamen und –eigenschaften definiert.

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.
Destination definieren
public class StepByStepClient { static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL"; static String DESTINATION_NAME2 = "ABAP_AS_WITH_POOL"; static { Properties connectProperties = new Properties(); connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "ls4065"); connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "85"); connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800"); connectProperties.setProperty(DestinationDataProvider.JCO_USER, "homofarber"); connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "laska"); connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en"); createDestinationDataFile(DESTINATION_NAME1, connectProperties);
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3"); connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10"); createDestinationDataFile(DESTINATION_NAME2, connectProperties);
}
static void createDestinationDataFile(String destinationName, Properties connectProperties) { File destCfg = new File(destinationName+".jcoDestination"); try { FileOutputStream fos = new FileOutputStream(destCfg, false); connectProperties.store(fos, "for tests only !"); fos.close(); } catch (Exception e) { throw new RuntimeException("Unable to create the destination files", e); } } |