@Contract public class Server extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Server.Builder
Builder for creating embedded server instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addContainer(ContainerBuilder.Type type)
Adds a container of a particular type using the default operating
configuration for the container.
|
<T extends EmbeddedContainer> |
addContainer(ContainerBuilder<T> info)
Adds a container to this server.
|
<T extends ContainerBuilder<?>> |
createConfig(Class<T> configType)
Get an embedded container configuration.
|
ContainerBuilder<EmbeddedContainer> |
createConfig(ContainerBuilder.Type type)
Get the embedded container configuration for a container type.
|
ContainerBuilder<EmbeddedContainer> |
createConfig(String name)
Get the embedded container builder for a container type identified by its
name.
|
Port |
createPort(int portNumber)
Creates a port to attach to embedded containers.
|
Collection<EmbeddedContainer> |
getContainers()
Returns a list of the currently managed containers
|
EmbeddedDeployer |
getDeployer()
Returns the embedded deployer implementation, can be used to
generically deploy applications to the embedded server.
|
EmbeddedFileSystem |
getFileSystem()
Returns the embedded file system used to run this embedded instance.
|
String |
getName()
Returns the server name, as specified in
Server.Builder#Builder(String) |
static Server |
getServer(String name)
Returns the embedded server instance of a particular name
|
static List<String> |
getServerNames()
Returns the list of existing embedded instances
|
void |
start()
Starts the embedded server, opening ports, and running the startup
services.
|
void |
stop()
stops the embedded server instance, any deployed application will be stopped
ports will be closed and shutdown services will be ran.
|
public static List<String> getServerNames()
public static Server getServer(String name)
name
- requested server namepublic ContainerBuilder<EmbeddedContainer> createConfig(ContainerBuilder.Type type)
type
- the container type (e.g. Type.ejb)public ContainerBuilder<EmbeddedContainer> createConfig(String name)
name
- the container name, which is the name used on the @Service annotationpublic <T extends ContainerBuilder<?>> T createConfig(Class<T> configType)
T
- type of the embedded containerconfigType
- the type of the embedded container configurationpublic void addContainer(ContainerBuilder.Type type)
type
- type of the container to be added (like web, ejb).IllegalStateException
- if the container is already started.public <T extends EmbeddedContainer> T addContainer(ContainerBuilder<T> info)
T
- type of the containerinfo
- the configuration for the containerIllegalStateException
- if the container is already started.public Collection<EmbeddedContainer> getContainers()
public Port createPort(int portNumber) throws IOException
portNumber
- port number for this portIOException
- if the port cannot be opened.public String getName()
Server.Builder#Builder(String)
public EmbeddedFileSystem getFileSystem()
public void start() throws LifecycleException
LifecycleException
- if the server cannot be started propertlypublic void stop() throws LifecycleException
LifecycleException
- if the server cannot shuts down properlypublic EmbeddedDeployer getDeployer()
Copyright © 2018. All rights reserved.