You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jim Marino <jm...@myromatours.com> on 2006/08/10 05:16:38 UTC
Refactoring of Service Contracts
Currently we use java.lang.Method to represent operations in the
runtime. It has been brought up by various people that this is not
ideal, for example, in dealing with E4X, data binding, and proxying
strategies that do not rely on reflection. It has also been an issue
with callbacks as we are having to imbed knowledge of Java
annotations related to asynchrony into the connector. Instead, I
think we need to have a general base representation of operations and
service contracts in general. One of the original problems we
encountered that forced us to move from a neutral representation to
java.lang.Method was the complexity of dealing with the model when
code needed to map from the general representation to the specific
operation, e.g. a method on a class. This can probably be alleviated
by using the pattern we have adopted with the current model where a
base class is extended with one that provides a more specific
representation, for example JavaMappedProperty, JavaMappedReference,
and JavaMappedService. Similarly, we could do something to the effect
of JavaMappedServiceContract.
Another issue that has come up is representation of data binding
types for parameters. We could perhaps have a generic representation
of an operation, Operation, that has a getParameterTypes() which
returns a collection of Class elements. The actual class elements
would correspond to type system of the specific data binding used.
Now that the wiring has been moved completely into the wire service
and we are working on a number of extension types, I believe it would
be a good time to get this figured out.
Thoughts?
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Refactoring of Service Contracts
Posted by Jeremy Boynes <jb...@apache.org>.
Good catch.
I need something like this for WSDL processing as well so I will go
ahead and add the objects as described below into the config model.
--
Jeremy
On Aug 12, 2006, at 10:34 AM, Raymond Feng wrote:
> Hi,
>
> The ServiceContract abstraction sounds good to me. One comment:
>
> For the Operation, I thin we need to add a list of fault types.
>
> List<DataType<?,?>> faultTypes;
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Jeremy Boynes"
> <jb...@apache.org>
> To: <tu...@ws.apache.org>
> Sent: Wednesday, August 09, 2006 10:50 PM
> Subject: Re: Refactoring of Service Contracts
>
>
>> On Aug 9, 2006, at 8:16 PM, Jim Marino wrote:
>>>
>>> Another issue that has come up is representation of data binding
>>> types for parameters. We could perhaps have a generic
>>> representation of an operation, Operation, that has a
>>> getParameterTypes() which returns a collection of Class
>>> elements. The actual class elements would correspond to type
>>> system of the specific data binding used.
>> I was chatting with Raymond at OSCON about metadata for the data
>> binding framework and I think that is relevant here. We talked
>> about representing the data being bound using three pieces of
>> information:
>> * the physical Java class in use in the runtime
>> * a logical identifier for the data type
>> * metadata defining the association between the two
>> The physical class is Java because the runtime is written in Java
>> so we need to pass around Java Objects. In terms of data binding
>> this would be the Class of the actual object that was passed to
>> the binding framework. This may be a user supplied Object, but
>> may also be some other representation of it such as a DataObject,
>> a Document, an XMLStreamReader or an InputStream.
>> The logical identifier is used to describe the data that is
>> represented by the physical object. If the type scheme is "Java"
>> then this would be the same Class as that used for the physical
>> type. For XML type schemes this would be something like the QName
>> of the type. This is used so that we know the type of object the
>> user is passing even when that is not apparent from the physical
>> form - for example, it would provide information about what ca be
>> read from a stream.
>> The metadata adds more information about the object that can
>> provide hints about the format that would factor into the binding
>> frameworks choice of technology. For example, it may provide the
>> size on a stream which might be used by the framework to decide
>> between a technology that would pull the stream content into
>> memory for random access vs. one that would keep it on the stream
>> or spool it to disk. It may also provide user hints - for
>> example, that although the user had specified an actual Java
>> interface for the physical object they also wanted the
>> implementation to be cross-castable to DataObject.
>> I think this ties into the service contract as this metadata
>> should be used to represent the parameters to the operation
>> rather than a simple collection of Class elements. Something like:
>> class DataType<P, L> {
>> Class<P> physical;
>> L logical;
>> Map<String, Object> metadata;
>> }
>> class Operation {
>> String name;
>> DataType<?,?> returnType;
>> List<DataType<?,?>> parameterTypes;
>> boolean nonBlocking;
>> }
>> class ServiceContract {
>> Class<?> interfaceClass; // optional, used if there is an
>> actual interface for this contract
>> Class<?> callbackClass; // optional, used if there is an
>> actual interface for the callback
>> List<Operation> operations;
>> List<Operation> callbackOperations;
>> }
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Refactoring of Service Contracts
Posted by Raymond Feng <en...@gmail.com>.
Hi,
The ServiceContract abstraction sounds good to me. One comment:
For the Operation, I thin we need to add a list of fault types.
List<DataType<?,?>> faultTypes;
Thanks,
Raymond
----- Original Message -----
From: "Jeremy Boynes" <jb...@apache.org>
To: <tu...@ws.apache.org>
Sent: Wednesday, August 09, 2006 10:50 PM
Subject: Re: Refactoring of Service Contracts
> On Aug 9, 2006, at 8:16 PM, Jim Marino wrote:
>>
>> Another issue that has come up is representation of data binding
>> types for parameters. We could perhaps have a generic
>> representation of an operation, Operation, that has a
>> getParameterTypes() which returns a collection of Class elements.
>> The actual class elements would correspond to type system of the
>> specific data binding used.
>
> I was chatting with Raymond at OSCON about metadata for the data
> binding framework and I think that is relevant here. We talked about
> representing the data being bound using three pieces of information:
> * the physical Java class in use in the runtime
> * a logical identifier for the data type
> * metadata defining the association between the two
>
> The physical class is Java because the runtime is written in Java so
> we need to pass around Java Objects. In terms of data binding this
> would be the Class of the actual object that was passed to the
> binding framework. This may be a user supplied Object, but may also
> be some other representation of it such as a DataObject, a Document,
> an XMLStreamReader or an InputStream.
>
> The logical identifier is used to describe the data that is
> represented by the physical object. If the type scheme is "Java" then
> this would be the same Class as that used for the physical type. For
> XML type schemes this would be something like the QName of the type.
> This is used so that we know the type of object the user is passing
> even when that is not apparent from the physical form - for example,
> it would provide information about what ca be read from a stream.
>
> The metadata adds more information about the object that can provide
> hints about the format that would factor into the binding frameworks
> choice of technology. For example, it may provide the size on a
> stream which might be used by the framework to decide between a
> technology that would pull the stream content into memory for random
> access vs. one that would keep it on the stream or spool it to disk.
> It may also provide user hints - for example, that although the user
> had specified an actual Java interface for the physical object they
> also wanted the implementation to be cross-castable to DataObject.
>
> I think this ties into the service contract as this metadata should
> be used to represent the parameters to the operation rather than a
> simple collection of Class elements. Something like:
>
> class DataType<P, L> {
> Class<P> physical;
> L logical;
> Map<String, Object> metadata;
> }
>
> class Operation {
> String name;
> DataType<?,?> returnType;
> List<DataType<?,?>> parameterTypes;
> boolean nonBlocking;
> }
>
> class ServiceContract {
> Class<?> interfaceClass; // optional, used if there is an actual
> interface for this contract
> Class<?> callbackClass; // optional, used if there is an actual
> interface for the callback
> List<Operation> operations;
> List<Operation> callbackOperations;
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: Refactoring of Service Contracts
Posted by Jeremy Boynes <jb...@apache.org>.
On Aug 9, 2006, at 8:16 PM, Jim Marino wrote:
>
> Another issue that has come up is representation of data binding
> types for parameters. We could perhaps have a generic
> representation of an operation, Operation, that has a
> getParameterTypes() which returns a collection of Class elements.
> The actual class elements would correspond to type system of the
> specific data binding used.
I was chatting with Raymond at OSCON about metadata for the data
binding framework and I think that is relevant here. We talked about
representing the data being bound using three pieces of information:
* the physical Java class in use in the runtime
* a logical identifier for the data type
* metadata defining the association between the two
The physical class is Java because the runtime is written in Java so
we need to pass around Java Objects. In terms of data binding this
would be the Class of the actual object that was passed to the
binding framework. This may be a user supplied Object, but may also
be some other representation of it such as a DataObject, a Document,
an XMLStreamReader or an InputStream.
The logical identifier is used to describe the data that is
represented by the physical object. If the type scheme is "Java" then
this would be the same Class as that used for the physical type. For
XML type schemes this would be something like the QName of the type.
This is used so that we know the type of object the user is passing
even when that is not apparent from the physical form - for example,
it would provide information about what ca be read from a stream.
The metadata adds more information about the object that can provide
hints about the format that would factor into the binding frameworks
choice of technology. For example, it may provide the size on a
stream which might be used by the framework to decide between a
technology that would pull the stream content into memory for random
access vs. one that would keep it on the stream or spool it to disk.
It may also provide user hints - for example, that although the user
had specified an actual Java interface for the physical object they
also wanted the implementation to be cross-castable to DataObject.
I think this ties into the service contract as this metadata should
be used to represent the parameters to the operation rather than a
simple collection of Class elements. Something like:
class DataType<P, L> {
Class<P> physical;
L logical;
Map<String, Object> metadata;
}
class Operation {
String name;
DataType<?,?> returnType;
List<DataType<?,?>> parameterTypes;
boolean nonBlocking;
}
class ServiceContract {
Class<?> interfaceClass; // optional, used if there is an actual
interface for this contract
Class<?> callbackClass; // optional, used if there is an actual
interface for the callback
List<Operation> operations;
List<Operation> callbackOperations;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org