public class DDMConnection extends HostServerConnection
DDMRead
for an example of using DDM.HostServerConnection.HostInputStream, HostServerConnection.HostOutputStream
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_DDM_SERVER_PORT |
static int |
DEFAULT_SSL_DDM_SERVER_PORT |
in_, out_
Modifier and Type | Method and Description |
---|---|
Message[] |
close(DDMFile file)
Closes the specified file and returns any messages that were issued.
|
java.util.List<Message> |
closeReturnMessageList(DDMFile file) |
void |
deleteCurrent(DDMFile file)
Removes the current record from the file.
|
Message[] |
execute(java.lang.String command)
Executes the specified CL command within the DDM host server job.
|
java.util.List<Message> |
executeReturnMessageList(java.lang.String command) |
static DDMConnection |
getConnection(boolean isSSL,
java.lang.String system,
java.lang.String user,
java.lang.String password)
Establishes a new socket connection to the specified system and authenticates the specified user and password.
|
static DDMConnection |
getConnection(boolean isSSL,
SystemInfo info,
java.lang.String user,
java.lang.String password)
Establishes a new socket connection to the specified system and authenticates the specified user and password.
|
static DDMConnection |
getConnection(boolean isSSL,
SystemInfo info,
java.lang.String user,
java.lang.String password,
int ddmPort)
Establishes a new socket connection to the specified system and port, and authenticates the specified user and password.
|
static DDMConnection |
getConnection(java.lang.String system,
java.lang.String user,
java.lang.String password)
Establishes a new socket connection to the specified system and authenticates the specified user and password.
|
static DDMConnection |
getConnection(SystemInfo info,
java.lang.String user,
java.lang.String password)
Establishes a new socket connection to the specified system and authenticates the specified user and password.
|
static DDMConnection |
getConnection(SystemInfo info,
java.lang.String user,
java.lang.String password,
int ddmPort)
Establishes a new socket connection to the specified system and port, and authenticates the specified user and password.
|
java.util.List<DDMFileMemberDescription> |
getFileMemberDescriptions(DDMFile file)
Retrieves the member descriptions for the specified file.
|
java.util.List<DDMFileMemberDescription> |
getFileMemberDescriptions(java.lang.String library,
java.lang.String file)
Retrieves the member descriptions for the specified file.
|
DDMRecordFormat |
getRecordFormat(DDMFile file)
Retrieves the record format of the specified file.
|
DDMRecordFormat |
getRecordFormat(java.lang.String library,
java.lang.String file)
Retrieves the record format of the specified file.
|
DDMFile |
open(java.lang.String library,
java.lang.String file,
java.lang.String member,
java.lang.String recordFormat)
Opens the specified file for sequential read-only access and a preferred batch size of 100.
|
DDMFile |
open(java.lang.String library,
java.lang.String file,
java.lang.String member,
java.lang.String recordFormat,
int readWriteType,
boolean keyed,
int preferredBatchSize,
int numBuffers)
Opens the specified file for reading or writing records.
|
void |
position(DDMFile file,
DDMReadCallback listener,
int recordNumber)
Positions the cursor to the specified record number.
|
void |
positionAfterLast(DDMFile file)
Positions the cursor to the end of the file (after the last record).
|
void |
positionBeforeFirst(DDMFile file)
Positions the cursor to the beginning of the file (before the first record).
|
void |
positionToFirst(DDMFile file)
Positions the cursor to the first record in the file.
|
void |
positionToKeyEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Positions the file cursor to the record whose key is equal to the specified key.
|
void |
positionToKeyGreater(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Positions the file cursor to the record whose key is greater than the specified key.
|
void |
positionToKeyGreaterOrEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Positions the file cursor to the record whose key is greater than or equal to the specified key.
|
void |
positionToKeyLess(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Positions the file cursor to the record whose key is less than the specified key.
|
void |
positionToKeyLessOrEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Positions the file cursor to the record whose key is less than or equal to the specified key.
|
void |
positionToLast(DDMFile file)
Positions the cursor to the last record in the file.
|
void |
positionToNext(DDMFile file,
DDMReadCallback listener)
Positions the cursor to the next record in the file.
|
void |
positionToPrevious(DDMFile file,
DDMReadCallback listener)
Positions the cursor to the previous record in the file.
|
void |
read(DDMFile file,
DDMReadCallback listener,
int recordNumber)
Reads the record with the specified record number from the file.
|
void |
readCurrent(DDMFile file,
DDMReadCallback listener)
Reads the current record from the specified file and positions the cursor on or after it.
|
void |
readFirst(DDMFile file,
DDMReadCallback listener)
Reads the first record from the specified file and positions the cursor on or after it.
|
void |
readKeyEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Reads the next record whose key is equal to the specified key.
|
void |
readKeyGreater(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Reads the next record whose key is greater than the specified key.
|
void |
readKeyGreaterOrEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Reads the next record whose key is greater than or equal to the specified key.
|
void |
readKeyLess(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Reads the next record whose key is less than the specified key.
|
void |
readKeyLessOrEqual(DDMFile file,
DDMReadCallback listener,
byte[] key,
int numberOfKeyFields)
Reads the next record whose key is less than or equal to the specified key.
|
void |
readLast(DDMFile file,
DDMReadCallback listener)
Reads the last record from the specified file and positions the cursor on or after it.
|
void |
readNext(DDMFile file,
DDMReadCallback listener)
Reads the next record from the specified file and positions the cursor on or after it.
|
void |
readPrevious(DDMFile file,
DDMReadCallback listener)
Reads the previous record from the specified file and positions the cursor on or before it.
|
protected void |
sendEndJobRequest()
No-op.
|
void |
updateCurrent(DDMFile file,
byte[] data,
int offset,
boolean[] nullFieldValues)
Updates the current record with the specified data.
|
void |
updateCurrent(DDMFile file,
DDMWriteCallback listener)
Updates the current record with the first record provided by the callback.
|
void |
write(DDMFile file,
byte[] data,
int offset,
boolean[] nullFieldValues,
DDMReadCallback listener)
Writes a single record to the end of the file.
|
void |
write(DDMFile file,
DDMWriteCallback listener)
Writes records provided by the callback to the file.
|
close, connect, finalize, getBytesReceived, getBytesSent, getEncryptedPassword, getInfo, getJobName, getUser, isClosed, isDatastreamDebug, isDefaultDatastreamDebug, setDatastreamDebug, setDefaultDatastreamDebug, writePadEBCDIC, writePadEBCDIC10, writeStringToUnicodeBytes
public static final int DEFAULT_DDM_SERVER_PORT
public static final int DEFAULT_SSL_DDM_SERVER_PORT
protected void sendEndJobRequest() throws java.io.IOException
sendEndJobRequest
in class HostServerConnection
java.io.IOException
public static DDMConnection getConnection(java.lang.String system, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static DDMConnection getConnection(boolean isSSL, java.lang.String system, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static DDMConnection getConnection(SystemInfo info, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static DDMConnection getConnection(boolean isSSL, SystemInfo info, java.lang.String user, java.lang.String password) throws java.io.IOException
java.io.IOException
public static DDMConnection getConnection(SystemInfo info, java.lang.String user, java.lang.String password, int ddmPort) throws java.io.IOException
java.io.IOException
public static DDMConnection getConnection(boolean isSSL, SystemInfo info, java.lang.String user, java.lang.String password, int ddmPort) throws java.io.IOException
java.io.IOException
public Message[] close(DDMFile file) throws java.io.IOException
java.io.IOException
public java.util.List<Message> closeReturnMessageList(DDMFile file) throws java.io.IOException
java.io.IOException
public DDMFile open(java.lang.String library, java.lang.String file, java.lang.String member, java.lang.String recordFormat) throws java.io.IOException
library
- The name of the library in which the file resides. For example, "QSYS".file
- The name of the physical or logical file.member
- The member within the file. This can be a special value such as "*FIRST".recordFormat
- The name of the record format. This value can also be obtained from DDMRecordFormat.getName()
.java.io.IOException
public DDMFile open(java.lang.String library, java.lang.String file, java.lang.String member, java.lang.String recordFormat, int readWriteType, boolean keyed, int preferredBatchSize, int numBuffers) throws java.io.IOException
library
- The name of the library in which the file resides. For example, "QSYS".file
- The name of the physical or logical file.member
- The member within the file. This can be a special value such as "*FIRST".recordFormat
- The name of the record format. This value can also be obtained from DDMRecordFormat.getName()
.readWriteType
- The read-write access type to use. Allowed values are:
keyed
- Indicates if the file should be opened for sequential or keyed access.preferredBatchSize
- The number of records to read or write at a time. This is a preferred number because the DDMConnection
may decide to use a different batch size depending on circumstances (e.g. READ_WRITE files always use a batch size of 1).numBuffers
- The number of data buffers to allocate for use when reading new records. The DDMConnection will round-robin
through the data buffers as it calls DDMReadCallback.newRecord()
. This can be useful
for multi-threaded readers that process new record data, such as DDMThreadedReader
. In such cases,
each processing thread could be assigned a specific data buffer, to avoid contention. See DDMDataBuffer
.java.io.IOException
public java.util.List<DDMFileMemberDescription> getFileMemberDescriptions(java.lang.String library, java.lang.String file) throws java.io.IOException
java.io.IOException
public java.util.List<DDMFileMemberDescription> getFileMemberDescriptions(DDMFile file) throws java.io.IOException
java.io.IOException
public DDMRecordFormat getRecordFormat(java.lang.String library, java.lang.String file) throws java.io.IOException
java.io.IOException
public DDMRecordFormat getRecordFormat(DDMFile file) throws java.io.IOException
java.io.IOException
public void read(DDMFile file, DDMReadCallback listener, int recordNumber) throws java.io.IOException
java.io.IOException
public void readKeyEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void readKeyGreater(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void readKeyGreaterOrEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void readKeyLess(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void readKeyLessOrEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void positionToKeyEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void positionToKeyGreater(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void positionToKeyGreaterOrEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void positionToKeyLess(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void positionToKeyLessOrEqual(DDMFile file, DDMReadCallback listener, byte[] key, int numberOfKeyFields) throws java.io.IOException
java.io.IOException
public void readNext(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void readPrevious(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void readFirst(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void readLast(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void readCurrent(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void positionToNext(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void positionToPrevious(DDMFile file, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void positionToFirst(DDMFile file) throws java.io.IOException
java.io.IOException
public void positionToLast(DDMFile file) throws java.io.IOException
java.io.IOException
public void positionAfterLast(DDMFile file) throws java.io.IOException
java.io.IOException
public void positionBeforeFirst(DDMFile file) throws java.io.IOException
java.io.IOException
public void position(DDMFile file, DDMReadCallback listener, int recordNumber) throws java.io.IOException
java.io.IOException
public void write(DDMFile file, byte[] data, int offset, boolean[] nullFieldValues, DDMReadCallback listener) throws java.io.IOException
java.io.IOException
public void write(DDMFile file, DDMWriteCallback listener) throws java.io.IOException
java.io.IOException
public void updateCurrent(DDMFile file, byte[] data, int offset, boolean[] nullFieldValues) throws java.io.IOException
java.io.IOException
public void updateCurrent(DDMFile file, DDMWriteCallback listener) throws java.io.IOException
java.io.IOException
public Message[] execute(java.lang.String command) throws java.io.IOException
java.io.IOException
public java.util.List<Message> executeReturnMessageList(java.lang.String command) throws java.io.IOException
java.io.IOException
public void deleteCurrent(DDMFile file) throws java.io.IOException
java.io.IOException