jasco
Class Jasco

java.lang.Object
  extended by jasco.Jasco

public class Jasco
extends java.lang.Object

JAsCo facade class for compilation and loading of aspect beans, connectors and traversal connectors. Can also be used to insert traps into java beans.

Use setExceptionLogger when you want to get exceptions instead of errors on the error stream when something goes wrong!

See Also:
Options

Constructor Summary
Jasco()
           
 
Method Summary
static void addToClassPath(java.lang.String path)
          adds a single directory or jar file to the classpath
protected static void checkFile(java.lang.String f)
           
static void compileAndLoadConnector(java.lang.String aConnector)
          Compile a connector and places the result in the output directory.
static void compileAspect(java.lang.String aAspect)
          Compiles an aspect bean and places it in the output directory.
static java.lang.String compileConnector(java.lang.String aConnector)
          Compile a connector and places the result in the output directory.
static void compileRefinement(java.lang.String aRefinement)
          Compiles a refining class and places it in the output directory.
static void compileTraversal(java.lang.String connector)
          Compiles a traversal connector and places it in the output directory.
static void createIntrospectorWindow()
          Creates an introspector gui window
static java.lang.String getClassPath()
          returns the classpath represented as a string separated by ; on windows and : on linux
static java.lang.String getOutputDir()
          gets the output directory where all entities generated by this class are placed
static java.lang.Object invokeTraversal(java.lang.String traversalName, java.lang.Object startingObject)
           
static java.lang.Object invokeTraversal(java.lang.String traversalName, java.lang.Object startingObject, java.lang.String resultMethod)
          Invokes a traversal connector
static void loadConnector(Connector aConnector)
          Load a connector so that all declared aspect beans are active.
static void loadConnectors()
          Forces the connector registry to load new connectors NOW.
static void modifyConnectorLoadingPriority(int pri)
          Alters the connector loading priority to a new one.
static void removeConnectorInClassPath(java.lang.String aConnector)
          Remove a connector from the classpath.
static void removeConnectorInOutputDir(java.lang.String aConnector)
          Remove a connector from the output directory.
static void setExceptionLogger()
          Makes sure JAsCo throws an exception instead of printing on the error stream when there are errors.
static void setOutputDir(java.lang.String outputdir)
          sets the output directory where all entities generated by this class will be placed
static void setOutputLogger()
          Makes sure JAsCo prints on the error stream when there are errors.
static boolean transformBeanInOutputDir(java.lang.String javaBean, java.util.Vector excluded)
          Tranforms a java bean and places the transformed version in the output directory
static void transformBeanInOutputDirInNewVM(java.lang.String javaBean, java.util.Vector excluded)
          Tranforms a java bean and places the transformed version in the output directory.
static void unloadConnector(Connector aConnector)
          Unload a connector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jasco

public Jasco()
Method Detail

invokeTraversal

public static java.lang.Object invokeTraversal(java.lang.String traversalName,
                                               java.lang.Object startingObject,
                                               java.lang.String resultMethod)
Invokes a traversal connector

Parameters:
traversalName - fully qualified classname of a traversal connector
startingObject - the starting object for the traversal
resultMethod - the method for fetching the result, if null no result is fetched
Returns:
an iterator to all aspect beans in the traversal for fetching results

invokeTraversal

public static java.lang.Object invokeTraversal(java.lang.String traversalName,
                                               java.lang.Object startingObject)

setExceptionLogger

public static void setExceptionLogger()
Makes sure JAsCo throws an exception instead of printing on the error stream when there are errors.


setOutputLogger

public static void setOutputLogger()
Makes sure JAsCo prints on the error stream when there are errors.


setOutputDir

public static void setOutputDir(java.lang.String outputdir)
sets the output directory where all entities generated by this class will be placed

Parameters:
outputdir - a string denoting a valid directory (relative or absolute)

getOutputDir

public static java.lang.String getOutputDir()
gets the output directory where all entities generated by this class are placed

Returns:
a string denoting a valid directory (relative or absolute)

getClassPath

public static java.lang.String getClassPath()
returns the classpath represented as a string separated by ; on windows and : on linux

Returns:
classpath string

addToClassPath

