public class ApplicationResource extends AbstractOpenShiftResource implements IApplication
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ApplicationResource.SshStreams |
AbstractOpenShiftResource.Parameters, AbstractOpenShiftResource.ServiceRequest| Modifier | Constructor and Description |
|---|---|
protected |
ApplicationResource(ApplicationResourceDTO dto,
DomainResource domain) |
protected |
ApplicationResource(String name,
String uuid,
String creationTime,
Messages messages,
String applicationUrl,
String sshUrl,
String gitUrl,
String initialGitUrl,
String deploymentType,
IGearProfile gearProfile,
ApplicationScale scale,
List<String> aliases,
Map<String,CartridgeResourceDTO> cartridgesByName,
Map<String,Link> links,
DomainResource domain)
Instantiates a new application.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAlias(String alias)
Add application alias
|
IEmbeddedCartridge |
addEmbeddableCartridge(ICartridge cartridge)
Adds the given embeddable cartridge to this application.
|
List<IEmbeddedCartridge> |
addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridges)
Adds all given embedded cartridges from this app, given their names.
|
List<IEmbeddedCartridge> |
addEmbeddableCartridges(ICartridge... cartridges)
Adds the given embeddable cartridges to this application.
|
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
|
protected boolean |
canResolv(String url) |
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)
|
boolean |
equals(Object object) |
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.
|
IDeployedStandaloneCartridge |
getCartridge()
Returns the cartridge (application type) that this app is running on.
|
protected ICartridge |
getCartridge(String cartridgeName)
Returns the main (standalone) cartrige or one of the embedded cartridges
whose name matches the given param.
|
protected IOpenShiftConnection |
getConnection() |
Date |
getCreationTime()
Returns the timestamp at which this app was created.
|
String |
getDeploymentType()
Returns the deployment type for this application.
|
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
|
String |
getEnvironmentVariableValue(String name)
Return the environment variables value for the specified name
|
List<IApplicationPortForwarding> |
getForwardablePorts()
Returns the list of forwardable ports on OpenShift for this application.
|
IGearGroup |
getGearGroup(ICartridge cartridge) |
IGearGroup |
getGearGroup(ICartridge cartridge,
Collection<IGearGroup> gearGroups) |
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.
|
protected Map<String,IEnvironmentVariable> |
getOrLoadEnvironmentVariables() |
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.
|
int |
hashCode() |
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.
|
protected void |
refreshEmbeddedCartridges()
Queries the backend to list the embedded cartridges and adds the new ones
& update the ones that are already present
|
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.
|
protected void |
removeEmbeddedCartridge(IEmbeddedCartridge embeddedCartridge)
"callback" from the embeddedCartridge once it has been destroyed.
|
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 targetName)
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
|
String |
setDeploymentType(String deploymentType)
Sets the deployment type for this 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.
|
protected List<String> |
sshExecCmd(String command,
ApplicationResource.SshStreams sshStream) |
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.
|
String |
toString() |
protected void |
update(ApplicationResourceDTO dto) |
IEnvironmentVariable |
updateEnvironmentVariable(String name,
String value)
Updates an environment variable to this application.
|
protected void |
updateEnvironmentVariables() |
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.
|
getCreationLog, getLink, getMessages, hasCreationLog, setLinksclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCreationLog, getMessages, hasCreationLogprotected ApplicationResource(ApplicationResourceDTO dto, DomainResource domain)
protected ApplicationResource(String name, String uuid, String creationTime, Messages messages, String applicationUrl, String sshUrl, String gitUrl, String initialGitUrl, String deploymentType, IGearProfile gearProfile, ApplicationScale scale, List<String> aliases, Map<String,CartridgeResourceDTO> cartridgesByName, Map<String,Link> links, DomainResource domain)
name - the nameuuid - the uuidcreationTime - the creation timemessages - the creation logapplicationUrl - the application urlgitUrl - the git urlsshUrl - the ssh urlcartridge - the cartridge (type/framework)aliases - the aliaseslinks - the linksdomain - the domain this application belongs toDatatypeConfigurationExceptionpublic String getName()
IApplicationgetName in interface IApplicationpublic ApplicationScale getApplicationScale()
IApplicationgetApplicationScale in interface IApplicationpublic IGearProfile getGearProfile()
IApplicationgetGearProfile in interface IApplicationpublic String getUUID()
IApplicationgetUUID in interface IApplicationpublic IDeployedStandaloneCartridge getCartridge()
IApplicationgetCartridge in interface IApplicationprotected ICartridge getCartridge(String cartridgeName)
cartridgeName - the name of the cartridge to look for.public Date getCreationTime()
IApplicationgetCreationTime in interface IApplicationpublic IDomain getDomain()
IApplicationgetDomain in interface IApplicationpublic void destroy()
throws OpenShiftException
IApplicationdestroy in interface IApplicationOpenShiftExceptionIUser#getApplications()public void start()
throws OpenShiftException
IApplicationstart in interface IApplicationOpenShiftExceptionpublic void restart()
throws OpenShiftException
IApplicationrestart in interface IApplicationOpenShiftExceptionpublic void stop()
throws OpenShiftException
IApplicationstop in interface IApplicationOpenShiftExceptionpublic void stop(boolean force)
throws OpenShiftException
IApplicationstop in interface IApplicationforce - : true to force stop, false otherwiseOpenShiftExceptionpublic void scaleDown()
throws OpenShiftException
IApplicationscaleDown in interface IApplicationOpenShiftExceptionpublic void scaleUp()
throws OpenShiftException
IApplicationscaleUp in interface IApplicationOpenShiftExceptionpublic void addAlias(String alias) throws OpenShiftException
IApplicationaddAlias in interface IApplicationOpenShiftExceptionpublic List<String> getAliases()
IApplicationgetAliases in interface IApplicationpublic boolean hasAlias(String name)
hasAlias in interface IApplicationpublic void removeAlias(String alias) throws OpenShiftException
IApplicationremoveAlias in interface IApplicationOpenShiftExceptionpublic String getGitUrl()
IApplicationgetGitUrl in interface IApplicationpublic String getInitialGitUrl()
IApplicationgetInitialGitUrl in interface IApplicationpublic String getDeploymentType()
IApplicationgetDeploymentType in interface IApplicationpublic String getSshUrl()
IApplicationgetSshUrl in interface IApplicationpublic String getApplicationUrl()
IApplicationgetApplicationUrl in interface IApplicationpublic String setDeploymentType(String deploymentType)
IApplicationsetDeploymentType in interface IApplicationpublic IEmbeddedCartridge addEmbeddableCartridge(ICartridge cartridge) throws OpenShiftException
IApplicationaddEmbeddableCartridge in interface IApplicationcartridge - the cartridge that shall be addedOpenShiftExceptionpublic List<IEmbeddedCartridge> addEmbeddableCartridges(ICartridge... cartridges) throws OpenShiftException
IApplicationaddEmbeddableCartridges in interface IApplicationcartridges - the cartridges that shall be addedOpenShiftExceptionpublic List<IEmbeddedCartridge> addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridges) throws OpenShiftException
IApplicationaddEmbeddableCartridges in interface IApplicationOpenShiftException#addEmbeddableCartridge(IEmbeddedCartridge),
#removeEmbeddedCartridge(IEmbeddedCartridge)protected void removeEmbeddedCartridge(IEmbeddedCartridge embeddedCartridge) throws OpenShiftException
embeddedCartridge - OpenShiftExceptionprotected void refreshEmbeddedCartridges()
throws OpenShiftException
OpenShiftExceptionpublic List<IEmbeddedCartridge> getEmbeddedCartridges() throws OpenShiftException
IApplicationgetEmbeddedCartridges in interface IApplicationOpenShiftExceptionIEmbeddedCartridge,
#addEmbeddableCartridge(IEmbeddedCartridge),
#removeEmbeddedCartridge(IEmbeddedCartridge)public boolean hasEmbeddedCartridge(String cartridgeName) throws OpenShiftException
IApplicationtrue if this application has an embedded cartridge.
Returns false otherwise.hasEmbeddedCartridge in interface IApplicationOpenShiftExceptionIEmbeddedCartridge,
#addEmbeddableCartridge(IEmbeddedCartridge),
#removeEmbeddedCartridge(IEmbeddedCartridge)public boolean hasEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplicationtrue if this application has an embedded cartridge.
Returns false otherwise.hasEmbeddedCartridge in interface IApplicationOpenShiftExceptionIEmbeddedCartridge,
#addEmbeddableCartridge(IEmbeddedCartridge),
#removeEmbeddedCartridge(IEmbeddedCartridge)public IEmbeddedCartridge getEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplicationnull if none was found.getEmbeddedCartridge in interface IApplicationOpenShiftExceptionpublic IEmbeddedCartridge getEmbeddedCartridge(String cartridgeName) throws OpenShiftException
IApplicationnull
if none was found.getEmbeddedCartridge in interface IApplicationOpenShiftExceptionpublic void removeEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplicationremoveEmbeddedCartridge in interface IApplicationcartridge - the cartridge that shall be removedOpenShiftExceptionpublic void removeEmbeddedCartridges(Collection<IEmbeddableCartridge> cartridges) throws OpenShiftException
IApplicationremoveEmbeddedCartridges in interface IApplicationcartridges - the cartridges that shall get removedOpenShiftExceptionpublic Collection<IGearGroup> getGearGroups() throws OpenShiftException
IApplicationgetGearGroups in interface IApplicationIGearGroup for this application.OpenShiftExceptionpublic IGearGroup getGearGroup(ICartridge cartridge) throws OpenShiftException
OpenShiftExceptionpublic IGearGroup getGearGroup(ICartridge cartridge, Collection<IGearGroup> gearGroups)
public boolean waitForAccessible(long timeout)
throws OpenShiftException
IApplicationwaitForAccessible in interface IApplicationOpenShiftExceptionIApplication.getApplicationUrl()public Future<Boolean> waitForAccessibleAsync(long timeout) throws OpenShiftException
IApplicationwaitForAccessibleAsync in interface IApplicationOpenShiftExceptionIApplication.getApplicationUrl(),
IApplication.waitForAccessible(long),
IOpenShiftConnection.getExecutorService(),
Futureprotected IOpenShiftConnection getConnection()
protected boolean canResolv(String url) throws MalformedURLException
MalformedURLExceptionpublic void refresh()
throws OpenShiftException
IApplicationrefresh in interface IApplicationrefresh in interface IOpenShiftResourceOpenShiftExceptionpublic void setSSHSession(com.jcraft.jsch.Session session)
IApplicationsetSSHSession in interface IApplicationsession - the SSH sessionpublic com.jcraft.jsch.Session getSSHSession()
IApplicationgetSSHSession in interface IApplicationpublic boolean hasSSHSession()
IApplicationhasSSHSession in interface IApplicationpublic boolean isPortFowardingStarted()
throws OpenShiftSSHOperationException
IApplicationisPortFowardingStarted in interface IApplicationOpenShiftSSHOperationExceptionpublic List<IApplicationPortForwarding> refreshForwardablePorts() throws OpenShiftSSHOperationException
IApplicationrefreshForwardablePorts in interface IApplicationOpenShiftSSHOperationExceptionpublic List<IApplicationPortForwarding> getForwardablePorts() throws OpenShiftSSHOperationException
IApplicationgetForwardablePorts in interface IApplicationOpenShiftSSHOperationExceptionpublic List<String> getEnvironmentProperties() throws OpenShiftSSHOperationException
IApplicationgetEnvironmentProperties in interface IApplicationOpenShiftSSHOperationExceptionpublic Map<String,IEnvironmentVariable> getEnvironmentVariables() throws OpenShiftException
IApplicationgetEnvironmentVariables in interface IApplicationOpenShiftSSHOperationExceptionOpenShiftExceptionprotected Map<String,IEnvironmentVariable> getOrLoadEnvironmentVariables() throws OpenShiftException
OpenShiftExceptionpublic IEnvironmentVariable addEnvironmentVariable(String name, String value) throws OpenShiftException
IApplicationaddEnvironmentVariable in interface IApplicationname - key associated with the variable to addvalue - value of the new variableOpenShiftSSHOperationException - - if the variable already existsOpenShiftExceptionpublic IEnvironmentVariable updateEnvironmentVariable(String name, String value) throws OpenShiftException
IApplicationupdateEnvironmentVariable in interface IApplicationname - key associated with the variable to updatevalue - value of the new variableOpenShiftSSHOperationException - - if the variable already existsOpenShiftExceptionpublic Map<String,IEnvironmentVariable> addEnvironmentVariables(Map<String,String> environmentVariables) throws OpenShiftException
IApplicationaddEnvironmentVariables in interface IApplicationenvironmentVariables - MapOpenShiftSSHOperationExceptionOpenShiftExceptionpublic void removeEnvironmentVariable(String targetName)
IApplicationremoveEnvironmentVariable in interface IApplicationtargetName - key associated with the IEnvironmentVariable to be removedpublic void removeEnvironmentVariable(IEnvironmentVariable environmentVariable)
IApplicationremoveEnvironmentVariable in interface IApplicationenvironmentVariable - IEnvironmentVariable instance which should be removedpublic boolean hasEnvironmentVariable(String name) throws OpenShiftException
IApplicationhasEnvironmentVariable in interface IApplicationname - Name of the environment variabletrue if the current instance has
IEnvironmentVariables to return false if the current instance has no
IEnvironmentVariables to returnOpenShiftSSHOperationExceptionOpenShiftExceptionprotected void updateEnvironmentVariables()
throws OpenShiftException
OpenShiftExceptionpublic IEnvironmentVariable getEnvironmentVariable(String name)
IApplicationgetEnvironmentVariable in interface IApplicationname - key to be used to locate the environment variablepublic String getEnvironmentVariableValue(String name)
IApplicationgetEnvironmentVariableValue in interface IApplicationname - key to be used to locate the environment variablepublic boolean canGetEnvironmentVariables()
IApplicationcanGetEnvironmentVariables in interface IApplicationtrue if this application can list its
environment variables. false if it cannot. Internally this
translates to the presence of the link to list environment
variables.#getEnvironmentVariablesMap(),
IApplication.getEnvironmentVariable(String),
LINK_LIST_ENVIRONMENT_VARIABLESpublic boolean canUpdateEnvironmentVariables()
IApplicationcanUpdateEnvironmentVariables in interface IApplicationtrue if this application can augment its
environment variables.false if it cannot. IApplication.addEnvironmentVariable(String, String),
IApplication.addEnvironmentVariables(Map),
LINK_SET_UNSET_ENVIRONMENT_VARIABLESprotected List<String> sshExecCmd(String command, ApplicationResource.SshStreams sshStream) throws OpenShiftSSHOperationException
command - OpenShiftSSHOperationExceptionpublic List<IApplicationPortForwarding> startPortForwarding() throws OpenShiftSSHOperationException
startPortForwarding in interface IApplicationOpenShiftSSHOperationExceptionpublic List<IApplicationPortForwarding> stopPortForwarding() throws OpenShiftSSHOperationException
IApplicationstopPortForwarding in interface IApplicationOpenShiftSSHOperationExceptionprotected void update(ApplicationResourceDTO dto)
Copyright © 2016 JBoss by Red Hat. All rights reserved.