Esempio n. 1
0
 def instanciate(cls, app):
     """
     Instanciate a blockchain processor
     :param sakia.app.Application app: the app
     """
     return cls(BmaConnector(NodesProcessor(app.db.nodes_repo), app.parameters),
                BlockchainProcessor.instanciate(app),
                IdentitiesProcessor.instanciate(app),
                CertificationsProcessor.instanciate(app),
                TransactionsProcessor.instanciate(app),
                SourcesProcessor.instanciate(app))
Esempio n. 2
0
 def create(cls, parent, app):
     """
     Instanciate a AccountConfigController component
     :param sakia.gui.component.controller.ComponentController parent:
     :param sakia.app.Application app:
     :return: a new AccountConfigController controller
     :rtype: AccountConfigController
     """
     view = ConnectionConfigView(parent.view if parent else None)
     model = ConnectionConfigModel(
         None, app, None,
         IdentitiesProcessor(
             app.db.identities_repo, app.db.blockchains_repo,
             BmaConnector(NodesProcessor(app.db.nodes_repo),
                          app.parameters)))
     account_cfg = cls(parent, view, model)
     model.setParent(account_cfg)
     return account_cfg
Esempio n. 3
0
    def instanciate_services(self):
        nodes_processor = NodesProcessor(self.db.nodes_repo)
        bma_connector = BmaConnector(nodes_processor, self.parameters)
        connections_processor = ConnectionsProcessor(self.db.connections_repo)
        identities_processor = IdentitiesProcessor(self.db.identities_repo,
                                                   self.db.certifications_repo,
                                                   self.db.blockchains_repo,
                                                   bma_connector)
        certs_processor = CertificationsProcessor(self.db.certifications_repo,
                                                  self.db.identities_repo,
                                                  bma_connector)
        blockchain_processor = BlockchainProcessor.instanciate(self)
        sources_processor = SourcesProcessor.instanciate(self)
        transactions_processor = TransactionsProcessor.instanciate(self)
        dividends_processor = DividendsProcessor.instanciate(self)
        nodes_processor.initialize_root_nodes(self.currency)
        self.db.commit()

        self.documents_service = DocumentsService.instanciate(self)
        self.identities_service = IdentitiesService(
            self.currency, connections_processor, identities_processor,
            certs_processor, blockchain_processor, bma_connector)

        self.transactions_service = TransactionsService(
            self.currency, transactions_processor, dividends_processor,
            identities_processor, connections_processor, bma_connector)

        self.sources_service = SourcesServices(
            self.currency, sources_processor, connections_processor,
            transactions_processor, blockchain_processor, bma_connector)

        self.blockchain_service = BlockchainService(self, self.currency,
                                                    blockchain_processor,
                                                    bma_connector,
                                                    self.identities_service,
                                                    self.transactions_service,
                                                    self.sources_service)

        self.network_service = NetworkService.load(self, self.currency,
                                                   nodes_processor,
                                                   self.blockchain_service,
                                                   self.identities_service)