com.mulesoft.cloudhub.client
Class CloudHubConnectionImpl

java.lang.Object
  extended by com.mulesoft.cloudhub.client.CloudHubConnectionImpl
All Implemented Interfaces:
CloudHubConnectionI
Direct Known Subclasses:
CloudHubDomainConnectionImpl

public class CloudHubConnectionImpl
extends Object
implements CloudHubConnectionI


Nested Class Summary
static class CloudHubConnectionImpl.ObjectMapper
           
 
Field Summary
protected  String accessToken
           
protected  String apiToken
           
protected  com.sun.jersey.api.client.Client client
           
static String ENVIRONMENT_ID
           
protected  String environmentId
           
protected  com.google.gson.Gson gson
           
static String NEW_DEFAULT_URL
           
protected  String password
           
protected  String url
           
protected  String username
           
 
Constructor Summary
protected CloudHubConnectionImpl()
           
  CloudHubConnectionImpl(String url, String accessToken, boolean debug)
           
  CloudHubConnectionImpl(String url, String accessToken, String environmentId, boolean debug)
           
 
Method Summary
protected  com.sun.jersey.api.client.WebResource.Builder addEnvironmentHeader(com.sun.jersey.api.client.WebResource.Builder pathResource)
           
protected  com.sun.jersey.api.client.WebResource.Builder authorizeResource(com.sun.jersey.api.client.WebResource pathResource)
           
protected  CloudHubException buildExpception(com.sun.jersey.api.client.ClientResponse clientResponse)
           
 CloudHubDomainConnectionI connectWithDomain(String domain)
          Returns a connection against a given domain of the CloudHub account
 com.mulesoft.ch.rest.model.Application createApplication(com.mulesoft.ch.rest.model.Application application)
          Creates an application on your CloudHub account.
protected  com.sun.jersey.api.client.WebResource.Builder createApplicationBuilder(String path)
           
protected  com.sun.jersey.api.client.WebResource.Builder createBuilder(String path)
           
protected  com.sun.jersey.api.client.WebResource createResource(String path)
           
 String getAccessToken()
           
 String getPassowrd()
           
 List<String> getSupportedMuleVersions()
          This method returns all the supported mule versions by CloudHub
 String getUrl()
           
 String getUsername()
           
protected  void init(String url, boolean debug)
           
 boolean isDomainAvailable(String domain)
          Checks if the domain is valid and available
 com.mulesoft.ch.rest.model.Account retrieveAccount()
          Retrieves the CloudHub Account
 List<com.mulesoft.ch.rest.model.Application> retrieveApplications()
          Retrieves All Applications from an specific CloudHub account
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEW_DEFAULT_URL

public static final String NEW_DEFAULT_URL
See Also:
Constant Field Values

ENVIRONMENT_ID

public static final String ENVIRONMENT_ID
See Also:
Constant Field Values

url

protected String url

client

protected com.sun.jersey.api.client.Client client

username

protected String username

password

protected String password

apiToken

protected String apiToken

environmentId

protected String environmentId

accessToken

protected String accessToken

gson

protected com.google.gson.Gson gson
Constructor Detail

CloudHubConnectionImpl

protected CloudHubConnectionImpl()

CloudHubConnectionImpl

public CloudHubConnectionImpl(String url,
                              String accessToken,
                              String environmentId,
                              boolean debug)

CloudHubConnectionImpl

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

init

protected void init(String url,
                    boolean debug)

connectWithDomain

public CloudHubDomainConnectionI connectWithDomain(String domain)
Description copied from interface: CloudHubConnectionI
Returns a connection against a given domain of the CloudHub account

Specified by:
connectWithDomain in interface CloudHubConnectionI
Parameters:
domain - the domain to which you want to connect
Returns:
an instance of CloudHubDomainConnectionImpl connected with the specified domain

retrieveAccount

public com.mulesoft.ch.rest.model.Account retrieveAccount()
                                                   throws CloudHubException
Description copied from interface: CloudHubConnectionI
Retrieves the CloudHub Account

Specified by:
retrieveAccount in interface CloudHubConnectionI
Returns:
an instance of Account
Throws:
CloudHubException - if there is an error when retrieving the account

isDomainAvailable

public boolean isDomainAvailable(String domain)
                          throws CloudHubException
Description copied from interface: CloudHubConnectionI
Checks if the domain is valid and available

Specified by:
isDomainAvailable in interface CloudHubConnectionI
Parameters:
domain - the domain to be validated
Returns:
true if the domain is valid and available to be used. False if the domain is already taken.
Throws:
CloudHubException - if there is an error when validating the domain

retrieveApplications

public List<com.mulesoft.ch.rest.model.Application> retrieveApplications()
Description copied from interface: CloudHubConnectionI
Retrieves All Applications from an specific CloudHub account

Specified by:
retrieveApplications in interface CloudHubConnectionI
Returns:
a collection of Application

createApplication

public com.mulesoft.ch.rest.model.Application createApplication(com.mulesoft.ch.rest.model.Application application)
                                                         throws CloudHubException
Description copied from interface: CloudHubConnectionI
Creates an application on your CloudHub account. This method does not deploy your application.

Specified by:
createApplication in interface CloudHubConnectionI
Parameters:
application - an instance of Application containing all the application's information
Returns:
an instance of Application containing all the recently created application's information provided by CloudHub
Throws:
CloudHubException - if there was an error while creating the application

getSupportedMuleVersions

public List<String> getSupportedMuleVersions()
                                      throws CloudHubException
Description copied from interface: CloudHubConnectionI
This method returns all the supported mule versions by CloudHub

Specified by:
getSupportedMuleVersions in interface CloudHubConnectionI
Returns:
a list of strings, with all the supported mule versions by CloudHub
Throws:
CloudHubException

createBuilder

protected com.sun.jersey.api.client.WebResource.Builder createBuilder(String path)

authorizeResource

protected com.sun.jersey.api.client.WebResource.Builder authorizeResource(com.sun.jersey.api.client.WebResource pathResource)

addEnvironmentHeader

protected com.sun.jersey.api.client.WebResource.Builder addEnvironmentHeader(com.sun.jersey.api.client.WebResource.Builder pathResource)

createResource

protected com.sun.jersey.api.client.WebResource createResource(String path)

createApplicationBuilder

protected final com.sun.jersey.api.client.WebResource.Builder createApplicationBuilder(String path)

buildExpception

protected CloudHubException buildExpception(com.sun.jersey.api.client.ClientResponse clientResponse)
                                     throws CloudHubException
Throws:
CloudHubException

getUrl

public String getUrl()
Specified by:
getUrl in interface CloudHubConnectionI

getUsername

public String getUsername()
Specified by:
getUsername in interface CloudHubConnectionI

getPassowrd

public String getPassowrd()
Specified by:
getPassowrd in interface CloudHubConnectionI

getAccessToken

public String getAccessToken()
Specified by:
getAccessToken in interface CloudHubConnectionI


Copyright © 2012-2015. All Rights Reserved.