OpenShift Java Client 2.5.0.Final

com.openshift.client
Interface IApplication

All Superinterfaces:
IOpenShiftResource
All Known Implementing Classes:
ApplicationResource

public interface IApplication
extends IOpenShiftResource

Author:
André Dietisheim, Syed Iqbal, Martes G Wigglesworth

Method Summary
 void addAlias(String string)
          Add application alias
 IEmbeddedCartridge addEmbeddableCartridge(IEmbeddableCartridge cartridge)
          Adds the given embeddable cartridge to this application.
 List<IEmbeddedCartridge> addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridge)
          Adds all given embedded cartridges from this app, given their names.
 IEnvironmentVariable addEnvironmentVariable(String name, String value)
          Adds an environment variable to this application.
 Map<String,IEnvironmentVariable> addEnvironmentVariables(Map<String,String> environmentVariables)
          Adds a map of environment variables to the application
 boolean canGetEnvironmentVariables()
          Used to determine if environment variables exist and are available to be retrieved
 boolean canUpdateEnvironmentVariables()
          Used to determine if the current instance is able to update environment variables.
 void destroy()
          Destroys this application (and removes it from the list of available applications)
 List<String> getAliases()
          Retrieve all application aliases
 ApplicationScale getApplicationScale()
          Returns true if scaling is enabled on this application (only set at creation time).
 String getApplicationUrl()
          Returns the url at which this application may be reached at.
 IStandaloneCartridge getCartridge()
          Returns the cartridge (application type) that this app is running on.
 Date getCreationTime()
          Returns the timestamp at which this app was created.
 IDomain getDomain()
          Get the domain of the application.
 IEmbeddedCartridge getEmbeddedCartridge(IEmbeddableCartridge cartridge)
          Returns the embedded cartridge in this application.
 IEmbeddedCartridge getEmbeddedCartridge(String cartridgeName)
          Returns the embedded cartridge given its name.
 List<IEmbeddedCartridge> getEmbeddedCartridges()
          Returns all embedded cartridges.
 List<String> getEnvironmentProperties()
          Retrieves the list of environment properties.
 IEnvironmentVariable getEnvironmentVariable(String name)
          Return the environment variable for the specified name
 Map<String,IEnvironmentVariable> getEnvironmentVariables()
          Retrieves the map of environment variables
 List<IApplicationPortForwarding> getForwardablePorts()
          Returns the list of forwardable ports on OpenShift for this application.
 Collection<IGearGroup> getGearGroups()
          Returns the gear groups for this application.
 IGearProfile getGearProfile()
          Returns true if scaling is enabled on this application (only set at creation time).
 String getGitUrl()
          Returns the uri at which the git repository of this application may be reached at.
 String getInitialGitUrl()
          Returns the git url that the application will get its initial code and configuration from.
 String getName()
          Returns the name of this application.
 com.jcraft.jsch.Session getSSHSession()
          Returns the SSH session that this application uses to connect to OpenShift.
 String getSshUrl()
          Returns the url to use to connect with ssh.
 String getUUID()
          Returns the uuid of this application.
 boolean hasAlias(String name)
           
 boolean hasEmbeddedCartridge(IEmbeddableCartridge cartridge)
          Returns true if this application has an embedded cartridge.
 boolean hasEmbeddedCartridge(String cartridgeName)
          Returns true if this application has an embedded cartridge.
 boolean hasEnvironmentVariable(String name)
          Checks if the environment variable is present in the application.
 boolean hasSSHSession()
          Returns true if the application was already provided with an SSH session, and this session is still valid (connected).
 boolean isPortFowardingStarted()
          Returns true if the port-forwarding has been started, false otherwise.
 void refresh()
          Refresh the application but reloading its content from OpenShift.
 List<IApplicationPortForwarding> refreshForwardablePorts()
          Refreshes the list of port-forwarding.
 void removeAlias(String alias)
          Remove application alias
 void removeEmbeddedCartridge(IEmbeddableCartridge cartridge)
          Removes the given embedded cartridge that is equal to the given embeddable cartridge.
 void removeEmbeddedCartridges(Collection<IEmbeddableCartridge> cartridges)
          Removes the given embedded cartridges in this application that are equal to the given IEmbeddableCartridge.
 void removeEnvironmentVariable(IEnvironmentVariable environmentVariable)
          Removes the environment variables with the given name from this application.
 void removeEnvironmentVariable(String name)
          Removes the environment variables with the given name from this application.
 void restart()
          Restarts this application.
 void scaleDown()
          Scale down application
 void scaleUp()
          Scale up application
 void setSSHSession(com.jcraft.jsch.Session session)
          Sets the SSH session that this application will use to connect to OpenShift to perform some operations.
 void start()
          Starts this application.
 List<IApplicationPortForwarding> startPortForwarding()
           
 void stop()
          Stops this application.
 void stop(boolean force)
          Stops this application
 List<IApplicationPortForwarding> stopPortForwarding()
          Stop the port-forwarding for all ports.
 boolean waitForAccessible(long timeout)
          Waits for this application to become accessible on its public url.
 Future<Boolean> waitForAccessibleAsync(long timeout)
          Returns a Future that the caller can use to wait for the application to become accessible on its public url.
 
