Class PlatformMain


  • public abstract class PlatformMain
    extends Object
    Useful delegation model for starting a hk2 instance using a service based lookup
    Author:
    Jerome Dochez
    • Field Detail

      • logger

        protected Logger logger
      • root

        protected File root
    • Constructor Detail

      • PlatformMain

        public PlatformMain()
    • Method Detail

      • getLogger

        public Logger getLogger()
      • setLogger

        public void setLogger​(Logger logger)
      • setContext

        public void setContext​(Object context)
      • getContext

        public <T> T getContext​(Class<T> contextType)
      • getName

        public abstract String getName()
        Returns the platform name associated with this main.
        Returns:
        ther plaform name
      • start

        public abstract void start​(Properties ctx)
                            throws Exception
        Starts the main entry point using this platform implementation.
        Parameters:
        ctx - Context in which this object executes. It contains arguments passed to the program as well.
        Throws:
        Exception - if anything goes wrong
      • getStartedService

        public <T> T getStartedService​(Class<T> serviceType)
        Optional method. Returns singleton services after the start method was executed successfully.
        Type Parameters:
        T - service type
        Parameters:
        serviceType - type of the requested service
        Returns:
        service instance