Exemplo n.º 1
0
 def store(self):
     try:
         if self._store is None:
             self.store = LiteAxolotlStore(
                 StorageTools.constructPath(
                     self.getProp(
                         YowAuthenticationProtocolLayer.PROP_CREDENTIALS)
                     [0], self.__class__._DB))
         return self._store
     except AttributeError:
         return None
Exemplo n.º 2
0
    def store(self):
        if self._store is None:
            self.store = LiteAxolotlStore(
                StorageTools.constructPath(
                    self.getProp(
                        YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0],
                    self.__class__._DB
                )
            )
            self.state = self.__class__._STATE_HASKEYS if  self.store.getLocalRegistrationId() is not None \
                else self.__class__._STATE_INIT

        return self._store
Exemplo n.º 3
0
    def store(self):
        if self._store is None:
            conn_str = self.getProp(self.__class__.PROP_CONNECTION_STRING)
            conn_type = self.getProp(self.__class__.PROP_STORE_TYPE)
            phone_number = self.getProp(
                YowAuthenticationProtocolLayer.PROP_CREDENTIALS)[0]
            if (conn_type == 'mysql' and conn_str):
                # try:
                self.store = MyAxolotlStore(conn_str, phone_number)
            # except:
            #    logger.error("ERROR:: {} ".format(sys.exc_info()[1]))
            else:
                self.store = LiteAxolotlStore(
                    StorageTools.constructPath(phone_number,
                                               self.__class__._DB))
            self.state = self.__class__._STATE_HASKEYS if  self.store.getLocalRegistrationId() is not None \
                else self.__class__._STATE_INIT

        return self._store