Ejemplo n.º 1
0
def main():
    app = CmdlineApplication()

    portOption = Option("-p",
                        "--port",
                        type="int",
                        dest="port",
                        default=defaultPort,
                        metavar="PORT",
                        help="Set the port the RegistryPeer will use")
    app.AddCmdLineOption(portOption)

    urlOption = Option(
        "-u",
        "--peerListUrl",
        type="string",
        dest="peerListUrl",
        default=defaultPeerListUrl,
        metavar="URL",
        help=
        "The url to bootstrap the system. For the current design, this is a complete list of peers."
    )
    app.AddCmdLineOption(urlOption)

    try:
        args = app.Initialize("RegistryPeer")
    except Exception, e:
        print "Toolkit Initialization failed, exiting."
        print " Initialization Error: ", e
        sys.exit(-1)
    def __init__(self, name, description, version, mimeType, extension):
        '''
        Initiate the class.

        ** Arguments **

        * name * name of the service.
        * description * description of the service.
        * version * service version.
        '''
        self.name = name
        self.description = description
        self.version = version
        self.mimeType = mimeType
        self.extension = extension
        self.visible = 1
        self.id = GUID()
                
        # Defined in Start.
        self.venueProxies = {}
        self.url = None 
        self.log = None 
        self.app = None

        # Standard AG initialization for console apps.
        self.app = CmdlineApplication.instance()
        self.app.AddCmdLineOption(Option("-v", "--venueUrl",
                                         dest="venueUrl",
                                         help="Register with venue located at this url."))
        
        self.app.AddCmdLineOption(Option("-s", "--venueServerUrl",
                                         dest="venueServerUrl",
                                         help="Register with all venues at server located at this url."))
                                         
        self.capabilities = []
Ejemplo n.º 3
0
def main():
    """
    The main routine.
    """
    # Instantiate the app
    app = CmdlineApplication()

    # Handle command-line arguments
    urlOption = Option("-u",
                       "--url",
                       dest="url",
                       default=0,
                       help="URL for the venue server to manage.")
    app.AddCmdLineOption(urlOption)

    # Initialize the application
    try:
        app.Initialize("VenueMgmt")
    except Exception, e:
        print "Exception: ", e
        sys.exit(0)
Ejemplo n.º 4
0
    def __init__(self, certMgr, log):
        """
        The constructor for the cert mgr command processor.
        """
        cmd.Cmd.__init__(self)

        self.log = log
        self.certMgr = certMgr
        try:
            self.certMgrUI = CmdlineApplication.instance().GetCertificateManagerUI()
        except CertificateManager.NoCertificates:
            pass
        self.certRepo = certMgr.GetCertificateRepository()
        self.interactive = 1
        self.forceOverwrite = 0

        self.setIdentityMode()
        
        self.certs = []
Ejemplo n.º 5
0
    def __init__(self, certMgr, log):
        """
        The constructor for the cert mgr command processor.
        """
        cmd.Cmd.__init__(self)

        self.log = log
        self.certMgr = certMgr
        try:
            self.certMgrUI = CmdlineApplication.instance(
            ).GetCertificateManagerUI()
        except CertificateManager.NoCertificates:
            pass
        self.certRepo = certMgr.GetCertificateRepository()
        self.interactive = 1
        self.forceOverwrite = 0

        self.setIdentityMode()

        self.certs = []
Ejemplo n.º 6
0
#!/usr/bin/python

import os
import sys

from AccessGrid.VenueClient import GetVenueClientUrls
from AccessGrid.VenueClient import VenueClientIW
from AccessGrid.Platform import isWindows
from AccessGrid.Platform.Config import UserConfig
from AccessGrid.Toolkit import CmdlineApplication



# Initialize
app = CmdlineApplication()
app.Initialize()


if len(sys.argv) > 1:
    # Use the provided venue client url
    venueClientUrlList = [ sys.argv[1] ]
