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<StringVoidwhen = new When<>();
 
 		this. = manager;
 	}
 
 	protected void reject(Deferred<StringVoiddString resultThrowable t) {
 		RuntimeException e = (t == null || t instanceof RuntimeException ? (RuntimeExceptiont : new RuntimeException(t));
 		d.getResolver().reject(new Value<>(resulte));
 	}
 
 	protected void reject(Deferred<VoidVoiddVoid resultThrowable t) {
 		RuntimeException e = (t == null || t instanceof RuntimeException ? (RuntimeExceptiont : new RuntimeException(t));
 		d.getResolver().reject(new Value<>(resulte));
 	}

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
 
 	public Promise<StringVoiddeployVerticle(String mainJsonObject configURL[] classpathint instancesString includes) {
 		final Deferred<StringVoidd = .defer();
 
 		.deployVerticle(mainconfigclasspathinstancesincludesnew Handler<AsyncResult<String>>() {
 			public void handle(AsyncResult<Stringresult) {
 				if (result.succeeded()) {
 					d.getResolver().resolve(result.result());
 				} else {
 					reject(dresult.result(), 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
 
 	public Promise<StringVoiddeployWorkerVerticle(boolean multiThreadedString mainJsonObject configURL[] classpathint instancesString includes) {
 		final Deferred<StringVoidd = .defer();
 
 		.deployWorkerVerticle(multiThreadedmainconfigclasspathinstancesincludesnew Handler<AsyncResult<String>>() {
 			public void handle(AsyncResult<Stringresult) {
 				if (result.succeeded()) {
 					d.getResolver().resolve(result.result());
 				} else {
 					reject(dresult.result(), 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
	public Promise<StringVoiddeployModule(String moduleNameJsonObject configint instances) {
		final Deferred<StringVoidd = .defer();
		.deployModule(moduleNameconfiginstancesnew Handler<AsyncResult<String>>() {
			public void handle(AsyncResult<Stringresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), 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
	public Promise<StringVoiddeployModuleFromZip(String zipFileNameJsonObject configint instances) {
		final Deferred<StringVoidd = .defer();
		.deployModuleFromZip(zipFileNameconfiginstancesnew Handler<AsyncResult<String>>() {
			public void handle(AsyncResult<Stringresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), 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
	public Promise<StringVoiddeployModuleFromClasspath(String moduleNameJsonObject configint instancesURL[] classpath) {
		final Deferred<StringVoidd = .defer();
		.deployModuleFromClasspath(moduleNameconfiginstancesclasspathnew Handler<AsyncResult<String>>() {
			public void handle(AsyncResult<Stringresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), 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
	public Promise<VoidVoidundeploy(String deploymentID) {
		final Deferred<VoidVoidd = new When<VoidVoid>().defer();
		.undeploy(deploymentIDnew Handler<AsyncResult<Void>>() {
			public void handle(AsyncResult<Voidresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), result.cause());
				}
			}
		});
		return d.getPromise();
	}

Undeploy all verticles and modules

Returns:
Promise of undeployment
	public Promise<VoidVoidundeployAll() {
		final Deferred<VoidVoidd = new When<VoidVoid>().defer();
			public void handle(AsyncResult<Voidresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), result.cause());
				}
			}
		});
		return d.getPromise();
	}

List all deployments, with deployment ID and number of instances

Returns:
map of instances
	}

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
	public Promise<VoidVoidinstallModule(String moduleName) {
		final Deferred<VoidVoidd = new When<VoidVoid>().defer();
		.installModule(moduleNamenew Handler<AsyncResult<Void>>() {
			public void handle(AsyncResult<Voidresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), result.cause());
				}
			}
		});
		return d.getPromise();
	}

Uninstall a module from the filesystem

Parameters:
moduleName The name of the module
Returns:
Promise of uninstallation
	public Promise<VoidVoiduninstallModule(String moduleName) {
		final Deferred<VoidVoidd = new When<VoidVoid>().defer();
			public void handle(AsyncResult<Voidresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), 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
	public Promise<VoidVoidpullInDependencies(String moduleName) {
		final Deferred<VoidVoidd = new When<VoidVoid>().defer();
			public void handle(AsyncResult<Voidresult) {
				if (result.succeeded()) {
					d.getResolver().resolve(result.result());
else {
					reject(dresult.result(), 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
	public void registerExitHandler(Handler<Voidhandler) {
	}

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