public static String switchType(String deploymentType) { if (isBinary(deploymentType)) { return GIT; } else if (isGit(deploymentType)) { return BINARY; } else { throw new OpenShiftException("Unknown deployment type {0}", deploymentType); } }
public NamedCartridgeHolder setName(String name) { ApplicationBuilder.this.name = name; return new NamedCartridgeHolder(); }; }
public AbstractConnectionBuilder disableSSLCertificateChecks() { return sslCertificateCallback(new NoopSSLCertificateCallback()); }
public static IDomain loginAndGetDomain(OpenShiftEndpoint endpoint, String openshiftServer) { // grab all applications IOpenShiftConnection connection = new OpenShiftConnectionFactory().getConnection(endpoint.getClientId(), endpoint.getUsername(), endpoint.getPassword(), openshiftServer); IUser user = connection.getUser(); IDomain domain; if (endpoint.getDomain() != null) { domain = user.getDomain(endpoint.getDomain()); } else { domain = user.getDefaultDomain(); } return domain; }
@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.start(); } } 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.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.restart(); } } return null; } }
public static String getStateForApplication(IApplication application) { for (IGearGroup group : application.getGearGroups()) { for (IGear gear : group.getGears()) { String state = gear.getState().getState().toLowerCase(Locale.ENGLISH); return state; } } return "unknown"; } }
protected IOpenShiftConnection getConnection(IApplication application) { Assert.notNull(application); return application.getDomain().getUser().getConnection(); }
public IOpenShiftConnection getConnection(final String clientId, final String username, final String password, final String authKey, final String authIV, final String token, final String serverUrl, final ISSLCertificateCallback sslCertificateCallback) throws OpenShiftException { return getConnection(clientId, username, password, authKey, authIV, token, serverUrl, sslCertificateCallback, createCipherExclusionRegex(getConfiguration())); }
/** * Checks if there is a {@link IDomain} matching the specified domainId. */ private static boolean domainExists(IUser user, String domainId) { for (IDomain domain : user.getDomains()) { if (domainId.equals(domain.getId())) { return true; } } return false; }
public IApplication build() { return domain.createApplication(name, applicationScale, gearProfile, initialGitUrl, timeout, environmentVariables, createCartridges(standaloneCartridge, embeddableCartridges)); }
/** * Creates a connection based on the specified options. */ IOpenShiftConnection createConnection() { return connectionFactory.getConnection("fabric", login, password, serverUrl); }
@Override public boolean isValid(String name) { IApplication application = domain.getApplicationByName(name); return application == null; } };
protected IOpenShiftConfiguration getConfiguration() throws OpenShiftException { if (this.configuration == null) { this.configuration = createConfiguration(); } return this.configuration; }
@Override public boolean verify(String hostname, SSLSession session) { return sslAuthorizationCallback.allowHostname(hostname, session); } }
public static SSHKeyType getByJSchKeyType(int jschKeyType) throws OpenShiftUnknownSSHKeyTypeException { if (jschKeyType == KeyPair.RSA) { return SSH_RSA; } else if (jschKeyType == KeyPair.DSA) { return SSH_DSA; } else { throw new OpenShiftUnknownSSHKeyTypeException("Unknown jsch key type \"{0}\"", jschKeyType); } } }
protected IOpenShiftConnection getConnection(IApplication application) { Assert.notNull(application); return application.getDomain().getUser().getConnection(); }