JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.core
Class Jac

java.lang.Object
  |
  +--org.objectweb.jac.core.Jac

public class Jac
extends Object

This is the main class of org.objectweb.jac. It launches a JAC container/server that is called s0 by default. If an application descriptor is given as a last parameter, it runs the corresponding JAC program on the newly created JAC container by using a customized class loader JacLoader.

Use the following command to run MyApp.main() with arg1, ...:

 % java org.objectweb.jac.core.Jac [options] [app.jac arg1, ...]

 where 'app.jac' is a JAC application descriptor

 where options are:
    -r (release): JAC displays the release number
    -v (verbose): the JAC class loader is set to verbose
    -d (debug)  : the JAC class loader is set to debugging mode
    -c (clean)  : JAC cleans the tempory classes directory (previously 
                  created with 'write' option)
    -w (write)  : the JAC class loader writes on disk all the translated
                  classes (and use them for the next run)
    -V [server:]logname  : set the log to verbose mode
    -L file     : redirect all the logs to a file
    -D [name] (dist): JAC runs in distributed mode, i.e. it constructs a 
                  distributed JAC system. If no name is given, the default is s0.
    -M [name]   : defines a master site where all the bytecode will be
                  fetched (by default, classes are loaded from the local
                  file system).
    -R dir      : specify jac_root directory
    -G [gui,...] : launch a list of customized GUI
    -G app@server:[gui,...] : launch a list of customized GUIs
                  with the swing GUI on a remote server for an application
    -A name     : launches an administration GUI on a remote server called 'name'
                  and do not start org.objectweb.jac.
    -W [gui[:port],...] : start the Web GUI server and provide access to some customized GUIs.
    -C  : specify a particular classpath that will replace $CLASSPATH
    -a application aspect server : reload the configuration for an aspect on a server.
    -x          : redirect ouput to out.txt
    -h (help)   : display the help.
 

Author:
Renaud Pawlak, Lionel Seinturier, Laurent Martelli
See Also:
JacLoader

Field Summary
static JacLoader classLoader
          The Javassist class loader.
static ClassLoader otherClasspath
          alternative classpath, added with -C option
 
Constructor Summary
Jac()
           
 
Method Summary
protected static void cleanDirectory(File dir)
          This method is internally used to clean the cache directory of the translated classes (to use the cache, use the -w option and clean it with the -c option).
static void displayLaunchingHelp()
          Print the help (displayed when the -h option is set).
static String getFullJavaVersion()
          Returns the JRE version on which JAC is currently running.
static String getJacRoot()
          Returns the JAC root directory.
static String getLaunchedClass()
          Gets the name of the class that has been launched when JAC was started (in an autonomous or a distributed mode).
static String getLaunchedProgram()
          Returns the logical name of the program that was launched when the JAC system started.