Methods inherited from interface com.openshift.client.IOpenShiftResource
getCreationLog, getMessages, hasCreationLog
 

Method Detail

getName

String getName()
Returns the name of this application.

Returns:

getUUID

String getUUID()
Returns the uuid of this application.

Returns:
the uuid of this application.

getGitUrl

String getGitUrl()
Returns the uri at which the git repository of this application may be reached at.

Returns:
the uri of the git repo of this application.

getSshUrl

String getSshUrl()
Returns the url to use to connect with ssh.

Returns:
the url to use to connect with ssh.

getInitialGitUrl

String getInitialGitUrl()
Returns the git url that the application will get its initial code and configuration from.

Returns:
the initial git url

getApplicationUrl

String getApplicationUrl()
Returns the url at which this application may be reached at.

Returns:
the url of this application.

getApplicationScale

ApplicationScale getApplicationScale()
Returns true if scaling is enabled on this application (only set at creation time).

Returns:
true if scaling is enabled on this application (only set at creation time).

getGearProfile

IGearProfile getGearProfile()
Returns true if scaling is enabled on this application (only set at creation time).

Returns:
true if scaling is enabled on this application (only set at creation time).

getCartridge

IStandaloneCartridge getCartridge()
Returns the cartridge (application type) that this app is running on.

Returns:
the cartridge of this application

addEmbeddableCartridge

IEmbeddedCartridge addEmbeddableCartridge(IEmbeddableCartridge cartridge)
                                          throws OpenShiftException
Adds the given embeddable cartridge to this application.

Parameters:
cartridge -
Throws:
OpenShiftException

addEmbeddableCartridges

List<IEmbeddedCartridge> addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridge)
                                                 throws OpenShiftException
Adds all given embedded cartridges from this app, given their names.

Parameters:
embeddedCartridges -
Throws:
OpenShiftException
See Also:
#addEmbeddableCartridge(IEmbeddedCartridge), #removeEmbeddedCartridge(IEmbeddedCartridge)

getEmbeddedCartridges

List<IEmbeddedCartridge> getEmbeddedCartridges()
                                               throws OpenShiftException
Returns all embedded cartridges.

Returns:
all embedded cartridges.
Throws:
OpenShiftException
See Also:
IEmbeddedCartridge, #addEmbeddableCartridge(IEmbeddedCartridge), #removeEmbeddedCartridge(IEmbeddedCartridge)

hasEmbeddedCartridge

boolean hasEmbeddedCartridge(IEmbeddableCartridge cartridge)
                             throws OpenShiftException
Returns true if this application has an embedded cartridge. Returns false otherwise.

Parameters:
the - name of the cartridge to look for
Returns:
true if there's an embedded cartridge with the given name
Throws:
OpenShiftException
See Also:
IEmbeddedCartridge, #addEmbeddableCartridge(IEmbeddedCartridge), #removeEmbeddedCartridge(IEmbeddedCartridge)

hasEmbeddedCartridge

boolean hasEmbeddedCartridge(String cartridgeName)
                             throws OpenShiftException
Returns true if this application has an embedded cartridge. Returns false otherwise.

Parameters:
the - name of the cartridge to look for
Returns:
true if there's an embedded cartridge with the given name
Throws:
OpenShiftException
See Also:
IEmbeddedCartridge, #addEmbeddableCartridge(IEmbeddedCartridge), #removeEmbeddedCartridge(IEmbeddedCartridge)

getEmbeddedCartridge

IEmbeddedCartridge getEmbeddedCartridge(String cartridgeName)
                                        throws OpenShiftException
Returns the embedded cartridge given its name. Returns null if none was found.

Parameters:
cartridgeName -
Returns:
the embedded cartridge with the given name
Throws:
OpenShiftException

getEmbeddedCartridge

IEmbeddedCartridge getEmbeddedCartridge(IEmbeddableCartridge cartridge)
                                        throws OpenShiftException
Returns the embedded cartridge in this application. Returns null if none was found.

