public class ApplicationResource extends AbstractOpenShiftResource implements IApplication
AbstractOpenShiftResource.ServiceRequest
Modifier | Constructor and Description |
---|---|
protected |
ApplicationResource(ApplicationResourceDTO dto,
ICartridge cartridge,
DomainResource domain)
Constructor...
|
protected |
ApplicationResource(String name,
String uuid,
String creationTime,
List<Message> creationLog,
String applicationUrl,
String gitUrl,
IGearProfile gearProfile,
ApplicationScale scale,
ICartridge cartridge,
List<String> aliases,
Map<String,String> embeddedCartridgesInfos,
Map<String,Link> links,
DomainResource domain)
Instantiates a new application.
|
Modifier and Type | Method and Description |
---|---|
void |
addAlias(String alias)
Add application alias
|
List<IEmbeddedCartridge> |
addEmbeddableCartridge(ICartridgeConstraint cartridgeConstraint)
Adds the embeddable cartridges that match the given constraint.
|
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.
|
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.
|
ICartridge |
getCartridge()
Returns the cartridge (application type) that this app is running on.
|
String |
getCartridge(String cartridgeName) |
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.
|
Collection<IEmbeddedCartridge> |
getEmbeddedCartridges(ICartridgeConstraint constraint)
Returns the embedded cartridges in this application that match the given cartridge constraint.
|
List<String> |
getEnvironmentProperties()
Retrieves the list of environment properties.
|
List<IApplicationPortForwarding> |
getForwardablePorts()
Returns the list of forwardable ports on OpenShift 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 |
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 |
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. |
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.
|
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 |
removeEmbeddedCartridges(ICartridgeConstraint cartridgeConstraint)
Removes the embeddable cartridges that match the given constraint.
|
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.
|
String |
toString() |
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.
|
areLinksLoaded, getCreationLog, getLink, getService, hasCreationLog
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getCreationLog, hasCreationLog
protected ApplicationResource(ApplicationResourceDTO dto, ICartridge cartridge, DomainResource domain)
dto
- cartridge
- domain
- protected ApplicationResource(String name, String uuid, String creationTime, List<Message> creationLog, String applicationUrl, String gitUrl, IGearProfile gearProfile, ApplicationScale scale, ICartridge cartridge, List<String> aliases, Map<String,String> embeddedCartridgesInfos, Map<String,Link> links, DomainResource domain)
name
- the nameuuid
- the uuidcreationTime
- the creation timecreationLog
- the creation logapplicationUrl
- the application urlgitUrl
- the git urlcartridge
- the cartridge (type/framework)aliases
- the aliaseslinks
- the linksdomain
- the domain this application belongs toDatatypeConfigurationException
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 ICartridge getCartridge()
IApplication
getCartridge
in interface IApplication
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 otherwiseOpenShiftException
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 getApplicationUrl()
IApplication
getApplicationUrl
in interface IApplication
public List<IEmbeddedCartridge> addEmbeddableCartridge(ICartridgeConstraint cartridgeConstraint) throws OpenShiftException
IApplication
addEmbeddableCartridge
in interface IApplication
cartridgeConstraint
- the constraint that determines what cartridges shall be addedOpenShiftException
- if no cartridge matches the constraintpublic IEmbeddedCartridge addEmbeddableCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
addEmbeddableCartridge
in interface IApplication
cartridge
- the embeddable cartridge that shall be added to this
applicationOpenShiftException
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
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 Collection<IEmbeddedCartridge> getEmbeddedCartridges(ICartridgeConstraint constraint) throws OpenShiftException
IApplication
getEmbeddedCartridges
in interface IApplication
constraint
- the constraint that the embedded cartridges shall matchOpenShiftException
public IEmbeddedCartridge getEmbeddedCartridge(String cartridgeName) throws OpenShiftException
IApplication
null
if none was found.getEmbeddedCartridge
in interface IApplication
OpenShiftException
public void removeEmbeddedCartridges(ICartridgeConstraint cartridgeConstraint) throws OpenShiftException
IApplication
removeEmbeddedCartridges
in interface IApplication
cartridgeConstraint
- the constraint that the cartridge shall matchOpenShiftException
- if no cartridge matches the constraintpublic void removeEmbeddedCartridge(IEmbeddableCartridge cartridge) throws OpenShiftException
IApplication
removeEmbeddedCartridge
in interface IApplication
cartridge
- the cartridge that shall be removedOpenShiftException
public void removeEmbeddedCartridges(Collection<IEmbeddableCartridge> cartridges) throws OpenShiftException
IApplication
removeEmbeddedCartridges
in interface IApplication
cartridges
- the cartridges that shall get removedOpenShiftException
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
public String getCartridge(String cartridgeName) throws OpenShiftException
getCartridge
in interface IApplication
OpenShiftException
protected IOpenShiftConnection getConnection()
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 List<IApplicationPortForwarding> startPortForwarding() throws OpenShiftSSHOperationException
startPortForwarding
in interface IApplication
OpenShiftSSHOperationException
public List<IApplicationPortForwarding> stopPortForwarding() throws OpenShiftSSHOperationException
IApplication
stopPortForwarding
in interface IApplication
OpenShiftSSHOperationException
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.