github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/families/battleship/sawtooth_battleship/processor/handler.py (about)

     1  # Copyright 2016 Intel Corporation
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  # ------------------------------------------------------------------------------
    15  
    16  import logging
    17  
    18  from sawtooth_sdk.processor.handler import TransactionHandler
    19  from sawtooth_battleship.processor.battleship_transaction \
    20      import BattleshipTransaction
    21  
    22  LOGGER = logging.getLogger(__name__)
    23  
    24  
    25  class BattleshipTransactionHandler(TransactionHandler):
    26      def __init__(self, namespace_prefix):
    27          self._namespace_prefix = namespace_prefix
    28  
    29      @property
    30      def family_name(self):
    31          return 'battleship'
    32  
    33      @property
    34      def family_versions(self):
    35          return ['1.0']
    36  
    37      @property
    38      def namespaces(self):
    39          return [self._namespace_prefix]
    40  
    41      def apply(self, transaction, context):
    42  
    43          battleship_transaction = \
    44              BattleshipTransaction(self._namespace_prefix, transaction)
    45  
    46          battleship_transaction.apply(context)