import sys import os if sys.platform=="darwin": import pyGlobus.ioc from AccessGrid.ServiceCapability import ServiceCapability from AccessGrid.AGNetworkService import AGNetworkService from AccessGrid.Platform.ProcessManager import ProcessManager from AccessGrid.Descriptions import StreamDescription from AccessGrid.NetworkLocation import MulticastNetworkLocation class DebugNetworkService(AGNetworkService): def __init__(self, name): AGNetworkService.__init__(self, name, 'Debug', '1.0') # Create capabilities inCap = "Add your in capabilities here" outCap = "Add your out capabilities here" self.inCapabilities = [inCap.ToXML()] self.outCapabilities = [outCap.ToXML()] print '\nnetwork service soap interface started' # Start the soap interface self.Start(self) def StopTransform(self, streamList): # Stop debug service print 'transform stopped' def Transform(self, streamList): # Start debug service newStreams = [] print 'transform started' for s in streamList: # Create new stream description # Capability of new stream will be the # same as the out capabilities of the network # service cap = s.capability cap.xml = self.outCapabilities[0] # Create new stream description location = MulticastNetworkLocation("224.2.2.2", 8000) ns = StreamDescription("Debug Stream", location, cap) newStreams.append(ns) return newStreams if __name__ == "__main__": import sys debug = DebugNetworkService("Debug Service") # The service will automatically register with the venue # given on the command line url = debug.app.GetOption('venueUrl') if not url: print "Please enter venue url on the command line; --venueUrl " sys.exit() debug.StartSignalLoop()