static String getMainJavaVersion()
          Returns the main JRE version (only the 2 first numbers, e.g.
static String[] getStartSwingGUI()
          Returns the array of of customized GUI ids to be shown with the Swing interface
static Date getStartTime()
          Returns the date when the JAC system was launched.
static String[] getStartWebGUI()
          Returns the array of of customized GUI ids to be made available on the web gui.
static void main(String[] args)
          The entry point of the JAC system.
static void remoteReloadAspect(String application, String server, String aspect)
          Reload an aspect on a remote server
static void remoteSetTrace(String application, String server, String category, int level)
          Sets a trace loggin level on a remote server.
static void remoteStartSwingGUI(String application, String server, String[] guiNames)
          Starts a swing GUI on a remote server.
static void setJacRoot(String dir)
          Sets the JAC root directory.
static void setLaunchedClass(String className)
          Sets the launched class.
static void setStartSwingGUI(String[] start)
          Tells the JAC system to start the GUI.
static void setStartWebGUI(String[] customizedGUIs)
          Tells the JAC system to start the GUI.
static boolean startSwingGUI()
          Tells if the JAC system must try to launch the GUI of the program is exist (see the -G option).
static boolean startWebGUI()
          Tells if the JAC system must try to launch the Web GUI of the program is exist (see the -G option).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classLoader

public static JacLoader classLoader
The Javassist class loader.


otherClasspath

public static ClassLoader otherClasspath
alternative classpath, added with -C option

Constructor Detail

Jac

public Jac()
Method Detail

getFullJavaVersion

public static String getFullJavaVersion()
Returns the JRE version on which JAC is currently running.


getMainJavaVersion

public static String getMainJavaVersion()
Returns the main JRE version (only the 2 first numbers, e.g. 1.3 or 1.4) on which JAC is currently running.


getStartTime

public static Date getStartTime()
Returns the date when the JAC system was launched.

Returns:
the date when JAC was launched

main

public static void main(String[] args)
                 throws Throwable
The entry point of the JAC system.

Creates a JAC loader that will load the classes and translate them.

Parameters:
args - the command-line options
Throwable
See Also:
JacLoader

remoteReloadAspect

public static void remoteReloadAspect(String application,
                                      String server,
                                      String aspect)
Reload an aspect on a remote server

Parameters:
application - the application for which to reload an aspect
server - the name of the JAC server on which the application runs
aspect - the name of the aspect to reload

remoteSetTrace

public static void remoteSetTrace(String application,
                                  String server,
                                  String category,
                                  int level)
Sets a trace loggin level on a remote server.

Parameters:
application - the application for which to reload an aspect
server - the name of the JAC server on which the application runs
category - the trace category
level - the trace level to set for the category

remoteStartSwingGUI

public static void remoteStartSwingGUI(String application,
                                       String server,
                                       String[] guiNames)
Starts a swing GUI on a remote server.

Parameters:
application - the application for which start the GUI
server - the name of the JAC server on which the application runs
guiNames - the names of the GUI windows to start

displayLaunchingHelp

public static void displayLaunchingHelp()
Print the help (displayed when the -h option is set).


cleanDirectory

protected static void cleanDirectory(File dir)
This method is internally used to clean the cache directory of the translated classes (to use the cache, use the -w option and clean it with the -c option).


getJacRoot

public static String getJacRoot()
Returns the JAC root directory.

The root directory is usually defined by an environment variable that is set to $HOME/jac where $HOME is the home directory of the current user.

It can also be defined at launching time with the -R option.

Returns:
the JAC root directory value
See Also:
setJacRoot(String)

setJacRoot

public static void setJacRoot(String dir)
Sets the JAC root directory.

Parameters:
dir - the path of the JAC root directory
See Also:
getJacRoot()

getLaunchedClass

public static String getLaunchedClass()
Gets the name of the class that has been launched when JAC was started (in an autonomous or a distributed mode).

The launched class is the class that contains the static run method.

Returns:
the launched class name
See Also:
setLaunchedClass(String)

setLaunchedClass

public static void setLaunchedClass(String className)
Sets the launched class.

Parameters:
className - the launched class name
See Also:
getLaunchedClass()

getLaunchedProgram

public static String getLaunchedProgram()
Returns the logical name of the program that was launched when the JAC system started.

The logical program name is by convention the package name of the class that runs the launched program.

For instance, if the command line is:

Then the launched program is org.objectweb.jac.samples.agenda

Returns:
the launched program name
See Also:
getLaunchedClass()

startSwingGUI

public static boolean startSwingGUI()
Tells if the JAC system must try to launch the GUI of the program is exist (see the -G option).

If the program does not provides a GUI aspect, then the default GUI is launched.

Returns:
true if the GUI must be launched
See Also:
setStartSwingGUI(String[])

startWebGUI

public static boolean startWebGUI()
Tells if the JAC system must try to launch the Web GUI of the program is exist (see the -G option).

If the program does not provides a Web GUI aspect, then the default GUI is launched.

Returns:
true if the Web GUI must be launched
See Also:
setStartWebGUI(String[])

setStartSwingGUI

public static void setStartSwingGUI(String[] start)
Tells the JAC system to start the GUI.

See Also:
startSwingGUI()

getStartSwingGUI

public static String[] getStartSwingGUI()
Returns the array of of customized GUI ids to be shown with the Swing interface


setStartWebGUI

public static void setStartWebGUI(String[] customizedGUIs)
Tells the JAC system to start the GUI.

See Also:
startWebGUI()

getStartWebGUI

public static String[] getStartWebGUI()
Returns the array of of customized GUI ids to be made available on the web gui.


Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli