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 StringDEFAULT_ADMIN_CONSOLE_APP_NAMEstatic StringDEFAULT_ADMIN_CONSOLE_CONTEXT_ROOTstatic StringkAppAltDDDirNamestatic StringkConfigDirNamefolder where the configuration of this instance is storedstatic StringkConfigXMLFileNamestatic StringkConfigXMLFileNameBackupstatic StringkDefaultLoggingPropertiesFileNamestatic StringkEJBStubDirNamestatic StringkGeneratedDirNamefolder where all generated code like compiled jsps, stubs is storedstatic StringkGeneratedXMLDirNamestatic StringkInitFileNameinit file namestatic StringkLoggingPropertiesFileNamestatic StringkPolicyFileDirNamestatic StringkRepositoryDirName-
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 FilegetApplicationAltDDPath()Gets the directory to store external alternate deployment descriptors NormallyROOT/generated/altddFilegetApplicationCompileJspPath()Returns the path for compiled JSP Pages from an application that is deployed on this instance.FilegetApplicationEJBStubPath()FilegetApplicationGeneratedXMLPath()FilegetApplicationPolicyFilePath()Returns the path for policy files for applications deployed on this instance.FilegetApplicationRepositoryPath()Gets the directory to store deployed applications NormallyROOT/applicationsFilegetApplicationStubPath()Gets the directory to store generated stuff.FilegetConfigDirPath()Gets the directory to store configuration.FilegetDefaultAdminConsoleFolderOnDisk()Returns the folder where the admin console application's folder (in the name of admin console application) should be found.StringgetDomainName()FilegetInitFilePath()Gets the init.conf file.StringgetInstanceName()Every server has a name that can be found in the server element in domain.xmlFilegetInstanceRoot()FilegetJKS()A Java KeyStore which is locked by administrator's master password.FilegetLibPath()Gets the directory for hosting user-provided jar files.FilegetMasterPasswordFile()A JCEKS keystore which is locked with a fixed-key.StringgetProp(String key)Return the value of one property.Map<String,String>getProps()RuntimeTypegetRuntimeType()Returns the process type of this instance.com.sun.enterprise.module.bootstrap.StartupContextgetStartupContext()return the startup context used to initialize this runtimeServerEnvironment.StatusgetStatus()Gets the server statusFilegetTrustStore()The truststore used by the server.booleanisDas()Am I a running GlassFish DAS server?booleanisDebug()booleanisEmbedded()booleanisInstance()Am I a running GlassFish server instance?booleanisMicro()booleanisVerbose()voidpostConstruct()This is where the real initialization happens.voidsetStatus(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:
postConstructin interfaceorg.glassfish.hk2.api.PostConstruct
-
getDomainName
public String getDomainName()
- Specified by:
getDomainNamein interfaceServerEnvironment
-
getInstanceRoot
public File getInstanceRoot()
- Specified by:
getInstanceRootin interfaceServerEnvironment
-
getStartupContext
public com.sun.enterprise.module.bootstrap.StartupContext getStartupContext()
Description copied from interface:ServerEnvironmentreturn the startup context used to initialize this runtime- Specified by:
getStartupContextin interfaceServerEnvironment
-
getConfigDirPath
public File getConfigDirPath()
Gets the directory to store configuration. NormallyROOT/config- Specified by:
getConfigDirPathin interfaceServerEnvironment
-
getApplicationRepositoryPath
public File getApplicationRepositoryPath()
Gets the directory to store deployed applications NormallyROOT/applications- Specified by:
getApplicationRepositoryPathin interfaceServerEnvironment
-
getApplicationStubPath
public File getApplicationStubPath()
Gets the directory to store generated stuff. NormallyROOT/generated- Specified by:
getApplicationStubPathin 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:
getLibPathin interfaceServerEnvironment
-
getApplicationEJBStubPath
public File getApplicationEJBStubPath()
- Specified by:
getApplicationEJBStubPathin interfaceServerEnvironment
-
getApplicationGeneratedXMLPath
public File getApplicationGeneratedXMLPath()
- Specified by:
getApplicationGeneratedXMLPathin 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:
getApplicationCompileJspPathin interfaceServerEnvironment
-
getApplicationPolicyFilePath
public File getApplicationPolicyFilePath()
Returns the path for policy files for applications deployed on this instance.- Specified by:
getApplicationPolicyFilePathin interfaceServerEnvironment
-
getApplicationAltDDPath
public File getApplicationAltDDPath()
Gets the directory to store external alternate deployment descriptors NormallyROOT/generated/altdd- Specified by:
getApplicationAltDDPathin 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:ServerEnvironmentA JCEKS keystore which is locked with a fixed-key. This is the "security-by-obfuscation" carried over from V2.- Specified by:
getMasterPasswordFilein interfaceServerEnvironment- Returns:
- File representing the JCEKS store containing the real master password
-
getJKS
public File getJKS()
Description copied from interface:ServerEnvironmentA Java KeyStore which is locked by administrator's master password.- Specified by:
getJKSin interfaceServerEnvironment- Returns:
- File representing the JKS which is server's keystore in developer-product case
-
getTrustStore
public File getTrustStore()
Description copied from interface:ServerEnvironmentThe truststore used by the server.- Specified by:
getTrustStorein interfaceServerEnvironment- Returns:
- File for the truststore
-
getStatus
public ServerEnvironment.Status getStatus()
Description copied from interface:ServerEnvironmentGets the server status- Specified by:
getStatusin interfaceServerEnvironment
-
setStatus
public void setStatus(ServerEnvironment.Status status)
-
isEmbedded
public boolean isEmbedded()
-
getRuntimeType
public RuntimeType getRuntimeType()
Description copied from interface:ServerEnvironmentReturns the process type of this instance.- Specified by:
getRuntimeTypein 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:
getInstanceNamein interfaceServerEnvironment- Returns:
- the name of this server i.e. "my" name
-
isInstance
public boolean isInstance()
Am I a running GlassFish server instance?- Specified by:
isInstancein interfaceServerEnvironment- Returns:
- true if we are an instance
-
isDas
public boolean isDas()
Am I a running GlassFish DAS server?- Specified by:
isDasin interfaceServerEnvironment- Returns:
- true if we are a DAS
-
isMicro
public boolean isMicro()
- Specified by:
isMicroin interfaceServerEnvironment
-
isDebug
public boolean isDebug()
-
isVerbose
public boolean isVerbose()
-
-