public static void addToClassPath(java.lang.String path)
adds a single directory or jar file to the classpath

Parameters:
path - a path or jar file

compileAspect

public static void compileAspect(java.lang.String aAspect)
                          throws java.io.FileNotFoundException
Compiles an aspect bean and places it in the output directory.

Parameters:
aAspect - a file string containing an aspect bean definition
Throws:
java.io.FileNotFoundException

compileRefinement

public static void compileRefinement(java.lang.String aRefinement)
                              throws java.io.FileNotFoundException
Compiles a refining class and places it in the output directory.

Parameters:
aRefinement - a file string containing a refinement definition
Throws:
java.io.FileNotFoundException

compileTraversal

public static void compileTraversal(java.lang.String connector)
                             throws java.io.FileNotFoundException
Compiles a traversal connector and places it in the output directory.

Parameters:
connector - a string denoting a file containing a traversal connector definition
Throws:
java.io.FileNotFoundException

transformBeanInOutputDir

public static boolean transformBeanInOutputDir(java.lang.String javaBean,
                                               java.util.Vector excluded)
Tranforms a java bean and places the transformed version in the output directory

Parameters:
javaBean - a string denoting a fully qualified class name (e.g. java.lang.String)
excluded - a list of method names that cannot be trapped

transformBeanInOutputDirInNewVM

public static void transformBeanInOutputDirInNewVM(java.lang.String javaBean,
                                                   java.util.Vector excluded)
Tranforms a java bean and places the transformed version in the output directory. Runs in a different virtual machine.

Parameters:
javaBean - a string denoting a fully qualified class name (e.g. java.lang.String)
excluded - a list of method names that cannot be trapped (not supported yet here)

checkFile

protected static void checkFile(java.lang.String f)
                         throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

compileConnector

public static java.lang.String compileConnector(java.lang.String aConnector)
                                         throws java.io.FileNotFoundException
Compile a connector and places the result in the output directory.

Parameters:
aConnector - a string denoting a file that contains a connector definition
Returns:
the name of the connector
Throws:
java.io.FileNotFoundException

loadConnector

public static void loadConnector(Connector aConnector)
                          throws java.lang.Throwable
Load a connector so that all declared aspect beans are active.
Not necessary when JAsCo searches the classpath for new connectors and the outputdir is in the classpath.

Parameters:
aConnector - a string denoting a file that contains a connector definition
Throws:
java.lang.Throwable

unloadConnector

public static void unloadConnector(Connector aConnector)
Unload a connector.
Not necessary when JAsCo searches the classpath for new connectors and the outputdir is in the classpath. Then the connector is auto unloaded when deleted.

Parameters:
aConnector - a connector singleton instance

compileAndLoadConnector

public static void compileAndLoadConnector(java.lang.String aConnector)
                                    throws java.lang.Throwable
Compile a connector and places the result in the output directory. The connector is also loaded by the JAsCo system and all declared aspect beans are activated.
Not necessary when JAsCo searches the classpath for new connectors.

Make sure outputdir is in the static startup classpath, fails otherwise!!!

Parameters:
aConnector - a string denoting a file that contains a connector definition
Throws:
java.lang.Throwable

removeConnectorInOutputDir

public static void removeConnectorInOutputDir(java.lang.String aConnector)
Remove a connector from the output directory.

Parameters:
aConnector - A connector NAME (not filename if different).

removeConnectorInClassPath

public static void removeConnectorInClassPath(java.lang.String aConnector)
Remove a connector from the classpath. Searches the complete classpath, if multiple occurances our found all of them are deleted..

Parameters:
aConnector - A connector NAME (not filename if different).

loadConnectors

public static void loadConnectors()
Forces the connector registry to load new connectors NOW.


modifyConnectorLoadingPriority

public static void modifyConnectorLoadingPriority(int pri)
Alters the connector loading priority to a new one. Halts the JAsCo aspect framework and restarts it. Only use this if absolutely required. You can use the -Djasco.connector.loadpriority startup switch for setting the priority at startup.

Parameters:
pri - new Priority has to be between [1..10]

createIntrospectorWindow

public static void createIntrospectorWindow()
Creates an introspector gui window