Sample Applications


The Shell class provides a way for REALbasic to interact with the command line through an object-oriented interface. This means that you use the Shell to execute applications and to pass arguments to the application, just like you were typing the information yourself into the terminal. The Shell class will be covered first. The discussion includes an application called Ant Shell that provides a graphical interface to Ant, which is an open-source Java application developed by the Apache Foundation. It was developed to build Java applications, similar to the way that Make is used to build C++ applications, but it is an extremely powerful, easy-to-use tool, and it is normally run from the command line. The reason I have chosen to share an Ant application with you is that Ant build files are XML documents, so in addition to introducing the Shell, it also provides a little more insight into how you can use XML technology.

After the Shell, I will turn to developing an actual console application in REALbasic (you could actually execute a REALbasic console application using the Shell class, if you wanted to, but in most cases, I don't think that's a smart way to be doing things). The first console application is called Transformer, and it provides a command-line interface to the XMLDocument and XSLStyleSheet classes in REALbasic. The class used to do the transforming will be written so that it can be used in a console application as well as in a desktop application. This means that I will be able to use the same class in the RSSReader application that I use in the Transformer application.

I'll also be able to use the same class in another console application, called rbCGI, which will serve as the final example. This console application is a simple framework for writing CGI programs. CGI refers to the Common Gateway Interface, which is one method that is used to execute scripts and programs to dynamically generate websites. It's really a simple framework with a lot of limitationsdefinitely not something you would use if you had a very high-traffic site. However, if you have relatively simple needs, it can work quite well. The CGI framework could be used as a way to distribute dynamically produced RSS XML documents, or it could be an alternative way to view RSS files as HTML.

There are a few interesting points about the CGI application worth mentioning here. First, it shows how standard input and standard output can be used in different contexts. In the case of the CGI application, standard output is sent back to the web browser of the individual who made the original HTTP request, rather than being sent to the terminal. Also, some of the data used by the CGI application is passed in environment variables. CGI applications can use either standard input or the content of environment variables as the source of data used to execute the application.

In the ongoing effort to demonstrate the joys of code reuse, the CGI application will also use the same class that's used to transform XML documents in the RSSReader application and the Transformer application. This will allow the CGI application to get a request, find an RSS file, transform it to HTML, and present it to the user. You can think of it as a start to a web-enabled version of the RSSReader application I have been reviewing throughout the book. In fact, after you've read through the examples, you will begin to think of a lot of ways that these different examples can interact with each other.




REALbasic Cross-Platform Application Development
REALbasic Cross-Platform Application Development
ISBN: 0672328135
EAN: 2147483647
Year: 2004
Pages: 149

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net