net_readme

Net Components

Introduction

Net components provides SmartFrog components for FTP, Telnet etc.

How to build

  1. First build the SmartFrog framework by running ant dist in core/smartfrog

  2. Build ant tasks by running ant in core/extras/ant

  3. Build Logger by running ant in core/components/net

  4. Step creates networkComponents.jar file in directory core/components/net/ build/dist/lib

  5. Copy following jar files from core/components/net/ build/dist/lib to core/smartfrog/dist/lib or update class path for the SmartFrog daemon so that net classes are available at run time.

    1. Commons-net-1.2.0.jar

    2. networkComponents.jar

Usage

FTP Component

The FTP component is deployed as a SmartFrog component. When deployed it will download or upload the specified files.

Attributes

Table1
Attribute NameDescriptionOptional/Mandatory
ftpHostFTP host nameMandatory
usernameFTP User NameMandatory
transferTypeType of file transfer ( possible values "get"/"put")Optional (Default is "get")
transferModeMode of file transfer Optional (Default is "ascii")
localFilesList of local files in the form of a vector. Fully qualified, comma separated file names.Mandatory
remoteFilesList of remote files corresponding to local files in the form of a vector.Mandatory
passwordProviderReference to password provider component. By default FilePasswordProvider is used.Mandatory
shouldTerminateBoolean attribute enables self termination of the FTP component after it upload/download files.Optional ( Default is true)

Please refer to ftpExample.sf for a sample usage of the FTP component.

Telnet Component

Telnet component is deployed as a SmartFrog component. When the component is started, it issues the series of telnet commands to the remote host.

Attributes

Table2
Attribute NameDescriptionOptional/Mandatory
HostTelnet host nameMandatory
UsernameTelnet User NameMandatory
commandsComma separated list of command to be executed in telnet session.Mandatory
passwordProviderReference to password provider component. By default FilePasswordProvider is used but user can provide their own Password providers such as Database and DirectoryServer password providers by implementing PasswordProvider interface method getPassword().Mandatory
timeoutTime in milli seconds. Beyond this time telnet component stops waiting on telnet input stream for some response.Optional ( default value is 30000 ms)
portTelnet PortOptional (default value is 23)
shellPromptShell Prompt expected after login in telnet sessionOptional (default value is "#")
logFileLog file used to log all activities in a telnet session. This could be useful for debugging.Optional
shouldTerminateBoolean attribute enables self termination of the Telnet component after executing telnet commands.Optional ( Default is true)

Please refer to telnetExample.sf for a sample usage of Telnet component.

Security

Remember that neither telnet or FTP are secure protocols; both send passwords in clear text when a session is made, and neither perform any rigorous verification that the remote server is the one that is normally used.

The FilePasswordProvider uses passwords stored in a text file. This text file should have restricted permissions: only the user that the SmartFrog daemon runs as needs read access. Because the passwords are kept out of the .sf files, these file do not need to be kept secret, and can be stored in public locations.