OpenShift Java Client 2.5.0.Final

com.openshift.internal.client
Class DomainResource

java.lang.Object
  extended by com.openshift.internal.client.AbstractOpenShiftResource
      extended by com.openshift.internal.client.DomainResource
All Implemented Interfaces:
IDomain, IOpenShiftResource

public class DomainResource
extends AbstractOpenShiftResource
implements IDomain

Author:
André Dietisheim, Nicolas Spano

Nested Class Summary
 
Nested classes/interfaces inherited from class com.openshift.internal.client.AbstractOpenShiftResource
AbstractOpenShiftResource.Parameters, AbstractOpenShiftResource.ServiceRequest
 
Constructor Summary
protected DomainResource(DomainResourceDTO domainDTO, APIResource api)
           
protected DomainResource(String namespace, String suffix, Map<String,Link> links, Messages messages, APIResource api)
           
 
Method Summary
 boolean canCreateApplicationWithEnvironmentVariables()
          Returns true if this domain can create application with environment variables.
 IApplication createApplication(String name, IStandaloneCartridge cartridge)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, IGearProfile gearProfile)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, IGearProfile gearProfile, String initialGitUrl)
          Creates a new application with the given name and the given cartridge/framework.
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, IGearProfile gearProfile, String initialGitUrl, int timeout, IEmbeddableCartridge... cartridges)
          Creates a new application with the given name and the given cartridge/framework.
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, IGearProfile gearProfile, String initialGitUrl, int timeout, Map<String,String> environmentVariables, IEmbeddableCartridge... cartridges)
          Creates a new application with the given name and the given cartridge/framework.
 IApplication createApplication(String name, IStandaloneCartridge cartridge, ApplicationScale scale, String initialGitUrl)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, IGearProfile gearProfile)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, IGearProfile gearProfile, String initialGitUrl)
           
 IApplication createApplication(String name, IStandaloneCartridge cartridge, String initialGitUrl)
           
 void destroy()
          Destroys the current domain.
 void destroy(boolean force)
          Destroys the current domain, using the 'force' parameter to also destroy the domain applications.
 boolean equals(Object obj)
           
 IApplication getApplicationByName(String name)
          Returns the application identified by the given name.
 List<IApplication> getApplications()
           
 List<IApplication> getApplicationsByCartridge(IStandaloneCartridge cartridge)
           
 List<String> getAvailableCartridgeNames()
          Returns the list of cartridges that can be used to create a new application.
 List<IGearProfile> getAvailableGearProfiles()
          Returns the list of available gear size that the user can choose when creating a new application (application's gear size can't be changed after creation).
 String getId()
           
protected  List<IApplication> getOrLoadApplications()
           
 String getSuffix()
          The domain suffix is the host part eg: 'rhcloud.com')
 IUser getUser()
          Returns the currently connected user that manages this domain.
 boolean hasApplicationByCartridge(IStandaloneCartridge cartridge)
           
 boolean hasApplicationByName(String name)
          Returns true if the application identified by the given name exists in the domain.
 int hashCode()
           
 void refresh()
          Refresh the resource and its list of children resources that were previously loaded
protected  void removeApplication(IApplication application)
           
 void rename(String id)
          Rename the current domain with the given id....
 String toString()
           
 
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

DomainResource

protected DomainResource(String namespace,
                         String suffix,
                         Map<String,Link> links,
                         Messages messages,
                         APIResource api)

DomainResource

protected DomainResource(DomainResourceDTO domainDTO,
                         APIResource api)
Method Detail

getId

public String getId()
Specified by:
getId in interface IDomain
Returns:
the domain id (formerly known as 'namespace'). A unique litteral identifier on OpenShift.

getSuffix

public String getSuffix()
Description copied from interface: IDomain
The domain suffix is the host part eg: 'rhcloud.com')

Specified by:
getSuffix in interface IDomain
Returns:

rename

public void rename(String id)
            throws OpenShiftException
Description copied from interface: IDomain
Rename the current domain with the given id....

Specified by:
rename in interface IDomain
Throws:
OpenShiftException

getUser

public IUser getUser()
              throws OpenShiftException
Description copied from interface: IDomain
Returns the currently connected user that manages this domain.

Specified by:
getUser in interface IDomain
Returns:
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge)
                               throws OpenShiftException
Specified by:
createApplication in interface IDomain
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale)
                               throws OpenShiftException
Specified by:
createApplication in interface IDomain
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      String initialGitUrl)
                               throws OpenShiftException
Specified by:
createApplication in interface IDomain
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale,
                                      String initialGitUrl)
                               throws OpenShiftException
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      IGearProfile gearProfile)
                               throws OpenShiftException
Specified by:
createApplication in interface IDomain
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      IGearProfile gearProfile,
                                      String initialGitUrl)
                               throws OpenShiftException
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale,
                                      IGearProfile gearProfile)
                               throws OpenShiftException
Specified by:
createApplication in interface IDomain
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale,
                                      IGearProfile gearProfile,
                                      String initialGitUrl)
                               throws OpenShiftException
Description copied from interface: IDomain
Creates a new application with the given name and the given cartridge/framework. Optionally, adds scalability and a specific gear profile and a git url to use for the initial template.

Specified by:
createApplication in interface IDomain
Parameters:
name - the name of the application
cartridge - the cartridge (the application type, ex. jbossas-7, jbossews-2, php.5.2, etc.
scale - or null (will use default on openshift, ie, false)
gearProfile - ("small", "micro", "medium", "large", "exlarge", "jumbo") or null (will use default on openshift, ie, 'small')
initialGitUrl - the git url for the initial template app to be used
Returns:
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale,
                                      IGearProfile gearProfile,
                                      String initialGitUrl,
                                      int timeout,
                                      IEmbeddableCartridge... cartridges)
                               throws OpenShiftException
