Downloading & Installing Sky Framework

Prerequisites

Before downloading and installing Sky web application development framework, make sure that the following software is installed on your computer.

J2SE
Sky framework is compatible with JDK 1.4.1_01 or higher versions. However, keep in mind that the latest version of eclipse supports only JDK 1.4.1_01. So if you want to develop sky-based web applications using eclipse development platform, then download and install JDK 1.4.1_01 only. After installing JDK, make sure that the environment variable JAVA_HOME has been properly set and the PATH environment variable has been modified to include %JAVA_HOME%\bin directory.

Ant
We recommend installing Ant version 1.6.1 or higher. You would need ant to build sky-based web applications. After installing Ant, make sure that the ANT_HOME environment variable has been properly set and the PATH environment variable has been modified to include %ANT_HOME%\bin directory. Once you have installed Ant, you are ready to download sky framework and start developing applications.

Apache Tomcat
Sky framework supports Apache Tomcat version 3.2.4 or higher version. After installing apache tomcat, make sure that the TOMCAT_HOME environment variable has been set and the PATH environment variable has been modified to include %TOMCAT_HOME%\bin directory. You may validate your tomcat installation by attempting to run some of the sample applications that come with tomcat.

Eclipse Development Environment (optional)
If you wish to use a graphical development environment for developing applications, we recommend Eclipse. The latest eclipse release (2.1.3) supports only JDK 1.4.1_01, so make sure that you have JDK 1.4.1_01. If you are using an eclipse version later than 2.1.3, make sure that you have a compatible JDK (see eclipse readme file) installed.

DBMS (optional)
If you wish to develop database enabled web applications, then you must also have access to connect to the database using a JDBC driver. Sky framework connects to and carries out operations on a DBMS through a JDBC driver. A JDBC driver for MySQL database is already included with Sky framework.

Email Server (optional)
If you wish to develop web applications that have the ability to send email, you must have access to an SMTP email server. The Sky framework uses Java Mail API and Java Activation Framework to connect to an SMTP server and send emails.

Now that you have J2SE, Ant, and maybe eclipse installed, you are ready to download and start developing sky applications.

Downloading & Installing Sky

Downloading
The latest version of sky framework can be downloaded from here.

Installation
Installation is simple. All you have to do is to unzip the file to a desired location.

Install Directory structure

The directory where you expanded the zip file, contains two projects: the Sample web application project and the Startup web application project. The Sample project is a sample web application that contain numerous forms used to demonstrate various features of the sky framework; while as, the Startup project is a bare-minimum web application that developers can use to build their own web applications. The sub-directory layout of both these projects are the same and also similar (but not the same) to the directory layout of a typical servlet based web application project.

The structure of Startup project is given below. Directories are shown in red; while as, files are shown in blue. Brief comments describing directories and files are shown in brown.

    [Startup]
      |
      +--.classpath                           For use by Eclipse development environment
      |
      +--.project                             Eclipse project file
      |
      +--build.xml                            Ant build file
      |
      +--README.txt
      |
      +--[doc]                                All documentation, javadocs for this web application project.
      |
      +--[html]                               Static html files that may or may not contain forms to invoke servlets.
      |
      +--[image]                              Images for use within static HTML or dynamically generated HTML documents.
      |
      +--[WEB-INF]                            This directory contains servlet code.
           |
           +--[classes]
           |    |
           |    +--[email]                    Email templates for dynamically generating emails send by servlets.
           |    | 
           |    +--[html]                     Html templates for dynamically generating html documents.
           |    |    |
           |    |    +--message.html
           |    |    |
           |    |    +--SessionTracker.html
           |    |
           |    +--[java]                     Servlets written in java or generated by the sky preprocessor from the *.sky files.
           |    |
           |    +--[sky]                      *.sky files that are combined with email and html templates to generate *.java files.
           |         |
           |         +--SkyServlet.sky
           |         |
           |         +--SkyTracker.sky
           |
           +--[lib]                           Jar files used by this web application project.
           |    |
           |    +--activation.jar
           |    |
           |    +--mail.jar
           |    |
           |    +--mysql-connector-java-2.0.14.jar
           |    |
           |    +--servlet.jar
           |    |
           |    +--sky.jar
           |
           +--web.xml                         Web application deployment descriptor

The Startup directory contains four files: 1) .classpath and 2) .project files are eclipse project files that can be used to open the Startup project within Eclipse development environment, 3) README.txt contains release notes, and 4) build.xml is the ant build file that can either be run from the command line or within the eclipse development environment.

The command "ant -projecthelp" gives the following information about build.xml:

    J:\code\Startup>ant -projecthelp
Buildfile: build.xml
Build file for empty startup project
Main targets:

