To create configure an embedded Enterprise Server, perform these tasks:
Instantiate the org.glassfish.api.embedded.Server.Builder class.
Invoke any methods for configuration settings that you require. This is optional.
Invoke one of the build methods to create a Server object.
The methods of this class for setting the server configuration are listed in the following table. The default value of each configuration setting is also listed.
Table 1 Constructor and Methods of the Server.Builder Class
Purpose |
Method |
Default Value |
|
---|---|---|---|
Creates a server builder and names the server |
|
None |
|
References an embedded file system |
|
None |
|
Enables verbose mode |
|
true |
|
Enables logging |
|
true |
|
Specifies a log file |
|
instance-dirlogs/server.log (see Instance Root Directory) |
|
Creates a server |
|
None |
|
Creates a server with properties |
|
None |
This example shows code for creating a server and enabling logging.
... import org.glassfish.api.embedded.*; ... Server.Builder builder = new Server.Builder("test"); builder.logger(true); ... Server server = builder.build(); ...