Closed backesj closed 11 years ago
Hello, In fact, the ConnectionInstance object contains connection reference. Then, the properties are then taken from the ConnectionReference and their related connection object from the declarative model. If you have some problems for accessing the properties of your model, lease send a model example so that we can reproduce the issue. Thanks.
I'm still unclear on what function to use to grab this information from a ConnectionReference (Something in "org.osate.xtext.aadl2.properties.util.PropertyUtils.java")? Could you point me to somewhere in the osate source or in a plugin where a ConnectionReference is queried for the value of one of it's properties?
On Mon, Jul 1, 2013 at 3:17 PM, Julien notifications@github.com wrote:
Hello, In fact, the ConnectionInstance object contains connection reference. Then, the properties are then taken from the ConnectionReference and their related connection object from the declarative model. If you have some problems for accessing the properties of your model, lease send a model example so that we can reproduce the issue. Thanks.
— Reply to this email directly or view it on GitHubhttps://github.com/osate/osate2-core/issues/252#issuecomment-20307375 .
You just use the helper methods to retrieve properties found in GetProperties. These helper methods are for many predeclared properties. They make use of lower level methods defined in PropertyUtils. For example, the flow latency analysis retrieves the latency value on a connection instance by calling res = GetProperties.getLatencyinMicroSec(connInstance);
This method is defined as public static double getLatencyinMicroSec(final NamedElement ne) { Property Latency = lookupPropertyDefinition(ne,CommunicationProperties._NAME, CommunicationProperties.LATENCY); UnitLiteral microSecond = PropertiesLinkingService.findUnitLiteral(Latency, AadlProject.US_LITERAL); return PropertyUtils.getScaledRangeMaximum(ne, Latency, microSecond,0.0); }
From: backesj [mailto:notifications@github.com] Sent: Wednesday, July 03, 2013 11:01 AM To: osate/osate2-core Subject: Re: [osate2-core] Checking properties for connection instances (#252)
I'm still unclear on what function to use to grab this information from a ConnectionReference (Something in "org.osate.xtext.aadl2.properties.util.PropertyUtils.java")? Could you point me to somewhere in the osate source or in a plugin where a ConnectionReference is queried for the value of one of it's properties?
On Mon, Jul 1, 2013 at 3:17 PM, Julien notifications@github.com<mailto:notifications@github.com> wrote:
Hello, In fact, the ConnectionInstance object contains connection reference. Then, the properties are then taken from the ConnectionReference and their related connection object from the declarative model. If you have some problems for accessing the properties of your model, lease send a model example so that we can reproduce the issue. Thanks.
— Reply to this email directly or view it on GitHubhttps://github.com/osate/osate2-core/issues/252#issuecomment-20307375 .
— Reply to this email directly or view it on GitHubhttps://github.com/osate/osate2-core/issues/252#issuecomment-20421177.
So I'm using the "PropertyUtils.getSimplePropertyValue(final NamedElement ph, final Property pd)" method, which works fine for component instances (and is called by the "PropertyUtils.getScaledRangeMaximum()") you suggested above. However, this method relies on the "getPropertyValueFromDeclarativeModel(final Property property, final PropertyAcc pas)" method implemented in "InstanceObjectImpl.java". It seems that the "getPropertyValueFromDeclarativeModel(final Property property, final PropertyAcc pas)" used to be overridden in "ConnectionInstanceImpl.java" but this is now longer the case (as stated my original post). I will try to develop a simple model where this method fails to return the correct results and post again.
After generating an instance model for the following model, I call the following method:
PropertyUtils.getSimplePropertyValue(el, prop);
where "el" is the ConnectionInstanceImpl corresponding to the "TA.data_out -> TB.data_in" connection in the instantiated process "P", and "prop" is the PropertyImpl corresponding to "TEST_PROPS::Test_Prop" property. The method throws a PropertyNotPresentException exception.
property set TEST_PROPS is
Test_Prop: aadlboolean applies to (port, connection);
end TEST_PROPS;
package TEST
public
with TEST_PROPS;
system test
end test;
system implementation test.Impl
subcomponents
P : process test_proc.Impl;
end test.Impl;
process test_proc
end test_proc;
process implementation test_proc.impl
subcomponents
TA: thread tA;
TB: thread Tb;
connections
port TA.data_out -> TB.data_in;
end test_proc.Impl;
thread tA
features
data_out: out data port;
properties
TEST_PROPS::Test_Prop => true applies to data_out;
end tA;
thread tB
features
data_in: in data port;
properties
TEST_PROPS::Test_Prop => true applies to data_in;
end tB;
end TEST;
I should also note that the following code throws the same exception:
for(ConnectionReference ref : el.getConnectionReferences())
PropertyUtils.getSimplePropertyValue(ref, prop);
Hello,
Do you still experience issues ? If yes, is it possible to explain the issue because I am not able to reproduce this issue. Thanks in advance for letting us know.
Regards.
John, in your provided example the property is attached the port, not the connection. In this case, you should be able to get the property with
PropertyUtils.getSimplePropertyValue(el.getSource(), prop)
Similarly you can use el.getDestination() for the other side of the connection. If you want to attach the property to the connection you can do either:
process implementation test_proc.impl
subcomponents
TA: thread tA;
TB: thread Tb;
connections
c1 : port TA.data_out -> TB.data_in;
properties
TEST_PROPS::Test_Prop => true applies to c1;
end test_proc.Impl;
or
process implementation test_proc.impl
subcomponents
TA: thread tA;
TB: thread Tb;
connections
port TA.data_out -> TB.data_in {
TEST_PROPS::Test_Prop => true;
};
end test_proc.Impl;
In either case, you can then look up the property in the instance model using
PropertyUtils.getSimplePropertyValue(el, prop)
Currently the code for getting the properties from the declarative model of a given connection instance is commented out. The commented code starting at line 741 of "org.osate.aadl2/src/org/osate/aadl2/instance/impl/ConnectionInstanceImpl.java" is shown below. How can I currently access the values of properties applied to connection instances?