You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by muhwas <mu...@yahoo.com> on 2007/04/13 18:41:59 UTC

using service name to call a service

Hi guys,

I was wondering if there is any way to get a reference
to web service interface using service name (in SCDL
file) only instead of doing

compositeContext.locateService(ClassName.class,"composite")

thank you,
muhwas

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


Re: using service name to call a service

Posted by muhwas <mu...@yahoo.com>.
I was trying to isolate the tuscany related code from
client code and move the tuscany related code that is
CompositeContext, locateService etc in common service
factory. Then client can call the service using the
service name only. Before i tried to pass the
bussiness interface also because client knows it but i
couldn't cast it to the java.lang.Object and and i
didn't want to hard code the type because this is
common service factory can be use for many different
service with different interface type. 

--- scabooz <sc...@gmail.com> wrote:

> Hi Muhwas,
> 
> I'm somewhat interested in this topic, so if you
> don't
> mind I have another question.  I'm not understanding
> why it was important for you not pass the interface
> class when it seems the intended interface was
> known.
> 
> I'm asking because I'm very interested in making
> sure that
> I have all the use cases related to dynamically
> obtaining
> service references.
> 
> thanks,
> Dave
> 
> ----- Original Message ----- 
> From: "muhwas" <mu...@yahoo.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, April 19, 2007 3:00 PM
> Subject: Re: using service name to call a service
> 
> 
> >I have tried that and it worked fine if you just
> pass
> > the java.lang.Object.class and service name. I was
> > writing a common service factory which return the
> > service bussiness interface with service name
> only.
> > and the client know which interface class it cast
> too
> > :)
> > --- scabooz <sc...@gmail.com> wrote:
> > 
> >> Muhwas,
> >> 
> >> Your objection to the locateService API seems to
> be
> >> the need to pass the business interface class. As
> >> Simon
> >> noted, this doesn't go away with the new v1.0
> API.
> >> 
> >> If the business interface were not passed as a
> >> parameter,
> >> what interface would you expect the returned
> proxy
> >> to implement?
> >> 
> >> Dave
> >> 
> >> 
> >> ----- Original Message ----- 
> >> From: "Simon Laws" <si...@googlemail.com>
> >> To: <tu...@ws.apache.org>
> >> Sent: Thursday, April 19, 2007 7:35 AM
> >> Subject: Re: using service name to call a service
> >> 
> >> 
> >> > On 4/13/07, muhwas <mu...@yahoo.com> wrote:
> >> >>
> >> >> Hi guys,
> >> >>
> >> >> I was wondering if there is any way to get a
> >> reference
> >> >> to web service interface using service name
> (in
> >> SCDL
> >> >> file) only instead of doing
> >> >>
> >> >>
> >>
> >
>
compositeContext.locateService(ClassName.class,"composite")
> >> >>
> >> >> thank you,
> >> >> muhwas
> >> >>
> >> >>
> >>
> >
>
---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail:
> >> tuscany-dev-unsubscribe@ws.apache.org
> >> >> For additional commands, e-mail:
> >> tuscany-dev-help@ws.apache.org
> >> >>
> >> >> Hi Muhwas
> >> >
> >> > I'm not sure what the options were on M2. In
> the
> >> latest software (in the
> >> > trunk of our svn respository) we are moving to
> >> implement V1.0 of the SCA
> >> > specifications. The emphasis here is on
> component
> >> context although how a
> >> > component context is obtained is not specified.
> In
> >> the trunk 
> >> > implementation
> >> > we currently have an embedded host container
> that
> >> allows a component 
> >> > context
> >> > to be returned in the following way.
> >> >
> >> > SCARuntime.start("my.composite");
> >> > ComponentContext context =
> >> SCARuntime.getComponentContext
> >> > ("MyComponentName");
> >> >
> >> > From there the spec says that you should be
> able
> >> to do (not sure it quite
> >> > works like this yet)
> >> >
> >> > MyService service =
> >> context.getService(MyService.class,
> >> "MyServiceName");
> >> >
> >> > I know this doesn't answer your question re. M2
> >> but hopefully gives you an
> >> > idea of where we are going.
> >> >
> >> > Regards
> >> >
> >> > Simon
> >> > 
> >> 
> >> 
> >>
> >
>
---------------------------------------------------------------------
> >> 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
> 
> 


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


