public class

WarProbeOption

extends Object
implements Option
java.lang.Object
   ↳ org.ops4j.pax.exam.options.WarProbeOption

Class Overview

This option can be used to explicitly define the contents of a WAR probe, overriding the default of the probe being built automatically from the classpath contents, excluding all libraries matching some predefined patterns.

Users should create instances of this class using warProbe() and then invoke methods of this class in fluent syntax to configure the WAR probe.

Summary

Fields
public static final String[] DEFAULT_CLASS_PATH_EXCLUDES
Public Constructors
WarProbeOption()
Creates an empty WAR probe option.
Public Methods
WarProbeOption autoClasspath(boolean includeDefaultFilters)
Automatically add libraries and class folders from the current classpath.
WarProbeOption classPathDefaultExcludes()
Automatically add libraries and class folders from the current classpath, applying the default classpath excludes.
WarProbeOption classes(Class...<?> klass)
Adds the given classes to the WAR in WEB-INF/classes.
WarProbeOption exclude(String... excludeRegExp)
This option implies autoClasspath(false) and adds the given regular expressions to the classpath filters.
List<String> getClassPathFilters()
Returns the classpath filters.
List<Class<?>> getClasses()
Returns the classes to be added to WEB-INF/classes.
List<String> getLibraries()
Returns the WEB-INF libraries.
List<String> getMetaInfResources()
Returns the META-INF resources.
String getName()
Returns the application name of this WAR.
List<String> getOverlays()
Returns the overlays.
List<String> getResources()
Returns the classpath resources.
List<String> getWebInfResources()
Returns the WEB-INF resources.
boolean isClassPathEnabled()
Shall libraries and class folders be added automatically from the current classpath?

Internal API, do no use in application code.

WarProbeOption library(String libraryPath)
Adds the library from the given path to the WAR.
WarProbeOption library(UrlReference libraryUrl)
Adds the library from the URL to the WAR.
WarProbeOption metaInfResource(String resourcePath)
Adds the given resourcs from the current class path to the WAR in META-INF/.
WarProbeOption name(String _name)
Sets the application name of this WAR.
WarProbeOption overlay(String overlayPath)
Adds an overlay from the given path to the WAR.
WarProbeOption overlay(UrlReference overlayUrl)
Adds an overlay from the given URL to the WAR.
WarProbeOption resources(String... resourcePath)
Adds the given resources from the current class path to the WAR in WEB-INF/classes.
WarProbeOption webInfResource(String resourcePath)
Adds the given resource from the current class path to the WAR in WEB-INF/.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final String[] DEFAULT_CLASS_PATH_EXCLUDES

Public Constructors

public WarProbeOption ()

Creates an empty WAR probe option. Application code should not invoke this constructor. Use warProbe() instead.

Public Methods

public WarProbeOption autoClasspath (boolean includeDefaultFilters)

Automatically add libraries and class folders from the current classpath.

Parameters
includeDefaultFilters should the default classpath excludes be applied?
Returns
  • this for fluent syntax

public WarProbeOption classPathDefaultExcludes ()

Automatically add libraries and class folders from the current classpath, applying the default classpath excludes.

Returns
  • this for fluent syntax

public WarProbeOption classes (Class...<?> klass)

Adds the given classes to the WAR in WEB-INF/classes.

Parameters
klass list of classes
Returns
  • this for fluent syntax

public WarProbeOption exclude (String... excludeRegExp)

This option implies autoClasspath(false) and adds the given regular expressions to the classpath filters.

Parameters
excludeRegExp list of regular expressions. Classpath libraries or folders matching any of these will be excluded
Returns
  • this for fluent syntax

public List<String> getClassPathFilters ()

Returns the classpath filters.

Internal API, do no use in application code.

Returns
  • filters (possibly empty but not null)

public List<Class<?>> getClasses ()

Returns the classes to be added to WEB-INF/classes.

Internal API, do no use in application code.

Returns
  • classes (possibly empty but not null)

public List<String> getLibraries ()

Returns the WEB-INF libraries.

Internal API, do no use in application code.

Returns
  • libraries (possibly empty but not null)

public List<String> getMetaInfResources ()

Returns the META-INF resources.

Internal API, do no use in application code.

Returns
  • resources (possibly empty but not null)

public String getName ()

Returns the application name of this WAR.

Internal API, do no use in application code.

Returns
  • application name

public List<String> getOverlays ()

Returns the overlays.

Internal API, do no use in application code.

Returns
  • overlays (possibly empty but not null)

public List<String> getResources ()

Returns the classpath resources.

Internal API, do no use in application code.

Returns
  • resources (possibly empty but not null)

public List<String> getWebInfResources ()

Returns the WEB-INF resources.

Internal API, do no use in application code.

Returns
  • resources (possibly empty but not null)

public boolean isClassPathEnabled ()

Shall libraries and class folders be added automatically from the current classpath?

Internal API, do no use in application code.

public WarProbeOption library (String libraryPath)

Adds the library from the given path to the WAR. If the path is a directory, it is assumed to be a class folder, and its contents will be archived in a JAR, and the JAR will be copied to WEB-INF/lib. The JAR name follows Maven conventions and is determined from properties defined in any file named pom.properties, located in any subdirectory of META-INF/maven, if available (otherwise, a random JAR name is generated).

If the path is not a directory, it is assumed to be a JAR, and its contents will be copied to WEB-INF/lib.

Parameters
libraryPath path to library
Returns
  • this for fluent syntax

public WarProbeOption library (UrlReference libraryUrl)

Adds the library from the URL to the WAR. The URL is assumed to reference a JAR. The JAR will be downloaded if required and its contents will be copied to WEB-INF/lib.

Returns
  • this for fluent syntax

public WarProbeOption metaInfResource (String resourcePath)

Adds the given resourcs from the current class path to the WAR in META-INF/.

Returns
  • this for fluent syntax

public WarProbeOption name (String _name)

Sets the application name of this WAR.

Parameters
_name application name
Returns
  • this for fluent syntax

public WarProbeOption overlay (String overlayPath)

Adds an overlay from the given path to the WAR. This is similar to the overlay concept of the Maven WAR Plugin. If the overlay path is a directory, its contents are copied recursively to the root of the WAR. If the overlay path is an archive, its exploded contents are copied to the root of the WAR. All overlays are copied in the given order. All overlay are copied before any libraries, classes or resources.

Parameters
overlayPath path to overlay
Returns
  • this for fluent syntax

public WarProbeOption overlay (UrlReference overlayUrl)

Adds an overlay from the given URL to the WAR. This is similar to the overlay concept of the Maven WAR Plugin. The URL is assumed to reference an archive. The archive is downloaded if required, and then its exploded contents are copied to the root of the WAR. All overlays are copied in the given order. All overlay are copied before any libraries, classes or resources.

Returns
  • this for fluent syntax

public WarProbeOption resources (String... resourcePath)

Adds the given resources from the current class path to the WAR in WEB-INF/classes.

Returns
  • this for fluent syntax

public WarProbeOption webInfResource (String resourcePath)

Adds the given resource from the current class path to the WAR in WEB-INF/.

Returns
  • this for fluent syntax