else:
    # Search for a venue client url
    venueClientUrlList = GetVenueClientUrls()

foundClient = 0
for venueClientUrl in venueClientUrlList:
    try:
        venueClient = VenueClientIW(venueClientUrl)
        venueClient._IsValid()
   def GetWidth(self):
      return self.proxy.GetWidth()

   def GetHeight(self):
      return self.proxy.GetHeight()

   def GetDepth(self):
      return self.proxy.GetDepth()
   
if __name__ == '__main__':
   from AccessGrid.Toolkit import CmdlineApplication
   import pprint
   
   # Do env init
   app = CmdlineApplication()
   app.Initialize("DisplayServiceTest")
   
   # Create a local hosting environment
   hn = SystemConfig.instance().GetHostname()
   hn = 'localhost'
   server = Server((hn, int(sys.argv[1])))

   # Create the display service
   dispService = DisplayService()

   # Then it's interface
   dispServiceI = DisplayServiceI(dispService)

   # Then register the display service with the hosting environment
   service = server.RegisterObject(dispServiceI, path = "/DisplayService")
Ejemplo n.º 8
0
            if os.path.exists("/usr/local/bin/vncviewer") or os.path.exists("/usr/X11R6/bin/vncviewer"):
		execString='vncviewer -shared -passwd %s %s'%(self.passwdFilename,self.vncContact)
            else:
		execString='chmod +x ./vncviewer; ./vncviewer -shared -passwd %s %s'%(self.passwdFilename,self.vncContact)
        elif IsOSX():
            vncviewer='/Applications/Chicken\ of\ the\ VNC.app/Contents/MacOS/Chicken\ of\ the\ VNC'
            execString='%s --PasswordFile %s %s' % (vncviewer,self.passwdFilename,self.vncContact)
        else:
            raise Exception("Unsupported platform")
        print "About the execute: %s"%(execString)
        log.info("Starting vnc client: %s", execString)
        os.system(execString);
        os.unlink(self.passwdFilename);

if __name__ == "__main__":
    app = CmdlineApplication.instance()
    app.Initialize("VenueVNCClient")

    log = app.GetLog()

    if len(sys.argv) < 2:
        print "Usage: %s <appObjectUrl>" % sys.argv[0]
        sys.exit(1)

    appUrl = sys.argv[1]

    clientProfileFile = os.path.join(UserConfig.instance().GetConfigDir(),
                                     "profile")
    clientProfile = ClientProfile(clientProfileFile)
    sb = vncSharedAppClient( appUrl, clientProfile )
