forked from eclipse/kapua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Client.java
61 lines (56 loc) · 2.02 KB
/
Client.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Inc - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.client.gateway;
/**
* A client connection
* <p>
* An instance of a client can be obtained by building and instance
* via different protocol stacks. e.g. see the {@code KuraMqttProfile}.
* </p>
* <p>
* In order to free resources the instance has to be closed when it is no
* longer needed.
* </p>
* <p>
* Data is exchanged by the use of {@link Application}s.
* </p>
*/
public interface Client extends AutoCloseable {
public interface Builder {
public Client build() throws Exception;
}
/**
* Get control over the transport
*
* @return The transport control instance
*/
public Transport transport();
/**
* Create a new application instance
* <p>
* This method only returns a new builder which will
* create a new instance once {@link Application.Builder#build()} is called.
* Before that the application is not built and no resources are claimed.
* </p>
* <p>
* Application IDs are unique. If an application ID is already allocated it
* cannot be allocated a second time. The second call to {@link Application.Builder#build()} will fail.
* However this application ID only allocated once the call to {@link Application.Builder#build()}
* succeeded.
* </p>
*
* @param applicationId
* The ID of the application to create
* @return the new {@link Application.Builder} instance
*/
public Application.Builder buildApplication(String applicationId);
}