CICS® Transaction Gateway Base API Programming Reference v8.1.0.2

com.ibm.ctg.client
Class Channel

java.lang.Object
  extended by com.ibm.ctg.client.Channel

public class Channel
extends java.lang.Object

A Channel is a named collection of Container objects that can be passed to a CICS program. A Channel can be sent on an ECI request by calling ECIRequest.setChannel.


Constructor Summary
Channel(java.lang.String channelName)
          Creates a new empty Channel with the specified name.
 
Method Summary
 void addContainer(Container container)
          Adds the provided container to the channel.
 Container copyContainer(java.lang.String containerName, Channel sourceChannel)
          Copy a container from another channel
 Container copyContainer(java.lang.String containerName, Channel sourceChannel, java.lang.String newContainerName)
          Copy a container from another channel
 Container createContainer(java.lang.String containerName, byte[] data)
          Creates a container to hold binary data within the channel.
 Container createContainer(java.lang.String containerName, byte[] data, int CCSID)
          Creates a container to hold character data within the channel.
 Container createContainer(java.lang.String containerName, byte[] data, java.lang.String encoding)
          Creates a container to hold character data within the channel.
 Container createContainer(java.lang.String containerName, java.lang.String data)
          Creates a container to hold character data within the channel.
 Container createContainer(java.lang.String containerName, java.lang.String data, java.lang.String encoding)
          Deprecated.  
 void deleteContainer(java.lang.String name)
          Deletes the container from the channel.
 int getCCSID()
          Returns the default CCSID associated with the channel
 java.lang.String getCodePage()
          Returns the default code page associated with the channel
 Container getContainer(java.lang.String name)
          This method will examine the current containers within this channel looking for a container with the name supplied.
 java.util.Set<java.lang.String> getContainerNames()
          Gets a collection containing the names of all the containers in the channel.
 java.util.Collection<Container> getContainers()
          Get a collection of all of the containers held within the channel
 java.lang.String getName()
          Returns the name of the channel
 Container moveContainer(java.lang.String containerName, Channel sourceChannel)
          Move a container from another channel
 Container moveContainer(java.lang.String containerName, Channel sourceChannel, java.lang.String newContainerName)
          Move a container from another channel
 void setCCSID(int ccsid)
          Sets the CCSID of the channel
 java.lang.String toString()
          Returns a string representation of the channel.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Channel

public Channel(java.lang.String channelName)
        throws ChannelException
Creates a new empty Channel with the specified name.

The Channel name must be between 1 and 16 characters in length and must consist of only the following types of character:

Channel names are case sensitive.

Parameters:
channelName - Unique name for this channel
Throws:
ChannelNameException - if the channel name includes invalid characters or is null
ChannelException
Method Detail

createContainer

public Container createContainer(java.lang.String containerName,
                                 byte[] data)
                          throws ContainerException
Creates a container to hold binary data within the channel.

The contents of the container will be set to the data supplied. Data within this container will not be considered for codepage conversion. The data will be transferred to the CICS application exactly as supplied.

The container name must be between 1 and 16 characters in length and must consist of only the following types of character:

Container names are case sensitive.

Parameters:
containerName - name for this container to be referenced by
data - data to be placed in the container referenced by containerName
Throws:
ContainerException - if the container name includes invalid characters or is null, or a container with the same name already exists in this channel

createContainer

