You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@beehive.apache.org by Michael Merz <mm...@bea.com> on 2004/10/01 18:29:54 UTC

RE: endpoint interface

Hi Wolfgang,

According to JSR-181, the endpointInterface property of the @WebService
annotation specifies a file that contains all annotations except for
@WebService. More specifically, a file annotated with @WebService that
specifies an endpointInterface must not have any other annotations.

In your example, Foo.java provides an implementation for the
endpointInterface defined in Cheetorama. Thus, it must not have any
other annotations. Instead, all other annotations would be defined in
Cheetorama.java.

In other words, the object model that you would get from
WsmAnnotationProcessor or WsmReflectionAnnotationProcessor would have
the data from the union of the annotation sets of both files Foo and
Cheetorama; there would only be one object model and the caller would
only invoke the annotation processor (apt or reflection) once
(explicitly).

I think Cheetorama could be compiled (and its annotations would be
processed) as a side effect of handling the @WebService annotation in
Foo. As a result the service invocation has to deal with two files in
the case of an endpointInterface being specified -- the implementation
file with the code and the interface file with the annotations.

Does this help/make sense?

Cheers,

-michael

-----Original Message-----
From: wolfgang127us@yahoo.co.jp [mailto:wolfgang127us@yahoo.co.jp] 
Sent: Wednesday, September 29, 2004 11:56 AM
To: Beehive Developers
Subject: Re: endpoint interface

Hi Michael,

> I am trying to find out how to do that as part of the switch from
> reflection/byte-code processing to apt. Stay tuned...

okay, please let me know when you make it.

I'm thinking to implement the service endpoint interface for 
the WsmReflectionAnnotationProcessor.java as well.
But before doing that, I wanna make sure one thing.

How does the caller retrieve the object model of the service 
endpoint interface ?

For example, Foo.java (in svn) specifies "Cheetorama" as its
@WebService.endpointInterface.
Using the last code I sent you, the caller gotta follow the procedures
below.

First: 
The caller uses the com.sun.tools.apt.Main class to get an object model
of the Foo.java.
(Like in
drt/tests/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProce
ssorTest.java )

   String[] _args = {
     "-factory",
 
"org.apache.beehive.wsm.jsr181.processor.apt.WsmAnnotationProcessorFacto
ry",
      ...
   };

   int status = new Main().compile(_args);
   ...
   this.objectModel = WsmAnnotationProcessor.getObjectModel("Foo");


Second:
The object model(this.objectModel) of the Foo.java is in the caller's
hands now, 
so the caller now gotta check whether the endpointInterface exists in
the object model.
In this case, it exists and specifies "Cheetorama".

Third:
The caller finally can get the object model of the Cheetorama by
invoking 
WsmAnnotationProcessor.getObjectModel("Cheetorama");

Is this sequence right ?

or
When WsmAnnotationProcessor.getObjectModel("Foo"); is invoked in the
First part,
Is the object model of "Cheetorama" actually returned ?
(So the caller doesn't need to care whether Foo.java has the service
endpoing interface.
If the Foo.java doesn't have the service endpoint interface, the object
model of Foo.java 
will be returned.)

Even though I implemented WsmAnnotationProcessorFactory as former way,
somehow I think 
latter way looks correct to me according to JSR-181. (not sure though)

But by the latter way, we can never get the object model of Foo.java if
the service 
endpoint interface exists. Foo's object model will be overrided by the
one of the service 
endpoing interface (Cheetorama).

Former or latter way, which is correct ??

Thanks in advance.

Wolfgang.






Re: endpoint interface

Posted by wo...@yahoo.co.jp.
Hi Michael,

I attached Bar.java, Cheetorama.java, BarTestCase.java, WsmAnnotationProcessorEndpointInterfaceTest.java and 
wsm_diff.txt onto this mail.

Bar.java and Cheetorama.java should be resided in wsm/drt/tests directory.
BarTestCase.java should be placed in wsm/drt/tests/org/apache/beehive/wsm/jsr181/model directory.
WsmAnnotationProcessorEndpointInterfaceTest.java should be placed in wsm/drt/tests/org/apache/beehive/wsm/jsr181/processor/apt directory.
wsm_diff.txt is the lastet patch for the WsmAnnotationProcessor.java in svn.

As I wrote in my previous mail, plz remove the @WebService.endpointInterface from Foo.java.

Thanks in advance.

Wolfgang


Re: endpoint interface

Posted by wo...@yahoo.co.jp.
Hi Michael,

> According to JSR-181, the endpointInterface property of the @WebService
> annotation specifies a file that contains all annotations except for
> @WebService. More specifically, a file annotated with @WebService that
> specifies an endpointInterface must not have any other annotations.

The JSR-181 states that the endpointInterface can include 
@WebService.name
@WebService.targetNamespace
@WebService.wsdlLocation
any other JSR-181 annotations.

But can NOT include
@WebService.endpointInterface
@WebService.serviceName

The service implementation bean which contains a @WebService.endpointInterface 
should not include any JSR-181 annotations other than @WebService.endpointInterface 
and @WebService.serviceName.
Not "must not", but "should not".
I took it as the service implementation bean which constains a @WebService.endpointInterface 
can include all kinds of JSR-181 annotations, but they will be ignored (taken from 
the endpoint interface's annotations) other than 
@WebService.endpointInterface and @WebService.serviceName.


> there would only be one object model and the caller would
> only invoke the annotation processor (apt or reflection) once

This is what I wanted to know. Thanks.
I attached a patch.  WsmAnnotationProcessor.java applied this patch satisfies what you wrote.

A couple of things to note:

1. WsmServiceEndpointInterfaceGenerator is no longer used. (don't need now)

2. The @WebService.endpointInterface must be specified with a qualified class name 
   or a source file path including its package directory. 
   (the absolute path to the source file is not allowed any more)
If a source file path is given, then the base directory to the package directory must be 
supplied with -AsrcPath=... option to APT.
This is because if the endpointInterface got "C:\\myJSR\sample\abc.java" as its value,
we never know its qualified class name is either myJRS.sample.abc, sample.abc or just abc.
Thus, we need the base directory "C:\\myJSR" and the source file path "sample\abc.java" separately,
then we can identify the class name ( sample.abc in this case ) to retrieve its object model 
from the objecModels Map. 
This is just an adhoc though.

Even though an absolute path of a source file is given, APT can treat it to compile so that I 
could retrieve the qualified class name from the class, but the mechanism of the current 
implementation is that WsmAnnotationProcessor calls APT internally to get an endpoint interface.
Thus, I need a mechanism for passing the name(key in objectModels) of an object model of an 
endpoint interface from the second invoked APT to the first invoked APT. I could implement this 
by just adding one more hashtable in WsmAnnotationProcessor.java , but I thought the source file 
would be kinda messy so I didn't implement.

3. Almost all current test cases for WsmAnnotationProcessor will fail because tge Cheetorama doesn't exist.
I will add a Bar.java which specifies "Cheetorama" as its endpointInterface and Cheetorama.java later.
Why don't we remove the endpointInterface from Foo.java now ?

Thanks in advance.

wolfgang