Link to home
Start Free TrialLog in
Avatar of NetworkArchitek
NetworkArchitek

asked on

Dynamically load a class

I kind of at a wall with this problem and need some help. If I could award more points I would. My issue is this:  I have a client-server system which is designed for others to extend. I have a a base interface, let's call it "MyRunnable." This interface has one method:  void run().      

I need to be able to allow someone to build their own client application to talk to my server (using Web Services). I need someone to, using my class library, construct a class that implements MyRunnable.and allow the server to invoke the run() method on an instance of that object.

Essentially, I believe I need to allow the ability have an instance of a MyRunnable object be serialized, sent to the Web Service, then the server deserialize it and invoke the method. But obviously, I need the class definition to be available to server and all of that.

I've looked at things like the ClassLoader and all of that but I need some guidance. I know this is non-trivial but hopefully someone can point me in the right direction. There is a project called JPPF (a grid computing project) which does something like this but it's implementation is far to complex/robust than what I need. So any help is appreciated.

Again, put simply: I need my library to allow for an object in one application X, that implements an interface known by another application Y, to have its class definition determined (and perhaps any non-built-in class definitions that it references) and its object state to be sent to application Y and have the methoid defined in the interface invoked.
SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NetworkArchitek
NetworkArchitek

ASKER

Whoops, forgot about this question. Both of you were very helpful on this issue. Thanks.