Parameters:
cartridge -
Returns:
the embedded cartridge
Throws:
OpenShiftException

removeEmbeddedCartridge

void removeEmbeddedCartridge(IEmbeddableCartridge cartridge)
                             throws OpenShiftException
Removes the given embedded cartridge that is equal to the given embeddable cartridge. Does nothing if the cartridge is not present in this application.

Parameters:
cartridge - the cartridge that shall be removed
Throws:
OpenShiftException

removeEmbeddedCartridges

void removeEmbeddedCartridges(Collection<IEmbeddableCartridge> cartridges)
                              throws OpenShiftException
Removes the given embedded cartridges in this application that are equal to the given IEmbeddableCartridge. Does nothing if the cartridge is not present in this application.

Parameters:
cartridges - the cartridges that shall get removed
Throws:
OpenShiftException

getGearGroups

Collection<IGearGroup> getGearGroups()
                                     throws OpenShiftException
Returns the gear groups for this application. The collection is never cached, so each call will trigger a request to the OpenShift Broker.

Returns:
the collection of IGearGroup for this application.
Throws:
OpenShiftException

getCreationTime

Date getCreationTime()
Returns the timestamp at which this app was created.

Returns:
the creation time
Throws:
OpenShiftException

destroy

void destroy()
             throws OpenShiftException
Destroys this application (and removes it from the list of available applications)

Throws:
OpenShiftException
See Also:
IUser#getApplications()

start

void start()
           throws OpenShiftException
Starts this application. Has no effect if this app is already running.

Throws:
OpenShiftException

restart

void restart()
             throws OpenShiftException
Restarts this application.

Throws:
OpenShiftException

stop

void stop()
          throws OpenShiftException
Stops this application.

Throws:
OpenShiftException

stop

void stop(boolean force)
          throws OpenShiftException
Stops this application

Parameters:
force - : true to force stop, false otherwise
Throws:
OpenShiftException

waitForAccessible

boolean waitForAccessible(long timeout)
                          throws OpenShiftException
Waits for this application to become accessible on its public url.

Parameters:
timeout -
Returns:
Throws:
OpenShiftException
See Also:
getApplicationUrl()

waitForAccessibleAsync

Future<Boolean> waitForAccessibleAsync(long timeout)
                                       throws OpenShiftException
Returns a Future that the caller can use to wait for the application to become accessible on its public url.

Parameters:
timeout -
Returns:
Throws:
OpenShiftException
See Also:
getApplicationUrl(), waitForAccessible(long), IOpenShiftConnection.getExecutorService(), Future

getDomain

IDomain getDomain()
Get the domain of the application.

Returns:
the domain

scaleDown

void scaleDown()
               throws OpenShiftException
Scale down application

Throws:
OpenShiftException

scaleUp

void scaleUp()
             throws OpenShiftException
Scale up application

Throws:
OpenShiftException

addAlias

void addAlias(String string)
              throws OpenShiftException
Add application alias

Throws:
OpenShiftException

getAliases

List<String> getAliases()
Retrieve all application aliases

Returns:
application aliases in an unmodifiable collection

hasAlias

boolean hasAlias(String name)

removeAlias

void removeAlias(String alias)
                 throws OpenShiftException
Remove application alias

Throws:
OpenShiftException

refresh

void refresh()
             throws OpenShiftException
Refresh the application but reloading its content from OpenShift. At the same time, this operation automatically set the embedded cartridges back to an 'unloaded' state.

Specified by:
refresh in interface IOpenShiftResource
Throws:
OpenShiftException

setSSHSession

void setSSHSession(com.jcraft.jsch.Session session)
Sets the SSH session that this application will use to connect to OpenShift to perform some operations. This SSH session must be initialized out of the library, since the user's SSH settings may depend on the runtime environment (Eclipse, etc.).

Parameters:
session - the SSH session

getSSHSession

com.jcraft.jsch.Session getSSHSession()
Returns the SSH session that this application uses to connect to OpenShift.

Returns:
the SSH session that this application uses to connect to OpenShift.

hasSSHSession

boolean hasSSHSession()
Returns true if the application was already provided with an SSH session, and this session is still valid (connected).

Returns:
true if the application was already provided with an SSH session, and this session is still valid (connected).

isPortFowardingStarted

boolean isPortFowardingStarted()
                               throws OpenShiftSSHOperationException
Returns true if the port-forwarding has been started, false otherwise.

Returns:
true if the port-forwarding has been started, false otherwise.
Throws:
OpenShiftSSHOperationException

getForwardablePorts

List<IApplicationPortForwarding> getForwardablePorts()
                                                     throws OpenShiftSSHOperationException