Re: using service name to call a service

Posted by scabooz <sc...@gmail.com>.
Hi Muhwas,

I'm somewhat interested in this topic, so if you don't
mind I have another question.  I'm not understanding
why it was important for you not pass the interface
class when it seems the intended interface was known.

I'm asking because I'm very interested in making sure that
I have all the use cases related to dynamically obtaining
service references.

thanks,
Dave

----- Original Message ----- 
From: "muhwas" <mu...@yahoo.com>
To: <tu...@ws.apache.org>
Sent: Thursday, April 19, 2007 3:00 PM
Subject: Re: using service name to call a service


>I have tried that and it worked fine if you just pass
> the java.lang.Object.class and service name. I was
> writing a common service factory which return the
> service bussiness interface with service name only.
> and the client know which interface class it cast too
> :)
> --- scabooz <sc...@gmail.com> wrote:
> 
>> Muhwas,
>> 
>> Your objection to the locateService API seems to be
>> the need to pass the business interface class. As
>> Simon
>> noted, this doesn't go away with the new v1.0 API.
>> 
>> If the business interface were not passed as a
>> parameter,
>> what interface would you expect the returned proxy
>> to implement?
>> 
>> Dave
>> 
>> 
>> ----- Original Message ----- 
>> From: "Simon Laws" <si...@googlemail.com>
>> To: <tu...@ws.apache.org>
>> Sent: Thursday, April 19, 2007 7:35 AM
>> Subject: Re: using service name to call a service
>> 
>> 
>> > On 4/13/07, muhwas <mu...@yahoo.com> wrote:
>> >>
>> >> Hi guys,
>> >>
>> >> I was wondering if there is any way to get a
>> reference
>> >> to web service interface using service name (in
>> SCDL
>> >> file) only instead of doing
>> >>
>> >>
>>
> compositeContext.locateService(ClassName.class,"composite")
>> >>
>> >> thank you,
>> >> muhwas
>> >>
>> >>
>>
> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail:
>> tuscany-dev-unsubscribe@ws.apache.org
>> >> For additional commands, e-mail:
>> tuscany-dev-help@ws.apache.org
>> >>
>> >> Hi Muhwas
>> >
>> > I'm not sure what the options were on M2. In the
>> latest software (in the
>> > trunk of our svn respository) we are moving to
>> implement V1.0 of the SCA
>> > specifications. The emphasis here is on component
>> context although how a
>> > component context is obtained is not specified. In
>> the trunk 
>> > implementation
>> > we currently have an embedded host container that
>> allows a component 
>> > context
>> > to be returned in the following way.
>> >
>> > SCARuntime.start("my.composite");
>> > ComponentContext context =
>> SCARuntime.getComponentContext
>> > ("MyComponentName");
>> >
>> > From there the spec says that you should be able
>> to do (not sure it quite
>> > works like this yet)
>> >
>> > MyService service =
>> context.getService(MyService.class,
>> "MyServiceName");
>> >
>> > I know this doesn't answer your question re. M2
>> but hopefully gives you an
>> > idea of where we are going.
>> >
>> > Regards
>> >
>> > Simon
>> > 
>> 
>> 
>>
> ---------------------------------------------------------------------
>> 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: using service name to call a service

Posted by muhwas <mu...@yahoo.com>.
I have tried that and it worked fine if you just pass
the java.lang.Object.class and service name. I was
writing a common service factory which return the
service bussiness interface with service name only.
and the client know which interface class it cast too
:)
--- scabooz <sc...@gmail.com> wrote:

