def start_check( self, rule, frequency ): """start checking of a rule""" id = uuid.uuid() self.lock.acquire() self.events[id] = self.sched.enter( 0, 1, self.control, ( id, rule, frequency ) ) self.lock.release() print "..... start check for rule ", id return id
def create_rule(self, cond, act, frequency): """create a Rule""" obj = self.boa.create(uuid.uuid(), Rule._FNORB_ID) impl = Rule(self.boa, cond, act, frequency, self.scheduler) self.boa.obj_is_ready(obj, impl) print "..... new rule created" return obj
def create_rule( self, cond, act, frequency ): """create a Rule""" obj = self.boa.create( uuid.uuid(), Rule._FNORB_ID ) impl = Rule( self.boa, cond, act, frequency, self.scheduler ) self.boa.obj_is_ready( obj, impl ) print "..... new rule created" return obj
def start_check(self, rule, frequency): """start checking of a rule""" id = uuid.uuid() self.lock.acquire() self.events[id] = self.sched.enter(0, 1, self.control, (id, rule, frequency)) self.lock.release() print "..... start check for rule ", id return id
def main ( argv ): # init ORB and BOA try: argv.append( "--ORBthreading-model=Threaded" ) orb = CORBA.ORB_init( argv, CORBA.ORB_ID ) boa = BOA.BOA_init( sys.argv, BOA.BOA_ID ) except: print "..... can`t initialize ORB" sys.exit( 1 ) # resolve NameService try : nsior = open( "ns.ior", "r" ).read() except : print "..... ns.ior file for NameService missing" sys.exit( 1 ) try : ns = orb.string_to_object( nsior )._narrow( CosNaming.NamingContext ) except : print "..... no NameService IOR in ns.ior file or service not running" sys.exit( 1 ) # create naming contexts nspath = [CosNaming.NameComponent( 'DCI', '' )] try: for component in nspath : ns.bind_new_context( [component] ) except CosNaming.NamingContext.AlreadyBound: pass # create ScriptProcessorRegistry object root = Tkinter.Tk() obj = boa.create( 'ScriptProcessorRegistry', ScriptProcessorRegistry._FNORB_ID ) impl = ScriptProcessorRegistry( root, orb, boa ) boa.obj_is_ready( obj, impl ) open( "script.ref", "w" ).write( orb.object_to_string( obj ) ) # bind name in name service name = nspath + [CosNaming.NameComponent( 'ScriptProcessorRegistry', '' )] ns.rebind( name, obj ) # register ScriptProcessor for Python obj2 = boa.create( uuid.uuid(), ScriptProcessor._FNORB_ID ) impl2 = ScriptProcessor( orb, boa ) boa.obj_is_ready( obj2, impl2 ) impl.register_processor( "Python", obj2 ) # mainloop print "..... ScriptProcessorRegistry running with ior:\n" print orb.object_to_string( obj ) #boa._fnorb_mainloop() thread.start_new_thread(boa._fnorb_mainloop,()) root.mainloop()
def create_script( self, code, ctx ): """create a Script""" try: obj = self.boa.create( uuid.uuid(), Script._FNORB_ID ) impl = Script( self.boa, code, ctx, self ) self.boa.obj_is_ready( obj, impl ) except: util.debug() print "..... error while creating script" else: print "..... new script created" return obj
def __init__ ( self, orb, boa ): self.orb = orb self.boa = boa self.registry = {} # register ScriptProcessor for Python try : obj = self.boa.create( uuid.uuid(), ScriptProcessor._FNORB_ID ) impl = ScriptProcessor( self.orb, self.boa ) self.boa.obj_is_ready( obj, impl ) self.registry["Python"] = obj except : util.debug( "register ScriptProcessor for Python" ) print "..... error with Python script processor"
def __init__(self, orb, boa): self.orb = orb self.boa = boa self.registry = {} # register ScriptProcessor for Python try: obj = self.boa.create(uuid.uuid(), ScriptProcessor._FNORB_ID) impl = ScriptProcessor(self.orb, self.boa) self.boa.obj_is_ready(obj, impl) self.registry["Python"] = obj except: util.debug("register ScriptProcessor for Python") print "..... error with Python script processor"