def main():
    """
    This is the function that does all the real work.
    """
    app = CmdlineApplication.instance()
    app.Initialize("CreateVenues")

    venueServerUri = "https://localhost:8000/VenueServer"

    if len(sys.argv) > 2:
        venueServerUri = sys.argv[2]

    configFile = sys.argv[1]

    venueServer = VenueServerIW(venueServerUri, tracefile=sys.stdout)
    #venueServer.SetEncryptAllMedia(0)

    config = ConfigParser.ConfigParser()
    config.read(configFile)
    venues = {}

    # Start up the logging
    log = Log.GetLogger("CreateVenues")
    hdlr = Log.StreamHandler()
    hdlr.setLevel(Log.INFO)
    Log.HandleLoggers(hdlr, Log.GetDefaultLoggers())

    # We do this in two iterations because we need valid URLs for connections
    for sec in config.sections():
        # Build Venue Descriptions
        vdesc = VenueDescription3(config.get(sec, 'name'),
                                  config.get(sec, 'description'))
        vdesc.streams = []

        # Static Video
        if config.has_option(sec, 'video'):
            (host, port) = string.split(config.get(sec, 'video'), ':')
            vcap = Capability3(Capability.PRODUCER, Capability.VIDEO)
            vsd = StreamDescription3(
                vdesc.name,
                MulticastNetworkLocation(host.strip(), int(port), 127), vcap,
                0, None, 1)
            vdesc.streams.append(vsd)

        # Static Audio
        if config.has_option(sec, 'audio'):
            (host, port) = string.split(config.get(sec, 'audio'), ':')
            acap = Capability3(Capability3.PRODUCER, Capability3.AUDIO)
            asd = StreamDescription3(
                vdesc.name,
                MulticastNetworkLocation(host.strip(), int(port), 127), acap,
                0, None, 1)
            vdesc.streams.append(asd)

        # Make the venue, then store the resulting URL
        print "VD #%s : %s" % (sec, vdesc.name)
        vdesc.uri = venueServer.AddVenue(vdesc)
        config.set(sec, 'uri', vdesc.uri)

        if config.has_option(sec, 'default'):
            venueServer.SetDefaultVenue(vdesc.id)

        venues[sec] = vdesc

    for sec in config.sections():
        # Build up connections
        exits = string.split(config.get(sec, 'exits'), ', ')
        for vexit in exits:
            if venues.has_key(vexit):
                toVenue = venues[vexit]
                uri = toVenue.uri
                conn = ConnectionDescription(toVenue.name, toVenue.description,
                                             toVenue.uri)
                venues[sec].connections.append(conn)
            else:
                print "Error making connection to venue: ", vexit

        # Set the connections on the given venue
        print "CD #%s/%s: %s" % (sec, venues[sec].name, config.get(
            sec, 'exits'))

        # venue = Client.Handle(venues[sec].uri).GetProxy()
        print "URL: %s" % venues[sec].uri
        venue = VenueIW(venues[sec].uri, tracefile=sys.stdout)
        venue.SetConnections(venues[sec].connections)
#!/usr/bin/python
#
#

import csv

from AccessGrid.Toolkit import CmdlineApplication
from AccessGrid.ClientProfile import ClientProfileCache

app = CmdlineApplication()
app.Initialize("ListKnownProfiles")

cache = ClientProfileCache()

profiles = cache.loadAllProfiles()

def makeRow(p):
    d = dict()
    d['name'] = p.name
    d['email'] = p.email
    d['phone'] = p.phoneNumber
    d['location'] = p.location
    d['home venue'] = p.homeVenue
    return d

pKeys = ('name', 'email', 'phone', 'location', 'home venue')
outfile = csv.DictWriter(file("KnownUsers.csv", "w"), pKeys, lineterminator="\n")
for row in map(lambda p: makeRow(p), profiles):
    outfile.writerow(row)

Ejemplo n.º 11
0
#!/usr/bin/python
#
import sys
from optparse import Option

from AccessGrid.Toolkit import CmdlineApplication
from AccessGrid.VenueServer import VenueServerIW

app = CmdlineApplication()

urlOption = Option("-u",
                   "--url",
                   dest="url",
                   default=None,
                   help="URL to the server you want to shut down.")

app.AddCmdLineOption(urlOption)

try:
    args = app.Initialize("StopServer")
except Exception, e:
    print "Exception initializing toolkit:", e
    sys.exit(-1)

