You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by amit patel <am...@gmail.com> on 2009/12/04 01:20:56 UTC
tuscany 2 and SCADomain
I am using tuscany 2.0-M4 to run ram's sample from here
http://svn.apache.org/repos/asf/tuscany/sandbox/ramkumar/helloworld-ws-reference/
I can't find the SCADomain class, is it deprecated? what should I use now?
Is there an equivalent sample for tuscany 2?
*
public* *class* HelloWorldClient {
*public* *final* *static* *void* main(String[] args) *throws* Exception {
SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
HelloWorldService helloWorldService =
scaDomain.getService(HelloWorldService.*class*, "HelloWorldServiceComponent"
);
OMFactory fac = OMAbstractFactory.*getOMFactory*();
OMElement imageElement = fac.createOMElement("image", *null*);
// Creating the Data Handler for the file.
DataHandler dataHandler = *new* DataHandler(*new* FileDataSource(
"C:/attachedfile.jpg"));
//create an OMText node with the above DataHandler and set optimized to true
OMText textData = fac.createOMText(dataHandler, *true*);
imageElement.addChild(textData);
String value = helloWorldService.getGreetings("attachedfile.jpg",
imageElement);
System.*out*.println(value);
scaDomain.close();
}
}
Re: tuscany 2 and SCADomain
Posted by amit patel <am...@gmail.com>.
i found this
http://cwiki.apache.org/TUSCANYxDOCx2x/converting-tuscany-1x-extensions.html
Changed client code to
String contribution = ContributionLocationHelper.*getContributionLocation*
(HelloWorldService.*class*);
Node node = NodeFactory.*newInstance*().createNode(
"helloworldwsclient.composite",
*new* Contribution("test", contribution));
node.start();
HelloWorldService helloWorldService = node.getService(HelloWorldService.*
class*, "HelloTuscanyServiceComponent");
And Now I got hit by the bug
http://issues.apache.org/jira/browse/TUSCANY-2664
Is there a workaround?
Thanks
Dec 4, 2009 10:23:32 AM
org.apache.tuscany.sca.core.assembly.impl.EndpointRegistryImpl addEndpoint
INFO: Add endpoint - (@622863648)Endpoint: URI =
HelloWorldServiceComponent#service-binding(HelloWorldService/HelloWorldService)
class org.apache.axiom.om.impl.llom.OMElementImpl
class org.apache.axiom.om.impl.llom.OMTextImpl
Injected helloWorldService
Called getGreetings
Exception in thread "main" *java.lang.IllegalArgumentException*:
Pass-by-value is not supported for the given object: *
org.apache.tuscany.sca.databinding.TransformationException
*
at org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding.copy(*
JavaBeansDataBinding.java:128*)
at
org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint$LazyDataBinding.copy(
*DefaultDataBindingExtensionPoint.java:169*)
Re: tuscany 2 and SCADomain
Posted by Raymond Feng <en...@gmail.com>.
Similar as the service side:
Node node = NodeFactory.newInstance().createNode(""helloworldwsclient.composite", this.getClass().getClassLoader()).start();
HelloWorldService helloWorldService = node.getService(HelloWorldService.class, "HelloWorldServiceComponent");
...
From: amit patel
Sent: Friday, December 04, 2009 8:02 AM
To: user@tuscany.apache.org ; antelder@apache.org
Subject: Re: tuscany 2 and SCADomain
Thanks!
So I was able to start the service
Now what do I change the client code to?
SCADomain scaDomain = SCADomain.newInstance(
"helloworldwsclient.composite");
HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.
class, "HelloWorldServiceComponent");
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement imageElement = fac.createOMElement(
"image", null);
// Creating the Data Handler for the file.
DataHandler dataHandler =
new DataHandler(new FileDataSource("C:/attachedfile.jpg"));
//create an OMText node with the above DataHandler and set optimized to true
OMText textData = fac.createOMText(dataHandler,
true);
imageElement.addChild(textData);
String value = helloWorldService.getGreetings(
"attachedfile.jpg", imageElement);
System.
out.println(value);
scaDomain.close();
Re: tuscany 2 and SCADomain
Posted by amit patel <am...@gmail.com>.
Thanks!
So I was able to start the service
Now what do I change the client code to?
SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
HelloWorldService helloWorldService =
scaDomain.getService(HelloWorldService.*class*, "HelloWorldServiceComponent"
);
OMFactory fac = OMAbstractFactory.*getOMFactory*();
OMElement imageElement = fac.createOMElement("image", *null*);
// Creating the Data Handler for the file.
DataHandler dataHandler = *new* DataHandler(*new* FileDataSource(
"C:/attachedfile.jpg"));
//create an OMText node with the above DataHandler and set optimized to true
OMText textData = fac.createOMText(dataHandler, *true*);
imageElement.addChild(textData);
String value = helloWorldService.getGreetings("attachedfile.jpg",
imageElement);
System.*out*.println(value);
scaDomain.close();
Re: tuscany 2 and SCADomain
Posted by ant elder <an...@gmail.com>.
Or even better just use call createNode with the explicit contribution
location, for example:
Node node = NodeFactory.newInstance().createNode(null, new
String[] {"target/classes"}).start();
I'd like to get that API simplified even further but have't got to it
yet, so you should be able to just do:
Node node =
NodeFactory.newInstance().createNode("target/classes").start();
...ant
On Fri, Dec 4, 2009 at 1:40 AM, Raymond Feng <en...@gmail.com> wrote:
> Please use NodeFactory/Node APIs instead. For example,
>
> String location =
> ContributionLocationHelper.getContributionLocation(SampleClient.class);
> Node node = NodeFactory.newInstance().createNode(new
> Contribution("c1", location));
>
> node.start();
>
> SampleClient sampleClient = node.getService(SampleClient.class,
> "SampleClient");
> sampleClient.runSample();
> Thanks,
> Raymond
> From: amit patel
> Sent: Thursday, December 03, 2009 4:20 PM
> To: user@tuscany.apache.org
> Subject: tuscany 2 and SCADomain
> I am using tuscany 2.0-M4 to run ram's sample from here
>
> http://svn.apache.org/repos/asf/tuscany/sandbox/ramkumar/helloworld-ws-reference/
>
> I can't find the SCADomain class, is it deprecated? what should I use now?
> Is there an equivalent sample for tuscany 2?
>
>
> public
>
> class HelloWorldClient {
>
> public final static void main(String[] args) throws Exception {
>
> SCADomain scaDomain = SCADomain.newInstance(
>
> "helloworldwsclient.composite");
>
> HelloWorldService helloWorldService =
> scaDomain.getService(HelloWorldService.
>
> class, "HelloWorldServiceComponent");
>
> OMFactory fac = OMAbstractFactory.getOMFactory();
>
> OMElement imageElement = fac.createOMElement(
>
> "image", null);
>
> // Creating the Data Handler for the file.
>
> DataHandler dataHandler =
>
> new DataHandler(new FileDataSource("C:/attachedfile.jpg"));
>
> //create an OMText node with the above DataHandler and set optimized to true
>
> OMText textData = fac.createOMText(dataHandler,
>
> true);
>
> imageElement.addChild(textData);
>
> String value = helloWorldService.getGreetings(
>
> "attachedfile.jpg", imageElement);
>
> System.
>
> out.println(value);
>
> scaDomain.close();
>
> }
>
> }
Re: tuscany 2 and SCADomain
Posted by Raymond Feng <en...@gmail.com>.
Please use NodeFactory/Node APIs instead. For example,
String location = ContributionLocationHelper.getContributionLocation(SampleClient.class);
Node node = NodeFactory.newInstance().createNode(new Contribution("c1", location));
node.start();
SampleClient sampleClient = node.getService(SampleClient.class, "SampleClient");
sampleClient.runSample();
Thanks,
Raymond
From: amit patel
Sent: Thursday, December 03, 2009 4:20 PM
To: user@tuscany.apache.org
Subject: tuscany 2 and SCADomain
I am using tuscany 2.0-M4 to run ram's sample from here
http://svn.apache.org/repos/asf/tuscany/sandbox/ramkumar/helloworld-ws-reference/
I can't find the SCADomain class, is it deprecated? what should I use now?
Is there an equivalent sample for tuscany 2?
public
class HelloWorldClient {
public final static void main(String[] args) throws Exception {
SCADomain scaDomain = SCADomain.newInstance(
"helloworldwsclient.composite");
HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.
class, "HelloWorldServiceComponent");
OMFactory fac = OMAbstractFactory.getOMFactory();
OMElement imageElement = fac.createOMElement(
"image", null);
// Creating the Data Handler for the file.
DataHandler dataHandler =
new DataHandler(new FileDataSource("C:/attachedfile.jpg"));
//create an OMText node with the above DataHandler and set optimized to true
OMText textData = fac.createOMText(dataHandler,
true);
imageElement.addChild(textData);
String value = helloWorldService.getGreetings(
"attachedfile.jpg", imageElement);
System.
out.println(value);
scaDomain.close();
}
}