You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Peizhao Hu <pe...@itee.uq.edu.au> on 2007/07/13 04:44:57 UTC

Can anyone show me example of a simple scenario?

Hi,

I want to achieve the following tasks in Tuscany. However, not quite 
sure which sample I really should look into. Can anyone point me to the 
right direction?

I want to write implementation for two components where each component 
take one input and generate one output. Imagine that these components 
are generic function, therefore, composition of these components is done 
by writing the composite file, which wires component's service(as 
output) and reference(as input) together.

is there any simple example for this scenario?

In the Tuscany samples, such as bigbank, it seems to me that composite 
service needs to have knowledge about the component service they are 
going to reference. but in my case, I want all component to be generic, 
and be able to dynamically compose by defining the composite file of 
what components to use.

not sure whether the SCA is a better way to do this? any idea or comment?

-- 
regards;

Peizhao


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Can anyone show me example of a simple scenario?

Posted by Simon Laws <si...@googlemail.com>.
On 7/13/07, Peizhao Hu <pe...@itee.uq.edu.au> wrote:
>
> Hi
>
> Sorry for any confusion, here are an abstract example of what I am
> trying to do.
>
> I would like to treat each component as a function as the followings:
>
> ComponentA(x) :=>  x + 2
> ComponentB(y) :=>  y * 3
>
> and I would like a composite file to dynamically compose them, for
> example:
>
> ComponentB(ComponentA(100)) you get (100+2)*3
> where
> ComponentA(ComponentB(100)) you get (100*3)+2
>
> In my actually design, each component is a data processing module for
> computing raw sensor data, so I want the SCA to dynamically compose
> these component for me according to a description similar to the
> composite. I won't need to autowire option.
>
> many thanks
>
>
> Raymond Feng wrote:
> > Hi,
> >
> > Please see my comments inline.
> >
> > Thanks,
> > Raymond
> >
> > ----- Original Message ----- From: "Peizhao Hu" <pe...@itee.uq.edu.au>
> > To: <tu...@ws.apache.org>
> > Sent: Thursday, July 12, 2007 7:44 PM
> > Subject: Can anyone show me example of a simple scenario?
> >
> >
> >> Hi,
> >>
> >> I want to achieve the following tasks in Tuscany. However, not quite
> >> sure which sample I really should look into. Can anyone point me to
> >> the right direction?
> >>
> >> I want to write implementation for two components where each
> >> component take one input and generate one output. Imagine that these
> >> components are generic function, therefore, composition of these
> >> components is done by writing the composite file, which wires
> >> component's service(as output) and reference(as input) together.
> >
> > It seems that you want implement some mediation logic, am I right? You
> > could define a generic interface or take advantage of the "any"
> > interface (org.apache.tuscany.sca.interfacedef.Interface, if
> > isDynamic() returns true).
> >
> >>
> >> is there any simple example for this scenario?
> >>
> >> In the Tuscany samples, such as bigbank, it seems to me that
> >> composite service needs to have knowledge about the component service
> >> they are going to reference. but in my case, I want all component to
> >> be generic, and be able to dynamically compose by defining the
> >> composite file of what components to use.
> >>
> >
> > What are the criteria for your composition? SCA spec defines the
> > wiring between a component reference and component service by the
> > interface compatibility. Components can also be autowired by the
> > runtime. Do you just want to programatically wire the components
> > together or do you expect the Tuscany runtime to wire things based on
> > the metadata (such as business semantics, service-level agreement)?
> >
> >> not sure whether the SCA is a better way to do this? any idea or
> >> comment?
> >>
> >> --
> >> regards;
> >>
> >> Peizhao
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> >>
> >
>
> --
> regards;
>
> Peizhao
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>
> Hi, doing a bit of mail tidying an notice you didn't get an answer to
this. The secret to what you need is to ensure that the interfaces of the
components you are building are composable in any order. In the real world,
with sensor data the physical interface is the air or a wire but you have to
understand the signals going through the wire/air in order that each
processor can successfully process them.

In your expression example the fundamental  interface you have is

interface MathComponent {
    int process(int number);
}

Assuming you wanted the result to be returned. The component implementations
could then look something like

class AddComponent implements MathComponent {
    @Reference
    protected nextComponent;

    int process(int number){
       if ( nextComponent != null) {
           return nextComponent.process(number) + 2;
       } else {
           return number + 2;
       }
   }
}

