public class App extends DestroyableBase
App
represents an application that is deployed in a Act container
Modifier and Type | Class and Description |
---|---|
static class |
App.F |
static interface |
App.HotReloadListener |
Destroyable.Util
logger
Modifier | Constructor and Description |
---|---|
protected |
App(java.io.File appBase,
org.osgl.bootstrap.Version version,
ProjectLayout layout) |
protected |
App(java.lang.String name,
org.osgl.bootstrap.Version version,
java.io.File appBase,
ProjectLayout layout) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.io.File> |
allLibDirs(boolean requireTestProfile) |
java.util.List<java.io.File> |
allResourceDirs(boolean requireTestProfile) |
java.util.List<java.io.File> |
allSourceDirs(boolean requireTestProfile) |
void |
asyncRefresh()
In dev mode it could request app to refresh.
|
java.io.File |
base()
The base dir where an application sit within
|
java.util.List<java.io.File> |
baseDirs() |
BinderManager |
binderManager() |
RequestHandler |
blockIssueHandler() |
act.app.AppBuilder |
builder() |
org.osgl.cache.CacheService |
cache() |
org.osgl.cache.CacheService |
cache(java.lang.String name) |
boolean |
checkUpdates(boolean async) |
java.lang.Class<?> |
classForName(java.lang.String className)
Load/get a class by name using the app’s
classLoader() |
AppClassLoader |
classLoader() |
CliDispatcher |
cliDispatcher() |
AppConfig<?> |
config() |
AppCrypto |
crypto() |
java.lang.String |
cuid()
Return an ID in string that is unique across the cluster
|
AppEventId |
currentState() |
DbServiceManager |
dbServiceManager() |
java.lang.String |
decrypt(java.lang.String message) |
void |
detectChanges() |
void |
emit(AppEventId appEvent) |
java.lang.String |
encrypt(java.lang.String message) |
boolean |
equals(java.lang.Object obj) |
EventBus |
eventBus() |
boolean |
eventEmitted(AppEventId appEvent) |
java.io.File |
file(java.lang.String path) |
<T> T |
getInstance(java.lang.Class<T> clz)
Get/Create new instance of a class
|
<T> T |
getInstance(java.lang.String className)
Get/Create new instance of a class specified by the className
|
boolean |
hasBlockIssue()
Check if the app has block issue set
|
int |
hashCode() |
java.io.File |
home()
The home dir of an application, referenced only at runtime.
|
<DI extends DependencyInjector> |
injector() |
<DI extends DependencyInjector> |
injector(DI dependencyInjector) |
static App |
instance() |
AppInterceptorManager |
interceptorManager() |
boolean |
isDev() |
boolean |
isMainThread() |
boolean |
isProd() |
boolean |
isRestarting() |
boolean |
isSingleton(java.lang.Class<?> cls)
Report if a class is registered into singleton registry
|
boolean |
isStarted() |
AppJobManager |
jobManager() |
ProjectLayout |
layout() |
java.util.List<java.io.File> |
libDirs() |
MailerConfigManager |
mailerConfigManager() |
Act.Mode |
mode() |
java.lang.String |
name()
Returns the name of the app
|
java.lang.String |
profile() |
void |
refresh() |
void |
refresh(boolean async) |
void |
registerDaemon(Daemon daemon) |
void |
registerHotReloadListener(App.HotReloadListener listener) |
<T> void |
registerSingleton(java.lang.Class<? extends T> cls,
T instance) |
void |
registerSingleton(java.lang.Object instance) |
void |
registerSingletonClass(java.lang.Class<?> aClass) |
protected void |
releaseResources() |
StringValueResolverManager |
resolverManager() |
java.io.File |
resource(java.lang.String path) |
java.util.List<java.io.File> |
resourceDirs() |
void |
restart() |
Router |
router() |
Router |
router(NamedPort port) |
Router |
router(java.lang.String name) |
java.util.Set<java.lang.String> |
scanList() |
AppCodeScannerManager |
scannerManager() |
<T extends AppService<T>> |
service(java.lang.Class<T> serviceClass) |
void |
setBlockIssue(java.lang.Throwable e) |
java.lang.String |
shortId()
Returns short id which is derived from passed in app name.
|
void |
shutdown() |
void |
shutdownEventBus() |
java.lang.String |
sign(java.lang.String message) |
<T> T |
singleton(java.lang.Class<T> clz) |
java.util.List<java.io.File> |
sourceDirs() |
java.util.List<java.io.File> |
testLibDirs() |
java.util.List<java.io.File> |
testResourceDirs() |
java.util.List<java.io.File> |
testSourceDirs() |
java.io.File |
tmpDir() |
java.lang.String |
toString() |
void |
unregisterDaemon(Daemon daemon) |
UploadFileStorageService |
uploadFileStorageService() |
org.osgl.bootstrap.Version |
version()
Returns the app version
|
addSubResource, destroy, isDestroyed, reload, scope
debug, debug, error, error, fatal, fatal, info, info, isDebugEnabled, isTraceEnabled, trace, trace, warn, warn
protected App(java.io.File appBase, org.osgl.bootstrap.Version version, ProjectLayout layout)
protected App(java.lang.String name, org.osgl.bootstrap.Version version, java.io.File appBase, ProjectLayout layout)
public static App instance()
public java.lang.String name()
Returns the name of the app
public org.osgl.bootstrap.Version version()
Returns the app version
public java.lang.String shortId()
Returns short id which is derived from passed in app name.
Note App.shortId()
is by no means to create a unique identifier of application.
public java.lang.String profile()
public Act.Mode mode()
public boolean isDev()
public boolean isProd()
public AppConfig<?> config()
public java.util.List<java.io.File> baseDirs()
public java.util.List<java.io.File> sourceDirs()
public java.util.List<java.io.File> resourceDirs()
public java.util.List<java.io.File> libDirs()
public java.util.List<java.io.File> testSourceDirs()
public java.util.List<java.io.File> testResourceDirs()
public java.util.List<java.io.File> testLibDirs()
public java.util.List<java.io.File> allSourceDirs(boolean requireTestProfile)
public java.util.List<java.io.File> allResourceDirs(boolean requireTestProfile)
public java.util.List<java.io.File> allLibDirs(boolean requireTestProfile)
public CliDispatcher cliDispatcher()
public Router router()
public Router router(java.lang.String name)
public AppCrypto crypto()
public java.io.File base()
The base dir where an application sit within
public java.io.File home()
The home dir of an application, referenced only at runtime.
Note when app is running in dev mode, appHome
shall be appBase/target
, while app is deployed to Act at other mode, appHome
shall be the same as appBase
public AppClassLoader classLoader()
public ProjectLayout layout()
public void registerHotReloadListener(App.HotReloadListener listener)
public boolean checkUpdates(boolean async)
public void detectChanges()
public void restart()
public void setBlockIssue(java.lang.Throwable e)
public void asyncRefresh()
In dev mode it could request app to refresh. However if the request is issued in a thread that will be interrupted e.g. the cli thread, it should call refresh in an new thread
public boolean isStarted()
public boolean isMainThread()
public void shutdown()
protected void releaseResources()
releaseResources
in class DestroyableBase
public void refresh(boolean async)
public boolean isRestarting()
public RequestHandler blockIssueHandler()
public void refresh()
public boolean hasBlockIssue()
Check if the app has block issue set
true
if the app has block issue encountered during start uppublic act.app.AppBuilder builder()
public boolean isSingleton(java.lang.Class<?> cls)
Report if a class is registered into singleton registry
cls
- the classtrue
if the class is registered into singleton registrypublic java.io.File tmpDir()
public java.io.File file(java.lang.String path)
public java.io.File resource(java.lang.String path)
public void registerDaemon(Daemon daemon)
public void unregisterDaemon(Daemon daemon)
public <T> void registerSingleton(java.lang.Class<? extends T> cls, T instance)
public void registerSingletonClass(java.lang.Class<?> aClass)
public void registerSingleton(java.lang.Object instance)
public AppInterceptorManager interceptorManager()
public AppCodeScannerManager scannerManager()
public DbServiceManager dbServiceManager()
public StringValueResolverManager resolverManager()
public BinderManager binderManager()
public org.osgl.cache.CacheService cache()
public org.osgl.cache.CacheService cache(java.lang.String name)
public MailerConfigManager mailerConfigManager()
public EventBus eventBus()
public AppJobManager jobManager()
public <DI extends DependencyInjector> App injector(DI dependencyInjector)
public <DI extends DependencyInjector> DI injector()
public UploadFileStorageService uploadFileStorageService()
public java.lang.String sign(java.lang.String message)
public java.lang.String encrypt(java.lang.String message)
public java.lang.String decrypt(java.lang.String message)
public <T> T singleton(java.lang.Class<T> clz)
public <T> T getInstance(java.lang.String className)
Get/Create new instance of a class specified by the className
This method will call the build in DependencyInjector
to load the instance. And this is dependency inject process, not a simple constructor call
Note the class will be loaded by the app’s classLoader()
T
- the generic type of the classclassName
- the className of the instance to be returnedpublic <T> T getInstance(java.lang.Class<T> clz)
Get/Create new instance of a class
This method will call the build in DependencyInjector
to load the instance. And this is dependency inject process, not a simple constructor call
T
- the generic type of the classclz
- the classpublic java.lang.Class<?> classForName(java.lang.String className)
Load/get a class by name using the app’s classLoader()
className
- the name of the class to be loadedpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String cuid()
Return an ID in string that is unique across the cluster
public <T extends AppService<T>> T service(java.lang.Class<T> serviceClass)
public void emit(AppEventId appEvent)
public java.util.Set<java.lang.String> scanList()
public boolean eventEmitted(AppEventId appEvent)
public AppEventId currentState()
public void shutdownEventBus()
Copyright © 2014–2017 ActFramework. All rights reserved.