com.mulesoft.cloudhub.client
Class Connection

java.lang.Object
  extended by com.mulesoft.cloudhub.client.Connection
All Implemented Interfaces:
CloudhubConnection
Direct Known Subclasses:
DomainConnection

public class Connection
extends Object
implements CloudhubConnection

Base class for CloudHub interaction.


Nested Class Summary
static class Connection.ObjectMapper
           
 
Field Summary
static String DEFAULT_URL
           
 
Constructor Summary
Connection(String url, String username, String password)
           
Connection(String url, String username, String password, boolean debug)
           
 
Method Summary
 Notification create(Notification notification)
           Connects to CH to create a notification
protected  com.sun.jersey.api.client.WebResource.Builder createBuilder(String path)
           
 Notification createNotification(String text, Notification.Priority priority, String domain, Map<String,String> customProperties)
          Deprecated. 
 void dismissAllNotifications()
           Does what CloudhubConnection.dismissNotification(String) to all the queued notifications in CH
 void dismissNotification(String href)
           Removes the notification form the read queue
protected  String getAPIURL()
           
protected  String getPassword()
           
protected  String getUrl()
           
protected  String getUsername()
           
protected  void handleErrors(com.sun.jersey.api.client.ClientResponse response)
           
 List<Application> listApplications()
          
 NotificationResults listNotifications(Integer maxResults, Integer offset, String tenantId)
           Lists all the notifications of an app.
 DomainConnection on(String domain)
          
 boolean test()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_URL

public static final String DEFAULT_URL
See Also:
Constant Field Values
Constructor Detail

Connection

public Connection(String url,
                  String username,
                  String password)

Connection

public Connection(String url,
                  String username,
                  String password,
                  boolean debug)
Method Detail

getUrl

protected final String getUrl()

getUsername

protected final String getUsername()

getPassword

protected final String getPassword()

getAPIURL

protected final String getAPIURL()

createBuilder

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

on

public final DomainConnection on(String domain)

Specified by:
on in interface CloudhubConnection
Parameters:
domain -

The domain of the required connection

Returns:

A connection for a specific domain


test

public final boolean test()

Specified by:
test in interface CloudhubConnection
Returns:
true if provided connection details allow to connect; false otherwise

listApplications

public final List<Application> listApplications()

Specified by:
listApplications in interface CloudhubConnection
Returns:
all existing applications

createNotification

@Deprecated
public final Notification createNotification(String text,
                                                        Notification.Priority priority,
                                                        String domain,
                                                        Map<String,String> customProperties)
Deprecated. 

Use CloudhubConnection.create(Notification) instead

Specified by:
createNotification in interface CloudhubConnection

create

public final Notification create(Notification notification)

Connects to CH to create a notification

Specified by:
create in interface CloudhubConnection
Parameters:
notification -

The notification information that needs to be created in CH

Returns:

The created notification


listNotifications

public final NotificationResults listNotifications(Integer maxResults,
                                                   Integer offset,
                                                   String tenantId)

Lists all the notifications of an app.

In the case of a multitenant application those notifications will be filtered by tenant id.

Specified by:
listNotifications in interface CloudhubConnection
Parameters:
maxResults -

Maximum number of results. For pagination.

offset -

Since which notification. For pagination.

tenantId -

Filter by tenant id. If null then don't apply the filter

Returns:

all existing applications


dismissNotification

public final void dismissNotification(String href)

Removes the notification form the read queue

Specified by:
dismissNotification in interface CloudhubConnection
Parameters:
href -

href id of the notification that needs to be dismissed


dismissAllNotifications

public final void dismissAllNotifications()

Does what CloudhubConnection.dismissNotification(String) to all the queued notifications in CH

Specified by:
dismissAllNotifications in interface CloudhubConnection

handleErrors

protected void handleErrors(com.sun.jersey.api.client.ClientResponse response)


Copyright © 2012-2013. All Rights Reserved.