Package org.apache.fulcrum.yaafi.cli
Klasse Main
java.lang.Object
org.apache.fulcrum.yaafi.cli.Main
- Alle implementierten Schnittstellen:
Runnable,org.apache.avalon.framework.activity.Disposable
public class Main
extends Object
implements Runnable, org.apache.avalon.framework.activity.Disposable
An example of the embedding of a YAAFI kernel inside an
arbitrary application.
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final Stringparameter for the application container configuration filestatic final Stringparameter for setting a shutdown hookstatic final Stringparameter for the application home directorystatic final Stringparameter for blocking the main thread in Main.run()static final Stringparameter for the application namestatic final Stringparameter for the application temporary directory -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungMain()ConstructorConstructor The following command line parameters are supported --yaafi.cli.applicationName name --yaafi.cli.applicationHome dir --yaafi.cli.tempHome dir --yaafi.cli.isBlocking [true|false] --yaafi.cli.hasShutdownHook [true|false] --yaafi.cli.config file -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoiddispose()Dispose the YAAFI containerString[]getArgs()org.apache.avalon.framework.logger.Loggerorg.apache.avalon.framework.service.ServiceManagerbooleanvoidInitialize the instancebooleanbooleanstatic voidThe main method.static FilemakeAbsoluteFile(File baseDir, String name) Determines the file location of the given name.makeAbsoluteFile(String fileName) Locates the file for the given file name.makeAbsolutePath(String fileName) Locates the file for the given file name.voidonWait()Depending on the configuration this method might block the calling thread or return immediately.voidrun()Runs the instance by initializing it and potentially blocking the invoking thread depending on the configuration.voidsetApplicationHome(String applicationHome) voidsetApplicationName(String applicationName) voidvoidsetContainerConfigValue(String containerConfigValue) voidsetHasShutdownHook(boolean hasShutdownHook) voidsetHasShutdownHook(Boolean hasShutdownHook) voidsetHasShutdownHook(String hasShutdownHook) protected voidsetInitialized(boolean isInitialized) voidsetIsBlocking(boolean isBlocking) voidsetIsBlocking(Boolean isBlocking) voidsetIsBlocking(String isBlocking) voidsetLogger(org.apache.avalon.framework.logger.Logger logger) voidsetTempHome(String tempHome) protected voidshutdown()Terminates the instancetoString()
-
Felddetails
-
APPLICATION_NAME
parameter for the application name- Siehe auch:
-
APPLICATION_HOME
parameter for the application home directory- Siehe auch:
-
APPLICATION_TEMP
parameter for the application temporary directory- Siehe auch:
-
APPLICATION_CONFIG
parameter for the application container configuration file- Siehe auch:
-
APPLICATION_HASSHUTDOWNHOOK
parameter for setting a shutdown hook- Siehe auch:
-
APPLICATION_ISBLOCKING
parameter for blocking the main thread in Main.run()- Siehe auch:
-
-
Konstruktordetails
-
Main
public Main()Constructor -
Main
Constructor The following command line parameters are supported- --yaafi.cli.applicationName name
- --yaafi.cli.applicationHome dir
- --yaafi.cli.tempHome dir
- --yaafi.cli.isBlocking [true|false]
- --yaafi.cli.hasShutdownHook [true|false]
- --yaafi.cli.config file
- Parameter:
args- the command line arguments
-
-
Methodendetails
-
main
The main method.- Parameter:
args- Command line arguments- Löst aus:
Exception- the execution failed
-
makeAbsoluteFile
Determines the file location of the given name. If the name denotes a relative file location it will be resolved using the application home directory.- Parameter:
baseDir- the base directoryname- the filename- Gibt zurück:
- the file
-
dispose
public void dispose()Dispose the YAAFI container- Angegeben von:
disposein Schnittstelleorg.apache.avalon.framework.activity.Disposable
-
run
public void run()Runs the instance by initializing it and potentially blocking the invoking thread depending on the configuration. -
onWait
public void onWait()Depending on the configuration this method might block the calling thread or return immediately. We currently poll a volatile variable which is not the most elegant solution. -
makeAbsoluteFile
Locates the file for the given file name.- Parameter:
fileName- the filename- Gibt zurück:
- an absolute file
-
makeAbsolutePath
Locates the file for the given file name.- Parameter:
fileName- the filename- Gibt zurück:
- an absolute path
-
getServiceContainer
- Gibt zurück:
- Returns the ServiceContainer interface
-
getServiceManager
public org.apache.avalon.framework.service.ServiceManager getServiceManager()- Gibt zurück:
- Returns the ServiceManager interface
-
getApplicationHome
- Gibt zurück:
- Returns the applicationHome.
-
setApplicationHome
- Parameter:
applicationHome- The applicationHome to set.
-
getContainerConfigValue
- Gibt zurück:
- Returns the containerConfigValue.
-
setContainerConfigValue
- Parameter:
containerConfigValue- The containerConfigValue to set.
-
isBlocking
public boolean isBlocking()- Gibt zurück:
- Returns the isBlocking.
-
setIsBlocking
public void setIsBlocking(boolean isBlocking) - Parameter:
isBlocking- The isBlocking to set.
-
setIsBlocking
- Parameter:
isBlocking- The isBlocking to set.
-
setIsBlocking
- Parameter:
isBlocking- The isBlocking to set.
-
getTempHome
- Gibt zurück:
- Returns the tempHome.
-
setTempHome
- Parameter:
tempHome- The tempHome to set.
-
getLogger
public org.apache.avalon.framework.logger.Logger getLogger()- Gibt zurück:
- Returns the logger.
-
setLogger
public void setLogger(org.apache.avalon.framework.logger.Logger logger) - Parameter:
logger- The logger to set.
-
getApplicationName
- Gibt zurück:
- Returns the applicationName.
-
setApplicationName
- Parameter:
applicationName- The applicationName to set.
-
getArgs
- Gibt zurück:
- Returns the args.
-
setArgs
- Parameter:
args- The args to set.
-
hasShutdownHook
public boolean hasShutdownHook()- Gibt zurück:
- Returns the hasShutdownHook.
-
setHasShutdownHook
public void setHasShutdownHook(boolean hasShutdownHook) - Parameter:
hasShutdownHook- The hasShutdownHook to set.
-
setHasShutdownHook
- Parameter:
hasShutdownHook- The hasShutdownHook to set.
-
setHasShutdownHook
- Parameter:
hasShutdownHook- The hasShutdownHook to set.
-
toString
-
isInitialized
public boolean isInitialized()- Gibt zurück:
- Returns the isInitialized.
-
setInitialized
protected void setInitialized(boolean isInitialized) - Parameter:
isInitialized- The isInitialized to set.
-
initialize
Initialize the instance- Löst aus:
Exception- the initialization failed
-
shutdown
protected void shutdown()Terminates the instance
-