JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Importing an SNA Custom Handshake Class     Java CAPS Documentation
search filter icon
search icon

Document Information

Importing an SNA Custom Handshake Class

Adding a Custom Handshake Class to a Project

Configuring the Adapter for a Custom Handshake Class

To Configure the Adapter

Importing a Custom Handshake Class into a Project

To Import a Custom Handshake Class

Sample Handshake Class

Implementing an SNA Custom Handshake Class

Sample Code for Inbound Mode

Sample Code for Outbound Mode

Adding a Custom Handshake Class to a Project

To use a custom handshake class with the SNA Adapter, you need to configure the Adapter by specifying the class name. You also need to import the file into the SNA Project, and if you are using it in a Java Collaboration Definition, you need to import it into the Collaboration as well.

Perform the following steps to use a custom handshake class:

Before you perform these steps, create the custom class and make it available to the NetBeans IDE.

Configuring the Adapter for a Custom Handshake Class

In order for the SNA Adapter to know which custom handshake class to use, you need to specify the class name in the Adapter properties of the Connectivity map.

To Configure the Adapter

  1. In the NetBeans IDE, expand the Project containing the SNA Adapter until the Connectivity Map is visible.
  2. Open the Connectivity Map in the Connectivity Map Editor.
  3. To import the custom handshake class for the inbound Adapter, double-click the inbound SNA Adapter icon.
    image:Inbound Connectivity Map

    The SNA Adapter Properties Editor appears, displaying the default properties for the inbound Adapter.


    image:Inbound Connectivity Map Properties
  4. Edit the Custom Handshake Class Name property in the Properties Editor and click OK.

    For the sample code provided with the Adapter, enter com.stc.connector.snalu62.api.SNACustomerHandshakeImplSampleAccept.

  5. To import the custom handshake class for the outbound Adapter, double-click the outbound SNA Adapter icon.
    image:Outbound Connectivity Map

    The SNA Adapter Properties Editor appears, displaying the default properties for the outbound Adapter.


    image:Outbound Connectivity Map Properties
  6. Edit the Custom Handshake Class Name property in the Properties Editor and click OK.

    For the sample code provided with the Adapter, enter com.stc.connector.snalu62.api.SNACustomerHandshakeImplSampleInitialize.

  7. Redeploy your project.

Importing a Custom Handshake Class into a Project

In order to use a custom class in a Project and a Java Collaboration Definition (JCD), you need to package the class into a JAR file and then import the file into both the Project and the JCD.

To Import a Custom Handshake Class

  1. Prepare a JAR file that includes your built class.
  2. From the NetBeans Projects window, right-click the sample Project and select Import > File.

    The Import Files window appears.


    image:Importing Files Window
  3. Navigate to the JAR file and click Select.

    The selected JAR file appears in the Selected Import Files pane at the bottom of the Import Files window.

  4. Click Import.

    The selected JAR file appears in the Project tree under the project you selected.

  5. Do the following to import the file into a JCD:
    1. Open the JCD in the Collaboration Editor.
    2. In the Collaboration Editor toolbar, click the Import JAR file icon.
      image:Importing JAR File – Collaboration

      The Add/Remove JAR Files window appears.


      image:Add/Remove JAR Files
    3. Click Add, navigate to and select the JAR file, and then click Import.

      The selected JAR file appears in the Imported JAR Files pane.

    4. Click Close on the Add/Remove JAR Files window.

      The selected JAR file appears under the JCD in the Projects window.


    Note - If you make any changes to the class, repeat the previous steps.


Sample Handshake Class

The Java Collaboration can handle the SNA connection completely using the default class that is provided with the Adapter, com.stc.connector.snalu62.api.SNACustomerHandshakeImplSampleDummy. This class has been implemented in the SNA Adapter. The sample code for this custom class is shown below:

package com.stc.connector.snalu62.api;

import com.stc.connector.logging.LogFactory;
import com.stc.connector.logging.Logger;
import com.stc.connector.snalu62.exception.SNAApplicationException;

/**
 * This is a sample class to implement the interface SNACustomerHandshake.
 * It implements a dummy handshake. That is, the method startConversation()
 does not perform a function.
 * No SNA conversation is established inside this implementation class.
You should establish the SNA conversation manually
(e.g. in the java Collaboration).
*/

public class SNACustomerHandshakeImplSampleDummy implements SNACustomerHandshake {
    public static final String version = "cvs $Revision: 1.1.2.2 $   
$Date: 2005/11/10 21:40:15 $";
    private Logger logger = LogFactory.getLogger
("STC.eWay.SNALU62." + getClass().getName());

    /**
     * Constructor
     *
     */
    public SNACustomerHandshakeImplSampleDummy() {
        super();
    }

    /**
     * @see com.stc.connector.snalu62.api.SNACustomerHandshake#startConversation
(com.stc.connector.snalu62.api.SNACPICCalls)
     */
    public void startConversation(SNACPICCalls cpic) throws SNAApplicationException {
        logger.info("SNACustomerHandshakeImplSampleDummy.startConversation():
Done nothing here.");

    }

}