url = app.GetOption("url")
server = VenueServerIW(url)
server.Shutdown(0)
Ejemplo n.º 12
0
def main():
    """
    This is the function that does all the real work.
    """
    app = CmdlineApplication.instance()
    app.Initialize("CreateVenues")

    venueServerUri = "https://localhost:8000/VenueServer"

    if len(sys.argv) > 2:
        venueServerUri = sys.argv[2]

    configFile = sys.argv[1]

    venueServer = VenueServerIW(venueServerUri, tracefile=sys.stdout)
    #venueServer.SetEncryptAllMedia(0)

    config = ConfigParser.ConfigParser()
    config.read(configFile)
    venues = {}

    # Start up the logging
    log = Log.GetLogger("CreateVenues")
    hdlr = Log.StreamHandler()
    hdlr.setLevel(Log.INFO)
    Log.HandleLoggers(hdlr, Log.GetDefaultLoggers())

    # We do this in two iterations because we need valid URLs for connections
    for sec in config.sections():
        # Build Venue Descriptions
        vdesc = VenueDescription3(config.get(sec, 'name'),
                              config.get(sec, 'description'))
        vdesc.streams = []
    
        # Static Video
        if config.has_option(sec, 'video'):
            (host, port) = string.split(config.get(sec, 'video'), ':')
            vcap = Capability3(Capability.PRODUCER, Capability.VIDEO)
            vsd = StreamDescription3(vdesc.name, 
                                    MulticastNetworkLocation(host.strip(),
                                                             int(port), 
                                                             127),
                                    vcap, 0, None, 1)
            vdesc.streams.append(vsd)
        
        # Static Audio
        if config.has_option(sec, 'audio'):
            (host, port) = string.split(config.get(sec, 'audio'), ':')
            acap = Capability3(Capability3.PRODUCER, Capability3.AUDIO)
            asd = StreamDescription3(vdesc.name, 
                                    MulticastNetworkLocation(host.strip(),
                                                             int(port), 
                                                             127),
                                acap, 0, None, 1)
            vdesc.streams.append(asd)

        # Make the venue, then store the resulting URL
        print "VD #%s : %s" % (sec, vdesc.name)
        vdesc.uri = venueServer.AddVenue(vdesc)
        config.set(sec, 'uri', vdesc.uri)

        if config.has_option(sec, 'default'):
            venueServer.SetDefaultVenue(vdesc.id)
        
        venues[sec] = vdesc

    for sec in config.sections():
        # Build up connections
        exits = string.split(config.get(sec, 'exits'), ', ')
        for vexit in exits:
            if venues.has_key(vexit):
                toVenue = venues[vexit]
                uri = toVenue.uri
                conn = ConnectionDescription(toVenue.name, toVenue.description,
                                           toVenue.uri)
                venues[sec].connections.append(conn)
            else:
                print "Error making connection to venue: ", vexit

        # Set the connections on the given venue
        print "CD #%s/%s: %s" % (sec, venues[sec].name,
                                 config.get(sec, 'exits'))
	
        # venue = Client.Handle(venues[sec].uri).GetProxy()
        print "URL: %s" % venues[sec].uri
        venue = VenueIW(venues[sec].uri, tracefile=sys.stdout)
        venue.SetConnections(venues[sec].connections)
Ejemplo n.º 13
0
#!/usr/bin/python2

import os, sys
import ConfigParser
from optparse import Option

from AccessGrid.Venue import VenueIW
from AccessGrid.Toolkit import CmdlineApplication

doc = """
This program creates a fictional shared app in a venue then removes it.
"""
# Initialize
app = CmdlineApplication()

urlOption = Option("-u",
                   "--url",
                   dest="url",
                   default=None,
                   help="Specify a venue url on the command line.")
app.AddCmdLineOption(urlOption)

args = app.Initialize()

venueUrl = app.GetOption("url")

print "URL: ", venueUrl

if venueUrl is None:
    print "Exiting, no url specified."
    sys.exit(0)
Ejemplo n.º 14
0
def main():
    """
    The main routine.
    """
    # Instantiate the app
    app = CmdlineApplication()

    caOption = Option(
        "-C",
        "--ca",
        action="store_true",
        dest="is_ca_mode",
        default=0,
        help="Use CA mode for this invocation of the certificate manager.")
    idOption = Option(
        "-I",
        "--id",
        action="store_false",
        dest="is_ca_mode",
        default=0,
        help="Use ID mode for this invocation of the certificate manager.")

    forceOption = Option("-f",
                         "--force",
                         action="store_true",
                         dest="force_overwrite",
                         default=0,
                         help="Overwrite existing files.")
    app.AddCmdLineOption(caOption)
    app.AddCmdLineOption(idOption)
    app.AddCmdLineOption(forceOption)

    try:
        args = app.Initialize("CertificateManager")
    except Exception:
        sys.exit(0)

    cmd = CertMgrCmdProcessor(app.GetCertificateManager(), app.GetLog())

    #
    # If no args were passed, start up the command-driver
    # cert mgr.
    #

    if app.GetOption("is_ca_mode"):
        cmd.setCAMode()

    if len(args) == 0:

        cmd.cmdloop()

    else:

        #
        # Otherwise, process a single command from teh command line.
        #

        cmd.setInteractive(0)
        cmd.setForceOverwrite(app.GetOption("force_overwrite"))

        mycmd = args[0] + " " + " ".join(map(lambda a: '"' + a + '"',
                                             args[1:]))
        print mycmd
        cmd.onecmd(mycmd)
