JET: EMF Resources & References in EMF Models [message #52697] |
Mon, 25 September 2006 19:06 |
Eclipse User |
|
|
|
Originally posted by: zx.us.ibm.com
Say you have an EMF model like...
....
<incomingTokenType tokenTypeName="ivcred">
<additionalAttributes name="tagvalue_empid"/>
<additionalAttributes name="tagvalue_phone"/>
<principalAttributes name="name"/>
<groupAttributes name="group1"/>
</incomingTokenType>
<outgoingTokenType tokenTypeName="saml1x">
<additionalAttributes name="empid"/>
<additionalAttributes name="phone"/>
<additionalAttributes name="username"/>
<principalAttributes name="principal"/>
<groupAttributes name="test"/>
</outgoingTokenType>
<mappings source="//@incomingTokenType/@additionalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.0"/ >
....
And I have some JET expressions...
<c:iterate select="//mappings" var="node" >
<c:setVariable select="$node/@source" var="sourceXpath"/>
<c:get select="$sourceXpath" default="no dice :(" />
I just get the string, //@incomingTokenType/@additionalAttributes.0
instead of resolving the reference and giving back the proper attribute.
If I do a
<c:get select="//incomingTokenType/additionalAttributes/@name"
default="no dice ;(" />
I get a 'tagvalue_empid' which is correct?
Why don't I get the same? Am I just being silly here?
Cheers,
~ Chris
|
|
|
|
Re: EMF Resources & References in EMF Models [message #52752 is a reply to message #52724] |
Mon, 25 September 2006 19:58 |
Eclipse User |
|
|
|
Originally posted by: zx.us.ibm.com
What a test jet file of:
<?xml version="1.0" encoding="utf-8"?>
<c:get select="//incomingTokenType/additionalAttributes/@name"
default="not found" />
<c:iterate select="//mappings" var="node" >
<c:setVariable select="$node/source" var="sourceXpath"/>
<c:setVariable select="$node/source" var="destXpath"/>
<c:get select="$sourceXpath/@name" default="not found" />
Source = <c:get select="$sourceXpath" default="not found"/>
Destination = <c:get select="$destXpath" default = "not found"/>
</c:iterate>
and an input of:
<?xml version="1.0" encoding="UTF-8"?>
<com.tivoli.am.fim.idmaptool:IDMapRoot xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:com.tivoli.am.fim.idmaptool="http:///idmap.ecore">
<incomingTokenType tokenTypeName="ivcred">
<additionalAttributes name="tagvalue_empid"/>
<additionalAttributes name="tagvalue_phone"/>
<principalAttributes name="name"/>
<groupAttributes name="group1"/>
</incomingTokenType>
<outgoingTokenType tokenTypeName="saml1x">
<additionalAttributes name="empid"/>
<additionalAttributes name="phone"/>
<additionalAttributes name="username"/>
<principalAttributes name="principal"/>
<groupAttributes name="test"/>
</outgoingTokenType>
<mappings source="//@incomingTokenType/@additionalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.0"/ >
<mappings source="//@incomingTokenType/@additionalAttributes.1"
destination="//@outgoingTokenType/@additionalAttributes.1"/ >
<mappings source="//@incomingTokenType/@groupAttributes.0"
destination="//@outgoingTokenType/@groupAttributes.0"/>
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@principalAttributes.0"/ >
<mappings source="//@incomingTokenType/@principalAttributes.0"
destination="//@outgoingTokenType/@additionalAttributes.2"/ >
</com.tivoli.am.fim.idmaptool:IDMapRoot>
I get output of:
<?xml version="1.0" encoding="utf-8"?>
tagvalue_empid
not found
Source = not found
Destination = not found
not found
Source = not found
Destination = not found
not found
Source = not found
Destination = not found
not found
Source = not found
Destination = not found
not found
Source = not found
Destination = not found
Any further thoughts?
Cheers,
~ Chris
|
|
|
Re: EMF Resources & References in EMF Models [message #52779 is a reply to message #52752] |
Mon, 25 September 2006 20:17 |
Paul Elder Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Summary of an offline conversation with Chris:
* Chris has an instance of the model in his workspace that a buddy sent him.
* He does not have the ECore model, nor any of the Java code.
Unfortunately, JET is trying to load the model and detects it is likely an
ECore package. It attempts to find a registered EPackage (as is created when
the EMF generated plug-in is installed in the workbench), and fails. As a
fall back, JET is trying (and succeeding) in loading the model as an XML
document.
The resulting in memory model looks a lot like the EMF model, but isn't. In
particular, the XPath expressions do not resolve $node/source (there is no
child element source), and the treat $node/@source as an attribute
reference - no special semantics applied.
Chris will be submitting a bugzilla suggesting that in the event that the
EMF EPackage cannot be found, that JET should fail with an informative
message, rather than attempt to the load as an XML document.
Paul
|
|
|
|
|
Re: EMF Resources & References in EMF Models [message #592002 is a reply to message #52752] |
Mon, 25 September 2006 20:17 |
Paul Elder Messages: 849 Registered: July 2009 |
Senior Member |
|
|
Summary of an offline conversation with Chris:
* Chris has an instance of the model in his workspace that a buddy sent him.
* He does not have the ECore model, nor any of the Java code.
Unfortunately, JET is trying to load the model and detects it is likely an
ECore package. It attempts to find a registered EPackage (as is created when
the EMF generated plug-in is installed in the workbench), and fails. As a
fall back, JET is trying (and succeeding) in loading the model as an XML
document.
The resulting in memory model looks a lot like the EMF model, but isn't. In
particular, the XPath expressions do not resolve $node/source (there is no
child element source), and the treat $node/@source as an attribute
reference - no special semantics applied.
Chris will be submitting a bugzilla suggesting that in the event that the
EMF EPackage cannot be found, that JET should fail with an informative
message, rather than attempt to the load as an XML document.
Paul
|
|
|
Powered by
FUDForum. Page generated in 0.03832 seconds