Class ScatteredArchive.Builder

java.lang.Object
org.glassfish.internal.embedded.ScatteredArchive.Builder
Enclosing class:
ScatteredArchive

public static class ScatteredArchive.Builder extends Object
  • Constructor Details

    • Builder

      public Builder(String name, File topDir)
      Construct a new scattered archive builder with the minimum information By default, a scattered archive is not different from any other archive where all the files are located under a top level directory (topDir). Some files can then be scattered in different locations and be specified through the appropriate setters. Alternatively, topDir can be null to specify a truely scattered archive and all the locations must be specified.
      Parameters:
      name - archive name
      topDir - top level directory
    • Builder

      public Builder(String name, Collection<URL> urls)
      Construct a new scattered archive builder with a set of URLs as repository for locating archive resources (like .class files).
      Parameters:
      name - archive name
      urls - set of resources repository
  • Method Details

    • resources

      public ScatteredArchive.Builder resources(File resources)
      Sets the location of resources files
      Parameters:
      resources - the resources directory
      Returns:
      itself
    • addMetadata

      public ScatteredArchive.Builder addMetadata(File metadata)
      Add a new metadata locator for this scattered archive. A metadata is identified by its name (like WEB-INF/web.xml) and the location of the metadata is used when the embedded server is requesting the metadata file. The name for this metadata will be obtained by doing metadata.getName()
      Parameters:
      metadata - the metadata file location
      Returns:
      itself
    • addMetadata

      public ScatteredArchive.Builder addMetadata(String name, File metadata)
      Add a new metadata locator for this scattered archive. A metadata is identified by its name (like WEB-INF/web.xml) and the location of the metadata is used when the embedded server is requesting the metadata file.
      Parameters:
      name - name of the metadata (eg WEB-INF/web.xml or web.xml or META-INF/ejb.xml or ejb.xml).
      metadata - the metadata file location
      Returns:
      itself
    • addClassPath

      public ScatteredArchive.Builder addClassPath(File location)
      Adds a directory to the classes classpath. Will be used to retrieve requested .class files.
      Parameters:
      location - must be a directory location
      Returns:
      itself
    • addClassPath

      public ScatteredArchive.Builder addClassPath(URL classpath)
      Adds a URL for the classes classpath. Will be used to retrieve requested .class files
      Parameters:
      classpath - the new classpath element.
      Returns:
      itself
    • buildJar

      public ScatteredArchive buildJar()
      Creates a new scattered jar file using this builder instance configuration. The resulting instance will behave like a jar file when introspected by the embedded instance.
      Returns:
      new scattered instance jar file
    • buildWar

      public ScatteredArchive buildWar()
      Creates a new scattered war file using this builder instance configuration. The resulting instance will behave like a war file when introspected by the embedded instance.
      Returns:
      the scattered instance war file