Example usage for io.vertx.core Context config

List of usage examples for io.vertx.core Context config

Introduction

In this page you can find the example usage for io.vertx.core Context config.

Prototype

@Nullable
JsonObject config();

Source Link

Document

If the context is associated with a Verticle deployment, this returns the configuration that was specified when the verticle was deployed.

Usage

From source file:de.braintags.netrelay.init.Settings.java

License:Open Source License

/**
 * Loads existing settings from the context, when the property {@link #SETTINGS_LOCATION_PROPERTY} is defined;
 * or loads or generates default settings and stores them in the local user directory, subdirectory .netrelay
 * /*www.j  a v a2 s.  c  o m*/
 * @param netRelay
 *          the instance of NetRelay, which would create the default settings
 * @param vertx
 *          the instance of {@link Vertx} to be used
 * @param context
 *          the context, which could contain the property {@link #SETTINGS_LOCATION_PROPERTY}, where the location of
 *          the settings file is defined
 * @return
 */
public static Settings loadSettings(NetRelay netRelay, Vertx vertx, Context context) {
    String path = context.config().getString(SETTINGS_LOCATION_PROPERTY);
    if (path != null) {
        return loadSettings(netRelay, vertx, path);
    } else {
        vertx.fileSystem().mkdirsBlocking(LOCAL_USER_DIRECTORY);
        String localSettingsFileName = LOCAL_USER_DIRECTORY + "/" + netRelay.getClass().getName()
                + ".settings.json";
        return loadSettings(netRelay, vertx, localSettingsFileName);
    }
}

From source file:io.servicecomb.transport.highway.HighwayServerVerticle.java

License:Apache License

@Override
public void init(Vertx vertx, Context context) {
    super.init(vertx, context);
    this.endpoint = (Endpoint) context.config().getValue(AbstractTransport.ENDPOINT_KEY);
    this.endpointObject = (URIEndpointObject) this.endpoint.getAddress();
}

From source file:io.servicecomb.transport.rest.vertx.RestServerVerticle.java

License:Apache License

@Override
public void init(Vertx vertx, Context context) {
    super.init(vertx, context);
    this.endpoint = (Endpoint) context.config().getValue(AbstractTransport.ENDPOINT_KEY);
    this.endpointObject = (URIEndpointObject) endpoint.getAddress();
}

From source file:se.liquidbytes.jel.web.WebserverVerticle.java

License:Apache License

/**
 * Method should be called during deployment of verticle
 *
 * @param vertx Vertx-instance//from  w  ww . j a v a 2  s . c  om
 * @param context Current context
 */
@Override
public void init(Vertx vertx, Context context) {
    super.init(vertx, context);
    config = context.config();
}