Appendix C. Source code for Flght400 user programs and script files on OS/400 423
The SampleExit.java file
Example C-6 shows the source code of the SampleExit class.
Example: C-6 Source of SampleExit
/*
* Created on Mar 11, 2005
*
* This sample program demonstrates how to create a wrapper.
* Based on your knowledge of your application,
* use this code as an example to develop a custom wrapper.
*/
package com.ibm.flght400;
import com.ibm.jsdt.support.SupportOS400Base;
import com.ibm.jsdt.support.SupportOS400Helper;
/**
* This is a sample class, created as part of the Redbook example.
*/
public class SampleExit extends SupportOS400Base {
public SampleExit() {
}
/**
* This method starts the WebFacing server on iSeries using the
* invokeCLCommand method in SampleCommands class
*/
private int startWFserver() {
int rc = 0;
SupportOS400Helper ivHelper = (SupportOS400Helper)getHelper();
SampleCommands clHandler = new SampleCommands(this, ivHelper);
String command = "STRTCPSVR SERVER(*WEBFACING)";
//Invoke the command
rc = clHandler.invokeCLCommand(command, true);
if (rc != 0) {
// log an error if not successful
setMessage(getResourceString(SampleNLSkeys.START_WEBFACINGSERVER_FAIL));
ivHelper.log(this);
}
return 0;
}
public static void main(String[] args) {
SampleExit sampleExit = new SampleExit();
int rc = sampleExit.startWFserver();
System.exit(rc);
}
}

Get IBM Express Runtime V2.1 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.