@Deprecated
public Container createContainer(java.lang.String containerName,
                                            java.lang.String data,
                                            java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException,
                                 ContainerException
Deprecated. 

This method has been deprecated and any call to use it will result in an UnsupportedOperationException being thrown to the application. The method createContainer(String containerName, byte[] data, String encoding) should be used instead.

Throws:
java.io.UnsupportedEncodingException
ContainerException

createContainer

public Container createContainer(java.lang.String containerName,
                                 byte[] data,
                                 java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException,
                                 ContainerException
Creates a container to hold character data within the channel.

The contents of the container will be set to the data supplied.

The container name must be between 1 and 16 characters in length and must consist of only the following types of character:

Container names are case sensitive.

Parameters:
containerName - name for this container to be referenced by
data - byte data to be placed in the container referenced by containerName
encoding - the codepage of the character data supplied
Throws:
ContainerException - if the container name includes invalid characters or is null, or a container with the same name already exists in this channel
java.io.UnsupportedEncodingException - if the encoding is not supported

createContainer

public Container createContainer(java.lang.String containerName,
                                 java.lang.String data)
                          throws java.io.UnsupportedEncodingException,
                                 ContainerException
Creates a container to hold character data within the channel.

The contents of the container will be set to the String data supplied.

Data within this container will be converted to the appropriate codepage specified in the CICS application. The container will inherit the CCSID of the channel.

The container name must be between 1 and 16 characters in length and must consist of only the following types of character:

Container names are case sensitive.

Parameters:
containerName - name for this container to be referenced by
data - String data to be placed in the container referenced by containerName
Throws:
ContainerException - if the container name includes invalid characters or is null, or a container with the same name already exists in this channel
java.io.UnsupportedEncodingException - if the CCSID of the channel is not supported

createContainer

public Container createContainer(java.lang.String containerName,
                                 byte[] data,
                                 int CCSID)
                          throws java.io.UnsupportedEncodingException,
                                 ContainerException
Creates a container to hold character data within the channel.

The contents of the container will be set to the data supplied.

The container name must be between 1 and 16 characters in length and must consist of only the following types of character:

Container names are case sensitive.

Parameters:
containerName - name for this container to be referenced by
data - byte[] data to be placed in the container referenced by containerName
CCSID - the CCSID of the character data supplied
Throws:
ContainerException - if the container name includes invalid characters or is null, or a container with the same name already exists in this channel
java.io.UnsupportedEncodingException - if the CCSID is not supported

copyContainer

public Container copyContainer(java.lang.String containerName,
                               Channel sourceChannel)
                        throws ContainerException
Copy a container from another channel

Copy a container from sourceChannel into this channel. The container containerName will be copied to this channel.

Parameters:
containerName - the container name to be copied
sourceChannel - reference to the channel that holds the container
Returns:
Container reference to the container copied.
Throws:
ContainerException - if the container is not found in sourceChannel or a container with the same name already exists in this channel

copyContainer

public Container copyContainer(java.lang.String containerName,
                               Channel sourceChannel,
                               java.lang.String newContainerName)
                        throws ContainerException
Copy a container from another channel

Copy a container from sourceChannel into this channel. The container containerName will be copied to this channel with a new name newContainerName

Parameters:
containerName - the container name to be copied
sourceChannel - reference to the channel that holds the container
newContainerName - new container name within this channel
Returns:
Container reference to the container copied.
Throws:
ContainerException - if the container is not found in sourceChannel, the new container name includes invalid characters or is null, or a container with the same name already exists in this channel

moveContainer

public Container moveContainer(java.lang.String containerName,
                               Channel sourceChannel)
                        throws ContainerException
Move a container from another channel

Move a container from sourceChannel into this channel. The container will no longer exist in sourceChannel. The container containerName will be moved to this channel.

Parameters:
containerName - the container name to be moved
sourceChannel - reference to the channel that holds the container
Returns:
Container reference to the container moved.
Throws:
ContainerException - if the container is not found in sourceChannel or a container with the same name already exists in this channel

moveContainer

public Container moveContainer(java.lang.String containerName,
                               Channel sourceChannel,
                               java.lang.String newContainerName)
                        throws ContainerException
Move a container from another channel

Move a container from sourceChannel into this channel. The container will no longer exist in sourceChannel. The container containerName will be moved to this channel with a new name newContainerName

Parameters:
containerName - the container name to be moved
sourceChannel - reference to the channel that holds the container
newContainerName - new container name within this channel
Returns:
Container reference to the container moved.
Throws:
ContainerException - if the container is not found in sourceChannel, the new container name includes invalid characters or is null, or a container with the same name already exists in this channel

getContainer

public Container getContainer(java.lang.String name)
                       throws ContainerNotFoundException
This method will examine the current containers within this channel looking for a container with the name supplied.

If a container with a matching name is found then a reference to that container is returned.

Parameters:
name - the container name to find
Returns:
Container reference to the container name
Throws:
ContainerNotFoundException - if the container name is not found

getContainers

public java.util.Collection<Container> getContainers()
Get a collection of all of the containers held within the channel

Returns:
Collection of Container objects

deleteContainer

public void deleteContainer(java.lang.String name)
                     throws ContainerException
Deletes the container from the channel.

Parameters:
name - name of the container to delete
Throws:
ContainerException - if the container name is not found

addContainer

public void addContainer(Container container)
                  throws ContainerException,
                         ContainerExistsException
Adds the provided container to the channel.

Parameters:
container - The container to add to the channel
Throws:
ContainerException - If the container is not of the correct type
ContainerExistsException - if a container with the same name already exists in this channel

getContainerNames

public java.util.Set<java.lang.String> getContainerNames()
Gets a collection containing the names of all the containers in the channel.

Returns:
Collection of container names

toString

public java.lang.String toString()
Returns a string representation of the channel.

Overrides:
toString in class java.lang.Object
Returns:
A description of the channel

getName

public java.lang.String getName()
Returns the name of the channel

Returns:
The name of the channel

getCCSID

public int getCCSID()
Returns the default CCSID associated with the channel

Returns:
The default CCSID associated with the channel

getCodePage

public java.lang.String getCodePage()
Returns the default code page associated with the channel

Returns:
The default code page associated with the channel

setCCSID

public void setCCSID(int ccsid)
Sets the CCSID of the channel

Parameters:
ccsid - The CCSID this channel should set as its default.

©Copyright IBM Corp. 1994, 2012
Legal