commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue-reports grpc/GRServer.grpc src/server/GRSe...


From: Jan Ischebeck
Subject: gnue-reports grpc/GRServer.grpc src/server/GRSe...
Date: Tue, 28 Oct 2003 13:23:52 -0500

CVSROOT:        /cvsroot/gnue
Module name:    gnue-reports
Branch:         
Changes by:     Jan Ischebeck <address@hidden>  03/10/28 13:23:51

Modified files:
        grpc           : GRServer.grpc 
        src/server     : GRServer.py 
        src/client     : GRRun.py 
Added files:
        src/server     : GRRpcWrapper.py 
Removed files:
        src/server     : GRServices.py 

Log message:
        first usable gnue-reports-server. still lacking any kind of security 
and advanced configuration settings

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/grpc/GRServer.grpc.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/server/GRRpcWrapper.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/server/GRServer.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-reports/src/client/GRRun.py.diff?tr1=1.28&tr2=1.29&r1=text&r2=text

Patches:
Index: gnue-reports/grpc/GRServer.grpc
diff -c gnue-reports/grpc/GRServer.grpc:1.1 gnue-reports/grpc/GRServer.grpc:1.2
*** gnue-reports/grpc/GRServer.grpc:1.1 Tue Jun  4 17:30:36 2002
--- gnue-reports/grpc/GRServer.grpc     Tue Oct 28 13:23:48 2003
***************
*** 2,7 ****
--- 2,9 ----
  <gnurpc>
    <service name="GReportServer" binding="GReportServer">
  
+     <!-- what does the following methods mean ? -->
+ 
      <method name="getReportHeader" return="string" 
        helptext="Returns the report definition (in XML format)">
          <argument name="location" type="string"/>
***************
*** 12,18 ****
          <argument name="location" type="string"/>
        </method>
  
!     <method name="getAvailableFilters" return="string"
        helptext="List filters available on the server"/>
    </service>
  </gnurpc>
--- 14,55 ----
          <argument name="location" type="string"/>
        </method>
  
!     <!-- get Information about available options -->
! 
!     <method name="getAvailableFilters" return="array"
        helptext="List filters available on the server"/>
+ 
+     <method name="getAvailableDestinations" return="array"
+       helptext="List destinations available on the server"/>
+     
+     <!-- load new report -->
+ 
+     <method name="requestReportEngine" 
return="&lt;GReportServer.ReportEngine&gt;"
+       helptext="List destinations available on the server"/>
+ 
+       <object name="ReportEngine">
+ <!-- use attribute style access for destinations ?
+     <attribute name="destination" type="string" readonly=""/>
+ -->
+         <method name="setDestination" return="integer">
+             <argument name="destination" type="string"/>
+             <argument name="destinationType" type="string"/>
+             <argument name="destinationOptions" type="string"/>
+         </method>
+         <method name="setFilter" return="integer">
+             <argument name="filter" type="string"/>
+             <argument name="filterOptions" type="string"/>
+         </method>
+ 
+       <method name="processReport" return="string" helptext="start the report 
engine for report X">
+         <argument name="reportfile" type="string"/>
+         <argument name="userParameters" type="array"/>
+         <argument name="sortoption" type="string"/>
+         <argument name="includeStructuralComments" type="string"/>
+         <argument name="omitGNUeXML" type="string"/>
+       </method>
+        <method name="clear" return="integer">
+         </method>
+       </object>
    </service>
  </gnurpc>
Index: gnue-reports/src/client/GRRun.py
diff -c gnue-reports/src/client/GRRun.py:1.28 
gnue-reports/src/client/GRRun.py:1.29
*** gnue-reports/src/client/GRRun.py:1.28       Mon Jun 16 08:39:07 2003
--- gnue-reports/src/client/GRRun.py    Tue Oct 28 13:23:51 2003
***************
*** 31,36 ****
--- 31,37 ----
  from gnue.reports import VERSION
  from gnue.common.apps import GDebug
  from gnue.common.apps.GClientApp import GClientApp
+ from gnue.common.rpc import GComm
  from gnue.reports.base.GREngine import GREngine
  from gnue.reports.base import GRFilters, GRExceptions
  from GRRunUI import GRRunUI