and of course you would write a multiply component along the same lines
(Note. I just typed this code in here so don't expect it tocompile :-). Then
you can wire them together as you please.

<component name="AddComponent>
   <implemenation.java class="AddComponent"/>
   <reference name="nextComponent" target="MultipleComponent"/>
</component>

<component name="MultipleComponent>
   <implemenation.java class="MultiplyComponent"/>
</component>

It would make a great sample for Tuscany if you were happy to make these
classes for real and contribute them.

Regards

Simon

Re: Can anyone show me example of a simple scenario?

Posted by Peizhao Hu <pe...@itee.uq.edu.au>.
Hi

Sorry for any confusion, here are an abstract example of what I am 
trying to do.

I would like to treat each component as a function as the followings:

ComponentA(x) :=>  x + 2
ComponentB(y) :=>  y * 3

and I would like a composite file to dynamically compose them, for example:

ComponentB(ComponentA(100)) you get (100+2)*3
where
ComponentA(ComponentB(100)) you get (100*3)+2

In my actually design, each component is a data processing module for 
computing raw sensor data, so I want the SCA to dynamically compose 
these component for me according to a description similar to the 
composite. I won't need to autowire option.

many thanks


Raymond Feng wrote:
> Hi,
>
> Please see my comments inline.
>
> Thanks,
> Raymond
>
> ----- Original Message ----- From: "Peizhao Hu" <pe...@itee.uq.edu.au>
> To: <tu...@ws.apache.org>
> Sent: Thursday, July 12, 2007 7:44 PM
> Subject: Can anyone show me example of a simple scenario?
>
>
>> Hi,
>>
>> I want to achieve the following tasks in Tuscany. However, not quite 
>> sure which sample I really should look into. Can anyone point me to 
>> the right direction?
>>
>> I want to write implementation for two components where each 
>> component take one input and generate one output. Imagine that these 
>> components are generic function, therefore, composition of these 
>> components is done by writing the composite file, which wires 
>> component's service(as output) and reference(as input) together.
>
> It seems that you want implement some mediation logic, am I right? You 
> could define a generic interface or take advantage of the "any" 
> interface (org.apache.tuscany.sca.interfacedef.Interface, if 
> isDynamic() returns true).
>
>>
>> is there any simple example for this scenario?
>>
>> In the Tuscany samples, such as bigbank, it seems to me that 
>> composite service needs to have knowledge about the component service 
>> they are going to reference. but in my case, I want all component to 
>> be generic, and be able to dynamically compose by defining the 
>> composite file of what components to use.
>>
>
> What are the criteria for your composition? SCA spec defines the 
> wiring between a component reference and component service by the 
> interface compatibility. Components can also be autowired by the 
> runtime. Do you just want to programatically wire the components 
> together or do you expect the Tuscany runtime to wire things based on 
> the metadata (such as business semantics, service-level agreement)?
>
>> not sure whether the SCA is a better way to do this? any idea or 
>> comment?
>>
>> -- 
>> regards;
>>
>> Peizhao
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-user-help@ws.apache.org
>>
>

-- 
regards;

Peizhao


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Re: Can anyone show me example of a simple scenario?

Posted by shaoguang geng <ge...@yahoo.com>.
Hi, around your question, I may suggest the samples/calculator to you. It is very easy to enjoy. Since your scenario is not clear, I can not write more info here. Any way, samples/calculator is to be used in one JVM, if you are working in a distributed environment, I may suggent you something more, it depends on you.
   
  Good Luck.

Raymond Feng <en...@gmail.com> wrote:
  Hi,

Please see my comments inline.

Thanks,
Raymond

----- Original Message ----- 
From: "Peizhao Hu" 

To: 
Sent: Thursday, July 12, 2007 7:44 PM
Subject: Can anyone show me example of a simple scenario?


> Hi,
>
> I want to achieve the following tasks in Tuscany. However, not quite sure 
> which sample I really should look into. Can anyone point me to the right 
> direction?
>
> I want to write implementation for two components where each component 
> take one input and generate one output. Imagine that these components are 
> generic function, therefore, composition of these components is done by 
> writing the composite file, which wires component's service(as output) and 
> reference(as input) together.

It seems that you want implement some mediation logic, am I right? You could 
define a generic interface or take advantage of the "any" interface 
(org.apache.tuscany.sca.interfacedef.Interface, if isDynamic() returns 
true).

>
> is there any simple example for this scenario?
>
> In the Tuscany samples, such as bigbank, it seems to me that composite 
> service needs to have knowledge about the component service they are going 
> to reference. but in my case, I want all component to be generic, and be 
> able to dynamically compose by defining the composite file of what 
> components to use.
>

What are the criteria for your composition? SCA spec defines the wiring 
between a component reference and component service by the interface 
compatibility. Components can also be autowired by the runtime. Do you just 
want to programatically wire the components together or do you expect the 
Tuscany runtime to wire things based on the metadata (such as business 
semantics, service-level agreement)?

> not sure whether the SCA is a better way to do this? any idea or comment?
>
> -- 
> regards;
>
> Peizhao
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org



  
---------------------------------
Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  

Re: Can anyone show me example of a simple scenario?

Posted by Raymond Feng <en...@gmail.com>.
Hi,

Please see my comments inline.

Thanks,
Raymond

----- Original Message ----- 
From: "Peizhao Hu" <pe...@itee.uq.edu.au>
To: <tu...@ws.apache.org>
Sent: Thursday, July 12, 2007 7:44 PM
Subject: Can anyone show me example of a simple scenario?


> Hi,
>
> I want to achieve the following tasks in Tuscany. However, not quite sure 
> which sample I really should look into. Can anyone point me to the right 
> direction?
>
> I want to write implementation for two components where each component 
> take one input and generate one output. Imagine that these components are 
> generic function, therefore, composition of these components is done by 
> writing the composite file, which wires component's service(as output) and 
> reference(as input) together.

It seems that you want implement some mediation logic, am I right? You could 
define a generic interface or take advantage of the "any" interface 
(org.apache.tuscany.sca.interfacedef.Interface, if isDynamic() returns 
true).

>
> is there any simple example for this scenario?
>
> In the Tuscany samples, such as bigbank, it seems to me that composite 
> service needs to have knowledge about the component service they are going 
> to reference. but in my case, I want all component to be generic, and be 
> able to dynamically compose by defining the composite file of what 
> components to use.
>

What are the criteria for your composition? SCA spec defines the wiring 
between a component reference and component service by the interface 
compatibility. Components can also be autowired by the runtime. Do you just 
want to programatically wire the components together or do you expect the 
Tuscany runtime to wire things based on the metadata (such as business 
semantics, service-level agreement)?

> not sure whether the SCA is a better way to do this? any idea or comment?
>
> -- 
> regards;
>
> Peizhao
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org