Evocb

From Wikipedia, the free encyclopedia
Jump to: navigation, search
EVO/CB
Evocb.jpg
Initial release 2011
Development status beta
Written in Java
Type Distributed development
License LGPL License
Website evocb.sf.net

Overview[edit]

EVO/CB is a distributed object system that is constructed on top of publish/subscribe event systems. This design decision implies modeling method calls as events and subscriptions over the underlying messaging middleware.

The current prototype is a free and open source software released under the terms of the LGPL License and written in Java.

Example[edit]

The following classes implement a simple client-server program using the Evo middleware that change a remote value.

Evo class—Defines the interface that is used by the client and implemented by the server.

import evo.ERemote;
import evo.annotation.*;
import evo.exception.*;
 
@RemoteInterface
public interface Evo extends ERemote {
 
  @RemoteMethod
  public void setValue (String value) throws RemoteException;
}

EvoImpl and EvoServer classes—Listens to Evo requests and implements the interface which is used by the client to invoke remote methods.

import evo.RemoteObject;
import evo.exception.RemoteException;
 
public class EvoImpl extends RemoteObject implements Evo {
 
  private String value = "sample";
 
  public EvoImpl() {}
 
  public EvoImpl (Properties env) throws RemoteException {
    super (env);
  }
 
  public void setValue (String value) throws RemoteException {
    this.value = value;
  }
}
import java.util.Properties;
import evo.Naming;
import evo.util.Environment;
 
public class EvoServer {
 
	public static void main(String[] args) {
		try	{			
			Naming.startRegistry();			
			Properties env = Environment.getEnv ();			
			Evo server = new EvoImpl (env);			
			Naming.bind("evo://remote",server);			
			System.in.read();
 
		}catch (Exception e) {
			 e.printStackTrace();
		}	
	}
}

EvoClient class—This is the client which gets the reference (a proxy) to the remote object and invokes its method to set a value.

import evo.Naming;
 
public class EvoClient {
 
	public static void main(String[] args) throws Exception {
 
		Naming.loadRegistry();
		Evo client = (Evo) Naming.lookup("evo://remote");
 
		client.setValue("newValue");
 
		client.close();
		Naming.unloadRegistry();
	}
}


See also[edit]

External links[edit]