com.ibm.vap.ctgadapter
Class CTGAdapter

java.lang.Object
  |
  +--com.ibm.vap.generic.ServerAdapter
        |
        +--com.ibm.vap.ctgadapter.CTGAdapter

public class CTGAdapter
extends com.ibm.vap.generic.ServerAdapter

This server adapter class is used by the VisualAge Pacbase Runtime to communicate with the server using CTG connectors through CICS Transaction Gateway.

The JavaGateway is the object that represents the logic connection between a client program and a CICS Transaction Gateway. You need one instance for each CTG you want to communicate with. Then you will need to instantiate a CTGAdapter class, setup its properties and set it as the current proxy adapter.

Sample code :

	// Instantiate the JavaGateway class
	com.ibm.ctg.client.JavaGateway gateway = new com.ibm.ctg.client.JavaGateway();
	gateway.setURL("tcp://9.101.41.177:2006");

	try {
		// Instantiate an Adpater class and setup paramters.
		com.ibm.vap.ctgadapter.CTGAdapter ctgAdapter = new com.ibm.vap.ctgadapter.CTGAdapter(gateway);
		ctgAdapter.setCallType(com.ibm.ctg.client.ECIRequest.ECI_SYNC_TPN);
		ctgAdapter.setCommareaLength(8192);
		ctgAdapter.setExtendMode(com.ibm.ctg.client.ECIRequest.ECI_NO_EXTEND);
		ctgAdapter.setLuwToken(0);
		ctgAdapter.setPassword("USERPWD");
		ctgAdapter.setProgram("CLECIN  ");
		ctgAdapter.setServer("CICSSTMV");
		ctgAdapter.setTransid("VEC1");
		ctgAdapter.setUserid("USERID");
		ctgAdapter.setHostCodePage("Cp1147");

		// Instantiate a Vap Proxy and set the adapter class
		com.ibm.vap.generated.proxies.CustomerProxyLv proxy = new com.ibm.vap.generated.proxies.CustomerProxyLv();
		proxy.setServerAdapter(ctgAdapter);
		proxy.selectInstances();

		// Disconnect the JavaGateway when it isn't needed anymore
		gateway.close();
		return proxy.rows();
	} catch (com.ibm.vap.generic.CommunicationError ce) {
		return ce.getMessage();
	} catch (com.ibm.vap.generic.SystemError se) {
		return se.getMessage();
	}
 

Since:
2.5v11
See Also:
ServerAdapter

Constructor Summary
CTGAdapter()
          Default constructor.
CTGAdapter(com.ibm.vap.ctgadapter.JavaGateway gateway)
          Full constructor.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 void disconnect()
          Frees resources used for the communication by this server adapter (connections, buffers, etc).
 int getCallType()
          Retrieves the callType attribut.
 int getCommareaLength()
          Retrieves the commarea length property.
 short getECITimeOut()
          Retrieves the Timeout property.
 int getExtendMode()
          Retrieves the extended mode property.
 java.lang.String getHostCodePage()
          Retrieves the host code page property.
 com.ibm.vap.ctgadapter.JavaGateway getJavaGateway()
          Retrieves the javaGateway instance.
 int getLuwToken()
          Retrieves the luwToken property.
 int getMessageQualifier()
          Retrieves the message qualifier property.
 java.lang.String getPassword()
          Retrieves the password property.
 java.lang.String getProgram()
          Retrieves the program property.
 java.lang.Object getProperty(java.lang.String name)
          Returns the communication parameter for the specified String name.
 java.lang.String getServer()
          Retrieves the server property.
 java.lang.String getTransid()
          Retrieves the transid property.
 java.lang.String getUserid()
          Retrieves the userid property.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
           
 com.ibm.vap.generic.Requester requireRequester()
          Returns an instance of requester associated to this server adapter, and open the javaGateway.
 void setCallType(int newValue)
          Sets the call type property.
 void setCommareaLength(int newValue)
          Sets the Commarea length property.
 void setECITimeout(short newValue)
          Sets the timeout property.
 void setExtendMode(int newValue)
          Sets the extend mode property.
 void setHostCodePage(java.lang.String newValue)
          Sets the host code page property.
 void setJavaGateway(com.ibm.vap.ctgadapter.JavaGateway newValue)
          Sets the javaGateway instance.
 void setLuwToken(int newValue)
          Sets the luwToken mode property.
 void setMessageQualifier(int newValue)
          Sets the message qualifier property.
 void setPassword(java.lang.String newValue)
          Sets the password property.
 void setProgram(java.lang.String newValue)
          Sets the program property.
 void setProperty(java.lang.String name, java.lang.Object newValue)
          Sets a communication parameter of specified name.
 void setServer(java.lang.String newValue)
          Sets the server property.
 void setTransid(java.lang.String newValue)
          Sets the transid property.
 void setUserid(java.lang.String newValue)
          Sets the user property.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CTGAdapter

public CTGAdapter()
Default constructor.

CTGAdapter

