Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.englishtown.vertx.promises.impl;
  
 
 import java.net.URL;
 import java.util.Map;

 
 public class DefaultWhenPlatformManager implements WhenPlatformManager {
 
     private final PlatformManager manager;
     private final When when;
 
     @Inject
     public DefaultWhenPlatformManager(PlatformManager managerWhen when) {
         this. = manager;
         this. = when;
     }

    
Deploy a verticle

Parameters:
main The main, e.g. app.js, foo.rb, org.mycompany.MyMain, etc
config Any JSON config to pass to the verticle, or null if none
classpath The classpath for the verticle
instances The number of instances to deploy
includes Comma separated list of modules to include, or null if none
Returns:
Promise of deployment
 
     @Override
     public Promise<StringdeployVerticle(String mainJsonObject configURL[] classpathint instancesString includes) {
         final Deferred<Stringd = .defer();
 
         .deployVerticle(mainconfigclasspathinstancesincludesresult -> {
             if (result.succeeded()) {
                 d.resolve(result.result());
             } else {
                 d.reject(result.cause());
             }
         });
 
         return d.getPromise();
     }

    
Deploy a worker verticle

Parameters:
multiThreaded Is it a multi-threaded worker verticle?
main The main, e.g. app.js, foo.rb, org.mycompany.MyMain, etc
config Any JSON config to pass to the verticle, or null if none
classpath The classpath for the verticle
instances The number of instances to deploy
includes Comma separated list of modules to include, or null if none
Returns:
Promise of deployment
 
     @Override
     public Promise<StringdeployWorkerVerticle(boolean multiThreadedString mainJsonObject configURL[] classpathint instancesString includes) {
         final Deferred<Stringd = .defer();
 
         .deployWorkerVerticle(multiThreadedmainconfigclasspathinstancesincludesresult -> {
             if (result.succeeded()) {
                 d.resolve(result.result());
             } else {
                 d.reject(result.cause());
             }
         });
 
         return d.getPromise();
     }

    
Deploy a module

Parameters:
moduleName The name of the module to deploy
config Any JSON config to pass to the verticle, or null if none
instances The number of instances to deploy
Returns:
Promise of deployment
 
     @Override
     public Promise<StringdeployModule(String moduleNameJsonObject configint instances) {
         final Deferred<Stringd = .defer();
 
         .deployModule(moduleNameconfiginstancesresult -> {
             if (result.succeeded()) {
                 d.resolve(result.result());
             } else {
                 d.reject(result.cause());
             }
         });
        return d.getPromise();
    }

    
Deploy a module from a zip file. The zip must contain a valid Vert.x module. Vert.x will automatically install the module from the zip into the local mods dir or the system mods dir (if it's a system module), or VERTX_MODS if set, and then deploy the module

Parameters:
zipFileName The name of the zip file that contains the module
config Any JSON config to pass to the verticle, or null if none
instances The number of instances to deploy
Returns:
Promise of deployment
    @Override
    public Promise<StringdeployModuleFromZip(String zipFileNameJsonObject configint instances) {
        final Deferred<Stringd = .defer();
        .deployModuleFromZip(zipFileNameconfiginstancesresult -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
Deploy a module from the classpath. The classpath must contain a single mod.json and the resources for that module only.

Parameters:
moduleName The name of the module to deploy
config Any JSON config to pass to the verticle, or null if none
instances The number of instances to deploy
classpath Array of URLS corresponding to the classpath for the module
Returns:
Promise of deployment
    @Override
    public Promise<StringdeployModuleFromClasspath(String moduleNameJsonObject configint instancesURL[] classpath) {
        final Deferred<Stringd = .defer();
        .deployModuleFromClasspath(moduleNameconfiginstancesclasspathresult -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
Undeploy a deployment

Parameters:
deploymentID The ID of the deployment to undeploy, as given in the doneHandler when deploying
Returns:
Promise of undeployment
    @Override
    public Promise<Voidundeploy(String deploymentID) {
        final Deferred<Voidd = .defer();
        .undeploy(deploymentIDresult -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
Undeploy all verticles and modules

Returns:
Promise of undeployment
    @Override
    public Promise<VoidundeployAll() {
        final Deferred<Voidd = .defer();
        .undeployAll(result -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
List all deployments, with deployment ID and number of instances

Returns:
map of instances
    @Override
    public Map<StringIntegerlistInstances() {
        return .listInstances();
    }

    
Install a module into the filesystem Vert.x will search in the configured repos to locate the module

Parameters:
moduleName The name of the module
Returns:
Promise of installation
    @Override
    public Promise<VoidinstallModule(String moduleName) {
        final Deferred<Voidd = .defer();
        .installModule(moduleNameresult -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
Uninstall a module from the filesystem

Parameters:
moduleName The name of the module
Returns:
Promise of uninstallation
    @Override
    public Promise<VoiduninstallModule(String moduleName) {
        final Deferred<Voidd = .defer();
        .uninstallModule(moduleNamenew Handler<AsyncResult<Void>>() {
            @Override
            public void handle(AsyncResult<Voidresult) {
                if (result.succeeded()) {
                    d.resolve(result.result());
                } else {
                    d.reject(result.cause());
                }
            }
        });
        return d.getPromise();
    }

    
Pull in all the dependencies (the 'includes' and the 'deploys' fields in mod.json) and copy them into an internal mods directory in the module. This allows a self contained module to be created.

Parameters:
moduleName The name of the module
Returns:
Promise of pull
    @Override
    public Promise<VoidpullInDependencies(String moduleName) {
        final Deferred<Voidd = .defer();
        .pullInDependencies(moduleNameresult -> {
            if (result.succeeded()) {
                d.resolve(result.result());
            } else {
                d.reject(result.cause());
            }
        });
        return d.getPromise();
    }

    
Register a handler that will be called when the platform exits because of a verticle calling container.exit()

Parameters:
handler The handler
    @Override
    public void registerExitHandler(Handler<Voidhandler) {
        .registerExitHandler(handler);
    }

    
Stop the platform manager
    @Override
    public void stop() {
        .stop();
    }
New to GrepCode? Check out our FAQ X