Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Servus Annotations"

(Annotations)
(Annotations)
Line 27: Line 27:
  
 
Note that the actual representation can be at any point between the full and compact representations. For example, if we start from WSDL, we usually get a full representation, but we can clean it to become a compact representation. If we start from Ecore, we might add a single WebEndpoint annotation and we have the compact representation directly.
 
Note that the actual representation can be at any point between the full and compact representations. For example, if we start from WSDL, we usually get a full representation, but we can clean it to become a compact representation. If we start from Ecore, we might add a single WebEndpoint annotation and we have the compact representation directly.
 +
 +
=Notation=
 +
 +
In the next section, we use the following notation:
 +
 +
* code style is used on Servus Model Annotations, classes and XML elements, like <code>WebEndpoint</code>, <code>EClass</code> and <code><port></code>.
 +
* a regular Java annotation is also in code style, but prefixed by an @, like <code>@WebMethod</code>
 +
* an annotation attribute is written in italics, like ''namespace'', unless it is a table's first column, when it is bold.
 +
  
 
=Annotations=
 
=Annotations=
  
Currently, there are 2 sets of Servus Annotations. The [[#Web Services Annotations|Web Services Annotations]] are generic Web Services related annotations. The [[#SOAP Annotations|SOAP Annotations]] are specific to encode SOAP binding information. All annotations have an EAnnotation and a ServusAnnotation forms. In the ServusAnnotation form, all attributes of the annotation are encoded as fields in a class deriving from ServusAnnotation. This is used for internal manipulation of the annotations and when a ServusWrapperAnnotation is used (more on this later). The EAnnotation form is the one regularly used in Ecore models. It uses the '''source''' attribute as the EAnnotation's source (to identify the type of the annotation) and the remaining attributes are encoded as key/value pairs of the details map, using the attribute's name as key.
+
Currently, there are 2 sets of Servus Annotations. The [[#Web Services Annotations|Web Services Annotations]] are generic Web Services related annotations. The [[#SOAP Annotations|SOAP Annotations]] are specific to encode SOAP binding information. They are both defined by an Ecore meta-model found in the <code>org.eclipse.emf.servus.annotation</code> project.
  
All annotations extend a basic ServusAnnotation and therefore contain the following attributes:
+
All annotations can be represented in 2 forms. In the ServusAnnotation form, all attributes of the annotation are encoded as fields in a class deriving from <code>ServusAnnotation</code>. This is used for internal manipulation of the annotations and when a <code>ServusWrapperAnnotation</code>. A model using these annotations conforms to the annotations meta-model. The EAnnotation form is the one regularly used in Ecore models. It uses regular <code>EAnnotation</code>s with the appropriate the '''source''' attribute (to identify the type of the annotation), and the remaining attributes are encoded as key/value pairs of the details map, using the attribute's name as key. The <code>ServusAnnotation</code> class provides methods to transform between these two forms.
  
 +
All annotations extend the basic <code>ServusAnnotation</code> and therefore contain the following attributes:
  
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
 
{| border="1" cellpadding="5" cellspacing="0" align="center"
Line 44: Line 54:
 
| '''source'''
 
| '''source'''
 
| Identifies the type of the annotation.
 
| Identifies the type of the annotation.
| There are no defaults, every annotation has it's own source, defined by '''<nowiki>http://org/eclipse/emf/servus/annotation/</nowiki>''' + the annotation name.
+
| There are no defaults, every annotation has it's own source, defined by '''<nowiki>http://org/eclipse/emf/servus/annotation/</nowiki> + the annotation name'''.
 
|-
 
|-
 
| '''namespace'''
 
| '''namespace'''
| The namespace of the annotation. Usually this attribute is unnecessary, but it is used if elements of different annotations are in the same EPackage.
+
| The namespace of the annotation. Usually this attribute is unnecessary, but it is used if elements of different namespaces are in the same <code>EPackage</code>.
| The value of the namespace of the EPackage in which the annotation resides. The namespace of the EPackage is its nsURI.
+
| The value of the namespace of the <code>EPackage</code> in which the annotation resides. The ''namespace'' of the EPackage is its ''nsURI''.
 
|-
 
|-
 
| '''name'''
 
| '''name'''
Line 55: Line 65:
 
|-
 
|-
 
| '''fullyQualifiedName'''
 
| '''fullyQualifiedName'''
| Used to identify this annotation in a model. It is derived from namespace + "#" + name, and should uniquely identify the annotation.
+
| Used to identify this annotation in a model. It is derived from '''namespace + "#" + name''', and should uniquely identify the annotation.
 
| There's no default. This is a derived attribute.
 
| There's no default. This is a derived attribute.
 
|-
 
|-
Line 65: Line 75:
 
===WebEndpoint===
 
===WebEndpoint===
  
{| border="1" cellpadding="5" cellspacing="0"
+
'''Host Ecore Types:''' <code>EClass</code>.
 +
 
 +
'''Description:''' Defines that the <code>EClass</code> represents a Web Service Endpoint. An endpoint defines that a web interface is exposed at an address using a certain binding.
 +
 
 +
'''WSDLv1 Mapping:''' Maps to a <code><port></code> element inside a <code><service></code>.
 +
 
 +
'''JAX-WS Mapping:''' Maps to a Server Skeleton implementation and a Client Proxy (that extends <code>javax.xml.ws.Service</code>)
 +
 
 +
{| border="1" cellpadding="5" cellspacing="0" align="center"
 +
|+'''WebEndpoint attributes'''
 
|-
 
|-
| '''Source'''
+
! style="background:#efefef;" | Name
| bla
+
! style="background:#efefef;" | Description
|-
+
! style="background:#efefef;" | Default Value
| '''Description'''
+
! style="background:#efefef;" | WSDLv1 Mapping
| bla
+
! style="background:#efefef;" | JAX-WS Mapping
|-
+
| '''Ecore Types'''
+
| There are no defaults, every annotation has it's own source hard coded.
+
 
|-
 
|-
 +
| '''name'''
 +
| Used to customize the name of the generated endpoint (port) in WSDL and Java.
 +
| The <code>EClass</code> non-qualified name.
 +
| Maps to a <code><port></code>'s name attribute.
 +
| In a Client Proxy, maps to the of the port's getter and to a <code>@WebEndpoint</code> annotation's ''name''. In a Server, maps to a <code>@WebService</code>'s ''portName''.
 
|}
 
|}
  

Revision as of 14:21, 11 July 2008

Attention : This is work in progress, meaning that the annotations described here are not yet guaranteed to be kept later or to be used with this semantics. However, it is unlikely that they will change a lot, so it can be used to understand what can be done with Servus annotations.

Overview

Servus deals with WSDL documents, Ecore models and Java source code. Servus Model Annotations are a way to express Web Services related information by decorating any Ecore model.

Goals

The main goals of the annotations are to be:

Complete with respect to WSDL

This means that all information available in WSDL documents (versions 1 and 2) can be encoded in the annotations of an Ecore model. If this property is achieved, we can have a full round-trip between WSDL documents and Ecore models, without ever losing information.

As we will see later, there's just one aspect of WSDLv1 that currently cannot be encoded in Servus Annotations: the different files. This means that when we transform from WSDL to Ecore we might lose track of the WSDL files used to create the model. All information is there, but if we now go from Ecore to WSDL we might get a different set of files. However, this just happens if the files contain the same namespace, which is allowed but is not a good practise.

Minimalistic

This means that Servus Annotations have defaults for almost all information, so that they can be left implicit in the model. In fact, the only characteristic of WSDL that cannot be directly encoded in an Ecore model with defaults is the URL of the service. Therefore, a simple WebEndpoint annotation containing an URL and stored in an EClass is enough to represent a full web service (Servus will fill the blanks with defaults, like using SOAP, Document, Literal, etc).

Model Representations

Because Servus extensively relies on implicit information, it is convenient to define 3 different representations (or views) of the same Ecore model, with respect to the Servus Annotations that it carries:

  • actual representation - this view contains the Servus Annotations that are actually stored in the model. This is what a developer sees in the regular editor while manipulating the model.
  • full representation - this view is derived by filling all defaults on the actual representation. It explicitly contains every piece of information of the model. This is useful for developers to understand the implicit information and for tools to generate source code or WSDL documents.
  • compact representation - this view is derived by removing all defaults from the actual representation. Every piece of information that could be inferred by defaults is removed and the model is as clean as possible. This is useful for developers, because it makes the model much smaller, hiding most of the complexity.

Note that the actual representation can be at any point between the full and compact representations. For example, if we start from WSDL, we usually get a full representation, but we can clean it to become a compact representation. If we start from Ecore, we might add a single WebEndpoint annotation and we have the compact representation directly.

Notation

In the next section, we use the following notation:

  • code style is used on Servus Model Annotations, classes and XML elements, like WebEndpoint, EClass and <port>.
  • a regular Java annotation is also in code style, but prefixed by an @, like @WebMethod
  • an annotation attribute is written in italics, like namespace, unless it is a table's first column, when it is bold.


Annotations

Currently, there are 2 sets of Servus Annotations. The Web Services Annotations are generic Web Services related annotations. The SOAP Annotations are specific to encode SOAP binding information. They are both defined by an Ecore meta-model found in the org.eclipse.emf.servus.annotation project.

All annotations can be represented in 2 forms. In the ServusAnnotation form, all attributes of the annotation are encoded as fields in a class deriving from ServusAnnotation. This is used for internal manipulation of the annotations and when a ServusWrapperAnnotation. A model using these annotations conforms to the annotations meta-model. The EAnnotation form is the one regularly used in Ecore models. It uses regular EAnnotations with the appropriate the source attribute (to identify the type of the annotation), and the remaining attributes are encoded as key/value pairs of the details map, using the attribute's name as key. The ServusAnnotation class provides methods to transform between these two forms.

All annotations extend the basic ServusAnnotation and therefore contain the following attributes:

ServusAnnotation Attributes
Name Description Default Value
source Identifies the type of the annotation. There are no defaults, every annotation has it's own source, defined by http://org/eclipse/emf/servus/annotation/ + the annotation name.
namespace The namespace of the annotation. Usually this attribute is unnecessary, but it is used if elements of different namespaces are in the same EPackage. The value of the namespace of the EPackage in which the annotation resides. The namespace of the EPackage is its nsURI.
name Used to customize the name of the element, in case it is different from the default based on the carrying Ecore element. Depends on the annotation. Therefore, we will discuss this attribute on each annotation bellow.
fullyQualifiedName Used to identify this annotation in a model. It is derived from namespace + "#" + name, and should uniquely identify the annotation. There's no default. This is a derived attribute.


Web Services Annotations

WebEndpoint

Host Ecore Types: EClass.

Description: Defines that the EClass represents a Web Service Endpoint. An endpoint defines that a web interface is exposed at an address using a certain binding.

WSDLv1 Mapping: Maps to a <port> element inside a <service>.

JAX-WS Mapping: Maps to a Server Skeleton implementation and a Client Proxy (that extends javax.xml.ws.Service)

WebEndpoint attributes
Name Description Default Value WSDLv1 Mapping JAX-WS Mapping
name Used to customize the name of the generated endpoint (port) in WSDL and Java. The EClass non-qualified name. Maps to a <port>'s name attribute. In a Client Proxy, maps to the of the port's getter and to a @WebEndpoint annotation's name. In a Server, maps to a @WebService's portName.

WebService

WebBinding

SOAP Annotations

Back to the top