Description copied from interface: IDomain
Creates a new application with the given name and the given cartridge/framework. Optionally, adds scalability, a specific gear profile, a git url to use for the initial template, the timeout value and the embeddable (add-on) cartridges for it.

Specified by:
createApplication in interface IDomain
Parameters:
name - the name of the application
cartridge - the cartridge (the application type, ex. jbossas-7, jbossews-2, php.5.2, etc.
scale - or null (will use default on openshift, ie, false)
gearProfile - ("small", "micro", "medium", "large", "exlarge", "jumbo") or null (will use default on openshift, ie, 'small')
initialGitUrl - the git url for the initial template app to be used
timeout - the timeout value in milliseconds
cartridges - the embeddable cartridges that shall get added to the new application (the add-on cartridges mysql, mongodb, postgresql, etc.)
Returns:
IApplication created
Throws:
OpenShiftException

createApplication

public IApplication createApplication(String name,
                                      IStandaloneCartridge cartridge,
                                      ApplicationScale scale,
                                      IGearProfile gearProfile,
                                      String initialGitUrl,
                                      int timeout,
                                      Map<String,String> environmentVariables,
                                      IEmbeddableCartridge... cartridges)
                               throws OpenShiftException
Description copied from interface: IDomain
Creates a new application with the given name and the given cartridge/framework. Optionally, adds scalability, a specific gear profile, a git url to use for the initial template, the timeout value, environment variables and the embeddable (add-on) cartridges for it.

Specified by:
createApplication in interface IDomain
Parameters:
name - the name of the application
cartridge - the cartridge (the application type, ex. jbossas-7, jbossews-2, php.5.2, etc.
scale - or null (will use default on openshift, ie, false)
gearProfile - ("small", "micro", "medium", "large", "exlarge", "jumbo") or null (will use default on openshift, ie, 'small')
initialGitUrl - the git url for the initial template app to be used
timeout - the timeout value in milliseconds
environmentVariables - the environment variables to be added to the application
cartridges - the embeddable cartridges that shall get added to the new application (the add-on cartridges mysql, mongodb, postgresql, etc.)
Returns:
IApplication created
Throws:
OpenShiftException

hasApplicationByName

public boolean hasApplicationByName(String name)
                             throws OpenShiftException
Description copied from interface: IDomain
Returns true if the application identified by the given name exists in the domain.

Specified by:
hasApplicationByName in interface IDomain
Returns:
Throws:
OpenShiftException

getApplicationByName

public IApplication getApplicationByName(String name)
                                  throws OpenShiftException
Description copied from interface: IDomain
Returns the application identified by the given name.

Specified by:
getApplicationByName in interface IDomain
Returns:
Throws:
OpenShiftException

getApplicationsByCartridge

public List<IApplication> getApplicationsByCartridge(IStandaloneCartridge cartridge)
                                              throws OpenShiftException
Specified by:
getApplicationsByCartridge in interface IDomain
Throws:
OpenShiftException

hasApplicationByCartridge

public boolean hasApplicationByCartridge(IStandaloneCartridge cartridge)
                                  throws OpenShiftException
Specified by:
hasApplicationByCartridge in interface IDomain
Throws:
OpenShiftException

canCreateApplicationWithEnvironmentVariables

public boolean canCreateApplicationWithEnvironmentVariables()
Description copied from interface: IDomain
Returns true if this domain can create application with environment variables. Returns false otherwise.

Specified by:
canCreateApplicationWithEnvironmentVariables in interface IDomain
Returns:
true if can create an application with environment variables
See Also:
IApplication.getEnvironmentVariables()

destroy

public void destroy()
             throws OpenShiftException
Description copied from interface: IDomain
Destroys the current domain. This method works only if it has not application.

Specified by:
destroy in interface IDomain
Throws:
OpenShiftException

destroy

public void destroy(boolean force)
             throws OpenShiftException
Description copied from interface: IDomain
Destroys the current domain, using the 'force' parameter to also destroy the domain applications. The domain cannot be destroyed without setting 'force-true' if it still contains applications.

Specified by:
destroy in interface IDomain
Throws:
OpenShiftException

getApplications

public List<IApplication> getApplications()
                                   throws OpenShiftException
Specified by:
getApplications in interface IDomain
Throws:
OpenShiftException

getOrLoadApplications

protected List<IApplication> getOrLoadApplications()
                                            throws OpenShiftException
Throws:
OpenShiftException

removeApplication

protected void removeApplication(IApplication application)

getAvailableCartridgeNames

public List<String> getAvailableCartridgeNames()
                                        throws OpenShiftException
Description copied from interface: IDomain
Returns the list of cartridges that can be used to create a new application.

Specified by:
getAvailableCartridgeNames in interface IDomain
Returns:
the list of cartridges that can be used to create a new application.
Throws:
OpenShiftException

getAvailableGearProfiles

public List<IGearProfile> getAvailableGearProfiles()
                                            throws OpenShiftException
Description copied from interface: IDomain
Returns the list of available gear size that the user can choose when creating a new application (application's gear size can't be changed after creation).

Specified by:
getAvailableGearProfiles in interface IDomain
Returns:
Throws:
OpenShiftException

refresh

public void refresh()
             throws OpenShiftException
Description copied from interface: IOpenShiftResource
Refresh the resource and its list of children resources that were previously loaded

Specified by:
refresh in interface IOpenShiftResource
Throws:
OpenShiftException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

OpenShift Java Client 2.5.0.Final

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