com.mulesoft.cloudhub.client
Class CloudHubDomainConnectionImpl

java.lang.Object
  extended by com.mulesoft.cloudhub.client.CloudHubConnectionImpl
      extended by com.mulesoft.cloudhub.client.CloudHubDomainConnectionImpl
All Implemented Interfaces:
CloudHubConnectionI, CloudHubDomainConnectionI

public class CloudHubDomainConnectionImpl
extends CloudHubConnectionImpl
implements CloudHubDomainConnectionI


Nested Class Summary
 
Nested classes/interfaces inherited from class com.mulesoft.cloudhub.client.CloudHubConnectionImpl
CloudHubConnectionImpl.ObjectMapper
 
Field Summary
 
Fields inherited from class com.mulesoft.cloudhub.client.CloudHubConnectionImpl
accessToken, apiToken, client, ENVIRONMENT_ID, gson, NEW_DEFAULT_URL, password, url, username
 
Constructor Summary
protected CloudHubDomainConnectionImpl(CloudHubConnectionI con, String environmentId, boolean csAuthentication, String domain)
           
  CloudHubDomainConnectionImpl(String url, String accessToken, boolean debug)
           
 
Method Summary
 void deleteApplication()
          Deletes the application by using the connection's domain.
 void deployApplication(File file, long maxWaitTime)
          Deploys an application with the provided fileStream
 String getDomain()
          Returns the connected domain
 com.mulesoft.ch.rest.model.Application retrieveApplication()
          Retrieves the application based on the connected domain
 com.mulesoft.ch.rest.model.ApplicationStatus retrieveApplicationStatus()
          Retrieves the application's status
 com.mulesoft.ch.rest.model.Application updateApplication(com.mulesoft.ch.rest.model.ApplicationUpdateInfo newApplicationInfo)
          Updates an application's information on your CloudHub account.
 void updateApplicationStatus(com.mulesoft.ch.rest.model.ApplicationStatusChange applicationStatusChange, long maxWaitTime)
          Updates an application's status based on some specific commands.
 
Methods inherited from class com.mulesoft.cloudhub.client.CloudHubConnectionImpl
addEnvironmentHeader, authorizeResource, buildExpception, connectWithDomain, createApplication, createApplicationBuilder, createBuilder, createResource, getAccessToken, getPassowrd, getSupportedMuleVersions, getUrl, getUsername, init, isDomainAvailable, retrieveAccount, retrieveApplications
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mulesoft.cloudhub.client.CloudHubConnectionI
connectWithDomain, createApplication, getAccessToken, getPassowrd, getSupportedMuleVersions, getUrl, getUsername, isDomainAvailable, retrieveAccount, retrieveApplications
 

Constructor Detail

CloudHubDomainConnectionImpl

protected CloudHubDomainConnectionImpl(CloudHubConnectionI con,
                                       String environmentId,
                                       boolean csAuthentication,
                                       String domain)

CloudHubDomainConnectionImpl

public CloudHubDomainConnectionImpl(String url,
                                    String accessToken,
                                    boolean debug)
Method Detail

getDomain

public String getDomain()
Description copied from interface: CloudHubDomainConnectionI
Returns the connected domain

Specified by:
getDomain in interface CloudHubDomainConnectionI
Returns:
the connected domain

retrieveApplication

public com.mulesoft.ch.rest.model.Application retrieveApplication()
                                                           throws CloudHubException
Description copied from interface: CloudHubDomainConnectionI
Retrieves the application based on the connected domain

Specified by:
retrieveApplication in interface CloudHubDomainConnectionI
Returns:
an instance of Application
Throws:
CloudHubException - if the domain does not exist

retrieveApplicationStatus

public com.mulesoft.ch.rest.model.ApplicationStatus retrieveApplicationStatus()
                                                                       throws CloudHubException
Description copied from interface: CloudHubDomainConnectionI
Retrieves the application's status

Specified by:
retrieveApplicationStatus in interface CloudHubDomainConnectionI
Returns:
one of com.mulesoft.ch.rest.model.Application.ApplicationStatus
Throws:
CloudHubException - if there was an error when retrieving the application status

deployApplication

public void deployApplication(File file,
                              long maxWaitTime)
Description copied from interface: CloudHubDomainConnectionI
Deploys an application with the provided fileStream

Specified by:
deployApplication in interface CloudHubDomainConnectionI
Parameters:
file - the file to be deployed
maxWaitTime - Maximum time allowed to deploy/undeploy in miliseconds. Case 1: 0, the connector won't wait CH to finish the deploy/undeploy process and will return a response based on CH API response status. Case 2: 1, the connector will wait until CH finish the deploy/undeploy process and will throw an exception if the deploy fails. Case 3: anyOthervalue, the connector will wait that amount of miliseconds for CH to finish the deploy/undeploy process. If takes longer, it will throw an exception. If takes shorter, it will follow the same process as case 2.

updateApplication

public com.mulesoft.ch.rest.model.Application updateApplication(com.mulesoft.ch.rest.model.ApplicationUpdateInfo newApplicationInfo)
                                                         throws CloudHubException
Description copied from interface: CloudHubDomainConnectionI
Updates an application's information on your CloudHub account. This method just updates metaData like Mule Version, Description, etc. If you want to update a new stream, use CloudHubDomainConnectionI.deployApplication(java.io.File, long) instead

Specified by:
updateApplication in interface CloudHubDomainConnectionI
Returns:
an instance of Application containing all the new application's information provided by CloudHub
Throws:
CloudHubException - if there was an error while updating the application

updateApplicationStatus

public void updateApplicationStatus(com.mulesoft.ch.rest.model.ApplicationStatusChange applicationStatusChange,
                                    long maxWaitTime)
                             throws CloudHubException
Description copied from interface: CloudHubDomainConnectionI
Updates an application's status based on some specific commands. Can be START or STOP

Specified by:
updateApplicationStatus in interface CloudHubDomainConnectionI
Parameters:
applicationStatusChange - an instance of com.mulesoft.cloudhub.client.ApplicationStatusChange with the new application status
maxWaitTime - Maximum time allowed to deploy/undeploy in miliseconds. Case 1: 0, the connector won't wait CH to finish the deploy/undeploy process and will return a response based on CH API response status. Case 2: 1, the connector will wait until CH finish the deploy/undeploy process and will throw an exception if the deploy fails. Case 3: anyOthervalue, the connector will wait that amount of miliseconds for CH to finish the deploy/undeploy process. If takes longer, it will throw an exception. If takes shorter, it will follow the same process as case 2.
Throws:
CloudHubException - if there was an error while updating the application's status.

deleteApplication

public void deleteApplication()
                       throws CloudHubException
Description copied from interface: CloudHubDomainConnectionI
Deletes the application by using the connection's domain. The domain can not be invalid since it was validated when creating the connection.

Specified by:
deleteApplication in interface CloudHubDomainConnectionI
Throws:
CloudHubException - if there was an error while deleting the application


Copyright © 2012-2015. All Rights Reserved.