Exemple #1
0
 def execute(self):
     status = 0
     # parse the command line
     try:
         status = self.__readCommandLine()
         if status != 0:
             exit(status)
     except Exception, e:
         util.printMessage(sys.stderr, "Error", repr(e))
         return 1
 def execute(self):
     status = 0
     # parse the command line
     try:
         status = self.__readCommandLine()
         if status != 0:
             util.printMessage(sys.stderr,"Canceled","Unable to process request -- exiting...")
             return status
     except Exception,e:
         util.printMessage(sys.stderr,"Error",repr(e))
         return 1
 def execute(self):
     status = 0
     # parse the command line
     try:
         status = self.__readCommandLine()
         if status != 0:
             util.printMessage(sys.stderr,"Canceled","Unable to process request -- exiting...")
             return status
     except Exception,e:
         util.printMessage(sys.stderr,"Error",repr(e))
         return 1
Exemple #4
0
    def execute(self):
        try:
            status = self.__readCommandLine()

            if CL.HELP_KEY in self.commands:
                self.__usage()
                return 1

            if 'afos_cmds' in self.commands:
                self.__afosCmds()
                return 1

            if 'awips_cmds' in self.commands:
                self.__awipsCmds()
                return 1

            if self.__isScriptRequest():
                self.__handleScriptRequest()
                return 0

            if self.__isTriggerScriptRequest():
                self.__handleWatchWarnRequest()
                return 0

            if self.__hasProduct():
                self.__readProduct()

            msg = self.__generateRequestMessage()

            msg = self.__submitRequestMessage(msg)

            if msg == None:
                return 0

            status = self.__processRequestResponse(msg)

        except Exception, e:
            util.printMessage(sys.stderr,
                              header='Error processing request',
                              body=str(e))
            return 1
Exemple #5
0
 def __handleWatchWarnRequest(self):
     cmd = self.commands.get('command')[0]
     args = self.commands.get(cmd)
     if cmd == 'trig_add':
         if (os.path.exists(args[0])):
             try:
                 self.__deleteWatchWarn()
                 self.__deleteSubscriptions()
             except Exception,e:
                     raise MSG.MessageError('unable to create message for textdb request',e)           
             try:    
                 for i in range(len(args)):    
                     f = open(args[i],'r')
                     for line in f:
                         # remove all white-spaces at beginning of the line.
                         line = line.lstrip()
                         if (line.find('#') == -1):                        
                             try:                  
                                 values = line.split(' ', 1)
                                 try:
                                     msg = MSG.Message(True)
                                     msg.initializeMessage(False)
                                     msg.addProperty(name='VIEW',value='warn',replace=False)    
                                     msg.addProperty(name='OP',value='PUT',replace=False)
                                     msg.addProperty(name='PRODID',value=values[0],replace=False)
                                     msg.addProperty(name='SCRIPT',value=values[1],replace=False)
                                 except Exception,e:
                                         raise MSG.MessageError('unable to create message for textdb request',e)
 
                                 if ((len(values[0]) >= 8) & (len(values[1].strip('\r\n')) > 0)):
                                     # print "Insert Subscription [" + values[0] + "] Status:" + str(sm.execute())
                                     cline = ['-o','add', '-t','ldad', '-r','ldad', '-p', values[0], '-f', values[1], '-c','%TRIGGER%']
                                     sm = SM.SubscriptionManager(name='textdb',args=cline)
                                     sm.execute()
                                     msg = self.__submitRequestMessage(msg.getXML())
                                     status = self.__processRequestResponse(msg)
                             except ValueError:
                                 util.printMessage(sys.stderr,
                                     header='Error processing line',
                                     body=line)            
Exemple #6
0
    def execute(self):
        try:
            status = self.__readCommandLine()
            
            if CL.HELP_KEY in self.commands:
                self.__usage()
                return 1
            
            if 'afos_cmds' in self.commands:
                self.__afosCmds()
                return 1
            
            if self.__isScriptRequest():
                self.__handleScriptRequest()
                return 0
            
            if self.__isTriggerScriptRequest():
                self.__handleWatchWarnRequest()
                return 0;
            
            if self.__hasProduct():
                self.__readProduct()

            msg = self.__generateRequestMessage()

            msg = self.__submitRequestMessage(msg)

            if msg == None:
                return 0

            status = self.__processRequestResponse(msg)
            
        except Exception,e:
            util.printMessage(sys.stderr,
                              header='Error processing request',
                              body=str(e))
            return 1
Exemple #7
0
 def __afosCmds(self):
     util.printMessage(sys.stderr, body=config.AFOS_CMDS)
Exemple #8
0
 def __usage(self):
     util.printMessage(sys.stderr, body=config.USAGE_MESSAGE)
Exemple #9
0
 def __afosCmds(self):
     util.printMessage(sys.stderr,body=config.AFOS_CMDS)
Exemple #10
0
 def __usage(self):
     util.printMessage(sys.stderr,body=config.USAGE_MESSAGE)
Exemple #11
0
 def __awipsCmds(self):
     util.printMessage(sys.stderr, body=config.AWIPS_CMDS)