|
OpenShift Java Client 2.5.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.openshift.internal.client.AbstractOpenShiftResource
com.openshift.internal.client.ApplicationResource
public class ApplicationResource
The ApplicationResource object is an implementation of com.openshift.client.IApplication, and provides a runtime model for the real application that resides on the OpenShift platform being accessed.
Nested Class Summary | |
---|---|
protected static class |
ApplicationResource.SshStreams
|
Nested classes/interfaces inherited from class com.openshift.internal.client.AbstractOpenShiftResource |
---|
AbstractOpenShiftResource.Parameters, AbstractOpenShiftResource.ServiceRequest |
Constructor Summary | |
---|---|
protected |
ApplicationResource(ApplicationResourceDTO dto,
DomainResource domain)
|
protected |
ApplicationResource(String name,
String uuid,
String creationTime,
Messages messages,
String applicationUrl,
String sshUrl,
String gitUrl,
String initialGitUrl,
IGearProfile gearProfile,
ApplicationScale scale,
List<String> aliases,
Map<String,CartridgeResourceDTO> cartridgesByName,
Map<String,Link> links,
DomainResource domain)
Instantiates a new application. |
Method Summary | |
---|---|
void |
addAlias(String alias)
Add application alias |
IEmbeddedCartridge |
addEmbeddableCartridge(IEmbeddableCartridge cartridge)
Adds the given embedded cartridge to this application. |
List<IEmbeddedCartridge> |
addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridges)
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 |
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. |
IStandaloneCartridge |
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. |
void |
getDescriptor()
|
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. |
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 |
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)
|
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. |
Methods inherited from class com.openshift.internal.client.AbstractOpenShiftResource |
---|
getCreationLog, getLink, getMessages, hasCreationLog, setLinks |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.openshift.client.IOpenShiftResource |
---|
getCreationLog, getMessages, hasCreationLog |
Constructor Detail |
---|
protected ApplicationResource(ApplicationResourceDTO dto, DomainResource domain)
protected ApplicationResource(String name, String uuid, String creationTime, Messages messages, String applicationUrl, String sshUrl, String gitUrl, String initialGitUrl, 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 to
DatatypeConfigurationException
Method Detail |
---|
public String getName()
IApplication
getName
in interface IApplication
public ApplicationScale getApplicationScale()
IApplication
getApplicationScale
in interface IApplication
public IGearProfile getGearProfile()
IApplication
getGearProfile
in interface IApplication
public String getUUID()
IApplication
getUUID
in interface IApplication
public IStandaloneCartridge getCartridge()
IApplication
getCartridge
in interface IApplication
protected ICartridge getCartridge(String cartridgeName)
cartridgeName
- the name of the cartridge to look for.
public Date getCreationTime()
IApplication
getCreationTime
in interface IApplication
public IDomain getDomain()
IApplication
getDomain
in interface IApplication
public void destroy() throws OpenShiftException
IApplication
destroy
in interface IApplication
OpenShiftException
IUser#getApplications()
public void start() throws OpenShiftException
IApplication
start
in interface IApplication
OpenShiftException
public void restart() throws OpenShiftException
IApplication
restart
in interface IApplication
OpenShiftException
public void stop() throws OpenShiftException
IApplication
stop
in interface IApplication
OpenShiftException
public void stop(boolean force) throws OpenShiftException
IApplication
stop
in interface IApplication
force
- : true to force stop, false otherwise
OpenShiftException
public void getDescriptor()
public void scaleDown() throws OpenShiftException
IApplication
scaleDown
in interface IApplication
OpenShiftException
public void scaleUp() throws OpenShiftException
IApplication
scaleUp
in interface IApplication
OpenShiftException
public void addAlias(String alias) throws OpenShiftException
IApplication
addAlias
in interface IApplication
OpenShiftException
public List<String> getAliases()
IApplication
getAliases
in interface IApplication
public boolean hasAlias(String name)
hasAlias
in interface IApplication
public void removeAlias(String alias) throws OpenShiftException
IApplication
removeAlias
in interface IApplication
OpenShiftException
public String getGitUrl()
IApplication
getGitUrl
in interface IApplication
public String getInitialGitUrl()
IApplication
getInitialGitUrl
in interface IApplication
public String getSshUrl()
IApplication
getSshUrl
in interface IApplication
public String getApplicationUrl()
IApplication
getApplicationUrl
in interface IApplication
public IEmbeddedCartridge addEmbeddableCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
addEmbeddableCartridge
in interface IApplication
cartridge
- the embeddable cartridge that shall be added to this
application
OpenShiftException
public List<IEmbeddedCartridge> addEmbeddableCartridges(Collection<IEmbeddableCartridge> cartridges) throws OpenShiftException
IApplication
addEmbeddableCartridges
in interface IApplication
OpenShiftException
#addEmbeddableCartridge(IEmbeddedCartridge)
,
#removeEmbeddedCartridge(IEmbeddedCartridge)
protected void removeEmbeddedCartridge(IEmbeddedCartridge embeddedCartridge) throws OpenShiftException
embeddedCartridge
-
OpenShiftException
protected void refreshEmbeddedCartridges() throws OpenShiftException
OpenShiftException
public List<IEmbeddedCartridge> getEmbeddedCartridges() throws OpenShiftException
IApplication
getEmbeddedCartridges
in interface IApplication
OpenShiftException
IEmbeddedCartridge
,
#addEmbeddableCartridge(IEmbeddedCartridge)
,
#removeEmbeddedCartridge(IEmbeddedCartridge)
public boolean hasEmbeddedCartridge(String cartridgeName) throws OpenShiftException
IApplication
true
if this application has an embedded cartridge.
Returns false
otherwise.
hasEmbeddedCartridge
in interface IApplication
OpenShiftException
IEmbeddedCartridge
,
#addEmbeddableCartridge(IEmbeddedCartridge)
,
#removeEmbeddedCartridge(IEmbeddedCartridge)
public boolean hasEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplication
true
if this application has an embedded cartridge.
Returns false
otherwise.
hasEmbeddedCartridge
in interface IApplication
OpenShiftException
IEmbeddedCartridge
,
#addEmbeddableCartridge(IEmbeddedCartridge)
,
#removeEmbeddedCartridge(IEmbeddedCartridge)
public IEmbeddedCartridge getEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplication
null
if none was
found.
getEmbeddedCartridge
in interface IApplication
OpenShiftException
public IEmbeddedCartridge getEmbeddedCartridge(String cartridgeName) throws OpenShiftException
IApplication
null
if none was found.
getEmbeddedCartridge
in interface IApplication
OpenShiftException
public void removeEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplication
removeEmbeddedCartridge
in interface IApplication
cartridge
- the cartridge that shall be removed
OpenShiftException
public void removeEmbeddedCartridges(Collection<IEmbeddableCartridge> cartridges) throws OpenShiftException
IApplication
removeEmbeddedCartridges
in interface IApplication
cartridges
- the cartridges that shall get removed
OpenShiftException
public Collection<IGearGroup> getGearGroups() throws OpenShiftException
IApplication
getGearGroups
in interface IApplication
IGearGroup
for this application.
OpenShiftException
public boolean waitForAccessible(long timeout) throws OpenShiftException
IApplication
waitForAccessible
in interface IApplication
OpenShiftException
IApplication.getApplicationUrl()
public Future<Boolean> waitForAccessibleAsync(long timeout) throws OpenShiftException
IApplication
waitForAccessibleAsync
in interface IApplication
OpenShiftException
IApplication.getApplicationUrl()
,
IApplication.waitForAccessible(long)
,
IOpenShiftConnection.getExecutorService()
,
Future
protected IOpenShiftConnection getConnection()
protected boolean canResolv(String url) throws MalformedURLException
MalformedURLException
public void refresh() throws OpenShiftException
IApplication
refresh
in interface IApplication
refresh
in interface IOpenShiftResource
OpenShiftException
public void setSSHSession(com.jcraft.jsch.Session session)
IApplication
setSSHSession
in interface IApplication
session
- the SSH sessionpublic com.jcraft.jsch.Session getSSHSession()
IApplication
getSSHSession
in interface IApplication
public boolean hasSSHSession()
IApplication
hasSSHSession
in interface IApplication
public boolean isPortFowardingStarted() throws OpenShiftSSHOperationException
IApplication
isPortFowardingStarted
in interface IApplication
OpenShiftSSHOperationException
public List<IApplicationPortForwarding> refreshForwardablePorts() throws OpenShiftSSHOperationException
IApplication
refreshForwardablePorts
in interface IApplication
OpenShiftSSHOperationException
public List<IApplicationPortForwarding> getForwardablePorts() throws OpenShiftSSHOperationException
IApplication
getForwardablePorts
in interface IApplication
OpenShiftSSHOperationException
public List<String> getEnvironmentProperties() throws OpenShiftSSHOperationException
IApplication
getEnvironmentProperties
in interface IApplication
OpenShiftSSHOperationException
public Map<String,IEnvironmentVariable> getEnvironmentVariables() throws OpenShiftException
IApplication
getEnvironmentVariables
in interface IApplication
OpenShiftSSHOperationException
OpenShiftException
protected Map<String,IEnvironmentVariable> getOrLoadEnvironmentVariables() throws OpenShiftException
OpenShiftException
public IEnvironmentVariable addEnvironmentVariable(String name, String value) throws OpenShiftException
IApplication
addEnvironmentVariable
in interface IApplication
name
- key associated with the variable to addvalue
- value of the new variable
OpenShiftSSHOperationException
- - if the variable already exists
OpenShiftException
public Map<String,IEnvironmentVariable> addEnvironmentVariables(Map<String,String> environmentVariables) throws OpenShiftException
IApplication
addEnvironmentVariables
in interface IApplication
environmentVariables
- MapOpenShiftSSHOperationException
OpenShiftException
public void removeEnvironmentVariable(String targetName)
IApplication
removeEnvironmentVariable
in interface IApplication
targetName
- key associated with the IEnvironmentVariable to be removedpublic void removeEnvironmentVariable(IEnvironmentVariable environmentVariable)
IApplication
removeEnvironmentVariable
in interface IApplication
environmentVariable
- IEnvironmentVariable instance which should be removedpublic boolean hasEnvironmentVariable(String name) throws OpenShiftException
IApplication
hasEnvironmentVariable
in interface IApplication
name
- Name of the environment variable
true
if the current instance has IEnvironmentVariables to return false
if the current instance has no IEnvironmentVariables to return
OpenShiftSSHOperationException
OpenShiftException
protected void updateEnvironmentVariables() throws OpenShiftException
OpenShiftException
public IEnvironmentVariable getEnvironmentVariable(String name)
IApplication
getEnvironmentVariable
in interface IApplication
name
- key to be used to locate the environment variable
public boolean canGetEnvironmentVariables()
IApplication
canGetEnvironmentVariables
in interface IApplication
true
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_VARIABLES
public boolean canUpdateEnvironmentVariables()
IApplication
canUpdateEnvironmentVariables
in interface IApplication
true
if this application can augment its environment variables.false
if it cannot. IApplication.addEnvironmentVariable(String, String)
,
IApplication.addEnvironmentVariables(Map)
,
LINK_SET_UNSET_ENVIRONMENT_VARIABLES
protected List<String> sshExecCmd(String command, ApplicationResource.SshStreams sshStream) throws OpenShiftSSHOperationException
command
-
OpenShiftSSHOperationException
public List<IApplicationPortForwarding> startPortForwarding() throws OpenShiftSSHOperationException
startPortForwarding
in interface IApplication
OpenShiftSSHOperationException
public List<IApplicationPortForwarding> stopPortForwarding() throws OpenShiftSSHOperationException
IApplication
stopPortForwarding
in interface IApplication
OpenShiftSSHOperationException
protected void update(ApplicationResourceDTO dto)
public int hashCode()
hashCode
in class Object
public boolean equals(Object object)
equals
in class Object
public String toString()
toString
in class Object
|
OpenShift Java Client 2.5.0.Final | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |