Hi,
As the source code is now available in the CVS we should start thinking
of integrating it with the surrounding environment in order to achieve a consistent
user experience.
I had a quick look at the current web service annotation tools
and found a couple of points which are common for both CFX and WS DOM tools but
are implemented in different manner. I think that we should combine the best
features of both and remove duplications
1.
Validation
a.
The CFX validation plugs into
java compilation process via JDT-APT, analyzes the annotations in the java
class and generates error markers if necessary
b. WS DOM validation is implemented as an EMF validator. The
implementation would check the current state of the web service model and would
return status (org.eclipse.core.runtime.IStatus) objects. Creating error
markers in case of status with severity of ERROR is responsibility of
the EMF validation framework and the corresponding contributors.
We obviously do not need two validation implementations as
multiple similar error markers can confuse the user. I am not a JDT-APT expert
and could not tell the advantages which JDT-APT offers. But I could point out
the advantages provided by the WS DOM implementation:
-
The implementation is not
bound to a specific component (e.g. java build). It would only analyze the
current WS model and will return status objects. Whether error markers are
generated or not is a matter of further processing. Thus a validation user code
could decide what to do with these errors – generate error markers or for
example try to fix the errors on the fly
-
The validation is performed on
the web service model. The web service model updates itself upon resource
change and “reconcile” events thus giving adequate representation
of the current source code (no matter built or not). With a model which
is up to date, an user (no matter human or API) can trigger validation of the
current source code and get the validation results immediately
-
The validation can be managed
centrally (via Window -> Preferences -> Validation)
2.
Properties view
a.
CFX provides its own annotation
view which shows all the annotations relevant for the current selection. The
user can turn on/off a given annotation and can change its attributes. I think
that it is a pretty powerful tool. However, I do have certain worries that
usability experts would dislike having two property views (the standard one and
the annotations one) and would prefer the annotations to be displayed in the
standard properties view.
b.
WS DOM plugins contribute
pages to the standard properties view for the WS model artifacts but provides
much less information than the annotation properties view does. Also, the editing
support is pretty limited
3.
Annotation API
a.
CFX uses the org.eclipse.jst.ws.annotations.core.utils.AnnotationUtils
class to create and modify annotations. From my point of view the interface this
utility is pretty complex. For example, here is the signature of a random
method:
public static void
addAnnotationToField(ICompilationUnit source, CompilationUnit compilationUnit,
ASTRewrite rewriter, IField field, Annotation annotation, TextFileChange
textFileChange) throws CoreException
The method has lots of input parameters
and I personally find it hard to get instances of everything I need to call
this method
b.
WS DOM comes with the org.eclipse.jst.ws.jaxws.utils.annotations.AnnotationWriter
utility class. Here is the equivalent method for adding annotations:
public <T extends
IJavaElement> void setAppliedElement(final
IAnnotation<T> annotation, final T javaElement) throws
AnnotationGeneratorException
As
you can see, the method signature is pretty simple – it only says “please
apply this annotation to that java element”
So does the tools unification makes sense to you? If yes, we
should come up with a plan what/when to refactor
Best regards, Danail