Package com.cbe

Class CloudBackend

java.lang.Object
com.cbe.CloudBackend

public class CloudBackend extends Object
The session that holds the connection with the cloud.
It ensures the connection is authenticated.
  • Field Details

    • swigCMemOwn

      protected transient boolean swigCMemOwn
  • Constructor Details

    • CloudBackend

      public CloudBackend(long cPtr, boolean cMemoryOwn)
    • CloudBackend

      public CloudBackend(DefaultCtor arg0)
      Default constructor.
      Construct a new object with
      the DefaultCtor to enable the
      operator bool()
      test
  • Method Details

    • getCPtr

      public static long getCPtr(CloudBackend obj)
    • finalize

      public void finalize()
      Overrides:
      finalize in class Object
    • 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 by username,
      password and tenant.

      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 as source.
      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 account
      password - Password for the new account
      email - Email address to owner of the new account
      firstName - First name of the owner of the new account
      lastName - Last name of the owner of the new account
      tenant - 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

      public long addListener(CloudBackendListenerDelegate listener)
      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

      public QueryChain query(long containerId, QueryDelegate queryDelegate)
      Select Item's of a container (table).
      Inquires for a set of Items from the provided Container,
      identified by containerId.
      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:

      1. To make a solely query() call without an additional chained
        join()-call.
      2. 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
        as delegate argument, must be used.


      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.

    • query

      public QueryChain query(long containerId, Filter filter, QueryDelegate queryDelegate)
      Select Item's of a container (table) with a filter (where).
      Same as query(ContainerId,QueryDelegatePtr),
      but with an additional parameter filter.

      Parameters:
      filter - Filter specifying the constraints of the requested items.
    • query

      public QueryChainExt query(long containerId, QueryJoinDelegate queryJoinDelegate)
      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

      public QueryChainExt query(long containerId, Filter filter, QueryJoinDelegate queryJoinDelegate)
      Join multiple tables using filter (where).
      Same as query(ContainerId,delegate::QueryJoinDelegatePtr), but with an
      additional Filter parameter filter.

      Parameters:
      filter - Filter specifying the constraints of the requested items.
    • queryWithPath

      public QueryChain queryWithPath(String relativePath, long queryRoot, QueryDelegate delegate)
      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 the queryRoot.

      E.g.:
      /Documents/Pictures

      from a queryRoot that has the nested containers
      Documents and Pictures.
      queryRoot - The container id forming the root of this query.
      delegate - Pointer to a delegate::QueryDelegate instance
      that is implemented by the user.
    • queryWithPath

      public QueryChain queryWithPath(String relativePath, QueryDelegate delegate)
      Queries items of a container with a given path relative the home root container.
      Same as queryWithPath(std::string, cbe::ContainerId, QueryDelegatePtr),
      but with the queryRoot parameter omitted. Instead,
      here the home root container is used as top container in the search tree.
    • search

      public QueryResult search(String tags, long containerId, QueryDelegate delegate)
      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

      public QueryResult search(Filter filter, long containerId, QueryDelegate delegate)
      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

      public static Container castContainer(Item item)
      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

      public static Object castObject(Item item)
      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

      public Account account()
      Returns an account object with information on the user.
      Returns:
      cbe::Account
    • version

      public String version()
      Returns the version number of the SDK.
      Returns:
      std::string
    • groupManager

      public GroupManager groupManager()
      Gets the group manager.
      Returns:
      cbe::GroupManager
    • shareManager

      public ShareManager shareManager()
      Gets the share manager.
      Returns:
      cbe::ShareManager
    • publishManager

      public PublishManager 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

      public SubscribeManager subscribeManager()
      Gets the subscribe manager.
      Returns:
      cbe::SubscribeManager