/[gnue]/gnue-reports/src/server/GRServer.py
ViewVC logotype

Diff of /gnue-reports/src/server/GRServer.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by reinhard, Sun Oct 5 17:12:08 2003 UTC revision 1.14 by siesel, Tue Oct 28 18:23:50 2003 UTC
# Line 30  Line 30 
30    
31  from gnue.common.apps import GDebug, GServerApp, GConfig  from gnue.common.apps import GDebug, GServerApp, GConfig
32  from gnue.common.rpc import GComm  from gnue.common.rpc import GComm
 from gnue.reports.base.GREngine import GREngine  
33  from gnue.reports.base.GRConfig import ConfigOptions  from gnue.reports.base.GRConfig import ConfigOptions
34  from gnue.reports.base import GRExceptions  from gnue.reports.server.GRRpcWrapper import GRRpcHandler
35  import string, sys, time  import string, sys, time
36  from gnue.reports import VERSION  from gnue.reports import VERSION
37    
# Line 51  class GRServer (GServerApp.GServerApp): Line 50  class GRServer (GServerApp.GServerApp):
50        _('Set the GNURPC connection type. The currently supported values ')+        _('Set the GNURPC connection type. The currently supported values ')+
51        _("for <type> are 'xmlrpc' and 'pw_xmlrpc'. For more information on ")+        _("for <type> are 'xmlrpc' and 'pw_xmlrpc'. For more information on ")+
52        _('GNURPC connection types have a look at ')+        _('GNURPC connection types have a look at ')+
53        _('common/doc/RPC-abstraction. ')]]        _('common/doc/RPC-abstraction. ')],
54  #    [ 'username',"u",'username',1,None, 'user',      [ 'rpcport',None,'rpc-port',1,8766, 'port',
55  #      _('Set the username for the used database.')],        _('Set the GNURPC port. For more information on ')+
56  #    [ 'password',"p",'password',1,None, 'password',        _('GNURPC have a look at common/doc/RPC-abstraction. ')],
57  #      _('Set the password for the used database.')]]      [ 'username',"u",'username',1,None, 'user',
58          _('Set the username for the used database.')],
59        [ 'password',"p",'password',1,None, 'password',
60          _('Set the password for the used database.')]]
61    SUMMARY = \    SUMMARY = \
62       "GNUe Reports is the primary reporting agent of the GNU Enterprise system."       "GNUe Reports is the primary reporting agent of the GNU Enterprise system."
63    
# Line 64  class GRServer (GServerApp.GServerApp): Line 66  class GRServer (GServerApp.GServerApp):
66    # Initialize the class    # Initialize the class
67    #    #
68    def __init__(self):    def __init__(self):
69      GServerApp.GServerApp.__init__(self)      GServerApp.GServerApp.__init__(self, application='reports',defaults=ConfigOptions)
70        
71        self.configurationManager.registerAlias('gConfigReports', 'reports')
72    
73    ## set a list of transports    ## set a list of transports
74    def setTransports(self,transports):    def setTransports(self,transports):
# Line 75  class GRServer (GServerApp.GServerApp): Line 78  class GRServer (GServerApp.GServerApp):
78    
79    def phaseInit(self):    def phaseInit(self):
80            
81      self._transports={}      rpctype = self.OPTIONS['rpctype']
82            
83      if self.OPTIONS["rpctype"]=="xmlrpc":      if rpctype in ('xmlrpc','xmlrpc.pw_xmlrpc','xmlrpc.py_xmlrpc'):
84                port = self.OPTIONS["rpcport"]
85        print "Exporting our services via xmlrpc (port 8766) ..."        print "Exporting our services via %s (port %s) ..." % (rpctype,port)
86        self.setTransports({'xmlrpc':{ 'port': 8766 }})        params = {'port': int (port)} #,
87          #                'allowed_hosts': gConfig ('allowed_hosts')}
88      elif self.OPTIONS["rpctype"]=="pw_xmlrpc":  
       
       print "Exporting our services via pw_xmlrpc (port 8766) ..."  
       self.setTransports({'pw_xmlrpc':{ 'port': 8766 }})  
89    
90      elif self.OPTIONS["rpctype"]=="sockets":        self.setTransports({rpctype: params})
91    
92        elif rpctype == "pyro":
93          print "Exporting our services via Pyro (EXPERIMENTAL!) ..."
94          self.setTransports ({'pyro':{}})
95    
96        elif rpctype == "sockets":
97        # Sockets not working yet        # Sockets not working yet
98        print "Exporting our services via sockets (port 8766) ..."        print "Exporting our services via sockets (EXPERIMENTAL!) ..."
99        self.setTransports({'sockets':{ 'port': 8766 }})        self.setTransports ({'sockets':{}})
100    
101      else:      else:
102          # wrong transport protocol set. exiting
       # not transport protocol set. exiting  
103        print "The protocol you've set is currently not supported."        print "The protocol you've set is currently not supported."
104        sys.exit(-1)        sys.exit (-1)
105    
106    def run(self):    def run(self):
107                        
# Line 120  class GRServer (GServerApp.GServerApp): Line 124  class GRServer (GServerApp.GServerApp):
124    
125    
126    def requestServer(self):    def requestServer(self):
127      return self      return GRRpcHandler(self.connections)
   
   def runInstance(self):  
     try:  
       GREngine(self.getConnectionManager()).processReport(reportfile, \  
           parameters=userParameters, sortoption=sortoption, \  
           includeStructuralComments=self.OPTIONS["comment"],  
           omitGNUeXML=self.OPTIONS["exclude_xml"])  
     except GRExceptions.ReportMarkupException, msg:  
       self.handleStartupError (msg)  
     except GRExceptions.ReportUnreadable, msg:  
       self.handleStartupError (msg)  
   
   
   ########  
   #  
   # Exported services...  
   #  
   ########  
   
   
   #  
   # List filters available on the server  
   #  
   def getAvailableFilters(self):  
   
     # TODO: um, implement??  
   
     return ( ('raw','Do not process the XML with a filter. Emit raw XML.'), )  
128    
   #  
   #  Returns the report definition (in XML format)  
   #  
   
   def getReportDefinition(self,location):  
     # Parameters: * location <string>   The location of the report  
 #  def getReportDefinition(self,reportName):  
     # Parameters: * location <string>   The location of the report  
   
     pass  
   
   #  
   #  Returns the report definition (in XML format)  
   #  
   
   def getReportHeader(self,location):  
     # Parameters: * location <string>   The location of the report  
   
     pass  
   
   
   def runReport(reportName, sortOption=None, parameters={}):  
     pass  
   
   
   def runReportFromDefinition(reportDefinition, sortOption, parameters):  
     pass  
   
   
   
     
129    
130  if __name__ == '__main__':  if __name__ == '__main__':
131    grserv=GRServer()    grserv=GRServer()

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26