예제 #1
0
    def __init__(self, dcfilename=default_dcfilename):
        Connection.__init__(self)
        self.mod = module.Module()
        # Add Astron-specific keywords
        for word in astron_keywords:
            self.mod.add_keyword(word)
        dcfile.parse_dcfile(self.mod, dcfilename)
        # Create class definition dicts
        self.create_dclass_dicts()
        self.distributed_objects = {}
        self.owner_views = {}

        self.handlers = {}
        
        # FIXME: Maybe move this into ClientRepository, if Internals won't get Interests in the future.
        # FIXME: Actually, fold this into the general callback mechanism.
        self.interest_counters = {}
        self.interest_callback_map = {}

        # The callback system for handling *_RESP messages
        self.msg_to_msgresp_map = {
            servermsg.STATESERVER_OBJECT_GET_FIELD        : servermsg.STATESERVER_OBJECT_GET_FIELD_RESP,
            servermsg.STATESERVER_OBJECT_GET_FIELDS       : servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP,
            servermsg.STATESERVER_OBJECT_GET_ALL          : servermsg.STATESERVER_OBJECT_GET_ALL_RESP,
            servermsg.STATESERVER_OBJECT_GET_LOCATION     : servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP,
            servermsg.STATESERVER_OBJECT_GET_AI           : servermsg.STATESERVER_OBJECT_GET_AI_RESP,
            servermsg.STATESERVER_OBJECT_GET_OWNER        : servermsg.STATESERVER_OBJECT_GET_OWNER_RESP,
            servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT   : servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP,
            servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT  : servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP,
            servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT  : servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP,
            servermsg.DBSS_OBJECT_GET_ACTIVATED           : servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP,
            servermsg.DBSERVER_CREATE_OBJECT              : servermsg.DBSERVER_CREATE_OBJECT_RESP,
            servermsg.DBSERVER_OBJECT_GET_FIELD           : servermsg.DBSERVER_OBJECT_GET_FIELD_RESP,
            servermsg.DBSERVER_OBJECT_GET_FIELDS          : servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP,
            servermsg.DBSERVER_OBJECT_GET_ALL             : servermsg.DBSERVER_OBJECT_GET_ALL_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS : servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS: servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY  : servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP,
            }
        self.context_counters = {
            servermsg.STATESERVER_OBJECT_GET_FIELD_RESP        : 0,
            servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP       : 0,
            servermsg.STATESERVER_OBJECT_GET_ALL_RESP          : 0,
            servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP     : 0,
            servermsg.STATESERVER_OBJECT_GET_AI_RESP           : 0,
            servermsg.STATESERVER_OBJECT_GET_OWNER_RESP        : 0,
            servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP   : 0,
            servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP  : 0,
            servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP  : 0,
            servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP           : 0,
            servermsg.DBSERVER_CREATE_OBJECT_RESP              : 0,
            servermsg.DBSERVER_OBJECT_GET_FIELD_RESP           : 0,
            servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP          : 0,
            servermsg.DBSERVER_OBJECT_GET_ALL_RESP             : 0,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP : 0,
            servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP: 0,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP  : 0,
            }
        self.callbacks = {}
    def __init__(self, dcfilename=default_dcfilename):
        self.mod = module.Module()
        # Add Astron-specific keywords
        for word in astron_keywords:
            self.mod.add_keyword(word)
        dcfile.parse_dcfile(self.mod, dcfilename)

        self.handlers = {}
