Class ESVerticleFactory

  • All Implemented Interfaces:
    io.vertx.core.spi.VerticleFactory
    Direct Known Subclasses:
    JSVerticleFactory, MJSVerticleFactory

    public abstract class ESVerticleFactory
    extends Object
    implements io.vertx.core.spi.VerticleFactory
    An abstract verticle factory for EcmaScript verticles. All factories can extend this class and only need to implement the 2 abstract methods:
    • Constructor Detail

      • ESVerticleFactory

        public ESVerticleFactory()
    • Method Detail

      • init

        public void init​(io.vertx.core.Vertx vertx)
        Specified by:
        init in interface io.vertx.core.spi.VerticleFactory
      • order

        public int order()
        Specified by:
        order in interface io.vertx.core.spi.VerticleFactory
      • createRuntime

        protected Runtime createRuntime​(ECMAEngine engine)
        Create a runtime. Use the method ECMAEngine.newContext(FileSystem, Source...) to create the runtime.

        This method allows the customization of the runtime (which initial scripts will be run, and add/remove objects to the global scope).

        Parameters:
        engine - the graaljs engine.
        Returns:
        the configured runtime.
      • createVerticle

        protected abstract io.vertx.core.Verticle createVerticle​(Runtime runtime,
                                                                 String fsVerticleName)
        Create a vertx verticle that wraps the script, it will use the runtime configured in the createRuntime(ECMAEngine) method.
        Parameters:
        fsVerticleName - the name as provided during the application initialization.
        runtime - the runtime created before.
        Returns:
        the configured verticle.
      • defaultExtensions

        protected abstract String[] defaultExtensions()
        Declares the default extensions this verticle factory will use when looking up for modules without extension on the filesystem.
        Returns:
        array of string in the format .EXTENSION
      • createVerticle

        public final void createVerticle​(String verticleName,
                                         ClassLoader classLoader,
                                         io.vertx.core.Promise<Callable<io.vertx.core.Verticle>> promise)
        Specified by:
        createVerticle in interface io.vertx.core.spi.VerticleFactory
      • setupVerticleMessaging

        protected void setupVerticleMessaging​(Runtime runtime,
                                              io.vertx.core.Vertx vertx,
                                              String address)
      • waitFor

        protected final io.vertx.core.Future<Void> waitFor​(Runtime runtime,
                                                           io.vertx.core.impl.ContextInternal context,
                                                           String callback)
      • close

        public void close()
        Close the factory. The implementation must release all resources.
        Specified by:
        close in interface io.vertx.core.spi.VerticleFactory