Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Definition

Excerpt

Create a container instance

Support Matrix

Java

Ant

Maven2

IntelliJ IDEA

Netbeans

(tick)

(tick)

(tick)

(tick)

(tick)

Java API

If you're using the Java API there are 2 solutions to instantiate a container:

  • by instantiating the Java object implementing the container and passing a Configuration object to it. For example:
Code Block

Container container = new Orion2xLocalContainer(configuration);
[...]
Container container = new Resin3xLocalContainer(configuration);
[...]
Container container = new Weblogic8xLocalContainer(configuration);
[...]
Container container = new TomcatRemoteContainer(configuration);
  • by using the DefaultContainerFactory class. The advantage is that you can instantiate the container by name and thus your code can be generic which is nice if you plan to run the same code with different containers. For example, to instantiate a Resin 3.x installed local container:
Code Block

ContainerFactory factory = new DefaultContainerFactory();
Container container = factory.createContainer("resin3x", ContainerType.INSTALLED, configuration);

...

The class or container id to use for instantiating a container can be found on each container's documentation page:

Children Display
pageContainers

Example using Cargo extensions

...