io.vertx.service

## Class ServiceVerticleFactory

- java.lang.Object
- - io.vertx.service.ServiceVerticleFactory

- All Implemented Interfaces:
    VerticleFactory
  Direct Known Subclasses:
    HttpServiceFactory, MavenVerticleFactory

      public class ServiceVerticleFactory
      extends Object
      implements VerticleFactory

  This verticle factory looks for a descriptor file on the classpath with a name given by the verticleName (with ':' replaced by '.' as ':' is an illegal file name character in Windows) and with ".json" appended to it. When it finds that file it deploys the actual verticle that's defined by the "main" field in that file. The descriptor file can also contain a field called "options" which is the JSON form of the DeploymentOptions class
  Author:
    Tim Fox

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServiceVerticleFactory()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Verticle` | `createVerticle(String verticleName, ClassLoader classLoader)` Create a verticle instance.
    `String` | `prefix()`
    `boolean` | `requiresResolve()` Does the factory require resolution? See `VerticleFactory.resolve(String, DeploymentOptions, ClassLoader, Future)` for more information.
    `void` | `resolve(String identifier, DeploymentOptions deploymentOptions, ClassLoader classLoader, Future<String> resolution)` Some verticle factories can "resolve" the identifer to another identifier which is then used to look up the real verticle factory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.core.spi.VerticleFactory

      `blockingCreate, close, init, order, removePrefix`

- - ### Constructor Detail

    - #### ServiceVerticleFactory

          public ServiceVerticleFactory()

  - ### Method Detail

    - #### requiresResolve

          public boolean requiresResolve()

      Description copied from interface: `VerticleFactory`
      Does the factory require resolution? See `VerticleFactory.resolve(String, DeploymentOptions, ClassLoader, Future)` for more information.
      Specified by:
        `requiresResolve` in interface `VerticleFactory`
      Returns:
        true if yes

    - #### resolve

          public void resolve(String identifier,
                              DeploymentOptions deploymentOptions,
                              ClassLoader classLoader,
                              Future<String> resolution)

      Description copied from interface: `VerticleFactory`
      Some verticle factories can "resolve" the identifer to another identifier which is then used to look up the real verticle factory. An Example is the Vert.x service factory which takes an identifier of form `service:com.mycompany.clever-db-service" then looks for a JSON file which it loads to get the real identifier (main verticle).
      Specified by:
        `resolve` in interface `VerticleFactory`
      Parameters:
        `identifier` - The identifier
        `deploymentOptions` - The deployment options - these can be changed inside the resolve method (e.g. to add an extra classpath)
        `classLoader` - The classloader
        `resolution` - A future which will receive the result of the resolution.

    - #### prefix

          public String prefix()

      Specified by:
        `prefix` in interface `VerticleFactory`
      Returns:
        The prefix for the factory, e.g. "java", or "js".

    - #### createVerticle

          public Verticle createVerticle(String verticleName,
                                         ClassLoader classLoader)
                                  throws Exception

      Description copied from interface: `VerticleFactory`
      Create a verticle instance. If this method is likely to be slow (e.g. Ruby or JS verticles which might have to start up a language engine) then make sure it is run on a worker thread by returning `true` from `VerticleFactory.blockingCreate()`.
      Specified by:
        `createVerticle` in interface `VerticleFactory`
      Parameters:
        `verticleName` - The verticle name
        `classLoader` - The class loader
      Returns:
        The instance
      Throws:
        `Exception`

Copyright © 2017. All rights reserved.