Search in sources :

Example 1 with IDeployedStandaloneCartridge

use of com.openshift.client.cartridge.IDeployedStandaloneCartridge in project camel by apache.

the class OpenShiftProducer method doGetStandaloneCartridge.

protected void doGetStandaloneCartridge(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 {
        IDeployedStandaloneCartridge p = app.getCartridge();
        exchange.getIn().setBody(p.getDisplayName());
    }
}
Also used : CamelExchangeException(org.apache.camel.CamelExchangeException) IApplication(com.openshift.client.IApplication) IDeployedStandaloneCartridge(com.openshift.client.cartridge.IDeployedStandaloneCartridge)

Aggregations

IApplication (com.openshift.client.IApplication)1 IDeployedStandaloneCartridge (com.openshift.client.cartridge.IDeployedStandaloneCartridge)1 CamelExchangeException (org.apache.camel.CamelExchangeException)1