Overview

crispy logoCRISPY = Communication per Remote Invocation for different kinds of Services via ProxYs.

The intention for this project is a very simple API to call different kinds of services (provider/technology). Crispy's aims is to provide a single point of entry for remote invocation for a wide number of transports: eg. RMI, EJB, JAX-RPC or XML-RPC. It works by using properties to configure a service manager, which is then used to invoke the remote API. Crispy is a simple Java codebase with an API that sits between your client code and the services your code must access. It provides a layer of abstraction to decouple client code from access to a service, as well as its location and underlying implementation. The special on this idea is, that these calls are simple Java object calls (remote or local calls are transparent).

From Crispy supported transport provider are:

The simplest case is a local Java call from Java object.

=> All calls can execute synchronous or asynchronous (see the user guide).

Details to the Crispy framework

What must I do, when I want to invoke a remote method/service. In this section you can get a comparsion from the native remote API (e.g. WebService and XML-RPC) and a Crispy call.

Example for remote invocation with the native API calls (without Crispy!)

  • WebService (JAX-RPC):
    Service service = (Service) ServiceFactory.newInstance().createService(null);
    Call call = service.createCall();
    call.setTargetEndpointAddress("http://localhost:9080/axis/services/Calculator");
    call.setOperationName(new QName("add"));
    QName paramXmlType = new QName(int.class.getName());
    call.addParameter("arg0", paramXmlType, int.class, ParameterMode.IN);			
    call.addParameter("arg1", paramXmlType, int.class, ParameterMode.IN);			
    
    call.setReturnType(new QName(int.class.getName()));
    Integer result = (Integer) call.invoke(new Integer[] {new Integer(1), new Integer(2)});
    System.out.println("1 + 2 = " + result);
    
  • XML-RPC (Apache XML-RPC):
    XmlRpcClient client = new XmlRpcClient("http://localhost:9090");
    Vector param = new Vector();
    param.add(new Integer(1));
    param.add(new Integer(2));
    Integer result = (Integer) client.execute("test.crispy.example.service.Calculator.add", param);
    System.out.println("1 + 2 = " + result);
    

Example for remote invocation with Crispy

Two steps to success:

  1. Define properties to describe the invocation.
  2. Do the remote invocation, how a local call.
=> The step two is always the same!

  • WebService (JAX-RPC):
    Properties prop = new Properties();
    prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:9080/axis/services");
    prop.put(Property.EXECUTOR_CLASS, JaxRpcExecutor.class.getName());
    
    ServiceManager manager = new ServiceManager(prop);
    Calculator calc =  (Calculator) manager.createService(Calculator.class);
    System.out.println("1 + 2 = " + calc.add(1, 2));
    
    
  • XML-RPC:
    Properties prop = new Properties();
    prop.put(Property.REMOTE_URL_AND_PORT, "http://localhost:9090");
    prop.put(Property.EXECUTOR_CLASS, XmlRpcExecutor.class.getName());
    
    ServiceManager manager = new ServiceManager(prop);
    Calculator calc =  (Calculator) manager.createService(Calculator.class);
    System.out.println("1 + 2 = " + calc.add(1, 2));
    
    

=> Properties can loaded with a implemetation from the net.sf.crispy.PropertiesLoader.

What ist the special on this framework?

  • Very easy to use.
  • Very simple and minimal to configure.
  • You can call a remote method from Java object, like a local call.
  • You don't need to know, how the (remote) technology work.
  • You can easy change the technology (for example from XML-RPC to RMI).
  • The services don't know a remote-interface or a RemoteException (how RMI).
  • The parameter can be a complex object (in parts without programming a Serializabler (Marshalling) or Deserializabler (Unmarshalling))
  • You can intercept methods before and after invocation (for logging, time stopping, ...).
  • You can modify or extends method parameter and the result (transformation, set a authorization (login) token for the request in the background, ...).

Where you can set in Crispy?

If two or more communication partner exist:

  • In Service Oriented Architecture (SOA).
  • By Enterprise Service Bus (ESB).
  • Client for Java Business Integration (JBI).
  • Communication by a Rich Client Platform (RCP) with the server (Client/Server Architecture).
  • Communication between service consumer (Client) and service provider (Server) (in the WWW or intranet).
  • And so on.

Crispy extensions

You can Crispy combinate with other frameworks. At time exist follow extensions (you can read more under the menu point Extension):

  • SpringFramework
  • HiveMind
  • PicoContainer
  • OSGi
  • AspectJ

Importend Hints

Before you started: Importend Hints

Questions?

You can read FAQs.

Why Crispy?

This little story describe the problems and the solution by finding the right solution for a service invocation:

erik question Developer crispy logo Crispy
I want to communicate with a remote service! What I have to do? You have to find the right remote technology for your plans.
What is the right technology? I don't know! I know this problem. A decision for a concrete technology is not easy, but important for a successful project (performance, security, interoperability and so on).
What must I do after the decision? If you don't know the technology, you must learn, how the remote technology work.
I decided for a technology and I have implemented some services. Now, I find the remote invocations are to slow.Change the remote technology!
The remote invocations are on many different places in my source code! The changes are very expensive! You need a transparent remote invocation on a central place in your source code. Than you can easy change the service technology (how Crispy).

=> The Crispy story you can see in a Crispy Comic.