Package com.cbe
Class CloudBackend
java.lang.Object
com.cbe.CloudBackend
The session that holds the connection with the cloud.
It ensures the connection is authenticated.
It ensures the connection is authenticated.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCloudBackend
(long cPtr, boolean cMemoryOwn) CloudBackend
(DefaultCtor arg0) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionaccount()
Returns an account object with information on the user.long
addListener
(CloudBackendListenerDelegate listener) Listen for changes to specific items.static Container
castContainer
(Item item) Casts an item to a container.static Object
castObject
(Item item) Casts an item to an object.boolean
Clear the local cache.static CloudBackend
createAccount
(String username, String password, String email, String firstName, String lastName, String tenant, String client, CreateAccountDelegate delegate) Creates a user account.void
delete()
void
finalize()
static long
getCPtr
(CloudBackend obj) Gets the group manager.static CloudBackend
Logs in to the CloudBackend service.Gets the publish manager.query
(long containerId, QueryDelegate queryDelegate) Select Item's of a container (table).query
(long containerId, QueryJoinDelegate queryJoinDelegate) Join multiple tables.query
(long containerId, Filter filter, QueryDelegate queryDelegate) Select Item's of a container (table) with a filter (where).query
(long containerId, Filter filter, QueryJoinDelegate queryJoinDelegate) Join multiple tables using filter (where).queryWithPath
(String relativePath, long queryRoot, QueryDelegate delegate) Queries items of a container with a given path.queryWithPath
(String relativePath, QueryDelegate delegate) Queries items of a container with a given path relative the home root container.void
removeListener
(long handle) Delete a specific listener.search
(Filter filter, long containerId, QueryDelegate delegate) Select Object's with specified key/values using filter.search
(String tags, long containerId, QueryDelegate delegate) Select Object's with specified key/values.Gets the share manager.Gets the subscribe manager.void
Terminates the CloudBackend service.version()
Returns the version number of the SDK.
-
Field Details
-
swigCMemOwn
protected transient boolean swigCMemOwn
-
-
Constructor Details
-
CloudBackend
public CloudBackend(long cPtr, boolean cMemoryOwn) -
CloudBackend
-
-
Method Details
-
getCPtr
-
finalize
public void finalize() -
delete
public void delete() -
logIn
public static CloudBackend logIn(String username, String password, String tenant, String client, LogInDelegate delegate) Logs in to the CloudBackend service.
When finished with the usage of the CloudBackend service, call
method CloudBackend::terminate() in all cases.
The authentication to the account is determined byusername
,
password
andtenant
.
Asynchronous version of this service function.
- Parameters:
username
- Name of the user to be signed in.password
- Password for the user to be signed in.tenant
- The identifier for the tenant,
formerly known assource
.client
- Identifier of what type of client the program is running
on. This is used by the tenant for statistics and
selective communication with the users.
The tenant administrator defines what client names to use.delegate
- Pointer to a be::CloudBackend::LogInDelegate() instance
that is implemented by the user to receive the response
of this login request.
This is accomplished in terms of the LogInDelegate
callback functions
delegate::LogInDelegate::onLogInSuccess(CloudBackend&&)
"onLogInSuccess()" and
delegate::LogInDelegate::onLogInError(LogInDelegate::Error&&,cbe::util::Context&&)
"onLogInError()".
-
createAccount
public static CloudBackend createAccount(String username, String password, String email, String firstName, String lastName, String tenant, String client, CreateAccountDelegate delegate) Creates a user account.
This method is only granted to the tenant administrator.
Asynchronous version of this service function.- Parameters:
username
- Username for the new accountpassword
- Password for the new accountemail
- Email address to owner of the new accountfirstName
- First name of the owner of the new accountlastName
- Last name of the owner of the new accounttenant
- The identifier for the tenant, formerly known as
source
.client
- Describing platform running the software.
Names defined by the tenant administrator.delegate
- Pointer to a delegate::CreateAccountDelegate instance
that is implemented by the user.
-
addListener
Listen for changes to specific items.
Adds a listener that will receive updates as changes occur on the account.
Note: removeListener()
should always be called when no longer using the delegate.- Parameters:
listener
- Delegate is a shared pointer to the class
delegate::CloudBackendListenerDelegate
that the user has implemented- Returns:
- Handle identifying the registration of the listener.
To be used when de-registering with method
removeListener(ListenerHandle).
-
removeListener
public void removeListener(long handle) Delete a specific listener.
Removes a listener that will receive updates as changes occur on the account- Parameters:
handle
- Handle previously retrieved from method
addListener(CloudBackendListenerDelegatePtr).
-
query
Select Item's of a container (table).
Inquires for a set of Items from the provided Container,
identified bycontainerId
.
Response is delivered asynchronously via the delegate::QueryDelegate
callback interface passed in as argument via parameter
queryDelegate
.
This overload of join() accepting a
QueryDelegate-pointer as parameter has two
use cases:
- To make a solely query() call without an additional chained
join()-call.
- To make a
query() call
with a desired chained join() call.
In this latter case, the overloaded
query(ContainerId,delegate::QueryJoinDelegatePtr)
"query()"-functions:
- query(ContainerId,delegate::QueryJoinDelegatePtr)
- query(ContainerId,Filter,delegate::QueryJoinDelegatePtr)
both accepting a
QueryJoinDelegate
asdelegate
argument, must be used.
- query(ContainerId,delegate::QueryJoinDelegatePtr)
Asynchronous version of this service function.
- Parameters:
containerId
-
Id of the container which contents will inquired.queryDelegate
-
Pointer to a QueryDelegate
instance, implemented by the user, that receives the response of
this query request.
I.e., either the
QueryDelegate
callback function
delegate::QueryDelegate::onQuerySuccess(delegate::QueryDelegate::Success&&)
"onQuerySuccess()"
or
delegate::QueryDelegate::onQueryError(delegate::QueryDelegate::Error&&,cbe::util::Context&&)
"onQueryError()"
will be called in the event of success, or failure respectively.
To use the code above, we must first login and then declare a
QueryDelegate class.
- To make a solely query() call without an additional chained
-
query
Select Item's of a container (table) with a filter (where).
Same as query(ContainerId,QueryDelegatePtr),
but with an additional parameterfilter
.
- Parameters:
filter
- Filter specifying the constraints of the requested items.
-
query
Join multiple tables.
Same as query(ContainerId,delegate::QueryDelegatePtr), but with a
QueryJoinDelegate as delegate,
queryJoinDelegate
.
see query(ContainerId,delegate::QueryDelegatePtr)
- Parameters:
queryJoinDelegate
-
Pointer to a QueryJoinDelegate
instance, implemented by the user, that receives the response of
this query request.
I.e., either its callback function
delegate::QueryJoinDelegate::onQueryJoinSuccess(cbe::QueryResult&&)
"onQueryJoinSuccess()" or
delegate::QueryJoinDelegate::onQueryJoinError(QueryJoinError &&, cbe::util::Context &&)
"onQueryJoinError()"
will be called in the event of success or failure respectively.
-
query
Join multiple tables using filter (where).
Same as query(ContainerId,delegate::QueryJoinDelegatePtr), but with an
additional Filter parameterfilter
.
- Parameters:
filter
- Filter specifying the constraints of the requested items.
-
queryWithPath
Queries items of a container with a given path.
Note:..
or.
relative path options are not
permitted.
Only top down search from start point,queryRoot
id
to downwards path in container tree.- Parameters:
relativePath
- The relative path from thequeryRoot
.
E.g.:
/Documents/Pictures
from aqueryRoot
that has the nested containers
Documents
andPictures
.queryRoot
- The container id forming the root of this query.delegate
- Pointer to a delegate::QueryDelegate instance
that is implemented by the user.
-
queryWithPath
Queries items of a container with a given path relative the home root container.
Same as queryWithPath(std::string, cbe::ContainerId, QueryDelegatePtr),
but with thequeryRoot
parameter omitted. Instead,
here the home root container is used as top container in the search tree. -
search
Select Object's with specified key/values.
Search the whole container for tags related to
Objects in the container structure.
E.g., <c> Key = Name, Value Contract/Object/Song => Name:Contract1 <c>.
Search handles tags in combination / conjunction of keys and/or key values
separated by |.
E.g., Name:*|Country:Sweden|Country:Norway.
This would search for objects with key Name but any value and where key
Country is either Sweden or Norway.- Parameters:
tags
- Is a string of key tags or key:value pairs that are
separated by |.containerId
- Is the cbe::ContainerId id of the rootContainer to
start the search of objects in.
E.g., if starting in the rootContainer,
the whole account will be searched for
matching tags, key/value's.delegate
- Is the callback pointer to where the API returns from
either cache or Server.
-
search
Select Object's with specified key/values using filter.
Search the whole container for tags related to Objects in the container
structure.
E.g., <c>Key = Name, Value Contract/Object/Song => Name:Contract1 <c>.
Search handles tags in combination / conjunction of keys and/or key values
separated by |.
E.g., Name:*|Country:Sweden|Country:Norway, this would search for objects
with key Name but any value and where key Country is either Sweden or
Norway.
See Filter.- Parameters:
filter
- is a cbe::Filter on which you can set how you want data to be
ordered when searching. Remember to set the queryString to be keys/tags or
key:value pairs that are separated by |.containerId
- is the ContainerId of the rootContainer to start the
search of Objects in.
E.g., if starting in the rootContainer, the whole
account will be searched for matching tags, key/value's.delegate
- is the callback pointer to where the API returns from either
cache or Server.
-
castContainer
Casts an item to a container.
If the provided cbe::Item "item" is not a cbe::Container "container", an
empty container instance is returned -
castObject
Casts an item to an object. If the provided cbe::Item "item" is not a cbe::Object "object", an empty object instance is returned -
clearCache
public boolean clearCache()Clear the local cache.
Use if there is a local SDK memory issue.
- Returns:
- true success
-
account
Returns an account object with information on the user.- Returns:
- cbe::Account
-
version
Returns the version number of the SDK.- Returns:
- std::string
-
groupManager
Gets the group manager.- Returns:
- cbe::GroupManager
-
publishManager
Gets the publish manager.- Returns:
- cbe::PublishManager
-
terminate
public void terminate()Terminates the CloudBackend service.
Shall also be called in connection with a failed log in. -
subscribeManager
Gets the subscribe manager.- Returns:
- cbe::SubscribeManager
-