Source Code Cross Referenced for RLoginClient.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » bsd » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.bsd 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2005 The Apache Software Foundation
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.apache.commons.net.bsd;
017:
018:        import java.io.IOException;
019:
020:        /***
021:         * RLoginClient is very similar to
022:         * {@link org.apache.commons.net.bsd.RCommandClient},
023:         * from which it is derived, and uses the rcmd() facility implemented
024:         * in RCommandClient to implement the functionality of the rlogin command that
025:         * first appeared in 4.2BSD Unix.  rlogin is a command used to login to
026:         * a remote machine from a trusted host, sometimes without issuing a
027:         * password.  The trust relationship is the same as described in
028:         * the documentation for
029:         * {@link org.apache.commons.net.bsd.RCommandClient}.
030:         * <p>
031:         * As with virtually all of the client classes in org.apache.commons.net, this
032:         * class derives from SocketClient.  But it relies on the connection
033:         * methods defined  in RcommandClient which ensure that the local Socket
034:         * will originate from an acceptable rshell port.  The way to use
035:         * RLoginClient is to first connect
036:         * to the server, call the {@link #rlogin  rlogin() } method,
037:         * and then
038:         * fetch the connection's input and output streams.
039:         * Interaction with the remote command is controlled entirely through the
040:         * I/O streams.  Once you have finished processing the streams, you should
041:         * invoke {@link org.apache.commons.net.bsd.RExecClient#disconnect disconnect() }
042:         *  to clean up properly.
043:         * <p>
044:         * The standard output and standard error streams of the
045:         * remote process are transmitted over the same connection, readable
046:         * from the input stream returned by
047:         * {@link org.apache.commons.net.bsd.RExecClient#getInputStream getInputStream() }
048:         * .  Unlike RExecClient and RCommandClient, it is
049:         * not possible to tell the rlogind daemon to return the standard error
050:         * stream over a separate connection.
051:         * {@link org.apache.commons.net.bsd.RExecClient#getErrorStream getErrorStream() }
052:         *  will always return null.
053:         * The standard input of the remote process can be written to through
054:         * the output stream returned by
055:         * {@link org.apache.commons.net.bsd.RExecClient#getOutputStream getOutputSream() }
056:         * .
057:         * <p>
058:         * <p>
059:         * @author Daniel F. Savarese
060:         * @see org.apache.commons.net.SocketClient
061:         * @see RExecClient
062:         * @see RCommandClient
063:         ***/
064:
065:        public class RLoginClient extends RCommandClient {
066:            /***
067:             * The default rlogin port.  Set to 513 in BSD Unix and according
068:             * to RFC 1282.
069:             ***/
070:            public static final int DEFAULT_PORT = 513;
071:
072:            /***
073:             * The default RLoginClient constructor.  Initializes the
074:             * default port to <code> DEFAULT_PORT </code>.
075:             ***/
076:            public RLoginClient() {
077:                setDefaultPort(DEFAULT_PORT);
078:            }
079:
080:            /***
081:             * Logins into a remote machine through the rlogind daemon on the server
082:             * to which the RLoginClient is connected.  After calling this method,
083:             * you may interact with the remote login shell through its standard input
084:             * and output streams.  Standard error is sent over the same stream as
085:             * standard output.  You will typically be able to detect
086:             * the termination of the remote login shell after reaching end of file
087:             * on its standard output (accessible through
088:             * {@link #getInputStream  getInputStream() }.  Disconnecting
089:             * from the server or closing the process streams before reaching
090:             * end of file will terminate the remote login shell in most cases.
091:             * <p>
092:             * If user authentication fails, the rlogind daemon will request that
093:             * a password be entered interactively.  You will be able to read the
094:             * prompt from the output stream of the RLoginClient and write the
095:             * password to the input stream of the RLoginClient.
096:             * <p>
097:             * @param localUsername  The user account on the local machine that is
098:             *        trying to login to the remote host.
099:             * @param remoteUsername  The account name on the server that is
100:             *        being logged in to.
101:             * @param terminalType   The name of the user's terminal (e.g., "vt100",
102:             *        "network", etc.)
103:             * @param terminalSpeed  The speed of the user's terminal, expressed
104:             *        as a baud rate or bps (e.g., 9600 or 38400)
105:             * @exception IOException If the rlogin() attempt fails.  The exception
106:             *            will contain a message indicating the nature of the failure.
107:             ***/
108:            public void rlogin(String localUsername, String remoteUsername,
109:                    String terminalType, int terminalSpeed) throws IOException {
110:                rexec(localUsername, remoteUsername, terminalType + "/"
111:                        + terminalSpeed, false);
112:            }
113:
114:            /***
115:             * Same as the other rlogin method, but no terminal speed is defined.
116:             ***/
117:            public void rlogin(String localUsername, String remoteUsername,
118:                    String terminalType) throws IOException {
119:                rexec(localUsername, remoteUsername, terminalType, false);
120:            }
121:
122:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.