예제 #3
0
    def __init__(self, dcfilename=default_dcfilename):
        Connection.__init__(self)
        self.mod = module.Module()
        # Add Astron-specific keywords
        for word in astron_keywords:
            self.mod.add_keyword(word)
        dcfile.parse_dcfile(self.mod, dcfilename)
        # Create class definition dicts
        self.create_dclass_dicts()
        self.distributed_objects = {}
        self.owner_views = {}

        self.handlers = {}

        # FIXME: Maybe move this into ClientRepository, if Internals won't get Interests in the future.
        # FIXME: Actually, fold this into the general callback mechanism.
        self.interest_counters = {}
        self.interest_callback_map = {}

        # The callback system for handling *_RESP messages
        self.msg_to_msgresp_map = {
            servermsg.STATESERVER_OBJECT_GET_FIELD:
            servermsg.STATESERVER_OBJECT_GET_FIELD_RESP,
            servermsg.STATESERVER_OBJECT_GET_FIELDS:
            servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP,
            servermsg.STATESERVER_OBJECT_GET_ALL:
            servermsg.STATESERVER_OBJECT_GET_ALL_RESP,
            servermsg.STATESERVER_OBJECT_GET_LOCATION:
            servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP,
            servermsg.STATESERVER_OBJECT_GET_AI:
            servermsg.STATESERVER_OBJECT_GET_AI_RESP,
            servermsg.STATESERVER_OBJECT_GET_OWNER:
            servermsg.STATESERVER_OBJECT_GET_OWNER_RESP,
            servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT:
            servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP,
            servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT:
            servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP,
            servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT:
            servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP,
            servermsg.DBSS_OBJECT_GET_ACTIVATED:
            servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP,
            servermsg.DBSERVER_CREATE_OBJECT:
            servermsg.DBSERVER_CREATE_OBJECT_RESP,
            servermsg.DBSERVER_OBJECT_GET_FIELD:
            servermsg.DBSERVER_OBJECT_GET_FIELD_RESP,
            servermsg.DBSERVER_OBJECT_GET_FIELDS:
            servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP,
            servermsg.DBSERVER_OBJECT_GET_ALL:
            servermsg.DBSERVER_OBJECT_GET_ALL_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS:
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS:
            servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY:
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP,
        }
        self.context_counters = {
            servermsg.STATESERVER_OBJECT_GET_FIELD_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_FIELDS_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_ALL_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_LOCATION_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_AI_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_OWNER_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_ZONE_COUNT_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_ZONES_COUNT_RESP: 0,
            servermsg.STATESERVER_OBJECT_GET_CHILD_COUNT_RESP: 0,
            servermsg.DBSS_OBJECT_GET_ACTIVATED_RESP: 0,
            servermsg.DBSERVER_CREATE_OBJECT_RESP: 0,
            servermsg.DBSERVER_OBJECT_GET_FIELD_RESP: 0,
            servermsg.DBSERVER_OBJECT_GET_FIELDS_RESP: 0,
            servermsg.DBSERVER_OBJECT_GET_ALL_RESP: 0,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EQUALS_RESP: 0,
            servermsg.DBSERVER_OBJECT_SET_FIELDS_IF_EQUALS_RESP: 0,
            servermsg.DBSERVER_OBJECT_SET_FIELD_IF_EMPTY_RESP: 0,
        }
        self.callbacks = {}
예제 #4
0
#!/usr/bin/env python3

from bamboo import dcfile, module

astron_keywords = ['clsend', 'ownsend', 'clrecv', 'ownrecv',
                   'airecv', 'broadcast', 'ram', 'required', 'db']

mod = module.Module()
for word in astron_keywords:
    mod.add_keyword(word)
dcfile.parse_dcfile(mod, 'sample.dc')

print() # Newline after prompt

# Inspect python imports
print('Imports')
for import_num in range(0, mod.num_imports()):
    # python module path
    pyimport = mod.get_import(import_num)
    #print('  ' + pyimport.module)
    #for symbol in pyimport.symbols:
    #    # Figure out the names of used classes
    #    fragments = str(symbol).split('/')
    #    base_class = fragments[0]
    #    suffixes = fragments[1:] + ['']
    #    for suffix in suffixes:
    #        print('    ' + base_class + suffix)

print() # Newline after imports

# Inspect module keywords
예제 #5
0
#!/usr/bin/env python3

from bamboo import dcfile, module

astron_keywords = [
    'clsend', 'ownsend', 'clrecv', 'ownrecv', 'airecv', 'broadcast', 'ram',
    'required', 'db'
]

mod = module.Module()
for word in astron_keywords:
    mod.add_keyword(word)
dcfile.parse_dcfile(mod, 'simple_example.dc')

print()  # Newline after prompt

# Inspect python imports
print('Imports')
for import_num in range(0, mod.num_imports()):
    # python module path
    pyimport = mod.get_import(import_num)
    print('  ' + pyimport.module)
    for symbol in pyimport.symbols:
        # Figure out the names of used classes
        fragments = str(symbol).split('/')
        base_class = fragments[0]
        suffixes = fragments[1:] + ['']
        for suffix in suffixes:
            print('    ' + base_class + suffix)

print()  # Newline after imports
예제 #6
0
#!/usr/bin/env python3

from bamboo import dcfile, module

astron_keywords = ['clsend', 'ownsend', 'clrecv', 'ownrecv',
                   'airecv', 'broadcast', 'ram', 'required', 'db']

mod = module.Module()
for word in astron_keywords:
    mod.add_keyword(word)
dcfile.parse_dcfile(mod, 'simple_example.dc')

print() # Newline after prompt

# Inspect python imports
print('Imports')
for import_num in range(0, mod.num_imports()):
    # python module path
    pyimport = mod.get_import(import_num)
    print('  ' + pyimport.module)
    for symbol in pyimport.symbols:
        # Figure out the names of used classes
        fragments = str(symbol).split('/')
        base_class = fragments[0]
        suffixes = fragments[1:] + ['']
        for suffix in suffixes:
            print('    ' + base_class + suffix)

print() # Newline after imports

# Inspect module keywords