Skip to content

Instantly share code, notes, and snippets.

@nialdarbey
Created August 25, 2012 19:33
Show Gist options
  • Save nialdarbey/3469899 to your computer and use it in GitHub Desktop.
Save nialdarbey/3469899 to your computer and use it in GitHub Desktop.
private String cloudHubUrl = "https://cloudhub.io";
@Override
public void execute() throws BuildException {
FileChecker checker = new FileChecker(getLocation());
checker.checkFile(applicationFile, "application file", false, false);
try {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(username, password));
WebResource webResource = client.resource(cloudHubUrl);
String domainCreationPath = "/api/applications/" + domain;
String appDeploymentPath = domainCreationPath + "/deploy";
webResource.path(appDeploymentPath).post(String.class, applicationFile);
} catch (Exception exception) {
throw new BuildException(MessageFormat.format("Problem deploying Mule application file {0} to {1}. Exception: {2}", applicationFile, cloudHubUrl, exception.getMessage()), exception, getLocation());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment