Hi,
I just ran the test case against our trunk and 1.0 branch. It works as
expected: {http://mytest.com/}alculatorComposite is printed out.
The 1.0 RC2 code is now under review @
http://people.apache.org/~antelder/tuscany/1.0-RC2/.
Thanks,
Raymond
package test;
import java.io.StringReader;
import java.util.List;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
import org.apache.tuscany.sca.contribution.Contribution;
import org.apache.tuscany.sca.contribution.ContributionFactory;
import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
import
org.apache.tuscany.sca.contribution.service.impl.ContributionMetadataProcessor;
public class Temp {
public static void main(String[] args) throws Exception {
AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
ContributionFactory contributionFactory = new ContributionFactoryImpl();
ContributionMetadataProcessor processor =
new ContributionMetadataProcessor(assemblyFactory, contributionFactory,
null);
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<contribution
xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" "
+ "targetNamespace=\"http://myexample.com/\" "
+ "xmlns:test=\"http://mytest.com/\">"
+ "<deployable composite=\"test:CalculatorComposite\"/>"
+ "</contribution>";
XMLStreamReader reader =
XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
Contribution contribution = processor.read(reader);
List<Composite> composites = contribution.getDeployables();
for (Composite composite : composites)
System.out.println(composite.getName());
}
}
----- Original Message -----
From: "Andrew Mak" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, September 18, 2007 8:31 AM
Subject: Re: reading in sca-contribution.xml file
Thank you for your reply. I am using 0.99 Tuscany release. I am not
quite sure where to get 1.0 RC, if you can give me a pointer to it I can
sure give it a try.
Andrew
"Luciano Resende" <[EMAIL PROTECTED]>
09/18/2007 11:19 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: reading in sca-contribution.xml file
Let me lake a look at this later today, but have you tried the latest
code or a SCA 1.0 RC ? What's your result with one of this ?
On 9/18/07, Andrew Mak <[EMAIL PROTECTED]> wrote:
Hi,
Has anyone else run into this problem I'm seeing with reading in
contribution xml files? (please see my original post below) Is there
anything wrong with my test program?
Thanks in advance.
Andrew
Andrew Mak/Toronto/[EMAIL PROTECTED]
09/13/2007 08:34 PM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: reading in sca-contribution.xml file
Hi Raymond,
I am using 0.99 level of Tuscany.
I noticed that in all the samples included in Tuscany, the
targetNamespace
attribute is there.
For example,
samples\calculator-webapp-ws\src\main\webapp\META-INF\sca-contribution.xml
has it:
<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://sample"
xmlns:sample="http://sample">
<deployable composite="sample:Calculator"/>
</contribution>
But in this case targetNamespace == xmlns:sample so the QName printed is
"{http://sample}Calculator".
However if I remove the targetNamespace attribute then the QName printed
is simply "Calculator".
Thanks,
Andrew
"Raymond Feng" <[EMAIL PROTECTED]>
09/13/2007 06:08 PM
Please respond to
[email protected]
To
<[email protected]>
cc
Subject
Re: reading in sca-contribution.xml file
Hi,
Thank you for reporting the issue.
1) The targetNamespace attribute shoudn't be in the sca-definitions.xml
2) Even with that, I tried a similar case and the result is good, i.e.
{http://mytest.com}CalculatorComposite is returned.
Which level of Tuscany code are you using?
Thanks,
Raymond
----- Original Message -----
From: "Andrew Mak" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 13, 2007 12:19 PM
Subject: reading in sca-contribution.xml file
> Hi,
>
> I am trying to read in a simple sca-contribution.xml file using
Tuscany.
> Here is the contribution file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
> targetNamespace="http://myexample.com/"
> xmlns:test="http://mytest.com/">
> <deployable composite="test:CalculatorComposite"/>
> </contribution>
>
> My test code looks like this:
>
> AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
> ContributionFactory contributionFactory = new
ContributionFactoryImpl();
>
> ContributionMetadataProcessor processor = new
> ContributionMetadataProcessor(assemblyFactory, contributionFactory,
null);
>
>
> InputStream stream = new
> FileInputStream("D:\\temp\\sca-contribution.xml");
> XMLStreamReader reader =
> XMLInputFactory.newInstance().createXMLStreamReader(stream);
>
> Contribution contribution = processor.read(reader);
>
> List<Composite> composites = contribution.getDeployables();
>
> for (Composite composite : composites)
> System.out.println(composite.getName());
>
>
> The output which I get from running the code is:
>
> {http://myexample.com/}CalculatorComposite
>
> I'm puzzled by the fact the namespace for my composite is
> http://myexample.com, which is the targetNamespace of my contribution
> file. I expected the QName of my composite to be {
> http://mytest.com/}CalculatorComposite since it's prefixed with
"test".
If
> I remove the targetNamespace attribute completely, then my composite
has
> no namespace at all. What am I missing here? Is there something
wrong
> with my contribution file and/or my test code?
>
> Thanks in advance. Any help is much appreciated.
>
> Andrew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]