Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] need some help

Greg,

to me, you should look at the tcf.test.BasicTests.py file. One good
(and simple) example is the

def testProcesses(c):
    from tcf.services import processes, processes_v1  # @UnresolvedImport
    lock = threading.Condition()

    def processTest():
        proc = c.getRemoteService(processes_v1.NAME) or \
            c.getRemoteService(processes.NAME)
        if not proc:
            with lock:
                lock.notify()
            return

        class DoneGetChildren(processes.DoneGetChildren):
            def doneGetChildren(self, token, error, context_ids):
                if error:
                    protocol.log("Error from Processes.GetChildren", error)
                else:
                    print("Processes: " + str(context_ids))
                with lock:
                    lock.notify()
        proc.getChildren(None, False, DoneGetChildren())
    with lock:
        protocol.invokeLater(processTest)
        lock.wait(5)


The getRemoteService() will get the remote service from the
tcf.services.remote.Processes(V1)Proxy.py file. You have to call for
the protocol.invokeLater(), and lock is released by the DoneGetChildren
class (called by the remote service).

The input/output of TCF services should be defined by the service
documentation, but basically all the interfaces are here in the python
opensource. The returned values are defined by the "done" classes.

There is a full example of a process start and debug with the
tcf.tests.ProcessStart.py file.

Hope this helps

DERF


On 05/10/2016 10:21 PM, Greg Watson wrote:
Hi,

I would like to see if it is possible to implement a basic agent in python. I’ve been looking at the python code, which implements a client, and it looks like most of the pieces are there other than the services themselves. I’m guessing that to implement a FileSystemService (for example), I would need to subclass filesystem.FileSystemServce and provide implementations for the abstract methods. My server registers a FileSystemServiceProvider(services.ServiceProcider) class using protocol.addServiceProvider, and when I invoke a method such as ‘roots’, my CommandServer.command method is being called.

What I’m not sure about is how to implement the abstract methods. e.g. what should the methods return? It looks like the proxy methods return a FileSystemCommand, but I’m not sure what my local methods should be returning.

If anyone can provide some assistance on how to do this, it would be appreciated.

Greg
_______________________________________________
tcf-dev mailing list
tcf-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tcf-dev



Back to the top