public CTGAdapter(com.ibm.vap.ctgadapter.JavaGateway gateway)
Full constructor.
Parameters:
gateway - com.ibm.ctg.client.JavaGateway
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

disconnect

public void disconnect()
Frees resources used for the communication by this server adapter (connections, buffers, etc). The JavaGateway isn't closed here because it's a multithreaded object that can be used by another adapter, so we let the user process the JavaGateway disconnection.
Overrides:
disconnect in class com.ibm.vap.generic.ServerAdapter

getCallType

public int getCallType()
Retrieves the callType attribut.
Returns:
the ECI call type

getCommareaLength

public int getCommareaLength()
Retrieves the commarea length property.
Returns:
the COMMAREA length to transmit to the CICS program

getECITimeOut

public short getECITimeOut()
Retrieves the Timeout property.
Returns:
the ECI timeout.

getExtendMode

public int getExtendMode()
Retrieves the extended mode property.
Returns:
the ECI Extend_Mode

getHostCodePage

public java.lang.String getHostCodePage()
Retrieves the host code page property.
Returns:
the value of the host encoding page code

getJavaGateway

public com.ibm.vap.ctgadapter.JavaGateway getJavaGateway()
Retrieves the javaGateway instance.
Returns:
com.ibm.ctg.clientJavaGateway instance used to communicate with the server

getLuwToken

public int getLuwToken()
Retrieves the luwToken property.
Returns:
the LUW Token identifier

getMessageQualifier

public int getMessageQualifier()
Retrieves the message qualifier property.
Returns:
the message Id set by the user

getPassword

public java.lang.String getPassword()
Retrieves the password property.
Returns:
String : the password value.

getProgram

public java.lang.String getProgram()
Retrieves the program property.
Returns:
String : the program name

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns the communication parameter for the specified String name.
Overrides:
getProperty in class com.ibm.vap.generic.ServerAdapter
Parameters:
name - the property name
Returns:
the property value

getServer

public java.lang.String getServer()
Retrieves the server property.
Returns:
String : the server name

getTransid

public java.lang.String getTransid()
Retrieves the transid property.
Returns:
String the transaction ID that must be used by the CICS program

getUserid

public java.lang.String getUserid()
Retrieves the userid property.
Returns:
the user Id for CICS

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)

requireRequester

public com.ibm.vap.generic.Requester requireRequester()
                                               throws com.ibm.vap.generic.CommunicationError
Returns an instance of requester associated to this server adapter, and open the javaGateway. The returned requester is initialized using the properties set in this server adapter.
Overrides:
requireRequester in class com.ibm.vap.generic.ServerAdapter
Returns:
a requester which can be used to send/receive requests
Throws:
com.ibm.vap.generic.CommunicationError - if the CTGRequester can't be instantiate

setCallType

public void setCallType(int newValue)
                 throws com.ibm.vap.generic.CommunicationError
Sets the call type property.
Parameters:
ECI - call type
Throws:
com.ibm.vap.generic.CommunicationError - if the calltype is not a SYNC type

setCommareaLength

public void setCommareaLength(int newValue)
Sets the Commarea length property.
Parameters:
the - COMMAREA length that will be send to the server

setECITimeout

public void setECITimeout(short newValue)
Sets the timeout property.
Parameters:
the - ECI Timeout value

setExtendMode

public void setExtendMode(int newValue)
Sets the extend mode property.
Parameters:
the - ECI Extend_Mode

setHostCodePage

public void setHostCodePage(java.lang.String newValue)
Sets the host code page property.
Parameters:
the - code page of the host server

setJavaGateway

public void setJavaGateway(com.ibm.vap.ctgadapter.JavaGateway newValue)
Sets the javaGateway instance.
Parameters:
instance - of JavaGateway that must be used to communicate with the server

setLuwToken

public void setLuwToken(int newValue)
Sets the luwToken mode property.
Parameters:
the - LUW Token identifier

setMessageQualifier

public void setMessageQualifier(int newValue)
Sets the message qualifier property.
Parameters:
the - message Id

setPassword

public void setPassword(java.lang.String newValue)
Sets the password property.
Parameters:
the - password for the CICS user Id

setProgram

public void setProgram(java.lang.String newValue)
Sets the program property.
Parameters:
the - CICS program name

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object newValue)
Sets a communication parameter of specified name.
Overrides:
setProperty in class com.ibm.vap.generic.ServerAdapter
Parameters:
name - the property name
newValue - the property value

setServer

public void setServer(java.lang.String newValue)
Sets the server property.
Parameters:
the - server name

setTransid

public void setTransid(java.lang.String newValue)
Sets the transid property.
Parameters:
the - transaction ID that must be used by the CICS program

setUserid

public void setUserid(java.lang.String newValue)
Sets the user property.
Parameters:
the - user Id for CICS


Licensed Materials - Property of IBM - 5655-F37 - (C) Copyright IBM Corp. 1983, 2003. All Rights Reserved.
IBM, VisualAge and Pacbase are trademarks of International Business Machines Corporation registered in the United States, other countries, or both.
Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States,other countries, or both.
Other company, product or service names may be the trademarks or service marks of others.