Package com.groiss.component
Class ServiceManager
java.lang.Object
com.groiss.component.ServiceManager
The main class. It contains the main method, which is called on startup.
Note that in standalone mode the Bootstrap class contains the main method that
calls the main method of this class.
The following steps are performed:
- load the configuration file
- set the system locale
- set the resources
- start the log service and settings service
- start the configured services
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Service
addService
(String id, Service s) Add an object to the list of services.static Service
addService
(String classname, String id) Add a class to the services, the class is loaded, the default contructor is called and the startup() method is called.static void
static Locale
static String
Get the name of the JVM incarnation of @enterprise.static Service
getService
(String id) Return the service by id.static Date
Return the date of startup.static boolean
This method returns true if the shutdown in in progress.static boolean
Returns true if @enterprise is running standalone (not in an application server).static boolean
Returns true if @enterprise is running in upgrade mode.static void
main()
Start @enterprise without a configuration file ( in app-server; conffile has already been set via webapplistener)static void
Main method suitable for starting @enterprise.static void
Start @enterprise with a configuration file.static void
Set the default locale and time zone for the whole java process.static void
shutdown()
Shutdown the services, the shutdown() methods of the services are called.static void
shutdown
(int status) This method is called from HTMLAdminstatic void
shutdown
(int status, int delayMS) static void
shutdownService
(String[] args) This method is called as stop method when running as JavaService NT service
-
Field Details
-
UPGRADE_FILENAME
- See Also:
-
-
Constructor Details
-
ServiceManager
public ServiceManager()
-
-
Method Details
-
getJVMName
Get the name of the JVM incarnation of @enterprise. Usually in the form "pid@hostname".- Returns:
- the name of the JVM
-
main
Main method suitable for starting @enterprise.- Parameters:
args
- optional arguments are:-restricted
:starts @enterprise in restricted mode (no non-sysadm logins allowed) and-upgrade
: performs @enterprise and applications upgrades. In this mode, @enterprise stops after performing this upgrades.- Throws:
Exception
-
main
Start @enterprise without a configuration file ( in app-server; conffile has already been set via webapplistener)- Throws:
Exception
-
main
public static void main(String confFiles, boolean logOnConsole, boolean isStandalone) throws Exception Start @enterprise with a configuration file.- Parameters:
confFiles
- pathes to the configurationlogOnConsole
- true if logging should go to the console.- Throws:
Exception
-
closeServerSocketLocker
public static void closeServerSocketLocker() -
setDefaultLocale
public static void setDefaultLocale()Set the default locale and time zone for the whole java process. The method takes language, country and variant from the configuration file. if language or country is null, the default locale is not changed. -
getConfiguredLocale
-
addService
Add an object to the list of services.- Parameters:
id
- the id for the service tables
- the service object
-
addService
Add a class to the services, the class is loaded, the default contructor is called and the startup() method is called.- Parameters:
classname
- the name of the service classid
- the id for the service table
-
shutdownService
This method is called as stop method when running as JavaService NT service -
shutdown
public static void shutdown(int status) This method is called from HTMLAdmin- Parameters:
status
- 0='Stop server', 2='Restart server'
-
shutdown
public static void shutdown(int status, int delayMS) -
shutdown
public static void shutdown()Shutdown the services, the shutdown() methods of the services are called. This is the final shutdown() method, called either from shutdown hook or from service stop method. -
getService
Return the service by id.- Parameters:
id
- the id of a service.- Returns:
- the service object.
-
getStartDate
Return the date of startup. -
isStandalone
public static boolean isStandalone()Returns true if @enterprise is running standalone (not in an application server).- Returns:
- true if standalone
-
isUpgrading
public static boolean isUpgrading()Returns true if @enterprise is running in upgrade mode.- Returns:
- true if upgrade taking place
-
isShutdownInProgress
public static boolean isShutdownInProgress()This method returns true if the shutdown in in progress.- Returns:
- true if in shutdown
-