@Override public boolean isValid(String name) { IApplication application = domain.getApplicationByName(name); return application == null; } };
protected void doState(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 state = OpenShiftHelper.getStateForApplication(app); exchange.getIn().setBody(state); } }
protected void doGetEmbeddedCartridges(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 { List<IEmbeddedCartridge> p = app.getEmbeddedCartridges(); exchange.getIn().setBody(p); } }
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); } }
protected void doGetDeploymentType(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 = app.getDeploymentType(); exchange.getIn().setBody(deploymentType); } }
protected void doGetAllEnvironmentVariables(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 { Map<String, IEnvironmentVariable> result = app.getEnvironmentVariables(); exchange.getIn().setBody(result); } }
protected void doGetAliases(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 { List<String> aliases = app.getAliases(); exchange.getIn().setBody(aliases); } } }
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()); } }
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()); } }
protected void doStart(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.start(); } }
@Override protected Object doExecute() throws Exception { IOpenShiftConnection connection = getOrCreateConnection(); for (IDomain domain : connection.getDomains()) { if (domainId == null || domainId.equals(domain.getId())) { IApplication application = domain.getApplicationByName(applicationName); application.start(); } } return null; } }
protected void doStop(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.stop(); } }
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(); } }
@Override protected Object doExecute() throws Exception { IOpenShiftConnection connection = getOrCreateConnection(); for (IDomain domain : connection.getDomains()) { if (domainId == null || domainId.equals(domain.getId())) { IApplication application = domain.getApplicationByName(applicationName); application.destroy(); } } return null; } }
@Override protected Object doExecute() throws Exception { IOpenShiftConnection connection = getOrCreateConnection(); for (IDomain domain : connection.getDomains()) { if (domainId == null || domainId.equals(domain.getId())) { IApplication application = domain.getApplicationByName(applicationName); application.stop(); } } return null; } }
@Override protected Object doExecute() throws Exception { IOpenShiftConnection connection = getOrCreateConnection(); for (IDomain domain : connection.getDomains()) { if (domainId == null || domainId.equals(domain.getId())) { IApplication application = domain.getApplicationByName(applicationName); application.restart(); } } return null; } }
private IApplication getBuilderApplication() { IUser user; try { user = OpenShiftCloud.get().getOpenShiftConnection().getUser(); } catch (IOException e) { throw new RuntimeException(e); } return user.getDomain(getNamespace()).getApplicationByName(name); }
public static IApplication getApplication(Container container, CreateOpenshiftContainerMetadata metadata, IOpenShiftConnection connection) { String containerName = container.getId(); IDomain domain = connection.getUser().getDomain(metadata.getDomainId()); return domain.getApplicationByName(containerName); } }
protected void doAddEmbeddedCartridge(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 embeddedCartridgeName = exchange.getIn().getHeader(OpenShiftConstants.EMBEDDED_CARTRIDGE_NAME, getEndpoint().getApplication(), String.class); if (ObjectHelper.isNotEmpty(embeddedCartridgeName)) { IEmbeddedCartridge p = app.addEmbeddableCartridge((new LatestEmbeddableCartridge(embeddedCartridgeName)).get(app)); exchange.getIn().setBody(p.getDisplayName()); } else { throw new CamelExchangeException("Cartridge not specified", exchange); } } }
public static IApplication getApplication(Container container) { CreateOpenshiftContainerMetadata metadata = getContainerMetadata(container); if (metadata == null) { return null; } CreateOpenshiftContainerOptions options = metadata.getCreateOptions(); IOpenShiftConnection connection = OpenShiftUtils.createConnection(options); String containerName = container.getId(); IDomain domain = connection.getUser().getDomain(metadata.getDomainId()); return domain.getApplicationByName(containerName); }