clean Removes temporary build directory, class files, and java files generated by sky precompiler.
compile Runs java compiler to compile /java/*.java files into class files
deploy Copies the web application archive file to the specified directory location.
init Carries out pre-build initializations.
process Runs Sky precompiler to convert /sky/*.sky files to /java/*.java files
war Packages class, web.xml, and html files into a web application archive.
Default target: war

A sky based application would have all its static html files in the html folder. All images used in web pages will go in image folder. Finally, all code that is involved in generation of dynamic content goes in the WEB-INF folder. The WEB-INF folder contains two directories where the directory lib contains all the jars that will be used by the web application and directory classes contains all the code. Within the classes folder, all the email templates are placed in email directory, all the html templates are placed in html directory, all the java files are placed in java directory, and all the sky files are placed in sky directory. Sky files are same as java files except that they sky files can contain macros that specify how html or email templates will be used. Sky files are precompiled using the sky precompiler into Java files. Once the sky precompiler has converted all *.sky files into *.java files, the java compiler creates class files which are packaged into a war file. The final war file can be found in folder called bin and can be deployed on a web application server.

The WEB-INF folder also contains a default deployment descriptor file web.xml. This file contains various constants such as JDBC driver name, JDBC url, SMTP Server name, and others that are used by Sky framework during runtime.

The WEB-INF/sky folder contains SkyServlet.sky and SkyTracker.sky files. SkyServlet is the controller through which all the servlet requests are redirected to their respective handlers; while as, SkyTracker is a simple session tracking application which keeps track of user sessions. The WEB-INF/html folder contains message.html and SessionTracker.html. If you open SkyTracker.sky in an editor, you will see that message.html is included by SkyTracker to handle any error, status, and success conditions that may arise during servlet request handling. SkyTracker.html is included by SkyTracker.sky to generate session tracking output.

SkyServlet.sky and SkyTracker.sky are processed by the sky framework preprocessor to create SkyServlet.java and SkyTracker.java files in WEB-INF/java folder.

Validating your Sky installation

Assuming that you installed the sky framework in directory J:\code, run the commands shown in red to validate your installation.


    J:\code>dir
     Volume in drive J is CODE
     Volume Serial Number is 1850-9EE6
    
     Directory of J:\code
    
    06/06/2004  09:08 PM    <DIR>          .
    06/06/2004  09:08 PM    <DIR>          ..
    06/11/2004  10:28 PM    <DIR>          Job
    06/11/2004  10:42 PM    <DIR>          Sample
    06/11/2004  10:19 PM    <DIR>          sky
    06/21/2004  09:43 PM    <DIR>          Startup
                   0 File(s)              0 bytes
                   6 Dir(s)  30,592,970,752 bytes free
    
    J:\code>cd Startup
    
    J:\code\Startup>dir
     Volume in drive J is CODE
     Volume Serial Number is 1850-9EE6
    
     Directory of J:\code\Startup
    
    06/21/2004  09:43 PM    <DIR>          .
    06/21/2004  09:43 PM    <DIR>          ..
    06/06/2004  10:15 PM               621 .classpath
    06/06/2004  04:04 PM               383 .project
    06/21/2004  09:44 PM             3,822 build.xml
    06/11/2004  10:45 PM    <DIR>          CVS
    06/11/2004  10:45 PM    <DIR>          doc
    06/11/2004  10:45 PM    <DIR>          html
    06/11/2004  10:45 PM    <DIR>          image
    06/06/2004  03:43 PM               743 README.txt
    06/11/2004  10:45 PM    <DIR>          WEB-INF
                   4 File(s)          5,569 bytes
                   7 Dir(s)  30,592,970,752 bytes free
    
    J:\code\Startup>ant war
    Buildfile: build.xml
    
    init:
        [mkdir] Created dir: J:\code\Startup\bin
        [mkdir] Created dir: J:\code\Startup\build
    
    process:
         [java] Directory or file at location CVS was not found
         [java] Directory or file at location CVS was ignored.
         [java] Generating WEB-INF\classes\SkyServlet.java from WEB-INF\classes\SkyServlet.sky
         [java] ..................................................................................................................
         [java] Generating WEB-INF\classes\SkyTracker.java from WEB-INF\classes\SkyTracker.sky
         [java] ............................
    
    
    
    compile:
         [copy] Copying 2 files to J:\code\Startup\build
        [javac] Compiling 2 source files to J:\code\Startup\build
    
    war:
       [delete] Deleting 2 files from J:\code\Startup\build
          [war] Building war: J:\code\Startup\bin\app.war
    
    BUILD SUCCESSFUL
    Total time: 8 seconds


The end result should be a Startup.war file in the build folder. You should be able to deploy this file to a web application server such as tomcat and be able to access SkyTracker by pointing your browser to the url: http://{host}/Startup/servlet/SkyServlet?handler=SkyTracker.


    J:\code\Startup>cd bin

    J:\code\Startup\bin>dir
     Volume in drive J is CODE
     Volume Serial Number is 1850-9EE6

     Directory of J:\code\Startup\bin

    06/27/2004  10:40 AM    <DIR>          .
    06/27/2004  10:40 AM    <DIR>          ..
    06/27/2004  10:40 AM           601,925 Startup.war
                   1 File(s)        601,925 bytes
                   2 Dir(s)  30,592,327,680 bytes free

    J:\code\Startup\bin>