<!doctype debiandoc public "-//DebianDoc//DTD DebianDoc//EN">

<debiandoc>

  <book id="DebianJavaPolicies">

    <titlepag>
      
      <title>
	Debian Java Policies and Procedures
      </title>
      
      <author>
	<name>Paul Reavis</name>
	<email>tumu@worldofbeverage.net</email>
      </author>
      
      <copyright>
	<copyrightsummary>
	  Copyright &copy; 1999 Paul Reavis
	</copyrightsummary>
	<p>
	  This manual, is free software; you
	  may redistribute it and/or modify it under the terms of the
	  GNU General Public License as published by the Free Software
	  Foundation; either version 2, or (at your option) any later
	  version.
	</p>
	<p>
	  This is distributed in the hope that it will be useful, but
	  <em>without any warranty</em>; without even the implied
	  warranty of merchantability or fitness for a particular
	  purpose.  See the GNU General Public License for more
	  details. 
	</p>
	<p>
	  You should have received a copy of the GNU General Public
	  License with your Debian GNU/Linux system, in
	  <file>/usr/doc/copyright/GPL</file>, or with the
	  <prgn>debiandoc-sgml</prgn> source package as the file
	  <tt>COPYING</tt>.  If not, write to the Free Software
	  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
	  02111-1307, USA
	</p>
      </copyright>

    </titlepag>
    
    <toc detail="sect">

    <chapt>
      <heading>Preface</heading>

      <sect>
	<heading>Overview</heading>
	<p>
	  This is the draft of a policies and procedures document for Java applications and libraries
	  installed in the <url id="http://www.debian.org" name="Debian GNU/Linux operating system">.
	</p>
      </sect>
      
      <sect>
	<heading>Definitions</heading>
	<p>
	  <taglist>
	    <tag>Java debian package
	    <item>A Java application, applet, servlet, or class library that has been compiled and built for
		use in a Debian installation. [packagename] refers to the name of some specific Java debian package in an example.
		
	    <tag>Java package
	    <item>The package that a class is defined to be in by a "package foo.bar.baz" statement
		at the top of its .java source file.
		
	    <tag>jar file
	    <item>A Java ARchive file generated by the "jar" utility or its equivalent.
	  </taglist>
	</p>
      </sect>

      <sect>
	<heading>Java executables</heading>
	<p>
	  Java code may be configured and launched in a wide variety of ways; this is natural consequence of
	  its flexible architecture. Major categories include:
	  
	  <taglist>
	    <tag>application
	    <item>A program, much like one coded in any other language, which may be launched from the
		command-line or similar, can take command-line arguments and java properties, and has
		very few restrictions on behavior. A java application is associated with a class
		which has a method with the signature "public static void main(String[] args)". This
		method is the entry point for the application. An application typically runs in 
		its own virtual machine.
		
	    <tag>applet
	    <item>This is a class which extends java.awt.Applet, and is designed to be embedded in
		graphical environments with security restrictions such as a web browser. It typically
		shares a virtual machine with other applets (e.g., in the same web browser).
		
	    <tag>servlet
	    <item>This is the server-side equivalent to an applet. Servlets are non-graphical, but
		are designed to share a virtual machine with other servlets and run under security restrictions.
		
	    <tag>embedded virtual machine
	    <item>A java runtime may be embedded in other, non-java applications. In fact, this is essentially
		the way the previous three categories are constructed, and therefore other categories may
		arise in the future by embedding a virtual machine in an application and defining 
		conventions on what sort of java code is launched and manipulated in that machine.
	  </taglist>
      </sect>
    </chapt>

    <chapt>
      <heading>Java environment policies</heading>
      
      <sect>
	<heading>Execution environment</heading>
	<p>Java executables require an environment to run in; this environment includes native libraries,
	  java core libraries, commands, etc.
	  
	<sect1>
	  <heading>Custom vs. transparent environments</heading>
	  <p>While a java-like environment may, of course add whatever extensions and goodies they like to the standard tools,
	    a transparent, standard java environment must hide or disable these. This is of concern when we consider
	    truly "pluggable" virtual machines - if we allow an environment to override, for example, the "javac" command,
	    then that overriding command must accept the same arguments and provide the same functionality as Sun's
	    "javac" command. Non-critical issues such as the formatting of compiler warnings, etc. should be of no concern,
	    but command-line syntax should be.
	  <p>The existing "alternatives" policy shall apply to executables that override standard java commands, or for that
	    matter, which overlap commands from other java environments, standard or not.
	</sect1>
      </sect>
    </chapt>
    
    <chapt>
      <heading>Class library policies</heading>
      <p>
	<list>
	  <item>Java class libraries may consist of some number of compiled .class files, along with any class resources and
	      supporting native libraries needed. This section refers only to executable-independent, shared class libraries.
	  <item>The .class files and class resources for a library shall be combined into a single .jar file.
	  <item>Library jar files should be placed in the /usr/share/java directory; system administrators
	      may install non-Debian jar files to /usr/local/share/java.
	  <item>A configurable path, much like LD_LIBRARY_PATH, will be used by wrapper scripts to decide where to look
	      for library files. This allows system administrators or end users flexibility in their environment.
	  <item>Compatible releases of jarfiles can share major/minor release numbers, and be referenced using links
	      (e.g. foobar-1.1.jar -&gt; foobar-1.1.6.jar) much like the current .so file scheme.
	  <item>Library jar files should be accompanied by JavaDoc or equivalent documentation in /usr/doc/[packagename]
	  <item>upstream maintainers should be encouraged to use standard Java package naming conventions
	      (e.g. "package org.debian.*" for classes maintained by the Debian organization).
	</list>
      </p>
    </chapt>
    
    <chapt>
      <heading>Executable policies</heading>
      <p>
	<list>
	  <item>Java executables, as defined above, generally include a non-shared portion of java code. This, like the
	      class libraries listed above, should be compiled along with any class resources into one or more jar files. The
	      jar files shall be placed in /usr/lib/[packagename]/java.
	  <item>Java applications must include a wrapper shell script in the correct "bin" directory for easy execution. 
	      The script should set up the
	      correct classpath, including shared and non-shared jar files, and launch the virtual machine with the correct
	      main class, passing through any arguments.
	</list>
      </p>
    </chapt>
    
  </book>
</debiandoc>