***************
*** 107,113 ****
        [ 'standalone', 'S', 'standalone', 0, 0, None,
            'Create a standalone, single-use server instance.  Use this option 
in a '
            'non-client/server environment or in a debugging/development 
environment. '
!           'NOTE: Until the Reports Server is operational, this mode is 
implied'],
        [ 'exclude_xml', 'X', 'exclude-xml', 0, 0, None,
            'Do not output GNUe Report''s runtime XML markup information.  If 
specified, '
            'then the GRD''s layout section will be processed and output '
--- 108,114 ----
        [ 'standalone', 'S', 'standalone', 0, 0, None,
            'Create a standalone, single-use server instance.  Use this option 
in a '
            'non-client/server environment or in a debugging/development 
environment. '
!           'NOTE: Until the Reports Server is mature this flag has the 
opposite meaning'],
        [ 'exclude_xml', 'X', 'exclude-xml', 0, 0, None,
            'Do not output GNUe Report''s runtime XML markup information.  If 
specified, '
            'then the GRD''s layout section will be processed and output '
***************
*** 221,256 ****
        pass
  
  
- 
- 
      #
      # Now, run an engine instance
      #
-     # TODO: Once reports is server-ized, this call
-     # TODO: will happen only if --standalone is
-     # TODO: specified. Otherwise, a call to gnu-rpc
-     # TODO: will cause this equivalent code to be
-     # TODO: run on the server instance.
-     #
-     try:
-       GREngine(self.getConnectionManager()).processReport(reportfile,
-           destination = destination,
-           destinationType = destinationType,
-           destinationOptions = destinationOptions,
-           filter = filter,
-           batch = self.OPTIONS['batch'],
-           filterOptions = self.OPTIONS['filter_options'],
-           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)
-     except IOError, msg:
-       self.handleStartupError (msg)
  
      sys.exit()
  
    #
--- 222,287 ----
        pass
  
  
      #
      # Now, run an engine instance
      #
  
+     # HACK: for now standalone means server
+     if not self.OPTIONS["standalone"]:
+      try:
+        rep_engine = GREngine(self.getConnectionManager())
+        rep_engine.processReport(reportfile, 
+                                 destination = destination,
+                                 destinationType = destinationType,
+                                 destinationOptions = destinationOptions,
+                                 filter = filter,
+                                 batch = self.OPTIONS['batch'],
+                                 filterOptions = 
self.OPTIONS['filter_options'],
+                                 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)
+      except IOError, msg:
+        self.handleStartupError (msg)
+        
+     else:
+       try:
+         # TODO: load this paramter from somewhere
+         params = {'host': 'localhost',
+                   'port': 8766,
+                   'transport': 'http' }
+         interface = 'xmlrpc'
+         
+         gcomm      = GComm.attach(interface, params)
+         rep_server = gcomm.request("GReportServer")
+         rep_engine = rep_server.requestReportEngine()
+         rep_engine.setDestination(destination, destinationType, 
destinationOptions)
+         rep_engine.setFilter(filter, self.OPTIONS['filter_options'])
+ 
+         # HACK:
+         if sortoption==None:
+           sortoption=0
+         # HACKEND:
+         
+         rep_engine.processReport(reportfile,                                 
+                                  userParameters,
+                                  sortoption,
+                                  self.OPTIONS["comment"],
+                                  self.OPTIONS["exclude_xml"])
+         rep_engine.clear()
+         
+       except GRExceptions.ReportMarkupException, msg:
+         self.handleStartupError (msg)
+       except GRExceptions.ReportUnreadable, msg:
+         self.handleStartupError (msg)
+       except IOError, msg:
+         self.handleStartupError (msg)
+        
      sys.exit()
  
    #
Index: gnue-reports/src/server/GRServer.py
diff -c gnue-reports/src/server/GRServer.py:1.13 
gnue-reports/src/server/GRServer.py:1.14
*** gnue-reports/src/server/GRServer.py:1.13    Sun Oct  5 13:12:08 2003
--- gnue-reports/src/server/GRServer.py Tue Oct 28 13:23:50 2003
***************
*** 30,38 ****
  
  from gnue.common.apps import GDebug, GServerApp, GConfig
  from gnue.common.rpc import GComm
- from gnue.reports.base.GREngine import GREngine
  from gnue.reports.base.GRConfig import ConfigOptions
! from gnue.reports.base import GRExceptions
  import string, sys, time
  from gnue.reports import VERSION
  
--- 30,37 ----
  
  from gnue.common.apps import GDebug, GServerApp, GConfig
  from gnue.common.rpc import GComm
  from gnue.reports.base.GRConfig import ConfigOptions
! from gnue.reports.server.GRRpcWrapper import GRRpcHandler
  import string, sys, time
  from gnue.reports import VERSION
  
***************
*** 51,61 ****
        _('Set the GNURPC connection type. The currently supported values ')+
        _("for <type> are 'xmlrpc' and 'pw_xmlrpc'. For more information on ")+
        _('GNURPC connection types have a look at ')+
!       _('common/doc/RPC-abstraction. ')]]
! #    [ 'username',"u",'username',1,None, 'user',
! #      _('Set the username for the used database.')],
! #    [ 'password',"p",'password',1,None, 'password',
! #      _('Set the password for the used database.')]]
    SUMMARY = \
       "GNUe Reports is the primary reporting agent of the GNU Enterprise 
system."
  
--- 50,63 ----
        _('Set the GNURPC connection type. The currently supported values ')+
        _("for <type> are 'xmlrpc' and 'pw_xmlrpc'. For more information on ")+
        _('GNURPC connection types have a look at ')+
!       _('common/doc/RPC-abstraction. ')],
!     [ 'rpcport',None,'rpc-port',1,8766, 'port',
!       _('Set the GNURPC port. For more information on ')+
!       _('GNURPC have a look at common/doc/RPC-abstraction. ')],
!     [ 'username',"u",'username',1,None, 'user',
!       _('Set the username for the used database.')],
!     [ 'password',"p",'password',1,None, 'password',
!       _('Set the password for the used database.')]]
    SUMMARY = \
       "GNUe Reports is the primary reporting agent of the GNU Enterprise 
