use of org.apache.camel.CamelExchangeException in project camel by apache.
the class OpenShiftProducer method doRestart.
protected void doRestart(Exchange exchange, IDomain domain) throws CamelExchangeException {
String name = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION, getEndpoint().getApplication(), String.class);
if (name == null) {
throw new CamelExchangeException("Application not specified", exchange);
}
IApplication app = domain.getApplicationByName(name);
if (app == null) {
throw new CamelExchangeException("Application with id " + name + " not found.", exchange);
} else {
app.restart();
}
}
use of org.apache.camel.CamelExchangeException in project camel by apache.
the class OpenShiftProducer method doGetGitUrl.
protected void doGetGitUrl(Exchange exchange, IDomain domain) throws CamelExchangeException {
String name = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION, getEndpoint().getApplication(), String.class);
if (name == null) {
throw new CamelExchangeException("Application not specified", exchange);
}
IApplication app = domain.getApplicationByName(name);
if (app == null) {
throw new CamelExchangeException("Application with id " + name + " not found.", exchange);
} else {
String gitUrl = app.getGitUrl();
exchange.getIn().setBody(gitUrl);
}
}
use of org.apache.camel.CamelExchangeException in project camel by apache.
the class OpenShiftProducer method doRemoveAlias.
protected void doRemoveAlias(Exchange exchange, IDomain domain) throws CamelExchangeException {
String name = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION, getEndpoint().getApplication(), String.class);
if (name == null) {
throw new CamelExchangeException("Application not specified", exchange);
}
IApplication app = domain.getApplicationByName(name);
if (app == null) {
throw new CamelExchangeException("Application with id " + name + " not found.", exchange);
} else {
String alias = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION_ALIAS, getEndpoint().getApplication(), String.class);
if (!app.canGetEnvironmentVariables()) {
throw new CamelExchangeException("The application with id " + name + " can't get Environment Variables", exchange);
}
if (ObjectHelper.isNotEmpty(alias)) {
app.removeAlias(alias);
exchange.getIn().setBody(alias);
} else {
throw new CamelExchangeException("Application Alias not specified", exchange);
}
}
}
use of org.apache.camel.CamelExchangeException in project camel by apache.
the class OpenShiftProducer method doSetDeploymentType.
protected void doSetDeploymentType(Exchange exchange, IDomain domain) throws CamelExchangeException {
String name = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION, getEndpoint().getApplication(), String.class);
if (name == null) {
throw new CamelExchangeException("Application not specified", exchange);
}
IApplication app = domain.getApplicationByName(name);
if (app == null) {
throw new CamelExchangeException("Application with id " + name + " not found.", exchange);
} else {
String deploymentType = exchange.getIn().getHeader(OpenShiftConstants.DEPLOYMENT_TYPE, getEndpoint().getApplication(), String.class);
if (ObjectHelper.isNotEmpty(deploymentType)) {
String result = app.setDeploymentType(deploymentType);
exchange.getIn().setBody(result);
} else {
throw new CamelExchangeException("Deployment Type not specified", exchange);
}
}
}
use of org.apache.camel.CamelExchangeException in project camel by apache.
the class OpenShiftProducer method doGetGearProfile.
protected void doGetGearProfile(Exchange exchange, IDomain domain) throws CamelExchangeException {
String name = exchange.getIn().getHeader(OpenShiftConstants.APPLICATION, getEndpoint().getApplication(), String.class);
if (name == null) {
throw new CamelExchangeException("Application not specified", exchange);
}
IApplication app = domain.getApplicationByName(name);
if (app == null) {
throw new CamelExchangeException("Application with id " + name + " not found.", exchange);
} else {
IGearProfile result = app.getGearProfile();
exchange.getIn().setBody(result.getName());
}
}
Aggregations