|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jgoodies.binding.beans.Model de.schwarzrot.data.support.AbstractEntity de.schwarzrot.app.domain.ServiceDefinition
public class ServiceDefinition
bean used to store the definition of a java system service. Java system
services are applications that could be started by ServiceManager
.
Each system service is bound to the hostname of the machine, it is installed
to.
Life cycle of a service is defined by Status
. A java system service
can be enriched by a command, executed before the service will be started and
a command, that gets executed after the service has been stopped. Primary
intention of the wrapper commands was to handle the start of a fileserver via
wakeOnLan.
ServiceManager
has started to start the service. If the service
is enriched by wrapper commands, the ScriptPreStart
will be executed.
The time of execution is stored, so the ServiceManager
is able to
wait waitPreStart
time before trying to start the service itself. If
a startTrigger
is defined, the ServiceManager
checks the
existance of the trigger file. The serivce will not get startet, until the
trigger file exists.ServiceManager
has started the real java system service.ServiceManager
has verified the running service, so it is really
up and runningServiceManager
hast started to stop the serviceServiceManager
has verified, that the service is stopped. If the
service is enriched by wrapper commands, the ServiceManager
waits
waitPostEnd
time, before the ScriptPostEnd
will be executed.
If a startTrigger
is defined, the ScriptPostEnd
should
ensure, that the trigger file does not exists any more.
Nested Class Summary | |
---|---|
static class |
ServiceDefinition.Status
|
Field Summary | |
---|---|
static int |
REQUEST_SHUTDOWN
|
static int |
REQUEST_STARTUP
|
Constructor Summary | |
---|---|
ServiceDefinition()
|
Method Summary | |
---|---|
String |
getComment()
returns the comment of this service definition |
List<SortInfo> |
getDefaultOrder()
returns a list of SortInfo , that build the order for default
list-queries. |
Date |
getDtStarted()
returns the timestamp when the service has been started |
Date |
getDtStopped()
returns the timestamp when the service has been stopped |
String |
getHostName()
returns the hostname of the machine, the service has been installed to |
File |
getLogConfig()
returns the path of a java properties file, used to configure java logging |
Map<String,String> |
getMappings()
returns a map with mappings of logical property names to physical property names (column names in database terms). |
String |
getName()
returns the name of the defined service |
String |
getPersistenceName()
returns the name of the entity for persistance. |
int |
getPid()
returns the process id of the running service. 0 signals a stopped service |
File |
getScriptPostEnd()
|
File |
getScriptPreStart()
|
String |
getServiceClassname()
returns the classname of the service |
File |
getServicePath()
returns the path of the service archive. |
int |
getSleepTime()
returns the time to sleep between consecutive jobs. |
String |
getStartTrigger()
returns the path of a file, that must exist, to enable the ServiceManager to start the service |
String |
getStartupArgs()
returns all startup parameters joined together into one String. |
ServiceDefinition.Status |
getStatus()
returns the status of a java system service |
List<String> |
getUniqColumnNames()
returns a list of property names, which serve to detect a uniq instance without the usage of the primary key. |
String |
getUserName()
returns the username, that is used to run the service. |
int |
getWaitPostEnd()
returns the wait time in seconds to wait after service has ended, before starting the PostEnd-script |
int |
getWaitPreStart()
returns the wait time in seconds to wait after executing the PreStart-script before starting the service |
boolean |
isAutoStart()
returns true, if the service should be startet automatically. |
void |
setAutoStart(boolean autoStart)
sets the autostart flag of a service. |
void |
setComment(String comment)
sets the comment of a service definition |
void |
setDtStarted(Date dtStarted)
sets the startup time of a service |
void |
setDtStopped(Date dtStopped)
sets the timestamp when the service has been stopped |
void |
setHostName(String hostName)
sets the hostname, where the service has been installed to. |
void |
setLogConfig(File logConfig)
sets the path of the java properties file, used to configure java logging |
void |
setName(String name)
sets the name of a service |
void |
setPid(int pid)
sets the process id of a running service. 0 signals a service that is not running |
void |
setScriptPostEnd(File scriptPostEnd)
sets the command, that should be executed after the service has been stopped |
void |
setScriptPreStart(File scriptPreStart)
sets the command, that should be executed before the service will be started |
void |
setServiceClassname(String serviceClassname)
sets the classname of the service |
void |
setServicePath(File servicePath)
sets the path of the services archive. |
void |
setSleepTime(int sleepTime)
sets the time (in seconds) the service should sleep in idle mode |
void |
setStartTrigger(String startTrigger)
sets the path of a trigger file. |
void |
setStartupArgs(String startupArgs)
sets the startup parameters for the service. |
void |
setStatus(ServiceDefinition.Status status)
sets the status of a service |
void |
setUserName(String userName)
sets the system user, that should be used to run the service |
void |
setWaitPostEnd(int waitPostEnd)
sets the time to wait (in seconds) after the service has been stopped, before executing the post-end-script |
void |
setWaitPreStart(int waitPreStart)
sets the time to wait (in seconds) after execution of pre-start-script, before starting the service |
Methods inherited from class de.schwarzrot.data.support.AbstractEntity |
---|
adoptChildren, adoptChildren, adoptGroupedChildren, compareTo, equals, getCModified, getCode, getDtCreated, getDtModified, getId, getLogger, getSchemaName, getSkipList, getSystemClass, getUCreated, getUModified, getUserAttributes, getVariantColumnName, getVariantTypeMap, hashCode, isDirty, isUserType, isVirtual, setCModified, setDirty, setDtCreated, setDtModified, setId, setSchemaName, setUCreated, setUModified, toString, validate |
Methods inherited from class com.jgoodies.binding.beans.Model |
---|
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, equals, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, fireMultiplePropertiesChanged, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jgoodies.binding.beans.Observable |
---|
addPropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
public static final int REQUEST_SHUTDOWN
public static final int REQUEST_STARTUP
Constructor Detail |
---|
public ServiceDefinition()
Method Detail |
---|
public final String getComment()
public List<SortInfo> getDefaultOrder()
Entity
SortInfo
, that build the order for default
list-queries.
getDefaultOrder
in interface Entity
getDefaultOrder
in class AbstractEntity
public final Date getDtStarted()
public final Date getDtStopped()
public final String getHostName()
public final File getLogConfig()
public Map<String,String> getMappings()
Entity
Every implementation should respect the parents mappings. The following sample shows different mapping types:
public Map<String, String> getMappings() { Map<String, String> mappings = super.getMappings(); mappings.put("title", "name"); mappings.put("streams", Stream.class.getName()); mappings.put("pageDefinitions", "pageType|" + ThemeElement.class.getName()); return mappings; }The mappings explained:
List
, known (named) children are hold in a Map
.
The mapped value is used as classname to create child instances.Map
, that holds grouped
children. Known children are hold by a Map
, unknown children by a
List
, so "pageDefinitions" may contain elements of type
Map
, or List
. pageType, a property of
ThemeElement
, is used to group the children. The word before the
'|' is the property name used as key value for grouping and the type
after '|' is used to create instances.
getMappings
in interface Entity
getMappings
in class AbstractEntity
Map
with property names as keys and column
names as values.public final String getName()
public final String getPersistenceName()
Entity
getClass().getSimpleName()
, but some storage may
have size limitations, or don't support case sensitive names, so this
call is to deal with that kind of limitations.
getPersistenceName
in interface Entity
getPersistenceName
in class AbstractEntity
public final int getPid()
public final File getScriptPostEnd()
public final File getScriptPreStart()
public final String getServiceClassname()
public final File getServicePath()
public final int getSleepTime()
public final String getStartTrigger()
ServiceManager
to start the service
public final String getStartupArgs()
public final ServiceDefinition.Status getStatus()
public List<String> getUniqColumnNames()
Entity
getUniqColumnNames
in interface Entity
getUniqColumnNames
in class AbstractEntity
public final String getUserName()
ServiceManager
is intended to run in superuser mode, to be able
to change the user of the java services.
public final int getWaitPostEnd()
public final int getWaitPreStart()
public final boolean isAutoStart()
Status
stopped.
public final void setAutoStart(boolean autoStart)
autoStart
- - true if the service should be started automatically, false
for services that should be started an requests from command
center onlypublic final void setComment(String comment)
comment
- - the comment of this definitionpublic final void setDtStarted(Date dtStarted)
dtStarted
- - the timestamp when the service has been startedpublic final void setDtStopped(Date dtStopped)
dtStopped
- - the timestamp when the service has been stoppedpublic final void setHostName(String hostName)
hostName
- - the name of the machine that hosts the servicepublic final void setLogConfig(File logConfig)
logConfig
- - path of the log configurationpublic final void setName(String name)
name
- - the name of the servicepublic final void setPid(int pid)
pid
- - the process id of the servicepublic final void setScriptPostEnd(File scriptPostEnd)
scriptPostEnd
- - the path to a system commandpublic final void setScriptPreStart(File scriptPreStart)
scriptPreStart
- - the path of a system commandpublic final void setServiceClassname(String serviceClassname)
serviceClassname
- - the classname of the servicepublic final void setServicePath(File servicePath)
servicePath
- - path of the services jarpublic final void setSleepTime(int sleepTime)
sleepTime
- - time to sleeppublic final void setStartTrigger(String startTrigger)
ServiceManager
before starting the service
startTrigger
- - the path of a file that must exists before the service will
be startedpublic final void setStartupArgs(String startupArgs)
startupArgs
- - the arguments of a servicepublic final void setStatus(ServiceDefinition.Status status)
status
- - the status of the servicepublic final void setUserName(String userName)
userName
- - a name of a system userpublic final void setWaitPostEnd(int waitPostEnd)
waitPostEnd
- - the time to waitpublic final void setWaitPreStart(int waitPreStart)
waitPreStart
- - the time to wait
|
SRJRCFrames v0.1.296 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |