SciPortal Directory Structure

The current status of the SciPortal is based on Tomcat 3.1 under APACHE. WebFlow is a servlet under this server.

Now, what about the SciPortal directory structure? Tomcat supports the Web Application concept, i.e., all the necessary pieces can be placed under a single directory, and can be distributed as a WAR file (a JAR file with the extension changed from jar --> war a web archive) and it will contain everything for presentation on the Web. In our case we have Corba applications which complicates the WAR. Later there will also have Globus, etc. However, at the development stage, we should keep as many things as possible under "one roof".

The Web Application Organization

DocPath
top physical directory for the Web Application. Currently (tomcat 3.1) it is /usr/local/apache_t3.1/htdocs/SciPortal
Under this top directory, there are two parts:
  1. inaccessible to Web Browsers directly (hidden part). This part consists of all stuff under WEB-INF subdirectory. Here: /usr/local/apache_t3.1/htdocs/SciPortal/WEB-INF
  2. accessible directly via Web Browser: everything else under /usr/local/apache_t3.1/htdocs/SciPortal
For example:

Conclusion: all stuff which you do not want to serve directly to a Web browser, you put under WEB-INF.

Why do you have "hidden" part of Web Application? To have files which can be accessed by servlets/JSP s but not by regular page request from the Web Browser.

For SciPortal, the visible material should consist of JSP, HTML pages, icons, images, Java Applets, and classes needed by Java Applets. Nothing ELSE!!! Note that HTML pages are not html or other templates. Page templates (i.e., HTML pages with some variable fields to be filled in (say, @@**UserName**@@) should be hidden, and belong under WEB-INF. In addition, all user data, etc., belong under the WEB-INF directory.

Access to files residing under WEB-INF can be done using Java code within servlets or JSP (or Beans). Note that you can always find out what is the top directory of the Web Application by calling:

getServletContext().getRealPath("/")

which returns the physical path to the top directory of the Web Application. Thus, to access the "user" directory in your Servlet or JSP:

String UserDirectory = getServletContext().getRealPath("/WEB-INF/users")

There are some special files/directories under WEB-INF:

web.xml DEPLOYMENT DESCRIPTOR FILE (official name).

A file containing configuration information for the Web Application. The values there overwrite the default configuration given in the $TOMCAT_HOME/conf directory. Please read the web.dtd in $TOMCAT_HOME/conf or in the appendix to the Java Servlet Spec. 2.2, and check also $TOMCAT/doc. This is the place to put customization and configuration info for given Web application, specify which servlets to start automatically, provide initial parameters for servlets, remap servlets names, etc.. This file can also have information (as init-params and context params) about locations of some other packages (say: Globus) needed by the current web application. This is a place to put custom info.

WEB-INF/classes The servlets class files are here.

Other files can be placed here as well and Tomcat "does not see them", i.e., will not serve them to the Web. Therefore, files such as Java source files are safely stored here and no one can access them via the Web. Of course, there is support for packages here, so, if a servlet myServlet.class is in a package called "com.big.utils", the class file should be placed under:

WEB-INF/classes/com/bin/utils/myServlet.class

All classes which are under WEB-INF/classes directory are automatically added to the CLASSPATH of Tomcat servlet and JSP container.

WEB-INF/lib The jar files are here.

These jar files will be automatically added to the CLASSPATH to servlet and JSP container. The jar files may contain servlets, JavaBeans, and whatever utility classes you need.

WEB-INF/tlds The Tag Libraries

Definition for the custom XML tags to be embedded in JSP pages.

Other directories are for you. Tomcat will not look at them, and will not serve them to anyone. For example, you can have a directory:

WEB-INF/private_classes

where some applications are placed which SHOULD NOT BE in the Tomcat CLASSPATH. These may be, e.g. utility applications which are not needed by Tomcat, but are needed for development, say jidl for compiling idl files, or some applications which are required to be started via runtime class of Java with statements such as:

String JavaApps = getServletContext().getRealPath("/WEB-INF/private_classes");
String[] envp = new String[3];
envp[0] = "JAVA_HOME=/usr/local/java1.3";
envp[1] = "CLASSPATH=/usr/local/java1.3/lib/tools.jar:" + JavaApps;
envp[2] = "PATH=/usr/local/bin:/usr/local/java1.3/bin";
Runtime rt = Runtime.getRuntime();
String MyApp = "java "+JavaApps;

Process PMyApp = rt.exec(MyApp, envp);

What is currently there under WEB-INF:

The additional directories needed for Tomcat SciPortal Web Application can be based on the proposed JSERV directory structure, namely:

               Admin/  -- config files and other admin files

               Templates/   -- HTML document templates (i.e., they are
                             processed by servlets which create a final
                             version by replacing tags with actual values.
               Scripts/   -- scripts (usually perl) which may be called
                              by servlets or modules to do something.
               ScriptTemplates/ -- templates for, eg. job submission scripts
               tmp/    -- temp directory for files which should not be
                        visible via net. The unique naming can be made
                        by appending "time+pid" value. This directory
                        should be cleaned by cron after files are older
                        than stated limit, say 2 days.    
               Classes/      -- jars and classes which need to be in a 
                              CLASSPATH for servlets/jsp but do not/should 
															not be publicly available.
               Descriptors/   -- 
                           Applications/  -- context data and xml/dtd's for
                                        applications, tasks, etc...
                           Machines/ -- as above for machines
                           Users/ -- context data for individual users
                                  (I think we should combine here the
                                   stuff from $HTML/DESCRIPTORS/USERS and
                                   /home/webflow/Data)

Other directories need to be added:

The stuff which needs to be served to the Web Browser directly, goes under top directory (DocPath). Again, it can closely follow the $GTWY_WEBROOT described in README.directories but without the servlet classes (those belong under WEB-INF/classes):

/usr/local/apache_t3.1/htdocs/SciPortal
               /                  Starting pages

               IOR/               stuff for Corba
               /applets           some general purpose applets and their
                                  classes
               style/             style sheets common to everybody
               doc/               html pages general
               images/            generic images and icons
               CCM/               general pages specific for CTA