Returns the list of forwardable ports on OpenShift for this application.

Returns:
the list of forwardable ports on OpenShift for this application.
Throws:
OpenShiftSSHOperationException

startPortForwarding

List<IApplicationPortForwarding> startPortForwarding()
                                                     throws OpenShiftSSHOperationException
Returns:
the list of forwardable ports on OpenShift for this application.
Throws:
com.jcraft.jsch.JSchException
OpenShiftSSHOperationException

stopPortForwarding

List<IApplicationPortForwarding> stopPortForwarding()
                                                    throws OpenShiftSSHOperationException
Stop the port-forwarding for all ports.

Returns:
the list of forwardable ports on OpenShift for this application.
Throws:
OpenShiftSSHOperationException

refreshForwardablePorts

List<IApplicationPortForwarding> refreshForwardablePorts()
                                                         throws OpenShiftSSHOperationException
Refreshes the list of port-forwarding. Started ones are kept as-is.

Returns:
the list of forwardable ports on OpenShift for this application.
Throws:
OpenShiftSSHOperationException

getEnvironmentProperties

List<String> getEnvironmentProperties()
                                      throws OpenShiftSSHOperationException
Retrieves the list of environment properties.

Returns:
the list of environment properties.
Throws:
OpenShiftSSHOperationException

getEnvironmentVariables

Map<String,IEnvironmentVariable> getEnvironmentVariables()
                                                         throws OpenShiftSSHOperationException
Retrieves the map of environment variables

Returns:
the Map of environment variables
Throws:
OpenShiftSSHOperationException

hasEnvironmentVariable

boolean hasEnvironmentVariable(String name)
                               throws OpenShiftException
Checks if the environment variable is present in the application.

Parameters:
name - Name of the environment variable
Returns:
true if the current instance has IEnvironmentVariables to return
false if the current instance has no IEnvironmentVariables to return
Throws:
OpenShiftSSHOperationException
OpenShiftException

addEnvironmentVariable

IEnvironmentVariable addEnvironmentVariable(String name,
                                            String value)
                                            throws OpenShiftException
Adds an environment variable to this application.

Parameters:
name - key associated with the variable to add
value - value of the new variable
Throws:
OpenShiftSSHOperationException - - if the variable already exists
OpenShiftException

addEnvironmentVariables

Map<String,IEnvironmentVariable> addEnvironmentVariables(Map<String,String> environmentVariables)
                                                         throws OpenShiftException
Adds a map of environment variables to the application

Parameters:
environmentVariables - Map of environment variables
Throws:
OpenShiftSSHOperationException
OpenShiftException

getEnvironmentVariable

IEnvironmentVariable getEnvironmentVariable(String name)
                                            throws OpenShiftException
Return the environment variable for the specified name

Parameters:
name - key to be used to locate the environment variable
Returns:
IEnvironmentVariable associated with the provided key
Throws:
OpenShiftSSHOperationException - - thrown if the key does not exist
OpenShiftException

removeEnvironmentVariable

void removeEnvironmentVariable(String name)
                               throws OpenShiftException
Removes the environment variables with the given name from this application.

Parameters:
name - key associated with the IEnvironmentVariable to be removed
Throws:
OpenShiftException - - thrown if there is no IEnvironmentVariable associated with the explicit parameter.

removeEnvironmentVariable

void removeEnvironmentVariable(IEnvironmentVariable environmentVariable)
Removes the environment variables with the given name from this application.

Parameters:
environmentVariable - IEnvironmentVariable instance which should be removed
Throws:
OpenShiftException - - thrown if there is no instance of IEnvironmentVariable available to be removed

canGetEnvironmentVariables

boolean canGetEnvironmentVariables()
Used to determine if environment variables exist and are available to be retrieved

Returns:
Returns true if this application can list its environment variables.
Returns false if it cannot. Internally this translates to the presence of the link to list environment variables.
See Also:
#getEnvironmentVariablesMap(), getEnvironmentVariable(String), ApplicationResource.LINK_LIST_ENVIRONMENT_VARIABLES

canUpdateEnvironmentVariables

boolean canUpdateEnvironmentVariables()
Used to determine if the current instance is able to update environment variables.

Returns:
Returns true if this application can augment its environment variables.
Returns false if it cannot.
See Also:
addEnvironmentVariable(String, String), addEnvironmentVariables(Map), ApplicationResource.LINK_SET_UNSET_ENVIRONMENT_VARIABLES

OpenShift Java Client 2.5.0.Final

Copyright © 2014 JBoss, a division of Red Hat, Inc.. All Rights Reserved.