[armedbear-devel] java interop question

Alessio Stalla alessiostalla at gmail.com
Thu Oct 14 19:43:54 UTC 2010

On Thu, Oct 14, 2010 at 8:15 PM, Kevin Raison <raison at chatsubo.net> wrote:
> Thanks for the pointers, David and Alessio.  I was able to implement my
> HTTP client in abcl with the knowledge that you provided.  As I move on
> to the next phase of my project, I have run into another issue that I
> can't figure out how to solve without coding in java (which I would
> prefer not to do, if I can help it).
> The issue is this:  I am trying to build on Apache CXF library, using
> just its simple interface for defining a soap service.  The java pattern
> is like this:
> public interface HelloWorld {
>   String sayHi(String text);
> }
> public class HelloWorldImpl implements HelloWorld {
>   public String sayHi(String text) {
>     return "Hello " + text;
>   }
> }
> import org.apache.cxf.frontend.ServerFactoryBean;
> HelloWorldImpl helloWorldImpl = new HelloWorldImpl();
> ServerFactoryBean svrFactory = new ServerFactoryBean();
> svrFactory.setServiceClass(HelloWorld.class);
> svrFactory.setAddress("http://localhost:9000/Hello");
> svrFactory.setServiceBean(helloWorldImpl);
> svrFactory.create();
> I would like to be able to all of this directly in abcl, meaning code
> the interface, implementation and serverFactory without using java.  I
> don't see a way to do this with abcl.  Several things are unclear to me:
> 1. I can't find a way to specify an interface in abcl;  if such a thing
> is not possible, all is maybe not lost.  Could I do the interface spec
> in java and the implementation in abcl?

There's currently no way to define a Java interface in ABCL. However,
there's a way to implement one (which is not equivalent to the Java
way of doing it - it's slower, because it uses reflection). Look at
jmake-proxy in java.lisp.

> 2. CLOS classes don't seem to correspond to java classes, so assuming
> issue #1 is solved, how would I specify an implementation of the
> interface in abcl?

There are several ways: a single function manually dispatching on the
method name, a Lisp package with a symbol for each method in the
interface, a hash map of method name -> closure entries.

> 3. As for the serverFactory: if #1 and #2 are solved, the only piece of
> this that isn't clear to me is how to translate
> svrFactory.setServiceClass(HelloWorld.class);
> to abcl.

(jcall "setServiceClass" svr-factory (jclass "com.whatever.HelloWorld"))


(jcall (jmethod "org.apache.cxf.frontend.ServerFactoryBean"
"setServiceClass" "java.lang.Class") svr-factory (jclass


More information about the armedbear-devel mailing list