system."
  
***************
*** 64,71 ****
    # Initialize the class
    #
    def __init__(self):
!     GServerApp.GServerApp.__init__(self)
! 
  
    ## set a list of transports
    def setTransports(self,transports):
--- 66,74 ----
    # Initialize the class
    #
    def __init__(self):
!     GServerApp.GServerApp.__init__(self, 
application='reports',defaults=ConfigOptions)
!     
!     self.configurationManager.registerAlias('gConfigReports', 'reports')
  
    ## set a list of transports
    def setTransports(self,transports):
***************
*** 75,103 ****
  
    def phaseInit(self):
      
!     self._transports={}
!         
!     if self.OPTIONS["rpctype"]=="xmlrpc":
!       
!       print "Exporting our services via xmlrpc (port 8766) ..."
!       self.setTransports({'xmlrpc':{ 'port': 8766 }})
!       
!     elif self.OPTIONS["rpctype"]=="pw_xmlrpc":
!     
!       print "Exporting our services via pw_xmlrpc (port 8766) ..."
!       self.setTransports({'pw_xmlrpc':{ 'port': 8766 }})
  
!     elif self.OPTIONS["rpctype"]=="sockets":
  
        # Sockets not working yet
!       print "Exporting our services via sockets (port 8766) ..."
!       self.setTransports({'sockets':{ 'port': 8766 }})
  
      else:
! 
!       # not transport protocol set. exiting
        print "The protocol you've set is currently not supported."
!       sys.exit(-1)
  
    def run(self):
             
--- 78,107 ----
  
    def phaseInit(self):
      
!     rpctype = self.OPTIONS['rpctype']
! 
!     if rpctype in ('xmlrpc','xmlrpc.pw_xmlrpc','xmlrpc.py_xmlrpc'):
!       port = self.OPTIONS["rpcport"]
!       print "Exporting our services via %s (port %s) ..." % (rpctype,port)
!       params = {'port': int (port)} #,
! #                'allowed_hosts': gConfig ('allowed_hosts')}
! 
  
!       self.setTransports({rpctype: params})
  
+     elif rpctype == "pyro":
+       print "Exporting our services via Pyro (EXPERIMENTAL!) ..."
+       self.setTransports ({'pyro':{}})
+ 
+     elif rpctype == "sockets":
        # Sockets not working yet
!       print "Exporting our services via sockets (EXPERIMENTAL!) ..."
!       self.setTransports ({'sockets':{}})
  
      else:
!       # wrong transport protocol set. exiting
        print "The protocol you've set is currently not supported."
!       sys.exit (-1)
  
    def run(self):
             
***************
*** 120,186 ****
  
  
    def requestServer(self):
!     return self
! 
!   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.'), )
  
-   #
-   #  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
- 
- 
- 
-   
  
  if __name__ == '__main__':
    grserv=GRServer()
--- 124,131 ----
  
  
    def requestServer(self):
!     return GRRpcHandler(self.connections)
  
  
  if __name__ == '__main__':
    grserv=GRServer()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]