public class

CloudHubConnector

extends Object
java.lang.Object
   ↳ org.mule.modules.cloudhub.CloudHubConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Provides the ability to interact with Mule CloudHub from within a Mule application. There are operations to deploy, start, stop, and update applications as well as send notifications from your application to CloudHub.

When running this connector in an application inside CloudHub, it will use token based authentication to access the API. This will allow access and usage of the CloudHub APIs without the need to specify your username and password.

Summary

Constants
String DOMAIN_SYSTEM_PROPERTY
String EXCEPTION_MESSAGE_CUSTOM_PROPERTY
String EXCEPTION_STACKTRACE_CUSTOM_PROPERTY
String TENANT_ID_PROPERTY
Fields
private CloudhubConnection connection
private Logger logger
private Long maxWaitTime Maximum time allowed to deplpoy/undeploy.
private String password CloudHub password.
private String url CloudHub URL.
private String username CloudHub username.
Public Constructors
CloudHubConnector()
Public Methods
void createNotification(String message, Notification.Priority priority, Map<String, String> customProperties, MuleEvent muleEvent)

Create a notification inside CloudHub.

void deleteApplication(String domain)

Delete an application.

void deployApplication(InputStream file, String domain, String muleVersion, int workerCount, Map<String, String> environmentVariables)
Deploy specified application.
void dismissNotification(String href)

Dismiss an individual notification.

Application getApplication(String domain)
Get an application.
Long getMaxWaitTime()
String getPassword()
static String getStackTrace(Throwable aThrowable)
String getUrl()
String getUsername()
List<Application> listApplications()
List applications.
NotificationResults listNotifications(Integer maxResults, Integer offset, MuleEvent muleEvent)

List a user's notifications.

void setMaxWaitTime(Long maxWaitTime)
void setPassword(String password)
void setUrl(String url)
void setUsername(String username)
void startApplication(String domain)
Start an application.
void stopApplication(String domain)
Stop an application.
void updateApplication(Application application)
Update an application.
Protected Methods
synchronized CloudhubConnection createConnection()
synchronized CloudhubConnection getConnection()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String DOMAIN_SYSTEM_PROPERTY

Constant Value: "domain"

public static final String EXCEPTION_MESSAGE_CUSTOM_PROPERTY

Constant Value: "exception.message"

public static final String EXCEPTION_STACKTRACE_CUSTOM_PROPERTY

Constant Value: "exception.stacktrace"

public static final String TENANT_ID_PROPERTY

Constant Value: "tenantId"

Fields

private CloudhubConnection connection

private Logger logger

private Long maxWaitTime

Maximum time allowed to deplpoy/undeploy.

private String password

CloudHub password.

private String url

CloudHub URL.

private String username

CloudHub username.

Public Constructors

public CloudHubConnector ()

Public Methods

public void createNotification (String message, Notification.Priority priority, Map<String, String> customProperties, MuleEvent muleEvent)

Create a notification inside CloudHub.

If the notification is sent after an exception, it attaches the exception.message and exception.stacktrace as as custom properties of the notification. Those custom properties can be accessed from Cloudhub console with the names 'exception.message' and 'exception.stacktrace'

In the case of multitenant applications the connector will create a notification for a particular tenant. (the one that is executing the flow)

Parameters
message

The contents of the notification.

priority

The notification priority.

customProperties

a map to represent custom placeholders on the notification template

muleEvent

Processed mule event

public void deleteApplication (String domain)

Delete an application.

Parameters
domain

The application domain.

public void deployApplication (InputStream file, String domain, String muleVersion, int workerCount, Map<String, String> environmentVariables)

Deploy specified application.

Parameters
file Mule application to deploy, Input Object type: java.io.InputStream
domain The application domain.
muleVersion The version of Mule, e.g. 3.2.2.
workerCount The number of workers to deploy.
environmentVariables Environment variables for you application.

public void dismissNotification (String href)

Dismiss an individual notification.

This operation does not depend on the tenant environment.

Parameters
href

The href property of the Notification object.

public Application getApplication (String domain)

Get an application.

Parameters
domain The application domain.
Returns
  • An application.

public Long getMaxWaitTime ()

public String getPassword ()

public static String getStackTrace (Throwable aThrowable)

Parameters
aThrowable

public String getUrl ()

public String getUsername ()

public List<Application> listApplications ()

List applications.

Returns
  • A list of applications.

public NotificationResults listNotifications (Integer maxResults, Integer offset, MuleEvent muleEvent)

List a user's notifications.

In the case of a multitenant application it searches for the notifications registered for the current tenant.

Parameters
maxResults

The maximum number of results to retrieve.

offset

The offset to start listing alerts from.

muleEvent

Processed mule event

Returns
  • A List of notifications.

public void setMaxWaitTime (Long maxWaitTime)

Parameters
maxWaitTime

public void setPassword (String password)

Parameters
password

public void setUrl (String url)

Parameters
url

public void setUsername (String username)

Parameters
username

public void startApplication (String domain)

Start an application.

Parameters
domain The application domain.

public void stopApplication (String domain)

Stop an application.

Parameters
domain The application domain.

public void updateApplication (Application application)

Update an application.

Parameters
application The application to update.

Protected Methods

protected synchronized CloudhubConnection createConnection ()

protected synchronized CloudhubConnection getConnection ()