Ejemplo n.º 15
0
    client.Shutdown()
    m2threading.cleanup()
   
if __name__ == "__main__":
    import os, sys, threading, time
    from optparse import Option
    from AccessGrid.Toolkit import CmdlineApplication
    from AccessGrid.interfaces.VenueServer_client import VenueServerIW
    from AccessGrid.ClientProfile import ClientProfile

    m2threading.init()

    verbose =1
    random.seed(time.time())
    
    app = CmdlineApplication()

    urlOption = Option("-u", "--url", dest="url",
                       default="https://localhost/VenueServer",
                       help="URL to the venue server to test.")
    app.AddCmdLineOption(urlOption)

    nvcOption = Option("-n", "--num-clients", dest="nc", type="int",
                       default=1, help="number of clients to use.")
    app.AddCmdLineOption(nvcOption)

    rtOption = Option("-t", "--traverse", dest="rt", type="int",
              default=10, help="number of venues each client will traverse.")
    app.AddCmdLineOption(rtOption)
    
    try:
Ejemplo n.º 16
0
specified on the command line.

This program assumes the file is a ConfigParser compatible file with
the following format:

files should be named with the .vv3d suffix, such as: <venueid>.vv3d,
and should contain:

[description]
url = <url>

There may be more information in the file, but this is the only information
used by this program and so anything else is extraneous.
"""
# Initialize
app = CmdlineApplication()

urlOption = Option("-u",
                   "--url",
                   dest="url",
                   default=None,
                   help="Specify a venue url on the command line.")
app.AddCmdLineOption(urlOption)
fileOption = Option("-f",
                    "--file",
                    dest="file",
                    default=None,
                    help="Specify a file that contains a venue url.")
app.AddCmdLineOption(fileOption)

args = app.Initialize()
Ejemplo n.º 17
0
        while self.running:
            time.sleep(1)

    def shutdown(self):
        log.debug('VNCServerAppObject.shutdown')
        # Stop while loop
        self.running = 0
        # Stop and cleanup vnc server
        self.vncServer.destroy()
        # Stop application service and remove from venue.
        self.venueProxy.DestroyApplication(self.appDescription.id)
        

if __name__ == "__main__":

    app = CmdlineApplication().instance()
    app.AddCmdLineOption( Option("-v", "--venueUrl", type="string", dest="venueUrl",
                        default=None, metavar="VENUE_URL",
                        help="Set the venue in which the VenueVNC application should be started.") )
    app.AddCmdLineOption( Option("-n", "--name", type="string", dest="name",
                        default=None, metavar="NAME",
                        help="Set the name by which the server will be identified in the venue.") )
    app.AddCmdLineOption( Option("--vncserverexe", type="string", dest="vncserverexe",
                        default=None, metavar="VNC_SERVER_EXE",
                        help="Set the VNC server executable to use") )

    app.AddCmdLineOption( Option("--display", type="string", dest="display",
                        default=":9", metavar="DISPLAY",
                        help="Set the display the VNC server should run on. (linux only)") )
    app.AddCmdLineOption( Option("-g", "--geometry", type="string", dest="geometry",
                        default="1024x768", metavar="GEOMETRY",