Beispiel #1
0
def registerApp(fileName):
    import AccessGrid.Toolkit as Toolkit
    app = Toolkit.CmdlineApplication()
    appdb = app.GetAppDatabase()

    fn = os.path.basename(fileName)

    exeCmd = sys.executable + " " + fn + " -a %(appUrl)s"

    # Call the registration method on the applications database
    #appdb.RegisterApplication("Shared Covise",
    #                          "application/x-ag-shared-covise",
    #                          "sharedcovise",
    #                          {"Open" : exeCmd },
    #                          [fn], os.getcwd())
    # old init have to be changed soon
    uad = Platform.GetUserAppPath()
    src = os.path.abspath(fn)
    dest = os.path.join(uad, fn)

    exeCmd = sys.executable + " \"" + dest + "\" -a %(appUrl)s"
    print("hallo" + src + " to " + dest)
    try:
        shutil.copyfile(src, dest)
    except IOError:
        print "could not copy app into place"
        sys.exit(1)

    # Call the registration method on the applications database
    appdb.RegisterApplication("Shared Covise", "application/x-ag-covise",
                              "sharedcovise", {"Open": exeCmd})
Beispiel #2
0
def registerApp(fileName):
    import AccessGrid.Toolkit as Toolkit
    app = Toolkit.CmdlineApplication()
    appdb = app.GetAppDatabase()

    fn = os.path.basename(fileName)

    exeCmd = sys.executable + " " + fn + " -a %(appUrl)s"

    # Call the registration method on the applications database
    appdb.RegisterApplication("Shared Covise",
                              "application/x-ag-shared-covise", "sharedcovise",
                              {"Open": exeCmd}, [fn], os.getcwd())
Beispiel #3
0
        del arg

        try:
            pass


#            sock = self.active_sockets[handle]
#            conn = ConnectionHandler(sock, self)
#            conn.registerForRead()
#            self.connectionMap[conn.GetId()] = None
#            del self.active_sockets[handle]
        except:
            log.exception("Accept failed to find socket for handle.")

        try:
            self.registerForListen()
        except:
            log.exception("acceptCallback failed")

if __name__ == "__main__":
    from AccessGrid import Toolkit

    Toolkit.CmdlineApplication().Initialize("Asynch_test", sys.argv[:1])

    port = 6500
    print "Creating new EventService at %d." % port
    eventService = EventService(('', port))
    evtThread = threading.Thread(target=eventService.start)
    evtThread.start()
    evtThread.join()
# 0 - success
# 1 - timed out
# 2 - connection failure
# 3 - unknown failure (the exception prints)

import sys, os, time, threading
from Queue import Queue
from optparse import Option

from AccessGrid import Toolkit
from AccessGrid.GUID import GUID
from AccessGrid.EventClient import EventClient
from AccessGrid.EventClient import EventClientConnectionException
from AccessGrid.Events import ConnectEvent, HeartbeatEvent

app = Toolkit.CmdlineApplication()

hostOption = Option("--host",
                    dest="host",
                    metavar="HOST",
                    default="localhost",
                    help="hostanme the event service.")
app.AddCmdLineOption(hostOption)
portOption = Option("--port",
                    dest="port",
                    metavar="PORT",
                    type="int",
                    default=8002,
                    help="port of the event service.")
app.AddCmdLineOption(portOption)
channelOption = Option("--channel",