Package com.aspectran.shell.service
Class AbstractShellService
- java.lang.Object
-
- com.aspectran.core.service.AbstractServiceController
-
- com.aspectran.core.service.AbstractCoreService
-
- com.aspectran.core.service.AspectranCoreService
-
- com.aspectran.shell.service.AbstractShellService
-
- All Implemented Interfaces:
CoreService,ServiceController,ShellService
- Direct Known Subclasses:
AspectranShellService
public abstract class AbstractShellService extends AspectranCoreService implements ShellService
Abstract base class forShellServiceimplementations.Created: 2017. 10. 30.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractShellService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterContextLoaded()This method is executed immediately after the ActivityContext is loaded.voidbeforeContextDestroy()This method executed just before the ActivityContext is destroyed.CommandRegistrygetCommandRegistry()java.lang.String[]getCommands()ConsolegetConsole()Returns the console.java.lang.StringgetGreetings()booleanisBusy()Returns whether this service has any work in progress.booleanisExposable(java.lang.String transletName)Checks whether the Translet can be exposed.booleanisVerbose()Tests if the verbose mode is enabled.SessionAdapternewSessionAdapter()Creates a new session adapter for the shell service and returns.voidprintGreetings()Prints welcome message.voidprintHelp()Prints help information.voidrestart()Restarts the service.voidrestart(java.lang.String message)Restarts the service.protected voidsetCommands(java.lang.String[] commands)protected voidsetConsole(Console console)voidsetGreetings(java.lang.String greetings)voidsetVerbose(boolean verbose)Enables or disables the verbose mode.-
Methods inherited from class com.aspectran.core.service.AspectranCoreService
doPause, doPause, doRestart, doResume, doStart, doStop
-
Methods inherited from class com.aspectran.core.service.AbstractCoreService
createSchedulerService, destroyActivityContext, determineBasePath, getActivityContext, getApplicationAdapter, getAspectranClassLoader, getAspectranConfig, getBasePath, getServiceController, isDerived, isHardReload, isLateStart, joinDerivedService, loadActivityContext, prepare, setActivityContext, setBasePath, setExposals
-
Methods inherited from class com.aspectran.core.service.AbstractServiceController
getLock, getServiceName, isActive, joinDerivedService, pause, pause, resume, setServiceStateListener, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.aspectran.core.service.CoreService
getActivityContext, getApplicationAdapter, getAspectranClassLoader, getAspectranConfig, getBasePath, getServiceController, isHardReload, isLateStart, joinDerivedService
-
Methods inherited from interface com.aspectran.shell.service.ShellService
execute, execute, release
-
-
-
-
Method Detail
-
afterContextLoaded
public void afterContextLoaded() throws java.lang.ExceptionDescription copied from class:AspectranCoreServiceThis method is executed immediately after the ActivityContext is loaded.- Overrides:
afterContextLoadedin classAspectranCoreService- Throws:
java.lang.Exception- if an error occurs
-
beforeContextDestroy
public void beforeContextDestroy()
Description copied from class:AspectranCoreServiceThis method executed just before the ActivityContext is destroyed.- Overrides:
beforeContextDestroyin classAspectranCoreService
-
newSessionAdapter
public SessionAdapter newSessionAdapter()
Description copied from interface:ShellServiceCreates a new session adapter for the shell service and returns.- Specified by:
newSessionAdapterin interfaceShellService- Returns:
- the session adapter
-
getConsole
public Console getConsole()
Description copied from interface:ShellServiceReturns the console.- Specified by:
getConsolein interfaceShellService- Returns:
- the console
-
setConsole
protected void setConsole(Console console)
-
getCommands
public java.lang.String[] getCommands()
- Specified by:
getCommandsin interfaceShellService
-
setCommands
protected void setCommands(java.lang.String[] commands)
-
getCommandRegistry
public CommandRegistry getCommandRegistry()
- Specified by:
getCommandRegistryin interfaceShellService
-
isExposable
public boolean isExposable(java.lang.String transletName)
Description copied from interface:ShellServiceChecks whether the Translet can be exposed.- Specified by:
isExposablein interfaceShellService- Overrides:
isExposablein classAbstractCoreService- Parameters:
transletName- the name of the Translet to check- Returns:
- true if the Translet can be exposed; false otherwise
-
isVerbose
public boolean isVerbose()
Tests if the verbose mode is enabled. If verbose mode is on, a detailed description is printed each time the command is executed. Returns a flag indicating whether to show the description or not.- Specified by:
isVerbosein interfaceShellService- Returns:
- true if the verbose mode is enabled
-
setVerbose
public void setVerbose(boolean verbose)
Enables or disables the verbose mode. If verbose mode is on, a detailed description is printed each time the command is executed. Sets a flag indicating whether to show the description or not.- Specified by:
setVerbosein interfaceShellService- Parameters:
verbose- true to enable the verbose mode; false to disable
-
getGreetings
public java.lang.String getGreetings()
- Specified by:
getGreetingsin interfaceShellService
-
setGreetings
public void setGreetings(java.lang.String greetings)
- Specified by:
setGreetingsin interfaceShellService
-
printGreetings
public void printGreetings()
Description copied from interface:ShellServicePrints welcome message.- Specified by:
printGreetingsin interfaceShellService
-
printHelp
public void printHelp()
Description copied from interface:ShellServicePrints help information.- Specified by:
printHelpin interfaceShellService
-
restart
public void restart() throws java.lang.ExceptionDescription copied from interface:ServiceControllerRestarts the service.- Specified by:
restartin interfaceServiceController- Overrides:
restartin classAbstractServiceController- Throws:
java.lang.Exception- if the service control fails
-
restart
public void restart(java.lang.String message) throws java.lang.ExceptionDescription copied from interface:ServiceControllerRestarts the service.- Specified by:
restartin interfaceServiceController- Overrides:
restartin classAbstractServiceController- Parameters:
message- the message to be delivered to the system before restart- Throws:
java.lang.Exception- if the service control fails
-
isBusy
public boolean isBusy()
Description copied from interface:ServiceControllerReturns whether this service has any work in progress.- Specified by:
isBusyin interfaceServiceController- Overrides:
isBusyin classAbstractServiceController- Returns:
- true, if this service is busy; false otherwise
-
-