> Muhwas,
> 
> Your objection to the locateService API seems to be
> the need to pass the business interface class. As
> Simon
> noted, this doesn't go away with the new v1.0 API.
> 
> If the business interface were not passed as a
> parameter,
> what interface would you expect the returned proxy
> to implement?
> 
> Dave
> 
> 
> ----- Original Message ----- 
> From: "Simon Laws" <si...@googlemail.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, April 19, 2007 7:35 AM
> Subject: Re: using service name to call a service
> 
> 
> > On 4/13/07, muhwas <mu...@yahoo.com> wrote:
> >>
> >> Hi guys,
> >>
> >> I was wondering if there is any way to get a
> reference
> >> to web service interface using service name (in
> SCDL
> >> file) only instead of doing
> >>
> >>
>
compositeContext.locateService(ClassName.class,"composite")
> >>
> >> thank you,
> >> muhwas
> >>
> >>
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> tuscany-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail:
> tuscany-dev-help@ws.apache.org
> >>
> >> Hi Muhwas
> >
> > I'm not sure what the options were on M2. In the
> latest software (in the
> > trunk of our svn respository) we are moving to
> implement V1.0 of the SCA
> > specifications. The emphasis here is on component
> context although how a
> > component context is obtained is not specified. In
> the trunk 
> > implementation
> > we currently have an embedded host container that
> allows a component 
> > context
> > to be returned in the following way.
> >
> > SCARuntime.start("my.composite");
> > ComponentContext context =
> SCARuntime.getComponentContext
> > ("MyComponentName");
> >
> > From there the spec says that you should be able
> to do (not sure it quite
> > works like this yet)
> >
> > MyService service =
> context.getService(MyService.class,
> "MyServiceName");
> >
> > I know this doesn't answer your question re. M2
> but hopefully gives you an
> > idea of where we are going.
> >
> > Regards
> >
> > Simon
> > 
> 
> 
>
---------------------------------------------------------------------
> 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: using service name to call a service

Posted by Mike Edwards <mi...@gmail.com>.
Muhwas,

I dont understand what you are saying here.

Surely, the actual service has a specific interface - it isn't simply 
"anything", so you can only cast to the actual business interface it 
actually implements.

Or did you envisage your client code introspecting the returned service 
proxy and dealing with whatever it found?  The latter case is possible 
but it is not a pattern I would encourage people to use - the code is 
likely to get very complex.  I can see a possible use for it in writing 
test clients, where the parameters are actually presented in a GUI for a 
user to fill dynamically.  However, this is not typical of real business 
code.


Yours,  Mike.

muhwas wrote:
> by the way i used this
> 
> CompositeContext compositeContext =
> CurrentCompositeContext.getContext();
> // get service reference using service component name
> in client side default.scdl
> return
> compositeContext.locateService(java.lang.Object.class,serviceName);
> 
> and then i casted it to what ever interface type i
> want to. so i think passing in interface doesn't
> nessasary.
> 
> --- scabooz <sc...@gmail.com> wrote:
> 

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


Re: using service name to call a service

Posted by muhwas <mu...@yahoo.com>.
by the way i used this

CompositeContext compositeContext =
CurrentCompositeContext.getContext();
// get service reference using service component name
in client side default.scdl
return
compositeContext.locateService(java.lang.Object.class,serviceName);

and then i casted it to what ever interface type i
want to. so i think passing in interface doesn't
nessasary.

--- scabooz <sc...@gmail.com> wrote:

