this is MyService.java

package simplecallback;

import org.osoa.sca.annotations.Callback;
import org.osoa.sca.annotations.OneWay;

/**
 * This service that will be invoked in a non-blocking fashion
 */
@Callback(MyServiceCallback.class)
public interface MyService {

    @OneWay
    void someMethod(String arg);
}


and MyClient.java

package simplecallback;

/**
 * The client interface
 */
public interface MyClient {

    void aClientMethod();
}



and MyServiceCallback.java

package simplecallback;

/**
 * The callback interface for {...@link MyService}.
 */
public interface MyServiceCallback {

    void receiveResult(String result);
}


2009/10/22 Antonio Mirarchi <[email protected]>

> This is my simplecallback.MyclientImpl:
>
> package simplecallback;
>
> import org.osoa.sca.annotations.Reference;
> import org.osoa.sca.annotations.Scope;
> import org.osoa.sca.annotations.Service;
>
> /**
>  * Demonstrates a component-to-component callback invocation
>  */
> @Service(MyClient.class)
> @Scope("COMPOSITE")
> public class MyClientImpl implements MyClient, MyServiceCallback {
>
>     private MyService myService;
>     static String result;
>
>     @Reference
>     public void setMyService(MyService myService) {
>         this.myService = myService;
>     }
>
>     public void aClientMethod() {
>         myService.someMethod("-> someMethod");
>     }
>
>     public void receiveResult(String result) {
>         System.out.println("Work thread " + Thread.currentThread());
>         System.out.println("Result: " + result);
>        MyClientImpl.result = result;
>     }
> }
>
>
> and this is simplecallback.MyServiceImpl:
>
>
> package simplecallback;
>
> import org.osoa.sca.annotations.Callback;
> import org.osoa.sca.annotations.Scope;
> import org.osoa.sca.annotations.Service;
>
> /**
>  * This class implements MyService and uses a callback.
>  */
> @Service(MyService.class)
> @Scope("COMPOSITE")
> public class MyServiceImpl implements MyService {
>
>     private MyServiceCallback myServiceCallback;
>
>     /**
>      * The setter used by the runtime to set the callback reference
>      * @param myServiceCallback
>      */
>     @Callback
>     public void setMyServiceCallback(MyServiceCallback myServiceCallback) {
>         this.myServiceCallback = myServiceCallback;
>     }
>
>     public void someMethod(String arg) {
>         // invoke the callback
>         try {
>             myServiceCallback.receiveResult(arg + " -> receiveResult");
>         } catch(RuntimeException e) {
>             System.out.println("RuntimeException invoking receiveResult: "
> + e.toString());
>         }
>     }
>
>
>
>
>
>
> 2009/10/22 Simon Laws <[email protected]>
>
> Hi
>>
>> On the face of it it seems to be complaining about a miss-match in
>> reference names. I.e. between MyService and myService. But as you say
>> this is with Node B that's seems a bit odd. Looking at the implementation
>> for the service does this make any sense? Can you post 
>> simplecallback.MyClientImpl
>> and simplecallback.MyServiceImpl?
>>
>> Under the covers we do create some automatic references and services, the
>> names of which are based on the forward reference and service names, so
>> something could be going wrong there.
>>
>> Regards
>>
>> Simon
>>
>
>

Reply via email to