Class IPlanetEjbc

java.lang.Object
org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbc

public class IPlanetEjbc extends Object
Compiles EJB stubs and skeletons for the iPlanet Application Server (iAS). The class will read a standard EJB descriptor (as well as an EJB descriptor specific to iPlanet Application Server) to identify one or more EJBs to process. It will search for EJB "source" classes (the remote ; * interface, home interface, and EJB implementation class) and the EJB stubs and skeletons in the specified destination directory. Only if the stubs and skeletons cannot be found or if they're out of date will the iPlanet Application Server ejbc utility be run.

Because this class (and it's assorted inner classes) may be bundled into the iPlanet Application Server distribution at some point (and removed from the Ant distribution), the class has been written to be independent of all Ant-specific classes. It is also for this reason (and to avoid cluttering the Apache Ant source files) that this utility has been packaged into a single source file.

For more information on Ant Tasks for iPlanet Application Server, see the IPlanetDeploymentTool and IPlanetEjbcTask classes.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    This inner class is used to signal any problems during the execution of the ejbc compiler.
  • Constructor Summary

    Constructors
    Constructor
    Description
    IPlanetEjbc(File stdDescriptor, File iasDescriptor, File destDirectory, String classpath, SAXParser parser)
    Constructs an instance which may be used to process EJB descriptors and generate EJB stubs and skeletons, if needed.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Verifies that the user selections are valid.
    void
    Compiles the stub and skeletons for the specified EJBs, if they need to be updated.
    Returns the list of CMP descriptors referenced in the EJB descriptors.
    Returns the display-name element read from the standard EJB descriptor.
    Returns a Hashtable which contains a list of EJB class files processed by the ejbc utility (both "source" class files as well as stubs and skeletons).
    static void
    main(String[] args)
    Main application method for the iPlanet Application Server ejbc utility.
    void
    registerDTD(String publicID, String location)
    Registers the location of a local DTD file or resource.
    void
    setDebugOutput(boolean debugOutput)
    If true, enables debugging output when ejbc is executed.
    void
    setIasHomeDir(File iasHomeDir)
    May be used to specify the "home" directory for this iAS installation.
    void
    setRetainSource(boolean retainSource)
    If true, the Java source files which are generated by the ejbc process are retained.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IPlanetEjbc

      public IPlanetEjbc(File stdDescriptor, File iasDescriptor, File destDirectory, String classpath, SAXParser parser)
      Constructs an instance which may be used to process EJB descriptors and generate EJB stubs and skeletons, if needed.
      Parameters:
      stdDescriptor - File referencing a standard EJB descriptor.
      iasDescriptor - File referencing an iAS-specific EJB descriptor.
      destDirectory - File referencing the base directory where both EJB "source" files are found and where stubs and skeletons will be written.
      classpath - String representation of the classpath to be used by the iAS ejbc utility.
      parser - SAXParser to be used to process both of the EJB descriptors.
      To do:
      classpathElements is not needed here, its never used (at least IDEA tells me so! :)
  • Method Details

    • setRetainSource

      public void setRetainSource(boolean retainSource)
      If true, the Java source files which are generated by the ejbc process are retained.
      Parameters:
      retainSource - A boolean indicating if the Java source files for the stubs and skeletons should be retained.
      To do:
      This is not documented in the HTML. On purpose?
    • setDebugOutput

      public void setDebugOutput(boolean debugOutput)
      If true, enables debugging output when ejbc is executed.
      Parameters:
      debugOutput - A boolean indicating if debugging output should be generated
    • registerDTD

      public void registerDTD(String publicID, String location)
      Registers the location of a local DTD file or resource. By registering a local DTD, EJB descriptors can be parsed even when the remote servers which contain the "public" DTDs cannot be accessed.
      Parameters:
      publicID - The public DTD identifier found in an XML document.
      location - The file or resource name for the appropriate DTD stored on the local machine.
    • setIasHomeDir

      public void setIasHomeDir(File iasHomeDir)
      May be used to specify the "home" directory for this iAS installation. The directory specified should typically be [install-location]/iplanet/ias6/ias.
      Parameters:
      iasHomeDir - The home directory for the user's iAS installation.
    • getEjbFiles

      public Hashtable<String,File> getEjbFiles()
      Returns a Hashtable which contains a list of EJB class files processed by the ejbc utility (both "source" class files as well as stubs and skeletons). The key for the Hashtable is a String representing the path to the class file (relative to the destination directory). The value for the Hashtable is a File object which reference the actual class file.
      Returns:
      The list of EJB files processed by the ejbc utility.
    • getDisplayName

      public String getDisplayName()
      Returns the display-name element read from the standard EJB descriptor.
      Returns:
      The EJB-JAR display name.
    • getCmpDescriptors

      public String[] getCmpDescriptors()
      Returns the list of CMP descriptors referenced in the EJB descriptors.
      Returns:
      An array of CMP descriptors.
    • main

      public static void main(String[] args)
      Main application method for the iPlanet Application Server ejbc utility. If the application is run with no commandline arguments, a usage statement is printed for the user.
      Parameters:
      args - The commandline arguments passed to the application.
    • execute

      public void execute() throws IPlanetEjbc.EjbcException, IOException, SAXException
      Compiles the stub and skeletons for the specified EJBs, if they need to be updated.
      Throws:
      IPlanetEjbc.EjbcException - If the ejbc utility cannot be correctly configured or if one or more of the EJB "source" classes cannot be found in the destination directory
      IOException - If the parser encounters a problem reading the XML file
      SAXException - If the parser encounters a problem processing the XML descriptor (it may wrap another exception)
    • checkConfiguration

      protected void checkConfiguration() throws IPlanetEjbc.EjbcException
      Verifies that the user selections are valid.
      Throws:
      IPlanetEjbc.EjbcException - If the user selections are invalid.