Preview only show first 10 pages with watermark. For full document please download

Novell Extend Composer 5 . 2

   EMBED


Share

Transcript

Novell exteNd Composer www.novell.com 5.2 TELNET CONNECT USER’S GUIDE Legal Notices Copyright © 2004 Novell, Inc. All rights reserved. No part of this publication may be reproduced, photocopied, stored on a retrieval system, or transmitted without the express written consent of the publisher. This manual, and any portion thereof, may not be copied without the express written permission of Novell, Inc. Novell, Inc. makes no representations or warranties with respect to the contents or use of this documentation, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to revise this publication and to make changes to its content, at any time, without obligation to notify any person or entity of such revisions or changes. Further, Novell, Inc. makes no representations or warranties with respect to any software, and specifically disclaims any express or implied warranties of merchantability or fitness for any particular purpose. Further, Novell, Inc. reserves the right to makes changes to any and all parts of Novell software, at any time, without any obligation to notify any person or entity of such changes. This product may require export authorization from the U.S. Department of Commerce prior to exporting from the U.S. or Canada. Copyright ©1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved. SilverStream software products are copyrighted and all rights are reserved by SilverStream Software, LLC Title to the Software and its documentation, and patents, copyrights and all other property rights applicable thereto, shall at all times remain solely and exclusively with SilverStream and its licensors, and you shall not take any action inconsistent with such title. The Software is protected by copyright laws and international treaty provisions. You shall not remove any copyright notices or other proprietary notices from the Software or its documentation, and you must reproduce such notices on all copies or extracts of the Software or its documentation. You do not acquire any rights of ownership in the Software. Patent pending. Novell, Inc. 404 Wyman Street, Suite 500 Waltham, MA 02451 U.S.A. www.novell.com exteNd Composer Telnet Conect User’s Guide June 2004 Online Documentation: To access the online documemntation for this and other Novell products, and to get updates, see www.novell.com/documentation. Novell Trademarks ConsoleOne is a registered trademark of Novell, Inc. eDirectory is a trademark of Novell, Inc. GroupWise is a registered trademark of Novell, Inc. exteNd is a trademark of Novell, Inc. exteNd Composer is a trademark of Novell, Inc. exteNd Director is a trademark of Novell, Inc. iChain is a registered trademark of Novell, Inc. jBroker is a trademark of Novell, Inc. NetWare is a registered trademark of Novell, Inc. Novell is a registered trademark of Novell, Inc. Novell eGuide is a trademark of Novell, Inc. SilverStream Trademarks SilverStream is a registered trademark of SilverStream Software, LLC. Third-Party Trademarks All third-party trademarks are the property of their respective owners. Third-Party Software Legal Notices The Apache Software License, Version 1.1 Copyright (c) 2000 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [email protected]. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. JDOM.JAR Copyright (C) 2000-2002 Brett McLaughlin & Jason Hunter. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the disclaimer that follows these conditions in the documentation and/or other materials provided with the distribution. 3. The name "JDOM" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact [email protected]. 4. Products derived from this software may not be called "JDOM", nor may "JDOM" appear in their name, without prior written permission from the JDOM Project Management ([email protected]). In addition, we request (but do not require) that you include in the end-user documentation provided with the redistribution and/or in the software itself an acknowledgement equivalent to the following: "This product includes software developed by the JDOM Project (http://www.jdom.org/)." Alternatively, the acknowledgment may be graphical using the logos available at http://www.jdom.org/images/logos. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Sun Sun Microsystems, Inc. Sun, Sun Microsystems, the Sun Logo Sun, the Sun logo, Sun Microsystems, JavaBeans, Enterprise JavaBeans, JavaServer Pages, Java Naming and Directory Interface, JDK, JDBC, Java, HotJava, HotJava Views, Visual Java, Solaris, NEO, Joe, Netra, NFS, ONC, ONC+, OpenWindows, PC-NFS, SNM, SunNet Manager, Solaris sunburst design, Solstice, SunCore, SolarNet, SunWeb, Sun Workstation, The Network Is The Computer, ToolTalk, Ultra, Ultracomputing, Ultraserver, Where The Network Is Going, SunWorkShop, XView, Java WorkShop, the Java Coffee Cup logo, Visual Java, and NetBeans are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Indiana University Extreme! Lab Software License Version 1.1.1 Copyright (c) 2002 Extreme! Lab, Indiana University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Indiana University Extreme! Lab (http://www.extreme.indiana.edu/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Indiana University" and "Indiana University Extreme! Lab" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact http://www.extreme.indiana.edu/. 5. Products derived from this software may not use "Indiana University" name nor may "Indiana University" appear in their name, without prior written permission of the Indiana University. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, COPYRIGHT HOLDERS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Phaos This Software is derived in part from the SSLavaTM Toolkit, which is Copyright ©1996-1998 by Phaos Technology Corporation. All Rights Reserved. Customer is prohibited from accessing the functionality of the Phaos software. W3C W3C® SOFTWARE NOTICE AND LICENSE This work (and included software, documentation such as READMEs, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions. Permission to copy, modify, and distribute this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications: 1.The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2.Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body of any redistributed or derivative code. 3. Notice of any changes or modifications to the files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. Contents About This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1 Welcome to exteNd Composer and Telnet User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Before You Begin. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 About exteNd Composer Connects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 What Is Telnet? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 What is the Telnet Connect? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 About exteNd Composer's Telnet Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 What Applications Can You Build Using the Telnet User Interface Component Editor? . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Getting Started with the Telnet Component Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating a Telnet Connection Resource . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Connection Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Constant and Expression Driven Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Code Page Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Creating XML Templates for Your Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 13 13 13 16 16 3 Creating a Telnet Component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Before Creating a Telnet Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Telnet Component Editor Window. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Telnet Native Environment Pane. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Telnet Keyboard Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Screen Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . What it is . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How it works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Telnet-Specific Menu Bar Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Component Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Telnet-Specific Context-Menu Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Native Environment Pane Context Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Action Pane Context Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Telnet-Specific Buttons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 17 19 19 20 22 22 22 22 22 23 23 24 24 4 Performing Telnet Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Actions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About Telnet-Specific Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Check Screen Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The Send Buffer Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Send Buffer Action and Record Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . How Keys Are Displayed in the Action Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Telnet-Specific Expression Builder Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Screen Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Screen Selections in the Telnet Connect. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting Continuous Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting Rectangular Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . About the Sample Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Recording a Telnet Session. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Looping Over Multiple Rows in Search of Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 27 27 28 30 31 32 32 32 32 35 35 35 36 37 37 42 5 Editing a Previously Recorded Action Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Changing an Existing Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Adding A New Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 About Adding Alias Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 Deleting an Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Testing your Telnet Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 Using the Animation Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 Tips for Building Reliable Telnet Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Using Other Actions in the Telnet Component Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Handling Errors and Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Finding a “Bad” Action . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 5 Advanced Telnet Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Data Sets that Span Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Dealing with Redundant Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 An Example of Looping over Multiple Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Performance Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 6 Logon Components, Connections, and Connection Pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 About Telnet Session Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 When Will I Need Logon Components? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Connection Pool Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 The Logon Connection’s Role in Pooling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 How Many Pools Do I Need? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Pieces Required for Pooling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 How Do I Implement Pooling? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 The Telnet Logon Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Logon, Keep Alive, and Logoff Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Logon Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 Keep Alive Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 Logoff Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Logon Component Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 About the Telnet Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Connection Pooling with a Single Sign-On. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Creating a Connection Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Creating a Basic Telnet Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Creating a Logon Component. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Creating a Logon Connection using a Pool Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Creating a Logon Connection using a Session Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Creating a Telnet Component That Uses Pooled Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Managing Pools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Connection Pool Management and Deployed Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Connection Discard Behavior. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Screen Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 A Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 B Telnet Keyboard Equivalents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 C Telnet Display Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 D Reserved Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 E Java Code Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 About Encodings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 6 Telnet Connect User’s Guide About This Book Purpose The guide describes how to use exteNd Composer Telnet Connect, referred to as the Telnet Component Editor. The Telnet Component Editor is a separately-installed component editor in exteNd Composer. Audience The audience for the guide is developers and system integrators using exteNd Composer to create services and components which integrate Telnet applications. Prerequisites The guide assumes the reader is familiar with and has used exteNd Composer’s development environment and deployment options. You must also have an understanding of the Telnet environment and building or using applications utilizing Telnet or VT-series terminals (e.g. VT100). Additional documentation For the complete set of Novell exteNd Composer documentation, see the Novell Documentation Web Site (http://www.novell.com/documentation-index/index.jsp). Organization The guide is organized as follows: Chapter 1, Welcome to exteNd Composer and Telnet User Interface, gives a definition and overview of the Telnet Component Editor. Chapter 2, Getting Started with the Telnet Component Editor, describes the necessary preparations for creating a Telnet component. Chapter 3, Creating a Telnet Component, describes the parts of the component editor. Chapter 4, Performing Telnet Actions, describes how to use the basic Telnet actions, as well as the unique drag-and-drop conventions of Telnet Connect. Chapter 5, Advanced Telnet Actions, discusses techniques for solving common Telnet computing problems in the context of an Action Model. Chapter 6, Logon Components, Connections, and Connection Pools, describes how to enhance performance through use of shared connections. Appendix A, is a glossary. Appendix B, Telnet Keyboard Equivalents, recognized and /or used by Telnet Connect. Appendix C, Telnet Display Attributes, and their display significance along with a discussion of how to use the getattribute( ). Appendix D, Reserved Words, lists those words used only for Telnet Connect. Appendix E, Java Code Pages, provides information about character encoding conversions. 7 Conventions Used in the Guide The guide uses the following typographical conventions. Bold typeface within instructions indicate action items, including: ‹ ‹ ‹ Menu selections Form selections Dialog box items Sans-serif bold typeface is used for: ‹ ‹ ‹ Uniform Resource Identifiers File names Directories and partial pathnames Italic typeface indicates: ‹ ‹ ‹ Variable information that you supply Technical terms used for the first time Title of other Novell publications Monospaced typeface indicates: ‹ ‹ ‹ ‹ 8 Method names Code examples System input Operating system objects Telnet Connect User’s Guide 1 Welcome to exteNd Composer and Telnet User Interface Before You Begin Welcome to the Telnet Connect Guide. This Guide is a companion to the exteNd Composer User's Guide, which details how to use all the features of exteNd Composer, except for the Connect Component Editors. If you haven't looked at the Composer User's Guide yet, please familiarize yourself with it before using this Guide. exteNd Composer provides separate Component Editors for each Connect. The special features of each component editor are described in separate Guides like this one. If you have been using exteNd Composer, and are familiar with the XML Map Component Editor, then this Guide should get you started with the Telnet Component Editor. Before you can begin working with the Telnet Connect you must have installed it into your existing exteNd Composer. Likewise, before you can run any Services built with this Connect in the exteNd Composer Enterprise Server environment, you must have already installed the server-side software for this Connect into Composer Enterprise Server. NOTE: To be successful with this Component Editor, you must be familiar with the Telnet environment and the particular applications that you want to XML-enable. About exteNd Composer Connects exteNd Composer is built upon a simple hub and spoke architecture (Fig.1-1). The hub is a robust XML transformation engine that accepts requests via XML documents, performs transformation processes on those documents and interfaces with XML-enabled applications, and returns an XML response document. The spokes, or Connects, are plug-in modules that "XML-enable" sources of data that are not XML aware, bringing their data into the hub for processing as XML. These data sources can be anything from legacy COBOL/applications to Message Queues to HTML pages. Welcome to exteNd Composer and Telnet User Interface 9 Figure 1-1 exteNd Composer Connects can be categorized by the integration strategy each one employs to XMLenable an information source. The integration strategies are a reflection of the major divisions used in modern systems designs for Internet-based computing architectures. Depending on your B2B needs and the architecture of your legacy applications, exteNd Composer can integrate your business systems at the User Interface, Program Logic, or Data levels. (See below.) What Is Telnet? Telnet is a specification (RFC 854) for a communications protocol. The term Telnet refers to a generic TCP/IP protocol for emulating a terminal on ANSI standard systems. Many applications for UNIX and VAX/VMS (as well as others) were developed for terminal based systems. These systems allow remote execution of their interface through the Telnet TCP/IP protocol. Telnet allows this by mimicking the terminal in that it sends screens to a client and accepts keyed data from the client. This interaction, through a so-called “dumb” terminal, means that all the data is processed on the host computer. Telnet terminal emulation software can be used to make a microcomputer or PC act as if it were a Telnet-type terminal while it is communicating with a host computer. 10 Telnet Connect User’s Guide What is the Telnet Connect? The Telnet Connect XML-enables VT-series and ANSI Terminal based systems using the User Interface integration strategy by hooking into the Telnet Terminal Stream. Using the Telnet Connect, you can make legacy applications and their business logic available to the internet, extranet, or intranet processes. You can navigate through an application as if you were at a terminal session, use XML documents to drive inquiries and updates into the screens rather than keying, use the messages returned from application screens to make the same decisions as if you were at a terminal, and move data and responses into XML documents that can be returned to the requestor or continue to be processed. The Telnet screens appear in the Native Environment Pane of the Telnet Component Editor. About exteNd Composer's Telnet Component Much like the XML Map component, the Telnet Component is designed to map, transform, and transfer data between two different XML templates (i.e., request and response XML documents). However, it is specialized to make a connection (via Telnet) to a host application, process the data using elements from a screen, and then map the results to an output DOM. You can then act upon the output DOM in any way that makes sense for your integration application. In essence, you're able to capture data from, or push data to, a host system without ever having to alter the host system itself. A Telnet Component can perform simple data manipulations, such as mapping and transferring data from an XML document into a host program, or perform "screen scraping" of a Telnet program, putting the harvested data into an XML document. A Telnet Component has all the functionality of the XML Map Component and can process XSL, send mail, and post and receive XML documents using the HTTP protocol. What Applications Can You Build Using the Telnet User Interface Component Editor? The Telnet User Interface Component Editor allows you to extend any XML integration you are building to include any of your business applications that support Telnet-based terminal interactions (See the exteNd Composer User's Guide for more information.) For example, you may have an application that retrieves a product's description, picture, price, and inventory from regularly updated databases and displays it in a Web browser. By using the Telnet Component Editor, you can now get the current product information from the operational systems and the static information (e.g., a picture) from a database and merge the information from these separate information sources before displaying it to a user. This provides the same current information to both your internal and external users. Welcome to exteNd Composer and Telnet User Interface 11 12 Telnet Connect User’s Guide 2 Getting Started with the Telnet Component Editor While there are many ways to go about creating Telnet Components, the most commonly used steps in creating a simple Telnet Component are as follows: ‹ ‹ ‹ ‹ ‹ ‹ ‹ Create XML Template(s) for the program. Create a Connection Resource. Create a Telnet Component. Enter Record mode and navigate to the program using terminal emulation available via the component editor’s Native Environment Pane. Drag and drop input-document data into the screen as needed. Drag and drop screen results into the output document. Stop recording. In this chapter, we’ll focus on creating and a configuring a Telnet Connection Resource, which is an essential first step in being able to use Telnet Components. Creating a Telnet Connection Resource Before you can create a Telnet Component, you need to create a Connection Resource to access the host program. If you try to create a Telnet Component in the absence of any available Connection Resources, a dialog will appear, asking if you wish to create a Connection Resource. By answering Yes to this dialog, you will be taken to the appropriate wizard. About Connection Resources When you create a Connection Resource for the Telnet Component, you will use a live Telnet Connection to connect to a host environment of your choice. After setting up your Connection Resource, it will be available for use by any number of Telnet Components that might require a connection to the host in question. About Constant and Expression Driven Connections You can specify Connection parameter values in one of two ways: as Constants or as Expressions. A constant-based parameter uses the static value you supply in the Connection dialog every time the Connection is used. An expression-based parameter allows you to set the value in question using a programmatic expression (that is, an ECMAScript expression), which can result in a different value each time the connection is used at runtime. This allows the Connection's behavior to be flexible and vary based on runtime conditions. Getting Started with the Telnet Component Editor 13 For instance, one very simple use of an expression-driven parameter in a Telnet Connection would be to define the User ID and Password as PROJECT Variables (e.g.: PROJECT.XPath("USERCONFIG/MyDeployUser"). This way, when you deploy the project, you can update the PROJECT Variables in the Deployment Wizard to values appropriate for the final deployment environment. At the other extreme, you could have a custom script that queries a Java business object in the Application Server to determine what User ID and Password to use. ¾ ¾ To switch a parameter from Constant-driven to Expression-driven: 1 Click the right mouse button in the parameter field you are interested in changing. 2 Select Expression from the context menu and the editor button will appear or become enabled. See below. 3 Click on the Expression Editor button. The Expression Editor appears. 4 Create an expression (optionally using the pick lists in the upper portion of the window) that evaluates to a valid parameter value at runtime. Click OK. To create a Telnet Connection Resource: 1 From the Composer File menu, select New>xObject, then open the Resource tab and select Connection. NOTE: Alternatively, you can highlight Connection in the Composer window category pane, click the right mouse button, then select New. 14 Telnet Connect User’s Guide The Create a New Connection Resource Wizard appears. 2 Type a Name for the connection object. 3 Optionally, type Description text. 4 Click Next. The second panel of the wizard appears. 5 Select the Telnet Connection type from the pulldown menu. Dialog changes appearance to show just the fields necessary for creating the Telnet connection. 6 In the Host or IP Address field, enter the physical (IP) address or hostname alias for the machine to which you are connecting. 7 In the Port field, enter the number of the Telnet port. The default port number is 23. 8 In the Terminal Type field, enter the type of terminal you wish to specify when handshaking with the host. Select one of the values in the pulldown menu (currently VT100, VT220, or VT320) or manually enter another terminal type. Use lowercase letters “vt” (as in vt132) when entering a value manually. NOTE: Some hosts may not let you log on as a “VT220” (or whatever). If you know the kind of terminal(s) the host recognizes, you can enter an acceptable value in this space to “spoof” the host into handshaking successfully. 9 In the Code Page field, specify a code page (See “About Code Page Support on page 19.” Getting Started with the Telnet Component Editor 15 10 Enter a UserID and Password. These are not actually submitted to the host during the establishment of a connection. They are simply defined here. (The Password is encrypted.) Rightmouse-click and choose Expression if you want to make these fields expression-driven. See discussion further above. NOTE: After you’ve entered UserID and Password info in this dialog, the ECMAScript global variables USERID and PASSWORD will point to these values. You can then use these globals in Send Buffer expressions (or as described in “Native Environment Pane Context Menu” on page -23). 11 Click the Default check box if you'd like this particular Telnet connection to become the default connection for subsequent Telnet Components. 12 Click Finish. The newly created resource connection object appears in the Composer Connection Resource detail pane. About Code Page Support Code Page support in exteNd Composer Connection Resources allow you to specify which Character Encoding scheme to use when translating characters sent between exteNd Composer and other host systems. exteNd Composer data uses Unicode character encoding (the Java and XML standard). Existing legacy and other host systems use a variety of character encoding schemes (i.e., Code Pages) specific for their language or usage. A mechanism is needed to translate the character encoding between these systems if they are to communicate with one another. This is handled in exteNd Composer by specifying the Code Page used by a host system in the Connection Resource. Creating XML Templates for Your Component In addition to a connection resource, a Telnet Component may also require that you have already created XML templates so that you have sample documents for designing your component. (For more information, see Chapter 5, “Creating XML Templates,” in the exteNd Composer User's Guide.) In many cases, your input documents will be designed to contain data that a terminal operator might type into the program interactively. Likewise, the output documents are designed to receive data returned to the screen as a result of the operator's input. For example, in a typical business scenario, a terminal operator may receive a phone request from a customer interested in the price or availability of an item. The operator would typically query the host system via “dumb terminal” in a Telnet session by entering information (such as a part number) into a terminal when prompted. A short time later, the host responds by returning data to the terminal screen, and the operator relays this information to the customer. This session could be carried out by an exteNd Composer Web Service that uses a Telnet Component. The part number (arriving via HTTP) might be represented as a data element in an XML input document. The looked-up data returned from the host would appear in the component’s output document. That data might in turn be output to a web page, or sent to another business process as XML, etc. NOTE: If your component design calls for any other xObject resources, such as custom scripts or Code Table maps, it is best to create these before creating the Telnet Component. For more information, see the exteNd Composer User's Guide. 16 Telnet Connect User’s Guide 3 Creating a Telnet Component Before Creating a Telnet Component As with all exteNd Composer components, the first step in creating a Telnet component—assuming a Connection Resource is available—is to prepare any XML templates needed by the component. (For more information, see “Creating a New XML Template” in the Composer User's Guide.) Once you've specified the XML templates, you can create a component, using the template's sample documents to represent the inputs and outputs processed by your component. Also, as part of the process of creating a Telnet component, you must specify a Telnet connection for use with the component (or you can create a new one). See the previous chapter for information on creating Telnet Connection Resources. ¾ To create a new Telnet Component: 1 Select File>New>xObject. Open the Component tab and select Telnet Terminal. NOTE: Alternatively, under Component in the Composer window category pane you can highlight Telnet Terminal, click the right mouse button, then select New. 2 The “Create a New Telnet Component” Wizard appears. 3 Enter a Name for the new Telnet Component. 4 Optionally, type Description text. Creating a Telnet Component 17 5 Click Next. The XML Input/Output Property Info pane of the New Telnet Component Wizard appears. 6 Specify the Input and Output templates as follows. 7 ‹ Type in a name for the template under Part if you wish the name to appear in the DOM as something other than “Input”. ‹ Select a Template Category if it is different than the default category. ‹ Select a Template Name from the list of XML templates in the selected Template Category. ‹ To add additional input XML templates, click Add and choose a Template Category and Template Name for each. ‹ To remove an input XML template, select an entry and click Delete. Select an XML template for use as an Output DOM using the same steps outlined above. NOTE: You can specify an input or output XML template that contains no structure by selecting {System}{ANY} as the Input or Output template. For more information, see “Creating an Output DOM without Using a Template” in the User’s Guide. 18 8 Click Next. The Temp and Fault XML Template panel appears. 9 If desired, specify a template to be used as a scratchpad under the “Temp Message” pane of the dialog window. This can be useful if you need a place to hold values that will only be used temporarily during the execution of your component or are for reference only. Select a Template Category if it is different than the default category. Then select a Template Name from the list of XML templates in the selected Template Category. Telnet Connect User’s Guide 10 Under the “Fault Message” pane, select an XML template to be used to pass back to clients when an error condition occurs. 11 As above, to add additional input XML templates, click Add and choose a Template Category and Template Name for each. Repeat as many times as desired. To remove an input XML template, select an entry and click Delete. 12 Click Next. The Connection Info panel of the Create a New Telnet Component Wizard appears. 13 Select a Connection name from the pulldown list. For more information on the Telnet Connection, see “Creating a Connection Resource” in Chapter 2 of this Guide. 14 Click Finish. The component is created and the Telnet Component Editor appears. About the Telnet Component Editor Window The Telnet Component Editor includes all the functionality of exteNd Composer’s XML Map Component Editor. For example, it contains mapping panes for Input and Output XML documents as well as an Action pane. There is one main difference, however. The Telnet Component Editor also includes a Native Environment Pane featuring a Telnet emulator. This screen appears black until you either click the Connection icon in the main toolbar or begin recording by clicking the Record button in the toolbar. Either action establishes a Telnet emulation session inside the Native Environment Pane with the host that you specified in the connection resource used by this Telnet component. About the Telnet Native Environment Pane The Telnet Native Environment Pane provides Telnet emulation of your host environment. From this pane, you can execute a Telnet session in real time, interacting with the Native Environment Pane exactly as you would with the screen on a “dumb terminal.” You can also do the following: ‹ ‹ ‹ Use data from an Input XML document (or other available DOM) as input for a Telnet screen field. For example, you could drag a SKU number from an input DOM into the “part number” field of a Telnet screen, which would then query the host and return data associated with that part number, such as description and price. Map the data from the returned Telnet screen and put it into an Output XML document (or other available DOM, e.g., Temp, MyDom, or whatever). Map header and detail information (such as a form with multiple line items) from the Native Environment Pane to an XML document using an ECMAScript expression or function. Creating a Telnet Component 19 About Telnet Keyboard Support The Telnet Native Environment Pane supports the use of numerous special terminal keys. The Terminal Keypad dialog (see below) is comprised of four Tabs: Common Keys, NumPad Keys, Control Keys and Other Keys. Each Tab contains a group of keys with specific functionality. Note that you can also achieve the use of additional keys (such as F13 through F20) by using the picklists in the Expression Builder dialog, Function/Methods column, under Telnet > Keys. ¾ How to Use the Floating Keypad: 1 Select View/Terminal Keypad from the Composer Menu. A floating Keypad appears. The Keypad window contains a series of tabs, including the following: Common Keys, NumPad Keys, Control Keys and Other Keys. 2 Click on the appropriate Tab to display the keys you wish to view on the Terminal Keypad. 3 Click on the key you wish to invoke. If you require help, hover the mouse over that key. Help will display the Telnet keyboard equivalent for that key. You will see the result of the key you clicked in the Native Environment Pane. 4 Click OK to close the keypad. In order for the keypad to redisplay, you must repeat step 1. When you display the keypad, you will return to the last Tab that you were using. The following pages illustrate the four Tabs and corresponding keys that can be used to interact with Telnet. Common Keys: Includes directional keys, (Arrow Down, Arrow Left, Arrow Right, Arrow Up, BackSpace, BackTab) as well as Delete, Escape, Linefeed, Return, and Tab. The function keys, F1 through F20, are also displayed. 20 Telnet Connect User’s Guide NumPad Keys: Includes the digits 0-9, Minus, Comma, Period and Enter keys. Control Keys: Includes 32 keys associated with specific functions. Refer to Appendix B for a complete listing. Other Keys: Includes keys to perform common functions for example: the Help key. Creating a Telnet Component 21 NOTE: The complete list of special (non-printing) keys and their ANSI equivalents is shown in Appendix B. About the Screen Object The Screen Object is a byte-array representation of the emulator screen shown in the Native Environment Pane, with methods for manipulating the screen contents. What it is The Telnet component communicates with the host environment via a character-mode terminal data stream, in a Telnet session. The user sends data to the host in the form of keystrokes (or XML data mapped to cursor prompts). The host, in turn, sends the terminal a stream of data which may contain anything from a single byte to a whole screen’s worth of information. The Screen Object represents the current screen’s worth of data. For a 24 x 80 ANSI terminal screen, this is 1,920 bytes of data. How it works When character data arrive from the host, appropriate updates to the Native Environment Pane occur in real time. Those updates might be anything from a simple cursor repositioning to a complete repaint of the terminal screen. The screen content is, in this sense, highly dynamic. When you have signaled exteNd Composer (via a Check Screen action) that you wish to operate on the current screen’s contents, the screen buffer is packaged into a Screen Object that is made accessible to your component through ECMAScript. Many times, it is not necessary for your component to “know” or understand the complete screen contents prior to sending keystrokes back to the host or prior to mapping data into a prompt. But when mapping outbound from the screen to a DOM, it can be useful to have programmatic access to the Screen Object. To make this possible, the Connect for Telnet defines a number of ECMAScript extensions for manipulating screen contents. These extensions are described in further detail in the next chapter. For now, a simple example will suffice. Suppose you are interested in obtaining a string value that occurs on the screen in row 5 at column position 20. If the string is 10 characters long, you could obtain its value by using the following ECMAScript expression as the Source in a Map action (with an output DOM or temp DOM as the Target): Screen.getTextAt( 5, 20, 10 ) The 10 characters beginning at row 5, column 20 on the screen would be mapped to the Target of the Map action. For more examples (and complete API documentation for the Screen object), see the section on “TelnetSpecific Expression Builder Extensions” on page -32 in the next chapter. About Telnet-Specific Menu Bar Items Component Menu Start/Stop Recording—This menu option manages the automatic creation of actions as you interact with a host program. Start will enable the automatic creation of actions as you interact with the screen and Stop will end action creation. 22 Telnet Connect User’s Guide Connect/Disconnect—This menu option allows you to control the connection to the host. When you are recording or animating, a connection is automatically established (and consequently, the connection icon is shown in the “connected/disabled” state). However, this button is useful if you are not recording and you merely want to establish a connection for the purpose of navigating the Telnet environment. About Telnet-Specific Context-Menu Items The Telnet Connect also includes context-menu items that are specific to this Connect. To view the context menu, place your cursor in the appropriate pane (Native Environment or Action) and click the right mouse button. Native Environment Pane Context Menu When you right-mouse-click in the Native Environment Pane, you will see a contextual menu. The menu items will be greyed out if you are not in record mode. In record mode, the context menu has the following appearance: The four commands work as follows: Send Buffer: USERID—Automatically sends User ID information to the host, based on the value you supplied (if any) for User ID in the Telnet Connection Resource for this component. Also creates the corresponding Send Buffer action in the Action Model. Send Buffer: PASSWORD—Automically transmits Password information to the host, based on the Password you supplied (if any) in the Telnet Connection Resource for this component. Also creates the corresponding Send Buffer action in the Action Model. Send Buffer—Brings up the Send Buffer dialog, allowing you to create a new Send Buffer Action. (See the next chapter for a detailed discussion of the use of this command.) Check Screen—Creates a new Check Screen action without bringing up a dialog (same as a click on the Create Check Screen button in the toolbar). Creating a Telnet Component 23 Action Pane Context Menu If you click the right mouse button when the mouse is located anywhere in the Action pane, a context menu appears as shown. The function of the context menu items are as follows: Send Buffer—Allows you to create a Send Buffer action. The Send Buffer Action dialog will appear, allowing you to enter text and/or control-key commands that will be sent to the Telnet host application. (This dialog will also let you enter an ECMAScript expression, or an XPath fragment representing the location of string data in your input DOM.) See the next chapter for a detailed discussion of the use of this command. Check Screen—This command allows you to create a new Check Screen action (to sync the component with the host). A dialog appears, allowing you to specify various go-ahead criteria as well as a Timeout value. See the next chapter for a detailed discussion of the Check Screen action. About Telnet-Specific Buttons The Telnet Connect includes a number of Connect-specific tool icons (and/or icons with Connectspecific functionality) on the component editor’s main toolbar. They appear as shown below. Record Button Record icon (normal state) Record icon (recording in progress) Record icon (disabled) The Record button allows you to capture keyboard and screen manipulations as you interact with the Native Environment Pane. Recorded operations are placed in the Action Model as actions, which you can then “play back” during testing. 24 Telnet Connect User’s Guide Connection Button Connection (disconnected state) Connection (connected state) Connection (connected/disabled state) The Connection button on Composer’s main toolbar toggles the connection state of the component (using settings you provided during the creation of the Connection Resource associated with the component). NOTE: When you are recording or animating, a connection is automatically established, in which case the button will be shown in the “connected/disabled” state. When you turn off recording, the connection the button will return to the enabled state. Create Check Screen Button The Create Check Screen button on Composer’s main toolbar should be clicked before the first user interaction with any given terminal screen. This signals exteNd Composer that you intend to work with the screen data as currently shown in the Native Environment Pane. Clicking this button causes a new Check Screen Action to be inserted into the Action Model. (See the next chapter for a detailed discussion of this action type.) Creating a Telnet Component 25 26 Telnet Connect User’s Guide 4 Performing Telnet Actions About Actions An action is similar to a programming statement in that it takes input in the form of parameters and performs specific tasks. Please see the chapters in the Composer User's Guide devoted to Actions. Within the Telnet Component Editor, a set of instructions for processing XML documents or communicating with non-XML data sources is created as part of an Action Model. The Action Model performs all data mapping, data transformation, data transfer between hosts and XML documents, and data transfer within components and services. An Action Model is made up of a list of actions that work together. As an example, one Action Model might read invoice data from a disk, retrieve data from a host inventory database, map the result to a temporary XML document, make a conversion, and map the converted data to an output XML document. The Action Model mentioned above would be composed of several actions. These actions would: ‹ ‹ ‹ ‹ Open an invoice document and perform a Telnet command to retrieve invoice data from a host database Map the result to a temporary XML document Convert a numeric code using a Code Table Map the result to an Output XML document About Telnet-Specific Actions The Telnet Connect includes two actions that are specific to the Telnet environment: Check Screen and Send Buffer. Telnet Action Description Check Screen Allows the component to stay in sync with the host application. This action signals the component that execution must not proceed until the screen is in a particular state (which can be specified in the Check Screen setup dialog), subject to a user-specified timeout value. Send Buffer Buffers a string for transmission to the host. The string is formed from Map actions and/or from user keystrokes. (The Send Buffer action can be created manually, but will more often be generated automatically when the user types into the screen or maps data to the current prompt.) The purpose of these actions is to allow the Telnet component (running in a deployed service) to replicate, at runtime, the terminal/host interactions that occur in a Telnet session. The usage and meanings of these actions are described in further detail below. Performing Telnet Actions 27 The Check Screen Action Because of the latency involved in Telnet sessions and the possibility that screen data may arrive in an arbitrary, host-application-defined order, it is essential that your component can depend on the terminal screen being in a given state before it operates on the current screen data. The Check Screen action makes it possible for your component to stay “in sync” with the host. You will manually create Check Screen actions at various points in your Action Model so that precisely the correct screens are acted on at precisely the right time(s). To create a new Check Screen action, you can do one of the following: ‹ ‹ ‹ Click on the “Create Check Screen Action” button on the main toolbar, or Perform a right mouse click inside the action list, then select New Action and Check Screen from the contextual menu, or In the component editor’s main menu bar, select Action, then New Action, then Check Screen NOTE: You will most often use the toolbar button when you are in Record mode. ¾ To create a Check Screen action using a menu command: 1 Perform a right mouse click inside the action list, then select New Action and Check Screen from the contextual menu (or use the Action menu in the main menu bar as described above). The Check Screen dialog appears. 2 Click one of the three radio buttons (Cursor position, Prompt, or Expression), depending on how you want to specify the go-ahead (screen readiness) criterion. (The default is “Cursor position.”) See discussion below. 3 Specify a Timeout value in milliseconds. (See discussion further below.) 4 Specify a Min wait value in milliseconds. (See discussion further below.) 5 Click OK. Understanding the Check Screen Action The purpose of the Check Screen Action dialog is twofold: ‹ ‹ It allows you to specify the readiness criteria by which the screen state will be judged at execution time. It allows you to specify a wait time for program synchronization. These factors are discussed in some detail below. Be sure to read and understand the following sections before creating your first Telnet Component. 28 Telnet Connect User’s Guide Readiness Criteria It is important that the execution of actions in your Action Model not proceed until: ‹ ‹ The host application is ready, and All screen data have arrived (that is, the screen is in a known state) Your component must have some way of “knowing” when the current screen is ready. You can specify the readiness criterion based on cursor position, prompt name, or an ECMAScript expression. Cursor Position You can base readiness on the location of the terminal’s cursor. Simply enter the row and column number of the cursor’s “prompt position.” (The values shown in the Row and Column fields of the dialog will always automatically default to the cursor’s current position. You will normally not have to enter the numbers manually.) Prompt The current prompt position can be specified on the basis of the character string that immediately precedes the cursor position in the terminal emulation window. For example, the prompt may say “Choose one: (A, B, C, D)”. In this instance, you could specify “Choose one: (A, B, C, D)”, or “(A, B, C, D)”, or perhaps simply “)”, as the go-ahead prompt. (The default value shown for the prompt string will be the current screen contents for the line in which the cursor is positioned. The default string will include all characters from the beginning of the prompt line up to and including the last space character, if any, preceding the cursor.) Expression It is possible that the prompt position or prompt text could vary dynamically at runtime. For the ultimate flexibility in determining the go-ahead criterion, you can click the Expression radio button in the Check Screen Action dialog and enter an ECMAScript expression in the associated text field. At runtime, if the expression evaluates as “true,” the screen will be considered ready; but not otherwise. Timeout The timeout value (in milliseconds) represents the maximum amount of time that your component will wait for screen data to both arrive and meet the readiness criterion specified in the top part of the dialog. If the available screen data do not meet the readiness criteria before the specified number of milliseconds have elapsed, an exception is thrown. NOTE: Obviously, since the latency involved in a Telnet session can vary greatly from application to application, from connection to connection, or even from screen to screen, a great deal of discretion should be exercised in deciding on a Timeout value. Careful testing of the component at design time as well as on the server will be required in order to determine “safe” timeout values. The default Timeout value will vary depending on whether you are in Record mode or you are merely creating Actions manually. In Record mode, the default Timeout value is a calculated value based on the actual time that elapses between the last operation and the loading of the new screen. (The value displayed in the dialog is twice this “observed load time,” rounded up to the nearest full second.) When you are creating a Check Screen action manually (not in Record mode), the default value is 1500 milliseconds. Performing Telnet Actions 29 Min Wait The Min Wait time (in milliseconds) represents the amount of time your component should wait before the initial check of the screen buffer. For example, if you specify a Min Wait of 500, your component will check the screen for readiness (according to the criteria you specified) after waiting 500 milliseconds. If the go-ahead criteria are met, the screen will be rechecked after another 100 milliseconds. Only if the second check is also good will execution of the component proceed. If not, the screen will be rechecked at 100-millisecond intervals until the Timeout value (above) has been reached. At that point, if the screen still does not meet readiness requirements, an exception is thrown. NOTE: Every Check Screen action checks the screen a minimum of two times. Go-ahead doesn’t occur unless two consecutive checks are passed. The default value for Min Wait is 50 milliseconds. But regardless of the Min Wait time, the screen will be checked one final time at the expiration of the Timeout period, so that even if the Min Wait time is greater than the Timeout value, the screen will still be checked once. The Send Buffer Action The Send Buffer action encapsulates “keystroke data” (whether actually obtained from keystrokes, or through a drag-and-drop mapping, or via an ECMAScript expression built with the Expression Builder) that will be sent to the host in a single transmission at component execution time. When the Send Buffer action executes, the buffered data are sent to the host in the form of a properly ANSI-escaped byte stream. The Send Buffer action can be created in several ways: ‹ ‹ ‹ ¾ 30 In Record mode, just begin typing after a Check Screen action has been created. Keystrokes are automatically captured to a new Send Buffer action. Right-mouse-click anywhere in the Action Model; a contextual menu appears. Select New Action and Send Buffer. In the main menu bar, under Action, select New Action and Send Buffer. To create a Send Buffer action using menu commands: 1 Right-mouse-click anywhere in the Action Model and select New Action, then Send Buffer, from the contextual menu (or use the Action menu as described above). The Send Buffer dialog will appear. 2 To map a DOM element’s contents to the buffer, click the XPath radio button, then select a DOM from the pulldown list and type the appropriate XPath node name in the text area (or click the Expression icon at right and build the node name using the Expression Builder). 3 To specify the buffer’s contents using ECMAScript, click the Expression radio button, then use the Expression Builder dialog to create an ECMAScript expression that evaluates to a string. 4 To specify the contents of the buffer manually (by typing a string into the text field), first check the Accept Key Strokes checkbox, then begin typing. The Expression radio button will become selected automatically and every key you press will be entered into a quoted string in the text area. Control keys (arrow keys, function keys, etc.) will automatically be translated to the appropriate escape sequences. (See discussion below.) 5 Click OK. Telnet Connect User’s Guide Editing Text in the Send Buffer Dialog When you are in “Accept Key Strokes” mode, normal editing of text via backspacing, cut/paste, etc. is not possible, since every keystroke is captured to the dialog as an escaped string-literal value. For example, if you hit the backspace key, a value of “\u0008” will be appended to the string buffer, instead of the previous character being deleted. This may not be what you want. To edit the buffer contents directly (using cut, paste, backspace, and so on), first uncheck the Accept Key Strokes checkbox. Then edit your text. To return to key-capture mode, check Accept Key Strokes. Any additional keystrokes will then be translated to escape sequences and appended to the existing text. On some occasions, you may wish to enter an escape value manually. You can do this by unchecking Accept Key Strokes and typing the value in question anywhere in the current text string. If you don’t know the escape sequence for a given control key, you can find it by clicking the Expression icon to the right of the text area (which brings up the Expression Builder dialog) and then doubleclicking the appropriate control-key entry in the picklist in the upper part of the Expression Builder dialog. If you want to know what a given escape sequence means in plain English, simply select (highlight) the escape sequence(s) of interest and let the mouse hover over the selection. See below. A hover-help box will appear, containing the escape sequence’s plain-English translation. For example, in the graphic above, the escape sequence “\u0008” has been highlighted and the mouse is hovering over the selection. The hover-help box shows that the combination “\u0008” is the Telnet equivalent of Backspace (BS) or Control-H. If a group of escape sequences is selected, you will see (in the hover-help box) all character equivalents, wrapped in angle brackets. For example, upon selecting the sequence “\u001b[A\u000a\u000d”, hoverhelp will display: < Arrow Up > < LF = CTRL+J > < CR = CTRL+M > All special (non-printing) keys and their ANSI equivalents are listed in “Telnet Keyboard Equivalents” in Appendix B. About the Send Buffer Action and Record Mode When you are building an Action Model in Record mode, a new Send Buffer action is created for you automatically if you click the Check Screen button, then begin typing. This makes it easy to build an Action Model, since all you have to do is click the Check Screen button, begin typing (or drag an element from the Input DOM into the prompt area onscreen), wait for the next screen to arrive from the host, click Check Screen, begin typing (or dragging), etc., repeatedly. In this fashion, a sequence of Check Screen and Send Buffer actions can be built very quickly and naturally. When a Send Buffer action has been created automatically for you, all of your subsequent keystrokes will be captured to the buffer until one of the following occurs: ‹ ‹ ‹ ‹ You perform a right-mouse-click. You begin to create a new action in the Action Model. You drag data into or out of the Native Environment Pane. You toggle the Record button to the non-recording state. Performing Telnet Actions 31 How Keys Are Displayed in the Action Model When a Send Buffer action is created, the keystrokes that are captured in real time are displayed in the Action Model either as plain alphanumeric values or (in the case of non-printing characters) in an escaped format. For example, an up arrow may be translated into \u001b[a, where \u001b represents the two-byte hex Unicode value of a particular ANSI control code and [a represents the rest of the ASCII escape sequence for up-arrow. Backspace and delete keystrokes are also represented as escape sequences. Therefore, if you wish to correct typos in your Send Buffer action, you may want to doubleclick the action in the Action Model (which brings up the Send Buffer dialog) and edit the buffer string by hand. Telnet-Specific Expression Builder Extensions The Connect for Telnet exposes a number of Telnet-specific ECMAScript variables and object extensions, which are visible in Expression Builder picklists. The Telnet-specific items are listed under the node labelled “Telnet.” There are three child nodes: Login, Screen Methods, and Keys. See illustration below. picktree nodes Telnet-specific Login Telnet Connection Resources have two global variables that are accessible from Expression Builder dialogs: the USERID and PASSWORD. These properties (available under the Login node of the picktree) specify the User ID and Password values that may be requested by the host system when you connect. You can map these variables into the terminal screen, which eliminates the need for typing user and password information explicitly in a map action. NOTE: You can also create a Send Buffer action where the XPath source is defined as $PASSWORD. Screen Methods When an Expression Builder window is accessed from a Map or Function action in the Telnet Component, the picklists at the top of the window expose special Telnet-specific ECMAScript extensions, consisting of various methods of the Screen object and predefined escape sequences corresponding to various “special keys” on the virtual terminal’s keyboard. 32 Telnet Connect User’s Guide Hover-help is available if you let the mouse loiter over a given picktree item. (See illustration.) In addition, you can obtain more complete online help by clicking Help in the lower left corner of the dialog. The Screen object offers methods with the following names, signatures, and usage conventions: int getAttribute( nRow, nColumn ) This method will return the display attribute value of the character at the screen position given by nRow, nColumn. The complete set of possible display attribute values is listed in Appendix C. An example of using this method is: if (Screen.getAttribute( 5, 20 ) == 1) // if character at 5, 20 is bold // do something int getCursorColumn( void ) This method returns the current column position of the cursor in the Telnet emulator screen (Native Environment Pane). Column positions are one-based rather than zero-based. In other words, in 24x80 mode, this method would return a value from 1 to 80, inclusive. int getCursorRow( void ) This method returns the current row position of the cursor in the Telnet emulator screen (Native Environment Pane). Row positions are one-based rather than zero-based. In other words, in 24x80 mode, this method would return a value from 1 to 24, inclusive. int getColumnCount( void ) This method returns the native column-width dimension of the current screen. (Due to possible mode changes in the course of host-program execution, this value can change from screen to screen. Do not depend on this value staying constant over the life of the component.) When the program is in 24x80 mode, this method will return 80. To retrieve all of the contents of row 15 of the current screen, regardless of its native dimensions, you could do: var myRow = Screen.getTextAt( 15, 1, Screen.getMaxColumn() ); Performing Telnet Actions 33 String getPrompt( void ) The getPrompt() method returns the string representing all characters in the cursor’s row, starting at column 1 and continuing to, but not including, getCursorColumn()—in other words, everything from the beginning of the line to the cursor position. (This is the same as the default prompt string shown in the Check Screen dialog.) Example: var thePrompt = Screen.getPrompt(); if (thePrompt().toLowerCase().indexOf("password") != -1) Screen.setText(PASSWORD); int getRowCount( void ) This method returns the native vertical dimension of the current screen. (Due to possible mode changes in the course of host-program execution, this value can change from screen to screen. Do not depend on this value staying constant over the life of the component.) When a program is in 24x80 mode, this method will return 24. To loop over all rows of a screen, regardless of its native dimensions, you could do: for (var i = 1; i <= Screen.getMaxRow(); i++) { var myRow = Screen.getTextAt( i, 1, Screen.getMaxColumn() ); // do something with myRow } String getText(nOffset, nLength) This method returns the string of characters (of length nLength) that occurs in the Screen object at the byte offset given by nOffset. Note that the offset is one-based, not zero-based. Thus, to obtain all of a 24 x 80 screen as an ECMAScript String, you would do: var wholeScreen = Screen.getText( 1, 24 * 80 ); Any attempt to obtain character data beyond the bounds of the screen buffer will result in an exception. For example, the following call will fail: var wholeScreen = Screen.getText( 1, 1 + 24 * 80 ); // ERROR! String getTextAt(nRow, nColumn, nLength) This method returns an ECMAScript String that represents the sequence of characters (of length nLength) in the current screen starting at the row and column position specified. Note that nRow and nColumn are one-based, not zero-based. A zero value for either of these parameters will cause an exception. To obtain all of row 20 of a 24x80 screen, you would do: var myRow = Screen.getTextAt( 20, 1, 80 ); The getTextAt() technique is used internally in drag-and-drop Map actions involving screen selections created as described in “Selecting Continuous Data” further below. String getTextFromRectangle(nStartRow, nStartColumn, nEndRow, nEndColumn) This method returns a single String consisting of substrings (one per row) comprising all the characters within the bounding box defined by the top left and bottom right row/column coordinates specified as parameters. So for example, in 24x80 mode, you could obtain the upper left quarter of the screen by doing: var topLeftQuadrant = Screen.getTextFromRectangle(1,1,12,40); The getTextFromRectangle() method is used internally in drag-and-drop Map actions involving rectangular screen selection regions created using the Shift-selection method (see “Selecting Rectangular Regions” below). 34 Telnet Connect User’s Guide Note that the string returned by this method contains newline (\u000a) delimiters between substrings. That is, there will be one newline at the end of each row’s worth of data. The overall length of the returned string will thus be the number of rows times the number of columns, plus the number of rows. For example, Screen.getTextFromRectangle(1,1,4,4).length will equal 20. void setText( String ) The setText() method allows you to send data to the screen (and therefore the host application) programmatically, without explicitly creating a Send Buffer action. Example: var myPhone = "(203) 225-1800"; if (Screen.getPrompt().indexOf("Phone") != -1) Screen.setText( myPhone + "\r" ); // send string + CR Keys The Keys node of the Telnet-specific picktree in the Expression Builder dialog has child nodes labelled Common Keys, NumPad Keys, Control Keys, and Other Keys. By doubleclicking the picklist items under these categories, you can automatically generate the ANSI escape sequence for any non-printing characters you wish to transmit to the host. The detailed contents of these picktree items can be found in Appendix B. Screen Selections in the Telnet Connect There are two main ways of selecting data on the terminal screen (in the Native Environment Pane) at design time, for purposes of dragging out. One method selects text in a continuous stream, from one screen-buffer offset to another; the other method selects text in an arbitrary onscreen bounding box or region. Selecting Continuous Data When you drag across multiple rows of data without holding the Shift key down, all characters from the initial screen offset (at the mouse-down event) to the final screen offset (at mouse-up) are selected, as shown in the graphic below. (The selected text is “reversed out.” A partial row has been selected, followed by three complete rows, followed by a partial row.) Performing Telnet Actions 35 As indicated in the component editor window’s status line (lower left), the selection in the above example actually begins at row 5, column 26, and ends at row 9, column 35. If you were to drag this selection out of the Native Environment Pane, into a DOM, a Map action would be generated as follows: Notice that the getTextAt() method is used. This means the captured screen characters form one string, which is mapped to Output/Inquiry/Response/Info. No newlines or other special characters are inserted into the string. (Areas of the screen shown in black are simply represented as space characters in the string.) Selecting Rectangular Regions Sometimes you may not want the selection behavior described above. In certain cases, screen data may be grouped into zones with their own natural boundaries. For example, in the screen shown previously, there is a box two-thirds of the way down the screen containing information on the availability of a given book. You may want to capture (for drag-out purposes) just the data enclosed within this particular rectangular region on the screen. To do this, first hold the Shift key down, then drag your mouse across the portion of the screen that you want to select. The selected area is highlighted and the appropriate row/column start and end points are displayed in the status line of the component editor’s window, as below: 36 Telnet Connect User’s Guide In this instance, when you drag the rectangular highlight region out of the Native Environment Pane, into a DOM, the resulting Map action uses the getTextFromRectangle() method described on page -34.The resulting action looks like: This method operates in a different fashion from getTextAt(), because the string returned by getTextFromRectangle() is wrapped at the rectangle’s right edge. Newlines are inserted at the wrap points as discussed in the API description of getTextFromRectangle(), further above. About the Sample Program For demonstration purposes, the CONSULS program is used in the example that follows. This Telnet program is offered online by the Connecticut state university library system to allow users to search for books and periodicals by title, author, and other criteria. Recording a Telnet Session The Telnet Component differs from other components in that a major portion of the Action Model is built for you automatically. This happens as you interact with the host in the Native Environment pane as part of a live Telnet session. Composer records your interactions as a set of auto-generated actions in the Action Model. Typically, in other exteNd Composer components (such as a JDBC Component), you must manually create actions in the Action Model, which then perform the mapping, logging, transformation, communication, and other tasks required by the component or service. By contrast, when you create a Telnet Component, you record requests and responses to and from the host, which end up as actions in the Action Model. In addition, you can add standard actions (Map, Log, Function, etc.) to the Action Model just the same as in other components. NOTE: In order to successfully build a Telnet Component, you should be familiar with Telnet commands and the specifics of the application you intend to use in your XML integration project. Performing Telnet Actions 37 The following example demonstrates several common tasks that you will encounter in building Telnet Components, such as: ‹ ‹ ‹ ‹ ‹ Creation of Check Screen actions Automatic creation of Send Buffer actions Drag-and-drop mapping of Input DOM elements to Telnet-screen prompts Drag-and-drop mapping from the Native Environment Screen to the Output DOM The use of ECMAScript expressions to manipulate Screen object elements In the following example, we start with an input XML document that contains the title and author of a book. The goal of our Web Service is to do an author search online, using the CONSULS Telnet app, to see if a book by the given title exists in the library system. If so, we retrieve its ISBN (International Standard Book Number) code in an Output DOM. Whether we succeed or not, we insert an appropriate status message in the Output DOM. ¾ 38 To record a Telnet session: 1 Create a Telnet Component per the procedure shown in “To create a new Telnet Component:” on page -17. 2 Once created, the Telnet Component Editor window appears, with the words “Telnet Terminal Emulation” in the center of the Native Environment Pane, indicating that no connection has yet been established with a host. Telnet Connect User’s Guide 3 Click the Record button. You are automatically connected to the host that you selected in the Connection Resource for the component. An input screen appears in the Native Environment pane as shown below. NOTE: The remainder of this example shows screens from a state university library system’s online book locator service. There are many similar Telnet services available online; consult your favorite Web search engine to obtain IP addresses of such services. 4 Click the Create Check Screen Action button in the toolbar. A new Check Screen action appears in the action list. It defaults to a go-ahead condition based on the current cursor position (which we assume will always be 21,56 on this screen, with every future execution of this component—an assumption worth questioning). We will tentatively accept the default Timeout of 1500 milliseconds for this Check Screen action, since the CONSULS program has a relatively quick response time. (Even so, careful testing of the component should be done in order to verify that this timeout value is safe.) Performing Telnet Actions 39 5 Type the letter A (for Author) in the input screen of the Telnet environment pane. A new Send Buffer action appears automatically in your component’s action list. Notice that the ‘A’ you typed is already in the action. NOTE: Telnet commands are often case-sensitive and should generally be entered in ALL CAPS. In this part of this particular host application, merely typing a single character (without hitting Enter or Return) causes a new screen to appear. The host, in other words, processes the typed character immediately. This is a common Telnet idiom. You will not always need to hit Return or Enter to get to a new screen. In response to ‘A’, the host program sends the new screen shown above. 6 Because we wish to terminate the Send Buffer action and go on to interact with the new screen, you should click the Check Screen button in the toolbar, at this point, to allow the component to “sync” our next action with the current screen. Click the Create Check Screen Action button now. The new Check Screen action appears in the action list. NOTE: Were you to simply start typing your next command at this point (without first creating a new Check Screen action), the command would be appended to the still-active Send Buffer. In essence, you would be creating a “type-ahead” buffer. At runtime, the buffer (containing two sets of screen commands concatenated together) would be sent all at once. While this would work okay in this particular program, the type-ahead technique could fail in other real-world Telnet programs. Therefore, use caution when deliberately overloading a Send Buffer action. A “best practices” approach is to create a new Check Screen action for every new screen that appears during your session. 7 Drag the BOOKINQUIRY/AUTHOR/LASTNAME node from the Input DOM to the cursor position in the Native Environment Pane. “Clancy” (without quotation marks) appears in the prompt zone and a new Send Buffer action appears automatically in the Action Model. NOTE: This Telnet application is expecting the author’s name to be provided as Last Name followed by First Name (with a space in between). Hence, we dragged the LASTNAME element first. 40 8 Hit the spacebar on your keyboard. Notice that a space character is added to “Clancy” in the Native Environment Pane. Also, a new Send Buffer action is created containing just the space character. 9 Drag the BOOKINQUIRY/AUTHOR/FIRSTNAME element from the Input DOM to the cursor position in the Native Environment Pane. “Tom” (without quotation marks) appears after “Clancy ” in the prompt zone and a new Send Buffer action appears in the Action Model. Telnet Connect User’s Guide 10 Note that the terminal screen has not changed (the host has not acted on our input), because it is waiting for Return or Enter. Press Return or Enter to tell the host that our query string (the author’s name) is complete. A new Send Buffer action appears, containing \u000a, and the Native Environment Pane updates to reflect the query results. Drag selected text to Output DOM New action appears here 11 Click the Create Check Screen button in the toolbar. A new Check Screen action appears, with a default go-ahead condition based on the cursor location of row 24, column 38. (Row 24 is the bottom row and column 38 is about halfway across the 80-column screen; see screenshot above.) There is no need to change the Check Screen default in this case. 12 In the Native Environment Pane, select the terminal-screen text in row 2, from column 2 to column 18, by clicking and dragging the mouse. NOTE: Notice that as you click and drag, the onscreen row/column coordinates of the selected area are displayed in the status line of the component editor window (lower left corner). 13 Lift your finger off the mouse button and place the mouse over the selected text. A finger cursor will appear. Click-drag the selection to the Output DOM InquiryResponse/Status node. The selected text is inserted into the DOM at the desired location, and a new Map Action is generated in the Action Model automatically. 14 Click the Record button to turn recording off. Performing Telnet Actions 41 Looping Over Multiple Rows in Search of Data In the CONSULS example (above), the goal is to find the ISBN (International Standard Book Number) information for the book we’re interested in and map it into the Output DOM. Therefore, when the CONSULS application shows us the result of our author search, we need to scan that screen, looking for the book title in question. If the title exists, our next action should be to send the corresponding line number, which will cause CONSULS to display a new screen showing detailed information (including ISBN) for the book. By simple visual inspection of the terminal emulator screen (see previous illustration), it’s easy to see that Tom Clancy’s Debt of Honor is listed as line-item number 3 in the search-results screen. But this only holds true for this particular search. A search on a different author/title combination might yield a hit at a different line position. (Or if Tom Clancy writes more books, Debt of Honor could assume a different listing position.) To determine the line position of the book at runtime, we should iterate through lines 4 through 11 of the terminal screen, searching for the string stored in the BOOKINQUIRY/TITLE node of our Input DOM. The next example shows how to do this, building on the previous example. ¾ 42 To search for a data item one row at a time: 1 At the bottom of the Action Model, add a new Repeat While action. (Perform a right-mouse-click, then select New Action, Repeat, and Repeat While.) The Repeat While dialog appears. 2 In the While text-entry box, type an expression representing the loop-termination condition you wish to apply to this loop. In this case, our condition involves a check of the index variable, rowIndex. We will be checking 8 rows of screen data in all. 3 In the Index Variable text-entry area, enter the name of your index variable (in this case, rowIndex). 4 Since we are only retreiving a single value (one book) from the screen, we do not need to fill in the optional Target portion of the dialog. Therefore, just click OK. A new Repeat While action is added to the component’s Action Model. Telnet Connect User’s Guide 5 In this example, we’re looking for a specific string within a given row. If the string is found, we will take several actions, then break out of the loop. We will perform our row parsing and string search within a Decision Action. Create a new Decision Action by clicking the right mouse button and selecting New Action > Decision from the contextual menu. The Decision Action dialog appears. 6 Enter a Decision Expression. In this example, the three-line expression is: var myRow = Screen.getTextAt(rowIndex+4, 1, 80).toLowerCase(); var bookTitle = String(Input.XPath("BOOKINQUIRY/TITLE")).toLowerCase(); myRow.indexOf( bookTitle ) != -1 The first line uses the Screen object’s getTextAt() method (see page -34) to retrieve the 80 characters of data (i.e., one full line, in a 24x80 terminal screen) at rowIndex + 4. We add an offset of 4 to the index variable because our search of screen data should begin at row 4 and continue through row 11. (The index variable itself will have values from 0 to 7. The loop terminates when rowIndex reaches 8.) The second line of code above simply retrieves the book title as a lowercase string from the Input DOM. (Notice that because we don’t want our search to be case-sensitive, we force both strings— the query string and the target-object string—to be lowercase.) The final line of code is the actual “condition check.” It relies on the core-ECMAScript String method indexOf(), which returns –1 when the argument string is not a substring of the string on which the method is being called. 7 In the TRUE branch of the Decision Action, create a new Send Buffer action. (Right-mouse-click, then choose New Action > Send Buffer from the contextual menu.) The Send Buffer dialog appears. 8 Click the Expression radio button and then enter an ECMAScript expression in the text-edit area. In this example, we’ve entered: var item = Screen.getTextAt( rowIndex + 4, 1,10); var regex = new RegExp("\\d+"); item.match(regex)[0]; The first line retrieves the first ten characters of data in the “hit” row using the getTextAt() method. Within this string, we want the first substring of numeric characters, representing the CONSULS line number of the book (i.e., 3). One way to extract this substring is with the ECMAScript String method, match(), which takes a regular expression object as an argument. On success, this method returns an array, of which the zeroth item is the matched text. Our regular expression consists of backslash-d followed by a plus sign, which means “one or more digit characters in a row.” NOTE: The RegExp constructor takes a String argument, in which backslashes that are to appear as literal backslashes “must be escaped with a backslash.” The net result of these lines of ECMAScript is that the number preceding the book title in the target row (namely, ‘3’) is supplied to the host application via a Send Buffer action. No newline need accompany the number ‘3’. Upon receiving this number, the host application will immediately send back a new screen giving detailed information about the indicated book, as shown below. Performing Telnet Actions 43 9 Create a new Check Screen action by performing a right-mouse-click and selecting New Action > Check Screen from the contextual menu. The Check Screen dialog appears. 10 Select the Expression radio button and enter “true” in the text-edit area. Set a Min wait value of 100, which (in this case) we know from experience is generous. NOTE: The combination of “true” and 100 means we will automatically accept any screen data that get sent within 100 milliseconds. 11 Create a new Function Action. (Right-mouse-click: select New Action > Function.) In this action, we will retrieve the first ISBN number on the page, if one exists, and store it into an ECMAScript global. The expression we will use is: this.isbn = "Not found"; // set up global var screen = Screen.getText( 1, 24 * 80 ); // fetch whole screen if (screen.indexOf('ISBN') != -1) // if ‘ISBN’ occurs, get it this.isbn = lTrim( screen.split('ISBN')[1] ).split(' ')[0]; The first line above simply declares and initializes an ECMAScript global variable (which, on success, will be overwritten with a valid ISBN value). The second line of code retrieves the entire screen buffer as a string and places it in a local variable, text. (We assume here that we’re in 24x80 mode.) The third line checks the screen buffer to see if “ISBN” occurs in it. If so, we split the buffer into an array of substrings using “ISBN” as the delimiter. The array member at index 1 will contain the ISBN number, trailed by a partial screen’s worth of information (and possibly containing one or more leading space characters). The custom ECMAScript function lTrim() is used to trimming leading spaces, while the split method is again employed to break our string into an array of substrings, assuming spaces to be the delimiters. The zeroth item of this final array is the ISBN string that we’re looking for. See the series of graphics below. 44 Telnet Connect User’s Guide Performing Telnet Actions 45 12 On finding the information we’re looking for, we no longer need to iterate through line items. Therefore, create a Break Action to break out of the loop. (Right-mouse-click; New Action; Break.) 13 Create a Map action that maps this.isbn to the InquiryResponse/ISBN node of the Output DOM. The completed Action Model looks like this: Editing a Previously Recorded Action Model You will encounter times when you need to edit a previously recorded action model. Unlike the situation with other components, editing a Telnet Component requires extra attention. When a Telnet Component executes, it plays back a sequence of actions that expect certain screens and data to appear at certain times in order to work properly. So when editing a component you must be careful not to make the action model sequence inconsistent with the host program execution sequence you recorded earlier. 46 Telnet Connect User’s Guide In general, to ensure successful edits, the following recommendations apply: ‹ ‹ Exercise extreme care when using Cut, Copy, and/or Paste to delete, move, or replicate actions in your Action Model. Actions that were created automatically during a “Record” session will often create data dependencies that are easily overlooked in the editing process. When you need to use drag-and-drop to add new Map actions to your Action Model, click the Start Animation button in the Action Pane toolbar and step to the line of interest in your Action Model; then Pause animation and turn on Record mode. At this point, you can safely drag to and from the screen. Following this procedure will prevent your Action Model from getting out of sync with the host or conflicting with previously mapped DOM data. Changing an Existing Action The following procedure will explain how to change an existing action in a previously recorded session. ¾ To Change an existing action in a previously recorded Action Model: 1 Open the component that includes the Action Model you'd like to edit. The component appears in the Telnet Component Editor window. 2 Navigate to the action in the Action Model where you’d like to make your edit and highlight the action. Performing Telnet Actions 47 3 Click the Toggle Breakpoint button (or press F2). The highlighted action becomes red. Start Animation Toggle Breakpoint 4 Click the Start Animation button. The animation tools (in the Actions pane’s toolbar) become enabled. Step to Breakpoint/End 5 48 Click the Step to Breakpoint/End button. The Action Model executes all of the actions from the beginning of the Action Model to the breakpoint you set in step 3 above. Telnet Connect User’s Guide 6 In the Component Editor tool bar, click the Record button. Record button 7 Perform any additional drag-and-drop (or other) actions that you’d like to make to the Action Model. 8 Turn off recording. (Toggle the Record button.) 9 Test your component. Performing Telnet Actions 49 Adding A New Action The following procedure explains how to add a new action in a previously recorded session. ¾ 50 To Add a Action to a previously recorded Action Model: 1 Open the component that includes the Action Model you'd like to add an action in. The component appears in the Telnet Component Editor window. 2 Navigate to the action in the Action Model where you’d like to make your addition and highlight the action. Telnet Connect User’s Guide 3 Click the Toggle Breakpoint button (or press F2). The highlighted action becomes red. Start Animation Toggle Breakpoint 4 Click the Start Animation button. The animation tools (in the Actions pane’s toolbar) become enabled. Step to Breakpoint/End 5 Click the Step to Breakpoint/End button. The Action Model executes all of the actions from the beginning of the Action Model to the breakpoint you set in step 3 above. Performing Telnet Actions 51 6 In the Component Editor tool bar, click the Record button. Record button 7 Use Composer's drag and drop features to add new Map actions that interact with the screen. The new action will be added directly under the highlighted line. 8 Turn off recording. (Toggle the Record button.) 9 Test your component. About Adding Alias Actions If you are adding Map Actions in a loop that are alias perform the following steps: ¾ 52 To Add an Alias Action to a previously recorded Action Model: 1 Open a component. 2 From the Action menu, select New Action, then Map. The Map Action dialog box displays. 3 Select the Expression for Source, and the dropdown box is grayed out. 4 Either type in the information, or click the Expression Builder button and create a new expression. 5 Create an XPath to be represented by the alias. Click from the dropdown list for the alias. 6 Click OK. Telnet Connect User’s Guide 7 The new action is inserted below the line you select. (New line is highlighted in the screen below to show it was inserted. Deleting an Action The following procedure explains how to delete an action in a previously recorded session ¾ To Delete an Action to a previously recorded Action Model: Highlight the action line that you want to delete and click on the RMB and select Delete from the menu. You may also highlight the line and press the Delete button on your keyboard. Testing your Telnet Component Composer includes animation tools that allow you to easily test your component. On the Telnet Component Editor tool bar you'll find the Execute button, which allows you to execute the entire Action Model and verify that your component works as you intend. It is important to test a newly created Telnet Component to be sure that Timeout values in all Check Screen actions are appropriate and that Send Buffer and other actions work as intended. Performing Telnet Actions 53 ¾ To execute a Telnet Component: 1 Open a Telnet Component. The Telnet Component Editor window appears. Execute button 2 Select the Execute button. The actions in the Action Model execute. If the component executes successfully, a message appears as follows. 3 Click OK. After executing the component, you may want to doublecheck the contents of your DOMs to be sure all of the appropriate data mappings occurred as expected. To make all data elements visible, select Expand XML Documents from the View menu. This expands all of the parents, children, data elements, etc. of the DOM trees, so that you can easily see the results of execution of the component. Using the Animation Tools In the Action Model, you'll find animation tools that allow you to test a particular section of the Action Model by setting one or more breakpoints. Using these tools, you can run through the actions that work properly, stop at the actions that are giving you trouble, and then troubleshoot the problem actions one at a time. •The following procedure is a brief example of the functionality of the animation tools. For a complete description of all the animation tools and their functionality, please refer to the exteNd Composer User's Guide. 54 Telnet Connect User’s Guide ¾ To run a Telnet Component using Animation Tools: 1 1.Open a Telnet Component. The component appears in the Telnet Component Editor window. NOTE: Animation and Recording are mutually exclusive modes in the component. In order to record during animation, you must either pause, or stop animation and then turn on record mode. 2 Click the Start Animation button in the Action Model tool bar, or press F5 on the keyboard. All of the tools on the tool bar become active, and a connection is established with the host. The Native Environment Pane becomes active. 3 Click the Step Into button. The first Check Screen action becomes highlighted. 4 Click the Step Into button again. The Check Screen action (above) executes and the next action becomes highlighted. 5 Click the Step Into button repeatedly to execute actions one-by-one. 6 Click other buttons (Step Over, Run To Breakpoint, Pause, etc.) as desired to control the execution of the component. Note that you can set a breakpoint at any time during execution by clicking the mouse on an action line and hitting F2 or using the Set Breakpoint button. 7 Once execution is complete, the following message appears. Tips for Building Reliable Telnet Components The following tips may be helpful to you in building reliable Telnet Components. ‹ ‹ ‹ Always follow a Send Buffer action with a Check Screen action. In Check Screen actions, accept the default go-ahead condition (based on cursor position) only when you are certain that the absolute cursor position will always be constant for the given screen. Many times, it is safer to write a custom expression. A fast, accurate way to create a prompt-based Check Screen action during recording is to highlight (select) the characters of interest immediately preceding the cursor (up to but not including the cursor position), then click the right mouse button and select Check Screen. This automatically creates a Check Screen action based on the prompt you highlighted. Performing Telnet Actions 55 ‹ ‹ ‹ ‹ ‹ When typing a custom prompt string under Prompt (in the Check Screen dialog), remember to escape any quotation marks that might appear within the prompt string. Avoid using Check Screen go-ahead criteria based on variable information, such as dates, times, etc. Avoid Check Screens that do nothing but wait a specified period of time using the Min Wait setting. While this technique may work, it can create significant performance bottlenecks. Remember that the default Timeout values used in Check Screen actions are calculated from actual response times during the design session. This has a couple of implications. First, the default Timeout value may need to be increased, for load-sensitive applications. Secondly, deleting a Check Screen action may cause synchronization timeouts on subsequent executions. Careful testing will reveal these sorts of problems. When disjointed go-ahead criteria come into play, such as when the middle of a screen remains constant during a repaint but the first and last lines change, you may want to create two Check Screen actions then combine them into one action that’s based on an expression. Using Other Actions in the Telnet Component Editor In addition to the Check Screen and Send Buffer actions, you have all the standard Basic and Advanced Composer actions at your disposal as well. The complete listing of Basic Composer Actions can be found in Chapter 7 of the Composer User’s Guide. Chapter 8 contains a listing of the more Advanced Actions available to you. Handling Errors and Messages In testing a Telnet Component, you may encounter errors relating to Check Screen and/or Send Buffer actions. These result in a dialog similar to the following: This section discusses possible error conditions and how to deal with them. Check Screen Errors Most of the errors you are likely to encounter at execution time will be related to Check Screen actions. It is important to realize that every one of the Check Screen errors discussed below is a timeout error. If one of the errors described below occurs, it means that the go-ahead criteria you specified in the Check Screen setup dialog were not met within the Timeout period. Therefore, you should first try to determine whether slow host response might be the real problem (in which case, the solution is to increase the Timeout value for the Check Screen action in question). If the error still occurs after the Timeout value has been increased, then you can be sure the error is due to an incorrect or inappropriate go-ahead condition in your Check Screen action. The following paragraphs describe typical error messages and their meanings. 56 Telnet Connect User’s Guide “Expected cursor position (Row = {0}, Column = {1}) was not established” This error means that the Check Screen failed because the cursor was not at the expected location at the expiration of the Timeout period. Perhaps the host application changed, or the prompt line may be varying dynamically in some way that you weren’t anticipating, etc. It’s also possible, as explained above, that the Check Screen simply “timed out” for reasons having to do with heavy host load or a bad connection. Try increasing the Timeout value for the given Check Screen action. If that doesn’t help (or if you suspect that the problem involves an inappropriate choice of go-ahead criteria), try rewriting the Check Screen go-ahead condition based on something other than fixed cursor coordinates. For example, specify a prompt string, or use an Expression to validate the screen contents in some way. “Expected prompt text {0} was not established” This error means that the Check Screen failed because the prompt was not identical to the specified (expected) prompt string prior to the expiration of the Timeout period. The prompt line may be varying dynamically in some way that you weren’t anticipating. Or (as explained above) the host response time may simply have increased unexpectedly due to heavy load or other factors. If you suspect that host latency is a problem, try increasing the Timeout value for the Check Screen action. Otherwise, rewrite your Check Screen go-ahead criteria to be based on something other than a hard-coded prompt value. For example, specify an Expression that validates the prompt in some way. “Screen Check Expression {0} was evaluated as false” This error happens when the Check Screen go-ahead is based on an ECMAScript expression and the expression happens to evaluate as false at execution time. Once again, it’s important to realize that this sort of error can be triggered simply on the basis of slow host response (timeout). When the host is slow to respond, it means that your ECMAScript expression will be evaluated on the basis of whatever is in the screen buffer as of the moment of timeout. If no data (or insufficient data) have arrived, the expression is bound to evaluate as false. To fix this sort of problem, either increase the Timeout value for this Check Screen action (if you suspect that the problem is host latency) or try modifying the logic in your ECMAScript expression. Send Buffer Errors If you see an automatically generated Send Buffer action at the top of your Action Model that contains the string "\u001b[?1;2c" (or something similar), it means that you have specified no terminal type (or perhaps an unrecognized terminal type) in the Terminal Type field of the Telnet Connection Resource setup dialog. Send Buffer errors will, in general, be rare. Be on guard, however, for Send Buffers that contain more than one screen’s worth of commands (so-called “type-ahead” buffering). Such actions are easy to create accidentally. An Action Model with overloaded Send Buffers may work correctly as you step through actions at animation time, but can fail when the component-as-a-whole is executed, due to screen synchronization problems. The way to avoid problems here is to make sure that for every Send Buffer action, there is always be a corresponding Check Screen action. Errors Involving Connections If connection pooling, which is discussed in detail in Chapter 6, is used, and there has been an attempt to log on with a bad UserID or Password, that connection instance will not be usable and that member of the pool will be skipped over in subsequent connection requests. An error message will be sent to the server log saying “Logon connection in pool was discarded for User ID .” You should check for messages of this sort during preproduction testing and/or any time performance issues arise. Performing Telnet Actions 57 Finding a “Bad” Action When you have a large Action Model (containing dozens or hundreds of Check Screen and Send Buffer actions), simply locating the action that’s responsible for an error can be a challenge. One way to find the problematic action is to: 1 Select and Copy the text after “Expected” in the error dialog. (Click the Details button if need be, to expose the full error description. Highlight the relevant text, such as cursor coordinates. Then use Control-C to Copy.) 2 Click inside the Action Model. 3 Use Control-F to initiate a search. 4 Paste the error text into the search dialog. 5 Execute the search. Of course, if you have multiple Check Screen actions that are based on identical go-ahead criteria, the foregoing technique won’t necessarily be helpful. If that’s the case, set a breakpoint at the midpoint of your Action Model, and run the component. If the error doesn’t occur, move the breakpoint to a spot halfway between the original breakpoint and the end of the action list. (Otherwise, if the error does happen, set the breakpoint at a spot one quarter of the way down from the top of the action list.) Run the component again. Keep relocating the breakpoint, each time halving the distance between the last breakpoint or the top or bottom of the action list, as appropriate. In this way, you can quickly narrow down the location of the problematic action. (Using this “binary search” strategy, you should be able to debug an Action Model containing 128 actions in just 7 tries.) 58 Telnet Connect User’s Guide 5 Advanced Telnet Actions Telnet-based computing differs from other types of computing (including other terminal-based interactions) in a number of important ways: ‹ ‹ ‹ ‹ ‹ Data arrive a character at a time, rather than in chunks. There is no obvious structure to arriving data; and the data may arrive in an arbitrary order. Screen updates may involve just a portion of the screen (perhaps a single character) or the whole screen. Retrieval of data sets may require repeated roundtrip communications with the host. (One query may bring many screens’ worth of data, which must be captured through multiple “page forward” commands, etc.) Information that spans screens may be (and often is) partially duplicated on the final screen. These factors can make automating a Telnet interaction (via an Action Model) challenging. The goal of this chapter is to suggest some strategies for dealing with common (yet potentially problematic) Telnetcomputing situations in the context of an eXtend Action Model. To get the most out of this chapter, you should already have read Chapter 4, “Performing Telnet Actions” and you should be familiar with Action Model programming constructs (such as looping via the Repeat While action). In addition, you should have some experience using ECMAScript. Data Sets that Span Screens A common requirement in Telnet computing is to capture a data set that spans multiple screens. In cases where the screen contains a line that says something like “Page 1 of 4,” it’s a straightforward matter to inspect the screen at the point where this line occurs (using one of the ECMAScript Screen-object methods described earlier, in the section titled “Telnet-Specific Expression Builder Extensions” on page -32) and construct a loop that iterates through all available screens. But sometimes it’s not obvious how many screens’ worth of data there may be. In some cases, the only clue that you have may be the presence of a “More” command (for example) at the top or bottom of the screen, which changes to “Back” (or “End,” or some other message) when you reach the final screen. In other cases, you may be told how many total records exist, and you may be able to determine (by visual inspection) how many records are displayed per screen; hence, you can calculate the total number of screens of information awaiting you. The point is that if your query results in (potentially) more than one screen’s worth of information, you must be prepared to iterate through all available screens using a Repeat/While action, and stop when no additional screens are available. You will have to supply your own custom logic for deciding when to stop iterating. Your logic might depend on one or more of the following strategies: ‹ ‹ ‹ ‹ ‹ Determine the total number of screens to visit by “scraping” that information, if available, off the first screen. Divide “total records” (if this information is available) by the number of records per screen (if this is known in advance), and add one. Visit screens one-by-one and break when a blank record is detected. Visit screens one-by-one until a special string (such as “End” or “Go Back”) is detected. Visit screens one-by-one until two consecutive identical screens have been encountered. Advanced Telnet Actions 59 Obviously, the strategy or strategies you should use will depend on the implementation specifics of the Telnet application in question. For some applications, iterating through screens until a blank record is encountered would be appropriate, whereas for others, it wouldn’t be. An example of an Action Model that combines two of these strategies will be discussed in detail further below. Dealing with Redundant Data In Telnet applications, it’s common for the final screen of a multiscreen result set to be “padded” with data from the previous screen. In this way, the appearance of a full screen is maintained. Consider the following two screen shots. The top one shows the next-to-last screen’s worth of information in a query that returned six screens of information. Notice that the reversed-out status line (row 2 from the top) says “43 entries found, entries 33–40 are:”, followed by line entries. Since there are 43 records in the overall data set, and the next-to-last screen ends with record number 40, you’d expect the next (and final) screen to show records 41 through 43. Instead, the final screen looks like the one at the bottom of the next page. Notice that it shows records 36 through 43—that is, it contains five records (36 through 40) from the previous screen. In most cases, you will not want to capture this redundant data. The question is: How can you detect and reject redundant records of this sort? ECMAScript offers an easy and convenient way of maintaining unduplicated lists. The trick is to create a bare (uninitialized) Object, then attach record names as properties. Since no object can ever have two properties with identical names, assigning record names as property names means the object’s property list is an unduplicated list of record names. 60 Telnet Connect User’s Guide A short example will make this clearer. Suppose you have an array of items in which some items are listed more than once: var myArray = new Array( "Tom","Amy","Greg","Tom","Amy"); To unduplicate this array, you could assign properties to a bare object, where the property names equal the array values: var myObject = new Object(); // create a bare object for (var i = 0; i < myArray.length; i++) // loop over array { var arrayMember = myArray[ i ]; // fetch array member myObject[ arrayMember ] = true; // create the property } // // var var for Now obtain all property names in a new, unduplicated array: uniqueValues = new Array(); n = 0; // counter (var propertyName in myObject) // enumerate property names uniqueValues[ n++ ] = propertyName; // Now ’uniqueValues’ contains just "Tom","Amy","Greg" We will use this trick to our advantage in the Telnet example discussed below. An Example of Looping over Multiple Screens Let’s look at a sample Telnet component that combines several of the strategies we’ve been talking about. The host application is a university library system’s book locator service. In this example, we have an input document that specifies an author’s name. Based on that name, we want to query the library for all available book titles by that author and capture the results to an output DOM. We want the output document to contain an unduplicated list of titles. Advanced Telnet Actions 61 This example will demonstrate: ‹ ‹ ‹ ‹ How to "scrape" data from multiple screens, without knowing in advance how many screens there are. How to reject duplicate records as they are encountered. How to create Output DOM nodes programmatically. Breaking out of the main loop if a blank record is encountered or the final screen has been reached. The logic for our Action Model’s main loop can be summarized (in pseudocode) as follows: Determine the number of records-per-screen While (true) // enter a "forever" loop Fetch a record IF Record is Valid // i.e., not blank Write data to Output DOM IF Screen has been completely processed IF this is not the final screen Fetch next screen ELSE BREAK // final screen processed ELSE BREAK // blank record reached Initial Actions The initial portion of the Action Model for this example looks exactly like the actions created in the earlier example (see “Recording a Telnet Session” on page -37), except that in this case our author is Thomas Aquinas. The initial actions are simply the Check Screen and Send Buffer actions necessary to conduct an Author search on "Thomas Aquinas." The initial screen of our result set looks like: 62 Telnet Connect User’s Guide At the very beginning of the second row, we’re told how many records ("entries") were found. We can capture this information by using a Function Action: This three-line script obtains all of Row 2 in a local variable called line2, trims leading spaces off the line, and splits the line on space characters (capturing the zeroth member of the resulting array into a variable, totalHits). After this, it’s a simple matter to write the "total hits" number into the Output DOM using a Map Action. At this point, we could use the "total hits" number as the basis for our main loop. But for illustration purposes, we’re going to bypass that tactic, because not every Telnet host reports "total hits" information on the first response screen. We will, however, take advantage of the fact that this particular application reports the number of records per screen (in row two). Here again, though, it’s possible—with clever ECMAScript programming—to determine "records-per-screen" information dynamically, at runtime. Alternatively, you can just hard-code this value after visually inspecting the screen. NOTE: At some point, you will have to decide whether (and under what circumstances) it makes sense to hard-code something like the number of records per screen, as opposed to applying runtime logic. With Telnet applications, it’s rare that you can count on being able to determine every important screen characteristic dynamically. Some fore-knowledge of the host application’s behavior will almost always be implicit in the final Action Model. We will store the records-per-screen number in an ECMAScript variable, booksPerScreen. In this example, there are eight records per screen. Setting Up the Main Loop Before creating our main loop, we need to set up an index variable that will be used when creating nodes in our Output DOM. This index (called bookNumber)will start at one and will be incremented once for every book title we capture to Output. The reason this index starts at one instead of zero is that DOM nodes use one-based indexing. We will be using bookNumber to index our nodes. We also will use an ECMAScript expression (in a Function Action) to create a blank ECMAScript object: var bookTable = new Object(); By storing book titles as property names on this object, we can keep an unduplicated list of records, as explained further above (see “Dealing with Redundant Data”). Advanced Telnet Actions 63 To create the loop, we place a Repeat While action in the Action Model. (Right-mouse-click, then select New Action > Repeat > Repeat While.) The dialog settings for this look like: By setting the While condition to true, we are—in effect—creating an infinite loop. The exit conditions for this loop are twofold: ‹ ‹ If a blank record (all space characters) is encountered, the loop is terminated. If the current screen is identical to the previous one, the loop is terminated. The latter condition provides a suitably robust way to break out of our infinite loop.What’s more, it’s generally applicable to a wide range of Telnet applications—not just the library-query application. The index variable i, which cycles from zero to booksPerScreen – 1, serves two roles: ‹ ‹ It lets us know when it’s time to fetch a new screen (namely, when the value reaches booksPerScreen – 1), and It serves as the basis for our row offset when fetching records. Screen Caching One additional bit of pre-loop setup code involves caching the current screen. We include the following Function Action statement immediately before beginning the loop: previousScreen = Screen.getTextAt(1,1,Screen.getColumnCount() * Screen.getRowCount()); The variable previousScreen caches the contents of the last-looked-at screen so that we can check newly obtained screens against it. If a newly obtained screen has exactly the same content as the screen we just processed, this is a hint that we have reached the final screen (and we should therefore terminate the loop). The Main Loop We’re now in a position to look at what our Action Model’s main loop actually does. First Half Consider the first portion of the loop as shown below. This is where most of the real work takes place. 64 Telnet Connect User’s Guide The first action inside the loop is a Function Action, which fetches the 53 characters beginning at column 9 of row 4 + i. The rows we’re interested in include rows 4 through 11, inclusive; this is the zone in which the host reports our line items. Since i cycles from zero to 7, we can use "4 + i" as a row offset in our code. Once we’ve obtained a record, we do a validation check before proceeding. Only if the zone that the record came from is non-empty will we continue with the loop. We use a Decision Action with a decision expression of: Screen.getTextAt( 4 + i, 9, 53) != (new Array(53) ).join(" ") The statement on the right side of the expression means "create a new, empty array of length 53, and convert it to a String by joining the array members together, using a single space character as the delimiter." Since each array member is null, this essentially forms a String consisting of 53 space characters in a row. We can compare this String with the onscreen string to determine if a blank record was encountered. In the TRUE branch of our Decision Action, we immediately check to see if the book title we just fetched has already been encountered. (We don’t want duplicates.) Since we’ve been using the tactic of keeping book titles as property names on the bookTable object (see discussion further above), all we have to do to check for prior existence of the book is execute a Decision Action against the expression: bookTable[ bookTitle ] == null If this statement is true, it means the bookTable object has no property who’s name matches the String in bookTitle. When this is the case, it means we can go ahead and do our mapping operations. (Otherwise, we fall through and keep iterating.) In the TRUE branch of this decision, we mark bookTable[ bookTitle ] as true; this assigns a new, non-null property to bookTable. We then map an index number as well as the book title to new nodes in our Output DOM. By applying a target expression of Output.createXPath("InquiryResponse/Books[$bookNumber]/Title") for mapping, we are able to use the running index in bookNumber to create a new node instance under InquiryResponse/Books with element name Title. Finally, we increment bookNumber. Second Half In the final portion of our loop, we check to see if it’s time to fetch a new screen. If so, we execute the necessary Send Buffer command to tell the host we want to page forward to the next screen. Advanced Telnet Actions 65 Notice that as soon as we’ve fetched the new screen, we capture its contents into a String variable, thisScreen. Then we execute a Decision Action in which we simply compare thisScreen to previousScreen. If the two are equal, we use a Break Action to break out of the loop. Otherwise we fall through and continue executing. NOTE: Use care when deciding a Min Wait time for the Check Screen action shown above. If the Min Wait is short and the go-ahead condition is true, it’s possible you could unintentionally skip a screen and break out of the loop prematurely. If we’re still executing, we reset i (the row index variable) and stuff thisScreen into previousScreen in preparation for the next round. The Output DOM resulting from our loop ends up looking something like this: The DOM lists all the titles found for this author, numbered sequentially. And even though the final screen’s worth of data contains a significant amount of information duplicated from the preceding screen, our DOM contains no duplicate titles. 66 Telnet Connect User’s Guide Performance Considerations You can perform millisecond-based timing of your Action Model’s actions by wrapping individual actions (or block of actions) in timing calls. ¾ To time an Action: 1 Click into the Action Model and place a new Function Action immediately before the action you wish to time. (Right-mouse-click, then New Action > Function.) 2 In the Function Action, enter an ECMAScript expression of the form: startTime = Number(new Date) 3 Insert a new Function Action immediately after the action you wish to time. 4 In the Function Action, enter an ECMAScript expression of the form: endTime = Number(new Date) 5 Create a Map Action that maps endTime – startTime to a temporary DOM element. (Rightmouse-click, New Action > Map.) 6 Run the Component. (Click the Execute button in the main toolbar.) If you do extensive profiling of your Action Model, you will probably find that the overwhelming majority of execution time is spent in Check Screen actions. (You will seldom, if ever, encounter a Check Screen that executes in less than 150 milliseconds.) Two implications of this worth considering are: ‹ ‹ ECMAScript expressions (in Map and/or Function actions) will seldom, if ever, be a performance consideration for the component as a whole. Overall component performance rests on careful tuning of Min Wait and Timeout values in Check Screen actions. Finally, remember that testing is not truly complete until the deployed service has been tested (and proven reliable) on the app server. For additional performance optimization through the use of shared connections, be sure to read the next chapter, on Logon Components. Advanced Telnet Actions 67 68 Telnet Connect User’s Guide 6 Logon Components, Connections, and Connection Pools This section discusses certain features available in the Telnet Connect designed to maximize performance of deployed services. About Telnet Session Performance The overall performance of any service that uses back-end connectivity is usually dependent on the time it takes to establish a connection and begin interacting with the host. Obtaining the connection is “expensive” in terms of wait time. One strategy for dealing with this is connection pooling, a scheme whereby an intermediary process (whether the app server itself, or some memory-resident background process not associated with the server) maintains a set number of preestablished, pre-authenticated connections, and oversees the “sharing out” of these connections among client apps or end users. Connection pooling overcomes the latency involved in opening a connection and authenticating to a host. But in terminal-based applications, a considerable amount of time can be spent “drilling down” through menu selections and navigating setup screens in order to get to the first bonafide application screen of the session. So even when connections are reused through pooling, session-prolog overhead can be a serious obstacle to performance. Composer addresses these issues by providing connection pooling, managed by a special kind of component (called a logon component) that can maintain an open connection at a particular “drill-down” point in a terminal session, so that clients can begin transactions immediately at the proper point in the session. When Will I Need Logon Components? Logon Components are useful in several types of situations: ‹ ‹ ‹ When you have a need for multiple tiers of pooling based on multiple security challenges within your system. (For example, users may need one set of logon credentials to get into the network, another to get into the mainframe, and another to get into database.) Serial log-in requirements may dictate the use of multiple logon components. When your service needs stateful “session-based” connections. When you need the performance advantages available through connection pooling. If performance under load is not a high-priority issue and your connectivity needs are relatively uncomplicated, you may not need to use Logon Components at all. But there is no way to know if performance is adequate merely by testing services at design time, on a desktop machine. Logon Components, Connections, and Connection Pools 69 Components and services built with the Telnet Component Editor may appear to execute quickly at design time (in Animation Mode, for example). But in real-world conditions—which is to say under load, with dozens or even hundreds of requests per second arriving at the server—session overhead can be a significant factor in overall transaction time. The only way to know whether you need to use the special performance enhancement features described in this chapter is to do load testing on a server, under test conditions that mimic real-world “worst case” conditions. Connection Pool Architecture When you install the Connect for Telnet, two types of Connection Resources are added to the Connection creation wizard: ‹ ‹ Telnet Connection Telnet Logon Connection (henceforth referred to as a Logon Connection) The Telnet Connection is a true terminal connection and (when used by a Telnet component) can establish a session with a host system. This is the connection-type we have been using throughout this Guide. The Telnet connection resource is designed to make an individual connection to the host on an as-needed basis. The connection is made just-in-time and discarded as soon as the client is done. It is not reused in any way. The Logon Connection, on the other hand, is different. It defines a pool of User IDs and passwords, each of which can make its own connection. The Logon Connection also serves as an indirection layer to allow clients to connect to the host at exactly the point in the host program (exactly the screen) where the client needs to start. This entry-point-location behavior is made possible by the Logon Component. (A Logon Connection always uses a Logon Component to get to the actual connection.) The architecture is shown in the graphic below. 70 Telnet Connect User’s Guide A Connection Resource is always required in order to get to the host. (This is true for any Composer service that uses Telnet components.) For simplicity, this diagram shows the Connection Resource going directly to the host; in the real world, there may be intervening delegation layers for security purposes. The Logon Component contains Actions (an action model) designed to find a particular screen of interest in the host program. This drill-down location is the effective entry point of the transaction for any upstream process that uses this Logon Component. You can think of the Logon Component as a gobetween between the physical connection (represented by the Connection Resource) and the logic layer (represented by the Telnet Component itself. In order for a Telnet Component (at the top of the diagram) to use a Logon Component, it needs to enlist the aid of a Logon Connection resource. The Logon Connection is the bridge between the Telnet Component and the Logon Component. The kinds and responsibilities of the various objects discussed above are summarized in the following table. Object Role Telnet Connection Resource Allows a connection to be established with a host system. Logon Component Specialized type of component in which the action model contains Logon, Keep Alive, and Logoff action blocks. This component can maintain a connection at a particular launch screen in a host program. Logon Connection Specialized type of Connection Resource that associates a pool of UserIDs and passwords with a given Logon Component type. At runtime, connections are established for client processes on demand (and reused), with one Logon Component instance per connection. Every connection in the pool provides ready access to a given point (a particular launch screen) in the host program, thanks to the associated Logon Component (see above). Telnet Terminal Component Contains the action model that comprises the business logic for a particular Telnet interaction (or transaction). Logon Components, Connections, and Connection Pools 71 The Logon Connection’s Role in Pooling The Logon Connection differs from the ordinary “host-direct” connection resource in that it manages pooling (the sharing of connection instances and Logon Component instances at runtime). In the context of a Composer service, pooling not only allows reuse of (open) connections at runtime, it also increases the effective bandwidth of a deployed service. Consider the simple case where you’ve designed a Telnet component that uses a regular connection resource. In creating the connection resource, you will have specified a UserID and password for the resource to use so that at runtime, the component can log in to the host. When an actual running instance of your component is using that connection, no other instance of the component can log in to the host using that same set of credentials. The bandwidth of your service is limited to one connected instance at a time. With a Logon Connection, on the other hand, numerous host connections can be maintained in a “live” state so that multiple instances of your component can access the host (each on its own connection) without waiting. Throughput is dramatically increased. The diagram below shows one possible runtime case where three component instances (two instance of Telnet Terminal Component A and one instance of Telnet Terminal Component B) are executing on the server. Instance 1 of Component A is using UserID ‘E’ to obtain a connection. This component has its own dedicated instances of Logon Component M and Connection S. Terminal Component B has just finished executing and is relinquishing its connection (established through credentials defined by UID ‘F’). Note that because connection pooling is in effect, Component B’s downstream resources (its Logon Component instance, M2, and its Connection instance, S2) are not simply discarded; they remain live. As a result, Terminal Component A2 is able to obtain (reuse) the M2/S2 resource instances that were previously held byTerminal Component B. In this diagram, Logon Connection D is associated with four connections based on four UIDs (user IDs or credentials: A-thru-F). One is in use; another (UID ‘F’) is alive but not being used; and two are inactive but available (i.e., valid UIDs have been assigned, so these two connections can be made live at any time). How Many Pools Do I Need? It’s possible for several different Telnet components to draw from the same connection pool. It’s also possible for different components to draw from different pools. This means different Logon Connections. An important factor in deciding how many Logon Connection resources (in effect, how many pools) your service needs is the number of different start screens (or entry point screens) needed by the various components in your project. Suppose Terminal Component A needs to begin its work at a particular starting screen in a host application, but you’ve also designed another component—Terminal Component B—that needs to start on a different screen. Components A and B will need separate Logon Connections, and the separate Logon Connections will point to separate Logon Components. (In any given connection pool, Composer objects are shared in such a way that every user of the pool must start at the same screen.) 72 Telnet Connect User’s Guide Pieces Required for Pooling The combination of a Logon Connection, a Logon Component, and its Connection Resource form the basis of a connection pool. Starting from the host layer and working up the chain: ‹ ‹ ‹ The Connection Resource defines the most basic parameters necessary for establishing a connection with the host. When connection pooling is in effect, runtime instances of this object are kept alive and reused. The Logon Component defines the set of steps (actions) necessary to get to a particular entry point in the host program. (At runtime, an instance of this component will actually carry out those steps in order to arrive at, and maintain ready-to-use, a particular screen location in the host program.) When connection pooling is in effect, instances of this object are kept alive and reused. The Logon Connection is a special type of resource that contains all the information needed to define a connection pool. This resource is designed to encapsulate pool-management info and does not establish host connections directly; instead, it delegates those responsibilities to the Logon Connection (which delegates them, in turn, to the appropriate Connection Resource). How Do I Implement Pooling? To create the various pieces required for pooling, you’ll go through the following basic steps (each of which will be discussed in greater detail in the sections to follow): 1 First, you’ll create a basic Telnet connection resource, as demonstrated in Chapter 2 of this Guide. 2 Next, you’ll create a Logon Component that uses the connection resource defined in Step 1. As part of this process, you’ll create an action model designed to navigate to a certain point in the host program. 3 You will create a Logon Connection resource, which is a specialized type of connection resource that relies on a Logon Component (from Step 2) to make the basic connection (through the resource defined in Step 1). 4 Finally, you’ll create a Telnet Terminal Component and associate it with the Logon Connection resource of Step 3. These steps are described in detail starting with the discussion in “Creating a Connection Pool” further below. Before going to that section, however, you should become familiar with the design principles behind the Logon Component (and also the Logon Connection). We’ll start with the Logon Component, since it’s impossible to create a Logon Connection without using a Logon Component. The Telnet Logon Component The Logon Component is a special type of component: It has an Action Model, yet can be used as a connection resource as well. The Action Model of this type of component is designed to manage a connection that will be used by multiple Telnet Terminal Components. In most respects, the Logon Component is the same as a Telnet Terminal component. The differences are: 1 In a Logon Component, the Action Model is organized around connection-management tasks. Those tasks are implemented via special actions: the Logon Action, Keep Alive Action, and Logoff Action. 2 A Logon Component is not invoked directly by another component or service. Its invocation is under the control of a Logon Connection. NOTE: A Logon Component must and can only be used in conjunction with a Logon Connection. Logon Components, Connections, and Connection Pools 73 Instead of calling the Logon Component directly, using (for example) a Component Action, you will associate the Logon Component with a special connection resource called a Logon Connection. When your Telnet Terminal Component executes, it executes via the Logon Connection, which in turn executes the Logon Component. Logon, Keep Alive, and Logoff Actions The Logon Component provides several screen-management capabilities that are important factors in overall performance. These capabilities are implemented in terms of Logon, Keep Alive, and Logoff actions: ‹ ‹ ‹ Logon Actions—These actions navigate through the host environment and park at a desired launch screen in the host system. The connection is activated using UserIDs from the pool. The Telnet Terminal components that subsequently reuse the connection have the performance benefit of already being at the launch screen and won’t incur the overhead of navigating to the launch screen as if they had come in under their own new session. Keep Alive Actions—These actions do two important tasks. First, they prevent the host from dropping a connection if it is not used within a standard timeout period defined by the host. Second, these actions must insure that the connection is always positioned at the “launch screen in the host, even after performing the Keep Alive actions needed to prevent the connection from dropping (the first important task). Logoff Actions—These actions exit the host environment in a manner you prescribe for all the connections made by User IDs from the pool, when a connection is being terminated. These actions and their meanings will be discussed in greater detail below. For now, it’s enough to know that these three action groupings are created for you automatically when you first create a Logon Component. Note the (empty) Logon, Keep Alive, and Logoff action blocks in the action model shown below: Logon Actions Actions you place in the LOGON group are primarily concerned with signing into the host security screen and then navigating through the host menu system to a launch screen where each Telnet component's Action Model will start. It is important that any Telnet component using a Logon component be able to start execution at the same common screen. Otherwise, the performance gains of avoiding navigation overhead won't be realized and more importantly, the odd Telnet component won't work. You can create actions under the Logon Actions block the same way as you would in an ordinary Telnet Terminal Component—namely by using the Record feature to create (in real time) whatever actions are necessary in order to enter sign-on info such as User ID and Password (as well as your initial menu choices to arrive at the launch screen). 74 Telnet Connect User’s Guide NOTE: Remember to use the User IDs and Passwords from the Logon Connection Pool. (See the discussion in “Creating a Logon Connection using a Pool Connection” on page -82.) To do this, you need to map the two special system variables called USERID and PASSWORD to the appropriate fields on the screen. By specifying these two variables, you make it possible for exteNd Composer to automatically locate and use values from the next active and free Pool slot. The launch screen is a common point of execution for all the Telnet Terminal Components that use the User ID pool provided by a Logon Connection. The Logon actions in a Logon Component (which are executed only once when a new connection is established) let the calling component—your Telnet Terminal Component—begin execution at a given screen in the host program. Maximizing Performance with the Logon Component The Logon Actions must be structured properly and therefore always begin and end with a Check Screen Action as shown in the screen below. The final Check Screen action in the Logon block guarantees that control is not turned over to the Telnet Component before the screen of interest has arrived in the connection. Without this, the Telnet Component could start at an invalid screen, throw an exception, and possibly corrupt a transaction. NOTE: You may notice when animating a Logon Component that the ending Check Screen is skipped. This is normal design-time behavior. In a production environment , the actions in a Logon Component always execute in an interleaved manner with a Telnet Terminal Component. Animating a Logon Component from start to finish actually creates an abnormal sequence of events that would result in two Check Screens being processed in succession, which is not allowed. The performance benefit comes into play as a result not only of connection reuse but launch-screen reuse. For example, if a User ID pool of three entries is fully used and (ultimately) reused by the execution of a component fifteen times, the overhead of navigating to a menu item that executes the transaction of interest will occur only three times. Likewise, there will only be three logons to the host because the Logon actions at the top of a Logon Component are executed only once—when a new connection is activated (not when it is reused). This is key to obtaining maximum performance in a high-transactionvolume production settings. Logon Components, Connections, and Connection Pools 75 NOTE: When possible, use the Try/On Error action to trap potential logon errors that may be recoverable. Otherwise, the UserID trying to establish the failed logon will be discarded from the pool, decreasing the potential pool size. The pool size will remain smaller until you manually reset the discarded connections using the exteNd Composer Enterprise Server Console for Telnet. See Managing Pools Sections in this Chapter for more details. Keep Alive Actions The Keep Alive block is where you will place actions that “ping the host” in whatever way necessary to keep the connection alive so that it can be reused. Keep Alive actions usually involve sending a key like , to the host at some specified interval. However, if after sending the key the screen changes to some screen that is different than the launch screen, you must be sure to return the Logon Component to the launch screen in the Keep Alive section. Failure to do so will leave the next component at an incorrect screen, causing it to fail. In Telnet connections, you may type a letter and then use backspace to erase it. See the following screen. This will create and send a buffer action to the Host. This action allows interaction to be maintained with the Host and keeps the terminal connected. This escape sequence corresponds to “1” and “Backspace.” The Pool Info dialog of a Logon Connection setup dialog (see discussion in “Creating a Logon Connection using a Pool Connection” on page -82) is where you control how often the Keep Alive actions will execute. If you specify in your Logon Connection pool that you would like to keep a free connection active for 60 minutes, but the host will normally drop a connection after two minutes of activity, you can specify keyboard actions to let the host know the connection is still active such as sending an key. 76 Telnet Connect User’s Guide interaction every 2 minutes active connection for 60 minutes Keep Alive actions may be executed multiple times, at intervals defined by the Keep Alive parameter defined on the Pool Info dialog of the Logon Connection. NOTE: The execution of the Keep Alive actions does not cause the Inactivity Lifetime clock to reset in the Logon Connection. Only a Telnet Component’s execution will reset the Inactivity Lifetime. The last action inside a Keep Alive block should be an empty but “enabled” navigation action. If a user disables this last action, animation will not work properly due to two consecutive empty navigation actions occurring. For example, if an action in Logon and the first action in Keep Alive are disabled, an error occurs. Maximizing Performance with Keep Alive Actions Check Screens must occur at the beginning and end of the Keep Alive section. Not only does the Keep Alive section prevent the connection from closing, but it must make sure that the launch screen is present when the execution is completed. The beginning Check Screen checks to make sure that during the time the connection was available but not in use, that an unexpected screen didn’t arrive from the host. And again, the ending Check Screen prevents releasing the connection to the next Telnet Component prematurely after executing the Keep Alive actions. See the following screen. Logon Components, Connections, and Connection Pools 77 Logoff Actions Logoff actions essentially navigate the User ID properly out of the host system after a timeout. Logoff actions execute only once for a given connection and only when a connection times out (i.e. the Inactivity Lifetime expires) or screen expression criteria is not met, or the connection is closed via the Telnet Server console. In a “best practices” sense, it’s vitally important to make Logoff Actions bulletproof. If an exception occurs during execution of the Logoff actions, exteNd Composer will break its connection with the host, freeing the UserID in the pool. But the UserID may still be active on the host. Until the host kills the UserID (from inactivity), a subsequent attempt by the pool to log on with that UserID may fail, unless you’ve coded your logon to handle the situation. Logon failures cause the UserID to be discarded from the pool, reducing the potential pool size and performance overall. As with Logon and Keep Alive actions, the way to guarantee you are on the proper screen at the end of the logoff is to end with a Check Screen. Logon Component Life Cycle Each time a User ID is activated from the Logon Connection Pool, an instance of the corresponding Logon Component is created and associated with that User ID. Then the Logon actions are executed until the desired launch screen is reached. At this point the Telnet Terminal component execution begins. When it is finished another Telnet Terminal component using the same Logon Connection may begin executing, starting at the same launch screen. If no other component requests the connection, then the connection-instance in question enters an active but free state (an “idle state”) defined by the Inactivity Lifetime and Keep Alive settings on the Pool Info dialog of the Logon Connection. If the Keep Alive period (e.g., 2 minutes) is shorter than the Inactivity Lifetime (e.g., 120 minutes), then at appropriate (2-minute) intervals, the Keep Alive actions will be executed, preventing a host timeout and dropped connection; and the Keep Alive Period begins anew. A Logon Component’s execution lifetime is dependent on the activity of the Logon Connection that uses it. As long as one entry in the Logon Connection pool is active, then one instance of the Logon Component will be in memory in a live state. A Logon Component instance will go out of scope (cease executing) when the last remaining pool entry expires due to inactivity. The only other way to stop execution of a Logon Component is through the Telnet Console on the Server. About the Telnet Connection The Logon Connection is not a true connection object like a Telnet Connection Resource, but a pointer to a Logon Component (which in turn connects to a host either through a conventional Connection Resource or yet more intervening Logon Connection/Logon Component pairs). The Logon Connection encapsulates information needed to describe a pool of connections. That includes User IDs and passwords, plus pool settings involving the time interval between retries on discarded connections, etc. Another function of the Logon Connection is that it ensures the use of different instances of the same Logon Component for all the User IDs for which connections are made. The dialogs you’ll use in setting up a pool of User IDs for a Logon Connection are shown in the following set of illustrations. Arrows denote the buttons that lead to continuation dialogs. 78 Telnet Connect User’s Guide Every Logon Connection is associated with a given Logon Component. In addition, the Logon Connection provides the following User ID pool functionality: 1 It allows the specification of multiple User IDs in advance ensuring that clients are able to secure a connection when one is needed 2 It allows the reuse of a User ID/connection once it is established to eliminate repeated user authentications and disconnects 3 It allows a single User ID to use multiple connections if this is supported by the host system 4 It keeps a connection active to prevent host timeouts during inactive periods 5 It lets you specify when to remove a connection from the active pool 6 It sets a timeout period to use for a fully active pool to provide a free connection 7 It lets you specify error handling dependent on the state of the Logon Component used by the Logon Connection Many-to-One Mapping of Components to Logons In order for multiple instances of a Telnet component or different Telnet components to use the same Logon Connection, the following conditions must be met: 1 All the Telnet components must use the same Connection Resource (thereby sharing the Telnet Host, Port and Terminal type). 2 All the Telnet components must have a common launch screen in the host system from which they can begin execution (see “The Telnet Logon Component” above for more detail). Logon Components, Connections, and Connection Pools 79 Connection Pooling with a Single Sign-On If your host system security supports multiple logins from a single user ID, you may have circumstances where you wish to pool the single User ID. This can be accomplished by performing the following steps: ‹ ‹ ‹ Specify a User ID/Password in the Connection Resource used by the Logon Component On the Pool Info dialog of the Logon Connection, specify a Pool Size greater than one Do NOT check the Override the UID/PWD setting in the Pool Info dialog of the Logon Connection. These steps will cause each pool slot to use the User ID and Password contained in the Connection object and not use and user IDs from the pool. Creating a Connection Pool Overview When creating a Telnet Terminal component, you normally create the Connection object it needs first. Similarly, when creating the objects comprising a Connection Pool, you must create certain objects first, starting (in essence) at the host and working your way backwards to the Telnet Terminal Component that will access the host. A typical sequence of steps for creating a Connection Pool is outlined in the diagram below: Step One: Create a basic host Connection Resource Step Two: Create Logon Component that uses basic Connection Step Three: Create Logon Connection that uses Logon Component Step Four: Create standard Components using Logon Connection Creating a Basic Telnet Connection This step is simple. Create a new Connection Resource as described in “To create a Telnet Connection Resource:” on page -14 of this Guide. Even though you will be using User IDs and Passwords defined in the Logon Connection later, you should still define one in the Connection as well. This will be needed when you define the Logon Component in the next step. Alternatively, you can simply use an existing Connection Resource. 80 Telnet Connect User’s Guide Creating a Logon Component ¾ To create a Telnet Logon Component: 1 From the Composer File menu, select New> xObject, then open the Component tab and choose Telnet Logon. The Header Info panel of the New xObject Wizard appears. 2 Type a Name for the component. 3 Optionally, type Description text. 4 Click Next and the Connection Info panel appears. 5 Select a Connection from the drop down list. (This will be the basic connection, not the logon connection.) 6 Click Finish and the Logon Component Editor appears. NOTE: Recording actions follows a series of steps. The cursor must be positioned over LOGON; then turn Record on, and when you are done, turn Record off. Position the cursor to Keep Alive, turn Record on, and when you are done, turn Record off. Position the cursor to LOGOFF, turn Record on, then when you are done, turn Record off. 7 Record Logon Actions for logging into the host and navigating to the launch screen using the same Recording techniques described in Chapter 4 of this Guide. Logon Components, Connections, and Connection Pools 81 8 Edit the Logon Map actions that enter a User ID and Password to instead use the special USERID and PASSWORD variables described in the section titled "Telnet Specific Expression Builder Extensions” in Chapter 4 of this Guide. 9 Create the needed SEND Buffer actions in the Keep Alive section of the Action Model (a quick way is to copy an existing SEND key action, Paste it, and then modify the key code sent). 10 Record Logoff actions for properly exiting the host 11 Save and Close the logon Component. Creating a Logon Connection using a Pool Connection ¾ 82 To create a Telnet Logon Connection: 1 From the Composer File menu, select New> xObject, then open the Resource tab and select Connection, or you can click on the icon. The Header Info panel of the New xObject Wizard appears. 2 Type a Name for the connection object. 3 Optionally, type Description text. Telnet Connect User’s Guide 4 Click Next and the Connection Info panel appears. 5 For the Connection Type select "Telnet Logon Connection" from the drop down list. 6 In the Logon Via control, select the Logon Component you just created. 7 Click on the Pool Info button and the Pool Info dialog appears. 8 Enter a Pool Size number. This represents the total number of connections you wish to make available in this pool. For each connection, you will be expected to supply a UserID/Password combination later. 9 Enter a Keep Alive time period. This number represents (in minutes) how often you wish to execute the Keep Alive actions in the associated Logon Component whenever the connection is active but free (i.e. not being used by a Telnet component). The number you enter here should be less than the Timeout period defined on the host for an inactive connection. 10 Enter an Inactivity Lifetime. This number represents (in minutes) how long you wish to keep an active free connection available before closing out the connection and returning it to the inactive portion of the connection pool. Remember, that once the connection is returned to its inactive state in the pool, it will incur the overhead of logging in and navigating host screens when it is reactivated. Logon Components, Connections, and Connection Pools 83 11 Enter an Entry Wait time in seconds. This time represents how long a Telnet component will wait for a free connection when all the pool entries are active and in use. If this time period is reached, an Exception will be thrown to the Application Server. 12 Checking Override UID/PWD means you wish to specify User ID/Password combinations for use in the connection pool. When checked, this activates the Set USERID/PASSWORD button. Click on the button to display the Set USERIDs and PASSWORDS dialog. Add Delete Paste On the Toolbar there are three icons: Add which adds an empty row, Delete, which deletes a highlighted row and Paste which allows you to copy/paste information from a spreadsheet into the table. For more on this, see the following Note. NOTE: Alternate and faster ways to enter data are to copy data from a spread sheet and paste it into the table. Make sure your selection contains at least two columns, UserID and Password. The first and second column must contain data, all other columns will be disregarded. The first number column you see in the screen is automatically generated. Open the spreadsheet, copy the two columns and as many rows as needed. Open the table and immediately press the Paste button. You can also copy data from tables in a Microsoft Word® document using the same technique. 13 Enter as many USERID/PASSWORD combinations until you reach the size of the pool you specified and click OK. Pool size will be adjusted depending upon how many rows you entered. 14 Click OK to dismiss the “Set User IDs and Passwords” dialog and return to the Pool Info dialog. 15 Optionally check the Use Sequential Connections control if you want Composer to establish connections in the same order that User IDs were listed in the “Set User IDs and Passwords” dialog. Connections will be made in numerical sequence. 16 Optionally check the Reuse connection only if expression is true control. This control allows you to enter an ECMAScript expression that evaluates to true or false based on some test of the launch screen. The purpose of the expression is to check to make sure the launch screen is the proper one each time a new Telnet Component is about to reuse an active free connection. Under circumstances unrelated to your Composer service, it’s possible that the launch screen will be replaced by the host with a different screen. For instance, if there is a system ABEND on the host, the launch screen in the Logon Component may be replaced by a System Message screen. The following a is a sample Custom Script used to see if a particular screen is present. If it is not, the script writes a message to the console stating that the screen is bad and the logon connection is being released. This function is called from the “Reuse connect only if expression is true” control on the Pool Info dialog. 84 Telnet Connect User’s Guide function checkValidLaunchScreen(ScreenDoc) { var screenText = ScreenDoc.XPath("SCREEN").item(0).text if((screenText.indexOf( "MENU") != -1 || screenText.indexOf("APLS") != -1) && (screenText.indexOf("COMMAND UNRECOGNIZED") == -1 || screenText.indexOf("UNSUPPORTED FUNCTION") == -1)) { return true; } else { java.lang.System.out.println("Warning - Releasing logon connection at bad screen"); java.lang.System.err.println("Warning - Releasing logon connection at bad screen"); return false; } } 17 Click OK to return to the Connection Info panel. 18 Click on Finish and the Logon Connection is saved. Maximizing Performance of Telnet Logon Connection To prevent Telnet Components from beginning execution on a connection that may have been left on an invalid screen by a previous Telnet component, the Logon Connection Resource allows the connection itself to check for the presence of the launch screen. This is accomplished by using the option titled “Reuse connection only if expression is true” on the Pool Info dialog of the Logon Connection. The screen test you specify here is executed each time a Telnet Component completes execution. If the test fails, exteNd Composer will immediately disconnect from the host, possibly leaving a dangling UserID on the host. As noted before, the host will eventually kill the user, but the UserID may be discarded from the pool if it is accessed again before being killed, thereby reducing the pool size and consequently overall performance. Another reason to use the “Reuse connection only if true” option is that you can perform very detailed tests against the screen to make sure it is your launch screen. While Map Screen actions do perform a screen check, they only look at the number of fields in the terminal data stream. In most cases, this is sufficient. However, it is possible two different screens can have the same number of fields in which case the expression based test that examines the content of the screen will produce more rigorous results. A best practices approach mandates that you use this feature all the time. Static versus Dynamically Created Documents/Elements In some Composer applications, users have a need to place various control, auditing, and/or meta-data in an XML document. This document may or may not be in addition to the actual elements/documents being processed (i.e. created from an information source). If this document structure and data is dynamically created by multiple Map actions (i.e. over 100) performance of the component and therefore the entire service may suffer. To boost performance, create the portion of the document structure without the dynamic content ahead of time, then load it into the Service at runtime via an XML Interchange action and retain the Map actions for dynamic content. This can boost performance as much as 30% in some cases. Logon Components, Connections, and Connection Pools 85 Creating a Logon Connection using a Session Connection Sometimes, you may want the extra level of control over session parameters that a Logon Connection affords, without necessarily wanting to use pooling. In this case, you can follow the procedure outlined below. ¾ To create a Telnet Session Connection: 1 From the Composer File menu, select New> xObject, then open the Resource tab and select Connection, or you can click on the icon. The Header Info panel of the New xObject Wizard appears. 86 2 Type a Name for the connection object. 3 Optionally, type Description text. 4 Click Next and the Connection Info panel appears. 5 For the Connection Type select “Telnet Logon Connection” from the drop down list. 6 In the Connect Via control, select the Logon Component you just created. Telnet Connect User’s Guide 7 Click the Session Connections radio button and then on Session Info. 8 The Keep Alive (minutes) number represents (in minutes) how often you wish to execute the Keep Alive actions in the associated Logon Component whenever the connection is active but free (i.e. not being used by a Telnet Terminal component). The number you enter here should be less than the Timeout period defined on the host for an inactive connection. 9 The Inactivity Lifetime (minutes) number represents (in minutes) how long you wish to keep an active free connection available before closing out the connection and returning it to the inactive portion of the connection pool. Remember, that once the connection is returned to its inactive state in the pool, it will incur the overhead of logging in and navigating host screens when it is reactivated. 10 Click in the checkmark box if you want to Reuse connection only if expression is true. If you choose to do so, the expression field automatically displays and you can click on the expression icon to display the if the expression is true dialog. Creating a Telnet Component That Uses Pooled Connections At this point, you are ready to create a Telnet Component that can use the Connection Pool. For the most part, you will build the component as you would a normal Telnet component, the only difference being the Connection you specify on the New xObject Wizard. (You’ll specify a Logon Connection instead of a regular Telnet Connection.) Logon Components, Connections, and Connection Pools 87 ¾ To create a Telnet Component: 1 From the Composer File menu, select New > xObject, then open the Component tab and select Telnet. The Header Info panel of the New xObject Wizard appears. 2 Type a Name for the component. 3 Optionally, type Description text. 4 Click Next and the XML Property Info panel appears. 5 Select the necessary Input and Output Templates for your component. 6 Click Next. The Connection Info panel appears. 7 Select the Logon Connection you created and click on Next. The Component editor appears. 8 Build the component as described in “To create a new Telnet Component:” on page -17 of this Guide. Maximizing Performance of Telnet Terminal Components Once the launch screen is obtained by the logon Component’s logon actions, it is handed to the Telnet Terminal Component that uses the connection. Then the Telnet Terminal component (when finished executing) leaves the screen handler back at the launch screen. If the Telnet Component finishes without being on the launch screen,(i.e. it releases the connection back to the pool with an invalid screen) then it is possible that all subsequent Telnet Components that use the connection may throw exceptions rendering the connection useless. It also will degrade overall performance and possibly cause data integrity problems within the component processing. Once again, to ensure that the launch screen is present, the last action to execute in a Telnet Component must be a Check Screen that checks for the launch screen. This can be tricky if your component has many decision paths that may independently end component execution. You must be sure that each path ends with a Check Screen action. 88 Telnet Connect User’s Guide Managing Pools Connections pools can be managed through the Telnet Console Screen. ¾ How to Access the Console 1 If you are using the Novell exteNd Application Server, log on to your Server via your web browser using http://localhost/SilverMaster50 (or whatever is appropriate for the version in use). In this example, Novell exteNd App Server 5.0 is used. NOTE: If you are not using the exteNd app server, enter a URL of this form: http://:/exteNdComposer/Console 2 Click on the exteNd Composer link and a list of installed Connects displays to the left of the main console page: Logon Components, Connections, and Connection Pools 89 3 90 Click on the Telnet link in the left (nav) frame and the Telnet Console General Properties Screen will come into view. Telnet Connect User’s Guide 4 Click on Console. A browser popup window (the Telnet Connection Pool Management Screen) should appear. 5 To initialize a Logon Connection Pool, enter its deployment context, the word "connection", and the actual connection name in the text field near the bottom of the screen. (See illustration above.) Then click the Initialize Pool button. NOTE: Refer to the appropriate Composer Enterprise Server guide for more information. 6 Optionally click the Refresh Console button to update the view. Connection Pool Management and Deployed Services The Connection Pool Management Screen displays the current state of the connection(s) with the Telnet Connect. The screen contains a table listing the Pool Name, Description of the connection, the maximum number of connections in the pool, the number of connections in use, the number of connections available, the number of connections discarded. It also contains several buttons allowing you to perform various actions related to connection pooling, which are outlined in the table below. Button Name Action Reset Discarded Resets the Discarded connections which are then reflected in the table Reset (Pool) Resets the Available and Discarded connections which are then reflected in the table Refill (Pool) Refills the pool with the maximum number of connections Additional Buttons on Telnet Connection Pool Manager Console Refresh Console Shows the current status of the connection pool Initialize Pool Initializes a Logon Connection Pool by entering a relative path to the deployed lib directory. This will not work unless the deployed jar is extracted. Click on the SUBMIT button when finished. Logon Components, Connections, and Connection Pools 91 Connection Discard Behavior The performance benefits of connection pooling are based on the ability of more than one user to access a resource, or set of resources, at once. The way a connection is established begins with the logon component picking the User ID and Password from the table. If the connection fails, then it is discarded for this User ID and Password and tries another until a connection is established. The failure of one connection doesn’t necessarily prevent a successful connection from being established. The Connect for Telnet addresses the “one bad apple” problem by discarding any connection that can’t be established (for whatever reason: bad user ID, timed-out password, etc.) and reusing the others. When a connection is determined to be unusable, the Connect for Telnet will write a message to the system log that says: “Logon connection in pool was discarded for User ID .” Screen Synchronization Screen synchronization has special ramifications for users of pools. If a situation arises in which a user leaves a connection without the screen returning to its original state, the next user will begin a session with the screen in an unexpected state and an error will occur. To prevent this, we have a screen expression which the user can specify in the connection pool. It is important that the last action in a Telnet Component be a correct Send Key action that will result in the session ending with the correct logon screen active. NOTE: The last action should be an empty Check Screen action so that the Telnet Terminal component waits until the launch screen arrives before giving up the connection. (This should happen automatically, when you create the Send Key action, but nevertheless, the last action should be the Check Screen.) If you want to check, at runtime, for the presence of a bad screen at the end of a user session, include a Function action at the end of your component’s action model that executes a function similar to the one shown below: function checkValidReleaseScreen(ScreenDoc) { var screenText = ScreenDoc.XPath("SCREEN").item(0).text if((screenText.indexOf( "MENU") != -1 || screenText.indexOf("APLS") != -1) && (screenText.indexOf("COMMAND UNRECOGNIZED") == -1 || screenText.indexOf("UNSUPPORTED FUNCTION") == -1)) { return true; } else // Write error messages to // System.out and System.err: { java.lang.System.out.println("Warning - Releasing logon connection at bad screen"); java.lang.System.err.println("Warning - Releasing logon connection at bad screen"); return false; } } This function checks the screen text and returns false if the final screen is not correct. The check returns true if the screen contains “MENU” or “APLS” and does not contain “COMMAND UNRECOGNIZED” nor “UNSUPPORTED FUNCTION.” 92 Telnet Connect User’s Guide A Glossary ANSI American National Standards Institute. Check Screen An action that action signals the component that execution must not proceed until the screen is in a particular state, subject to a user-specified timeout value. Dumb Terminal A computer terminal that has no onboard CPU, memory, or storage devices, beyond the minimum necessary to communicate with a more powerful host machine. ECMAScript Any JavaScript-like language that conforms to European Computer Manufacturers Association standard No. 262. Native Environment Pane A pane in the Telnet Component Editor that provides an emulation of an actual Telnet terminal session. Screen Object A special DOM in the Telnet (and 5250) component editor windows representing the current Telnet screen display as an XML document. Send Buffer An action that appears in the Action Model whenever a there is map to the screen or keys entered on the screen. TCP/IP Abbreviation for Transmission Control Protocol/Internet Protocol Telnet A specification (RFC854) for a communications protocol (TCP/IP) used for emulating a terminal on ANSI standard systems. Type-ahead A technique for preloading a keyboard buffer with more than one screen’s worth of commands. Terminal Emulation A technique for imitating the runtime behavior of a “dumb terminal” on a desktop (or other) machine. VT100 VAX Terminal, model 100. Also refers to the particular ANSI encoding used by this class of terminal. Glossary 93 94 Telnet Connect User’s Guide B Telnet Keyboard Equivalents Telnet Common Keys Arrow Down \u001b[B Arrow Left \u001b[D Arrow Right \u001b[C Arrow Up \u001b[A BackSpace \u0008 Back Tab \u001bOP\u0009 Delete \u007f Escape \u001b Linefeed \u000a Return \u000d Tab \u0009 Telnet Functional Keys F1-F20 F1 \u001bOP F2 \u001bOQ F3 \u001bOR F4 \u001bOS F5 \u001b[15~ F6 \u001b[17~ F7 \u001b[18~ F8 \u001b[19~ F9 \u001b[20~ F10 \u001b[21~ F11 \u001b[23~ F12 \u001b[24~ F13 \u001b[25~ Telnet Keyboard Equivalents 95 Telnet Functional Keys F1-F20 F14 \u001b[26~ F15 \u001b[28~ F16 \u001b[29~ F17 \u001b[31~ F18 \u001b[32~ F19 \u001b[33~ F20 \u001b[34~ Telnet NumPad Keys 0 \u001bOp 1 \u001bOq 2 \u001bOr 3 \u001bOs 4 \u001bOt 5 \u001bOu 6 \u001bOv 7 \u001bOw 8 \u001bOx 9 \u001bOy Minus \u001bOm Comma \u001bOl Period \u001bOn Enter \u001bOM Telnet Control Keys 96 ACK \u0006 ( CTRL+F ) BELL \u0007 ( CTRL+G ) BS \u0008 ( CTRL+H ) CAN \u0018 ( CTRL+X ) CR \u000d ( CTRL+M ) DC1 or XON \u0011 ( CTRL+Q ) DC2 \u0012 ( CTRL+R ) DC3 or XOFF \u0013 ( CTRL+S ) Telnet Connect User’s Guide Telnet Control Keys DC4 \u0014 ( CTRL+T ) DLE \u0010 ( CTRL+P ) EM \u0019 ( CTRL+Y ) ENQ \u0005 ( CTRL+E ) EOT \u0004 ( CTRL+D ) ESC \u001b ( CTRL+[ ) ETB \u0017 ( CTRL+W ) ETX \u0003 ( CTRL+C ) FF \u000c ( CTRL+L ) FS \u001c ( CTRL+\ ) GS \u001d ( CTRL+] ) HT \u0009 ( CTRL+I ) LF \u000a ( CTRL+J ) NAK \u0015 ( CTRL+U ) NUL \u0000 ( CTRL+SpaceBar ) RS \u001e ( CTRL+~ ) SI \u000f ( CTRL+O ) SO \u000e ( CTRL+N ) SOH \u0001 ( CTRL+A ) STX \u0002 ( CTRL+B ) SUB \u001a ( CTRL+Z ) SYN \u0016 ( CTRL+V ) US \u001f ( CTRL+? ) VT \u000b ( CTRL+K ) Telnet Other Keys Do \u001b[29~ Find \u001b[1~ Help \u001b[28~ Insert \u001b[2~ KeyEnd \u001b[F KeyHome \u001b[H NextScn \u001b[6~ PrevScn \u001b[5~ Telnet Keyboard Equivalents 97 Telnet Other Keys 98 Remove \u001b[3~ Select \u001b[44~ Telnet Connect User’s Guide C Telnet Display Attributes The Screen.getAttribute() method will return one of the values shown below, representing the current attribute state of the onscreen character at the given location. Number Attribute 0 normal display 1 bold on 2 faint 3 standout 4 underline (mono only) 5 blink on 7 reverse video on 8 nondisplayed (invisible) 30 black foreground 31 red foreground 32 green foreground 33 yellow foreground 34 blue foreground 35 magenta foreground 36 cyan foreground 37 white foreground 40 black background 41 red background 42 green background 43 yellow background 44 blue background 45 magenta background 46 cyan background 47 white background Telnet Display Attributes 99 Viewing All Character Attributes at Once Using the Screen.getAttribute() method, you can easily write a function that captures all attributes (at all screen locations) at once. The following ECMAScript function, for example, can be used at design time to display screen attributes in an alert dialog. function showAttributes( myScreen ) { var attribs = new String(); // create empty string // Iterate over all rows and columns: for (var i = 1; i <= myScreen.getRowCount(); i++, attribs += "\n") for (var k = 1; k <= myScreen.getColumnCount(); k++) attribs += myScreen.getAttribute(i,k); // display the results: alert( attribs ); } The following illustrations show a Telnet screen and the result of applying the showAttributes() function to the screen: 100 Telnet Connect User’s Guide Telnet Display Attributes 101 102 Telnet Connect User’s Guide D Reserved Words The following terms are reserved words in exteNd Composer for Telnet Connect and should not be used as labels for any user-created variables, methods, or objects. ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ ‹ USERID PASSWORD PROJECT Screen getAttribute getCursorColumn getColumnCount getPrompt getRowCount getText getTextAt getTextFromRectangle setText Reserved Words 103 104 Telnet Connect User’s Guide E Java Code Pages About Encodings exteNd Composer’s ability to perform character encoding conversions is tied directly to the Java VM in use. The supported encodings vary between different implementations of the Java 2 platform. Sun's Java 2 Software Development Kit, Standard Edition, v. 1.2.2 for Windows or Solaris and the Java 2 Runtime Environment, Standard Edition, v. 1.2.2 for Solaris support. The encodings can be found at the Sun web page: http://java.sun.com/products//jdk/1.2/docs/guide/internat/encoding.doc.html Sun's Java 2 Runtime Environment, Standard Edition, v. 1.2.2 for Windows comes in two different versions: US-only and international. The international version (which includes the lib\i18n.jar file) supports all encodings in both tables. Java Code Pages 105 106 Telnet Connect User’s Guide Index Symbols $PASSWORD 32 A About Adding Alias Actions 52 About the Telnet Connection 78 Accept Key Strokes 30, 31 actions, editing 46 Adding A New Action 50 Animation 48, 51 tools 55 animation 55 array, unduplicating an 61 attributes, screen 100 B binary search technique 58 blank record 64 breakpoint 58 breakpoints 48, 51, 55 buttons, toolbar 24 C caching screens 64 calculated Timeout 29 Changing an Existing Action 47 Check Screen Action 28 purpose of 28 Clancy, Tom 40 Code Pages encodings 105 support 16 comparing screens 64 Connection Discard Behavior 92 Connection Pool steps for creating 80 Connection Pool Console, refreshing 91 Connection Pool Management and Deployed Services 91 Connection Pooling with a Single Sign-On 80 Connection Pools implementing 73 steps in creating 80 Connection Resource 13, 70, 80 constant-driven 13 expression-based 13 how to create 14 ConnectionPools status 91 Connections logon 78 resetting discarded 91 CONSULS 37, 38 context menus 23 control keys (also see Appendix B) 31 coordinates, onscreen 41 Create Check Screen button 25 createXPath() method 65 Creating a Connection Pool 80 Creating a Logon Connection 82 Creating a Telnet Component 86 Cursor Position 29 Cutting/Copying actions 47 D debugging 56 Decision Action 43 default Min Wait time 30 default Timeout value 29 Deleting an Action 53 DOM 19 drag and drop 35, 47 dumb terminal 19 E ECMAScript Telnet-specific methods 32 unduplicating data with 60 editing an Action Model 46 errors and error messages 56 escape values 31 exceptions 30, 56 Expression Builder picklists in 32 Expression Editor 14 107 F F13 through F20 20 final screen, detecting 60 Floating Keypad 20 Function Action 63 G getAttribute() 33 getColumnCount() 33 getCursorColumn() 33 getCursorRow() 33 getPrompt() 34 getRowCount() 34 getText() 34 getTextAt() 34, 36 getTextFromRectangle() 34, 37 H handshaking 15 hard-coded values 63 Host or IP Address 15 hover-help box, escape codes and 31 I Inactivity Lifetime 77, 83, 87 index variables 63 indexOf() 43, 44 infinite loop 64 Initialize Pool 91 ISBN 38, 42, 44 iterating through screens 60 J join() method 65 K Keep Alive 87 KeepAlive Actions 73 L latency 29 launch screen 74 Logoff action 74 LOGOFF Actions 78 Logon action 74 Logon Actions 74 Logon Component definition 73 108 Logon Components creating 81 Logon Connections 70 looping over multiple screens 61 lTrim() 44 M Managing Pools 89 Maximizing Performance of Telnet Logon Connection 85 Maximizing Performance of Telnet Terminal Components 88 Maximizing Performance with KEEP ALIVE Actions 77 Maximizing Performance with the Logon Component 75 millisecond timing 67 Min Wait 28 default of 50ms 30 multiple screens, grabbing data from 59 N Native Environment Pane 19 newlines, in rectangular screen selections 37 non-printing characters 32, 35 non-printing keys 22 NumPad Keys 20, 21 O Output DOM notes, creating 62 Override the UID/PWD 80 Override UID/PWD 84 P padded screens 60 PASSWORD global 32 performance tuning 67 picklists 32 Pool Info dialog 76 pool size 83 pools checking status 91 implementing 73 initializing 91 refilling 91 resetting 91 Port 15 profiling 67 PROJECT Variables 14 Prompt 29 prompt string 56 property names 63 pseudocode 62 R readiness criteria 29 recording 22, 37 rectangular onscreen selections 36 redundant data, dealing with 60 Refill Pool 91 Refresh Consolel 91 RegExp constructor 43 RegExp() 43 regular expressions 43 rejection of duplicates 60 Repeat While action 64 Reset Discarded 91 Reset Pool 91 Reuse connection 87 RFC 854 10 To create a Telnet Component 88 To create a Telnet Logon Connection 82 Toggle Breakpoint 48, 51 toolbar buttons 24 troubleshooting 56 type-ahead 40, 57 U unduplicating records 60 Unicode 16, 32 USERID global 32 V S scraping data 59 scraping data from multiple screens 62 screen caching 64 Screen Object 22 API for all methods 33 screen scraping 11 Screen Selections 35 Screen Synchronization 92 screens, comparing 64 selecting onscreen data 35 Send Buffer PASSWORD 23 USERID 23 Send Buffer Action 30 creating 30 exiting 31 hover help in dialog 31 Record Mode and 31 setText() 35 Shift key down, dragging with 36 shift-drag selection technique 36 split() 44 spoofing 15 spoofing, logon 15 Static versus Dynamically Created Documents/Elements 85 Step to Breakpoint 48, 51 strategies for loop termination 59 synchronization 28 VAX 10 VT100 93 VT220 15 W While (Repeat-While action) 42 X XML Templates 16 XPath 30 XSL 11 T Telnet Connection types 70 Telnet specification 10 Temp XML Document 18 Terminal Type 15 testing 53 Thomas Aquinas 62 Timeout 28, 29, 30 Tips for building Telnet Components 55 109 110