Package org.glassfish.server
Class ServerEnvironmentImpl
- java.lang.Object
-
- org.glassfish.server.ServerEnvironmentImpl
-
- All Implemented Interfaces:
ServerEnvironment
,org.glassfish.hk2.api.PostConstruct
@Service public class ServerEnvironmentImpl extends Object implements ServerEnvironment, org.glassfish.hk2.api.PostConstruct
Defines various global configuration for the running GlassFish instance.This primarily replaces all the system variables in V2.
- Author:
- Jerome Dochez, Byron Nevins
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.admin.ServerEnvironment
ServerEnvironment.Status
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ADMIN_CONSOLE_APP_NAME
static String
DEFAULT_ADMIN_CONSOLE_CONTEXT_ROOT
static String
kAppAltDDDirName
static String
kConfigDirName
folder where the configuration of this instance is storedstatic String
kConfigXMLFileName
static String
kConfigXMLFileNameBackup
static String
kDefaultLoggingPropertiesFileName
static String
kEJBStubDirName
static String
kGeneratedDirName
folder where all generated code like compiled jsps, stubs is storedstatic String
kGeneratedXMLDirName
static String
kInitFileName
init file namestatic String
kLoggingPropertiesFileName
static String
kPolicyFileDirName
static String
kRepositoryDirName
-
Fields inherited from interface org.glassfish.api.admin.ServerEnvironment
DEFAULT_INSTANCE_NAME, kCompileJspDirName
-
-
Constructor Summary
Constructors Constructor Description ServerEnvironmentImpl()
Compute all the values per default.ServerEnvironmentImpl(File root)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description File
getApplicationAltDDPath()
Gets the directory to store external alternate deployment descriptors NormallyROOT/generated/altdd
File
getApplicationCompileJspPath()
Returns the path for compiled JSP Pages from an application that is deployed on this instance.File
getApplicationEJBStubPath()
File
getApplicationGeneratedXMLPath()
File
getApplicationPolicyFilePath()
Returns the path for policy files for applications deployed on this instance.File
getApplicationRepositoryPath()
Gets the directory to store deployed applications NormallyROOT/applications
File
getApplicationStubPath()
Gets the directory to store generated stuff.File
getConfigDirPath()
Gets the directory to store configuration.File
getDefaultAdminConsoleFolderOnDisk()
Returns the folder where the admin console application's folder (in the name of admin console application) should be found.String
getDomainName()
File
getInitFilePath()
Gets the init.conf file.String
getInstanceName()
Every server has a name that can be found in the server element in domain.xmlFile
getInstanceRoot()
File
getJKS()
A Java KeyStore which is locked by administrator's master password.File
getLibPath()
Gets the directory for hosting user-provided jar files.File
getMasterPasswordFile()
A JCEKS keystore which is locked with a fixed-key.String
getProp(String key)
Return the value of one property.Map<String,String>
getProps()
RuntimeType
getRuntimeType()
Returns the process type of this instance.com.sun.enterprise.module.bootstrap.StartupContext
getStartupContext()
return the startup context used to initialize this runtimeServerEnvironment.Status
getStatus()
Gets the server statusFile
getTrustStore()
The truststore used by the server.boolean
isDas()
Am I a running GlassFish DAS server?boolean
isDebug()
boolean
isEmbedded()
boolean
isInstance()
Am I a running GlassFish server instance?boolean
isMicro()
boolean
isVerbose()
void
postConstruct()
This is where the real initialization happens.void
setStatus(ServerEnvironment.Status status)
-
-
-
Field Detail
-
kGeneratedDirName
public static final String kGeneratedDirName
folder where all generated code like compiled jsps, stubs is stored- See Also:
- Constant Field Values
-
kRepositoryDirName
public static final String kRepositoryDirName
- See Also:
- Constant Field Values
-
kAppAltDDDirName
public static final String kAppAltDDDirName
- See Also:
- Constant Field Values
-
kEJBStubDirName
public static final String kEJBStubDirName
- See Also:
- Constant Field Values
-
kGeneratedXMLDirName
public static final String kGeneratedXMLDirName
- See Also:
- Constant Field Values
-
kPolicyFileDirName
public static final String kPolicyFileDirName
- See Also:
- Constant Field Values
-
kConfigXMLFileName
public static final String kConfigXMLFileName
- See Also:
- Constant Field Values
-
kConfigXMLFileNameBackup
public static final String kConfigXMLFileNameBackup
- See Also:
- Constant Field Values
-
kLoggingPropertiesFileName
public static final String kLoggingPropertiesFileName
- See Also:
- Constant Field Values
-
kDefaultLoggingPropertiesFileName
public static final String kDefaultLoggingPropertiesFileName
- See Also:
- Constant Field Values
-
kConfigDirName
public static final String kConfigDirName
folder where the configuration of this instance is stored- See Also:
- Constant Field Values
-
kInitFileName
public static final String kInitFileName
init file name- See Also:
- Constant Field Values
-
DEFAULT_ADMIN_CONSOLE_CONTEXT_ROOT
public static final String DEFAULT_ADMIN_CONSOLE_CONTEXT_ROOT
- See Also:
- Constant Field Values
-
DEFAULT_ADMIN_CONSOLE_APP_NAME
public static final String DEFAULT_ADMIN_CONSOLE_APP_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServerEnvironmentImpl
public ServerEnvironmentImpl()
Compute all the values per default.
-
ServerEnvironmentImpl
public ServerEnvironmentImpl(File root)
-
-
Method Detail
-
postConstruct
public void postConstruct()
This is where the real initialization happens.- Specified by:
postConstruct
in interfaceorg.glassfish.hk2.api.PostConstruct
-
getDomainName
public String getDomainName()
- Specified by:
getDomainName
in interfaceServerEnvironment
-
getInstanceRoot
public File getInstanceRoot()
- Specified by:
getInstanceRoot
in interfaceServerEnvironment
-
getStartupContext
public com.sun.enterprise.module.bootstrap.StartupContext getStartupContext()
Description copied from interface:ServerEnvironment
return the startup context used to initialize this runtime- Specified by:
getStartupContext
in interfaceServerEnvironment
-
getConfigDirPath
public File getConfigDirPath()
Gets the directory to store configuration. NormallyROOT/config
- Specified by:
getConfigDirPath
in interfaceServerEnvironment
-
getApplicationRepositoryPath
public File getApplicationRepositoryPath()
Gets the directory to store deployed applications NormallyROOT/applications
- Specified by:
getApplicationRepositoryPath
in interfaceServerEnvironment
-
getApplicationStubPath
public File getApplicationStubPath()
Gets the directory to store generated stuff. NormallyROOT/generated
- Specified by:
getApplicationStubPath
in interfaceServerEnvironment
-
getInitFilePath
public File getInitFilePath()
Gets the init.conf file.
-
getLibPath
public File getLibPath()
Gets the directory for hosting user-provided jar files. NormallyROOT/lib
- Specified by:
getLibPath
in interfaceServerEnvironment
-
getApplicationEJBStubPath
public File getApplicationEJBStubPath()
- Specified by:
getApplicationEJBStubPath
in interfaceServerEnvironment
-
getApplicationGeneratedXMLPath
public File getApplicationGeneratedXMLPath()
- Specified by:
getApplicationGeneratedXMLPath
in interfaceServerEnvironment
-
getApplicationCompileJspPath
public File getApplicationCompileJspPath()
Returns the path for compiled JSP Pages from an application that is deployed on this instance. By default all such compiled JSPs should lie in the same folder.- Specified by:
getApplicationCompileJspPath
in interfaceServerEnvironment
-
getApplicationPolicyFilePath
public File getApplicationPolicyFilePath()
Returns the path for policy files for applications deployed on this instance.- Specified by:
getApplicationPolicyFilePath
in interfaceServerEnvironment
-
getApplicationAltDDPath
public File getApplicationAltDDPath()
Gets the directory to store external alternate deployment descriptors NormallyROOT/generated/altdd
- Specified by:
getApplicationAltDDPath
in interfaceServerEnvironment
-
getProp
public final String getProp(String key)
Return the value of one property. Example
String pr = getProp(SystemPropertyConstants.PRODUCT_ROOT_PROPERTY);- Parameters:
key
- the name of the property- Returns:
- the value of the property
-
getDefaultAdminConsoleFolderOnDisk
public File getDefaultAdminConsoleFolderOnDisk()
Returns the folder where the admin console application's folder (in the name of admin console application) should be found. Thus by default, it should be: [install-dir]/lib/install/applications. No attempt is made to check if this location is readable or writable.- Returns:
- java.io.File representing parent folder for admin console application Never returns a null
-
getMasterPasswordFile
public File getMasterPasswordFile()
Description copied from interface:ServerEnvironment
A JCEKS keystore which is locked with a fixed-key. This is the "security-by-obfuscation" carried over from V2.- Specified by:
getMasterPasswordFile
in interfaceServerEnvironment
- Returns:
- File representing the JCEKS store containing the real master password
-
getJKS
public File getJKS()
Description copied from interface:ServerEnvironment
A Java KeyStore which is locked by administrator's master password.- Specified by:
getJKS
in interfaceServerEnvironment
- Returns:
- File representing the JKS which is server's keystore in developer-product case
-
getTrustStore
public File getTrustStore()
Description copied from interface:ServerEnvironment
The truststore used by the server.- Specified by:
getTrustStore
in interfaceServerEnvironment
- Returns:
- File for the truststore
-
getStatus
public ServerEnvironment.Status getStatus()
Description copied from interface:ServerEnvironment
Gets the server status- Specified by:
getStatus
in interfaceServerEnvironment
-
setStatus
public void setStatus(ServerEnvironment.Status status)
-
isEmbedded
public boolean isEmbedded()
-
getRuntimeType
public RuntimeType getRuntimeType()
Description copied from interface:ServerEnvironment
Returns the process type of this instance.- Specified by:
getRuntimeType
in interfaceServerEnvironment
- Returns:
- the instance process type
-
getInstanceName
public String getInstanceName()
Every server has a name that can be found in the server element in domain.xml- Specified by:
getInstanceName
in interfaceServerEnvironment
- Returns:
- the name of this server i.e. "my" name
-
isInstance
public boolean isInstance()
Am I a running GlassFish server instance?- Specified by:
isInstance
in interfaceServerEnvironment
- Returns:
- true if we are an instance
-
isDas
public boolean isDas()
Am I a running GlassFish DAS server?- Specified by:
isDas
in interfaceServerEnvironment
- Returns:
- true if we are a DAS
-
isMicro
public boolean isMicro()
- Specified by:
isMicro
in interfaceServerEnvironment
-
isDebug
public boolean isDebug()
-
isVerbose
public boolean isVerbose()
-
-