-
1. Re: BaseModel and QName attributes
dward Sep 26, 2012 11:57 AM (in response to objectiser)1 of 1 people found this helpfulThere isn't a direct way on the interface right now, however:
- I added a jira to cover this: https://issues.jboss.org/browse/SWITCHYARD-1058
- You can, for now:
// pseudo
public class MyModel extends BaseModel {
public QName getFoo() {
String foo = getModelAttribute("foo");
if (foo != null && foo.indexOf(':') != -1) {
String [] split = foo.split(":", 2);
Map<String,String> map = getModelConfiguration().getPrefixNamespaceMap();
String ns = map.get(split[0]);
String localName = split[1];
return new QName(ns, localName);
}
}
}
-
2. Re: BaseModel and QName attributes
objectiser Sep 26, 2012 12:02 PM (in response to dward)Thanks David, I'll give it a go.
-
3. Re: BaseModel and QName attributes
objectiser Sep 27, 2012 6:04 AM (in response to objectiser)Unfortunately didn't work. I have the following switchyard.xml:
<?xml version="1.0" encoding="UTF-8"?> <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:swyd="urn:switchyard-config:switchyard:1.0" xmlns:trfm="urn:switchyard-config:transform:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:soap="urn:switchyard-component-soap:config:1.0" xmlns:bpel="http://docs.oasis-open.org/ns/opencsa/sca/200903" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:ls="http://example.com/loan-approval/loanService/" xmlns:ra="http://example.com/loan-approval/riskAssessment/" targetNamespace="urn:switchyard-quickstart:bpel-loan-approval:0.1.0" name="loanapproval"> <sca:composite name="loanservice" targetNamespace="urn:bpel:test:1.0"> <sca:service name="loanService" promote="loanService"> <soap:binding.soap> <soap:wsdl>loanServicePT.wsdl</soap:wsdl> <soap:socketAddr>localhost:18001</soap:socketAddr> </soap:binding.soap> </sca:service> <sca:component name="loanService"> <bpel:implementation.bpel process="ls:loanApprovalProcess" /> <sca:service name="loanService"> <sca:interface.wsdl interface="loanServicePT.wsdl#wsdl.porttype(loanServicePT)"/> </sca:service> <sca:reference name="riskAssessor" > <sca:interface.wsdl interface="riskAssessmentPT.wsdl#wsdl.porttype(riskAssessmentPT)"/> </sca:reference> </sca:component> <sca:component name="riskAssessor" > <bpel:implementation.bpel process="ra:riskAssessmentProcess" /> <sca:service name="riskAssessor"> <sca:interface.wsdl interface="riskAssessmentPT.wsdl#wsdl.porttype(riskAssessmentPT)"/> </sca:service> </sca:component> </sca:composite> </switchyard>
When I attempt to retrieve the QName for the first "bpel:implementation" model element, the namespace/prefix map contains:
map={ns0=http://www.w3.org/2000/xmlns/, ns1=http://docs.oasis-open.org/ns/opencsa/sca/200903}
Regards
Gary
-
4. Re: BaseModel and QName attributes
dward Sep 27, 2012 7:38 AM (in response to objectiser)Okay, I'll squeeze something into 0.6.0-SNAPSHOT for you later today.
-
5. Re: BaseModel and QName attributes
dward Sep 27, 2012 5:25 PM (in response to dward)Sorry; it's gonna hafta be tomorrow.
-
6. Re: BaseModel and QName attributes
dward Oct 1, 2012 2:28 PM (in response to objectiser)Gary,
I finally submitted a pull request that fixes https://issues.jboss.org/browse/SWITCHYARD-1058 for you.
You can now call getModelAttributeAsQName(String):QName or getModelAttributeAsQName(QName):QName. You can also set model attibutes as qnames.
I tested it with your XML, and I get the proper qnames out per your examples, testing the prefix, namespace and local parts are all good:
pfx: ls
ns: http://example.com/loan-approval/loanService/
lp: loanApprovalProcess
pfx: ra
ns: http://example.com/loan-approval/riskAssessment/
lp: riskAssessmentProcess
So once this gets processed, you should be good to go. Thanks for your patience!
Sincerely,
David
-
7. Re: BaseModel and QName attributes
objectiser Oct 2, 2012 9:21 AM (in response to dward)Thanks David.