> Muhwas,
> 
> Your objection to the locateService API seems to be
> the need to pass the business interface class. As
> Simon
> noted, this doesn't go away with the new v1.0 API.
> 
> If the business interface were not passed as a
> parameter,
> what interface would you expect the returned proxy
> to implement?
> 
> Dave
> 
> 
> ----- Original Message ----- 
> From: "Simon Laws" <si...@googlemail.com>
> To: <tu...@ws.apache.org>
> Sent: Thursday, April 19, 2007 7:35 AM
> Subject: Re: using service name to call a service
> 
> 
> > On 4/13/07, muhwas <mu...@yahoo.com> wrote:
> >>
> >> Hi guys,
> >>
> >> I was wondering if there is any way to get a
> reference
> >> to web service interface using service name (in
> SCDL
> >> file) only instead of doing
> >>
> >>
>
compositeContext.locateService(ClassName.class,"composite")
> >>
> >> thank you,
> >> muhwas
> >>
> >>
>
---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
> tuscany-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail:
> tuscany-dev-help@ws.apache.org
> >>
> >> Hi Muhwas
> >
> > I'm not sure what the options were on M2. In the
> latest software (in the
> > trunk of our svn respository) we are moving to
> implement V1.0 of the SCA
> > specifications. The emphasis here is on component
> context although how a
> > component context is obtained is not specified. In
> the trunk 
> > implementation
> > we currently have an embedded host container that
> allows a component 
> > context
> > to be returned in the following way.
> >
> > SCARuntime.start("my.composite");
> > ComponentContext context =
> SCARuntime.getComponentContext
> > ("MyComponentName");
> >
> > From there the spec says that you should be able
> to do (not sure it quite
> > works like this yet)
> >
> > MyService service =
> context.getService(MyService.class,
> "MyServiceName");
> >
> > I know this doesn't answer your question re. M2
> but hopefully gives you an
> > idea of where we are going.
> >
> > Regards
> >
> > Simon
> > 
> 
> 
>
---------------------------------------------------------------------
> 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: using service name to call a service

Posted by scabooz <sc...@gmail.com>.
Muhwas,

Your objection to the locateService API seems to be
the need to pass the business interface class. As Simon
noted, this doesn't go away with the new v1.0 API.

If the business interface were not passed as a parameter,
what interface would you expect the returned proxy
to implement?

Dave


----- Original Message ----- 
From: "Simon Laws" <si...@googlemail.com>
To: <tu...@ws.apache.org>
Sent: Thursday, April 19, 2007 7:35 AM
Subject: Re: using service name to call a service


> On 4/13/07, muhwas <mu...@yahoo.com> wrote:
>>
>> Hi guys,
>>
>> I was wondering if there is any way to get a reference
>> to web service interface using service name (in SCDL
>> file) only instead of doing
>>
>> compositeContext.locateService(ClassName.class,"composite")
>>
>> thank you,
>> muhwas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>> Hi Muhwas
>
> I'm not sure what the options were on M2. In the latest software (in the
> trunk of our svn respository) we are moving to implement V1.0 of the SCA
> specifications. The emphasis here is on component context although how a
> component context is obtained is not specified. In the trunk 
> implementation
> we currently have an embedded host container that allows a component 
> context
> to be returned in the following way.
>
> SCARuntime.start("my.composite");
> ComponentContext context = SCARuntime.getComponentContext
> ("MyComponentName");
>
> From there the spec says that you should be able to do (not sure it quite
> works like this yet)
>
> MyService service = context.getService(MyService.class, "MyServiceName");
>
> I know this doesn't answer your question re. M2 but hopefully gives you an
> idea of where we are going.
>
> Regards
>
> Simon
> 


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


Re: using service name to call a service

Posted by Simon Laws <si...@googlemail.com>.
On 4/13/07, muhwas <mu...@yahoo.com> wrote:
>
> Hi guys,
>
> I was wondering if there is any way to get a reference
> to web service interface using service name (in SCDL
> file) only instead of doing
>
> compositeContext.locateService(ClassName.class,"composite")
>
> thank you,
> muhwas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Hi Muhwas

I'm not sure what the options were on M2. In the latest software (in the
trunk of our svn respository) we are moving to implement V1.0 of the SCA
specifications. The emphasis here is on component context although how a
component context is obtained is not specified. In the trunk implementation
we currently have an embedded host container that allows a component context
to be returned in the following way.

SCARuntime.start("my.composite");
ComponentContext context = SCARuntime.getComponentContext
("MyComponentName");

>From there the spec says that you should be able to do (not sure it quite
works like this yet)

MyService service = context.getService(MyService.class, "MyServiceName");

I know this doesn't answer your question re. M2 but hopefully gives you an
idea of where we are going.

Regards

Simon