Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Ecore Data Source with ExtendedMetaData
Ecore Data Source with ExtendedMetaData [message #1005934] Tue, 29 January 2013 10:48 Go to next message
Dumont Jonathan is currently offline Dumont JonathanFriend
Messages: 33
Registered: January 2013
Location: Laval
Member
Hi,

I use Birt 3.7.2 to create a report using multiple EMF Ecore Data Sources. For one of these data sources, the ecore defining the metamodel use ExtendedMetaData.

For example, it has a class REQIF, defined as :
<eClassifiers xsi:type="ecore:EClass" name="REQIF">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="REQ-IF"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eStructuralFeatures ....
    </eStructuralFeatures>
</eClassifiers>


The goal of this metadata is to write an element "REQ-IF" instead of "REQIF" in the xml model file.

Thus, the problem is that when Birt try to build its Data Source, I have a class not found exception for "REQ-IF" when I test the connexion.

Do you know how can I force the Data Source to use the ExtendedMetaData information ?

Regards,

Jonathan


Re: Ecore Data Source with ExtendedMetaData [message #1005962 is a reply to message #1005934] Tue, 29 January 2013 12:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
Dumont,

The name of a class will only ever appear in an xsi:type declaration,
except at the root, though for real XML schema based models, there will
be a DocumentRoot class at the root, and the name of it's one populated
feature will be the name of the root element in the XML). In general,
it's the names of features that control the names of elements in the
XML. Is your XML being loaded by a resource created by the resource
factory that you've registered properly?


On 29/01/2013 11:48 AM, Dumont Jonathan wrote:
> Hi,
>
> I use Birt 3.7.2 to create a report using multiple EMF Ecore Data
> Sources. For one of these data sources, the ecore defining the
> metamodel use ExtendedMetaData.
>
> For example, it has a class REQIF, defined as :
>
> <eClassifiers xsi:type="ecore:EClass" name="REQIF">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="REQ-IF"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures ....
> </eStructuralFeatures>
> </eClassifiers>
>
>
> The goal of this metadata is to write an element "REQ-IF" instead of
> "REQIF" in the xml model file.
>
> Thus, the problem is that when Birt try to build its Data Source, I
> have a class not found exception for "REQ-IF" when I test the connexion.
>
> Do you know how can I force the Data Source to use the
> ExtendedMetaData information ?
>
> Regards,
>
> Jonathan


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore Data Source with ExtendedMetaData [message #1005984 is a reply to message #1005962] Tue, 29 January 2013 13:26 Go to previous messageGo to next message
Dumont Jonathan is currently offline Dumont JonathanFriend
Messages: 33
Registered: January 2013
Location: Laval
Member
Hi Mr Merks,

Thanks for your quick reply.

In fact, we don't have a problem in our Eclipse RCP application, which manages its resources correctly. Our problem appears in the design of our Birt report. This report use a Data Source of type "EMF Ecore Data Source". This data source is linked to an instance of the ReqIf model, which looks like this :
<?xml version="1.0" encoding="UTF-8"?>
<REQIF xmlns="...spec/ReqIF/20110401/reqif.xsd" xmlns:xsi=".../2001/XMLSchema-instance">
  <THE-HEADER>
    <REQ-IF-HEADER IDENTIFIER="OurCompany">
      <CREATION-TIME>2013-01-24T11:16:31.866+01:00</CREATION-TIME>
      <REQ-IF-TOOL-ID>OurCompanyAndTool</REQ-IF-TOOL-ID>
      <REQ-IF-VERSION>1.0</REQ-IF-VERSION>
      <SOURCE-TOOL-ID>OurCompanyAndTool</SOURCE-TOOL-ID>
      <TITLE>Default Title</TITLE>
    </REQ-IF-HEADER>
  </THE-HEADER>
  <CORE-CONTENT>
    <REQ-IF-CONTENT>
      <DATATYPES>
        <DATATYPE-DEFINITION-BOOLEAN IDENTIFIER="_H83NpGYPEeKpTrI2wMp8Jw" LONG-NAME="Category"/>
        <DATATYPE-DEFINITION-STRING IDENTIFIER="_H83NpWYPEeKpTrI2wMp8Jw" LONG-NAME="String"/>
        <DATATYPE-DEFINITION-XHTML IDENTIFIER="_H83NpmYPEeKpTrI2wMp8Jw" LONG-NAME="RTF"/>
      </DATATYPES>
      <SPEC-TYPES>
        <SPEC-OBJECT-TYPE IDENTIFIER="_H83Np2YPEeKpTrI2wMp8Jw" LONG-NAME="Requirement Type">
          <SPEC-ATTRIBUTES>
(...)
</REQIF>


And in our Eclipse, we have the "reqif.xsd" package correctly registered. This package is defined in a ecore file which contains the classes with the ExtendedMetaData properties previously descrived :
<eClassifiers xsi:type="ecore:EClass" name="REQIF">
    <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
      <details key="name" value="REQ-IF"/>
      <details key="kind" value="elementOnly"/>
    </eAnnotations>
    <eStructuralFeatures ....
    </eStructuralFeatures>
</eClassifiers>


In conclusion, if I understand our problem, we need to know if it's possible to configure Birt or its Data Source to read correctly the ExtendedMetaData, to be able to make the link between the element "REQ-IF" and the class "REQIF", and so to build the report design with the data source directly pluggued to the xml file.

Regards,

Jonathan



Re: Ecore Data Source with ExtendedMetaData [message #1006019 is a reply to message #1005984] Tue, 29 January 2013 15:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
Dumont,

I know nothing of BIRFT and I don't know much about the details of EMF's
ODA support, but from a quite glance it's clear it's using a resource
set that is encapsulated in a Connection. As long as you can manage to
get that resource set configured so that your resource factory is used
to create your resources, i.e., register it in the resource set's
resource factory registry, you should get it working nicely. It looks
as if you can pass in your own resource set via
org.eclipse.emf.oda.ecore.impl.Connection.RESOURCE_SET_PROPERTY_NAME
which you put in your appContext which you can set up via
org.eclipse.datatools.connectivity.oda.IConnection.setAppContext(Object)
if you pass in a Map. Have a look at the source code
org.eclipse.emf.oda.ecore.impl.Connection.open(Properties).

On 29/01/2013 2:27 PM, Dumont Jonathan wrote:
> Hi Mr Merks,
>
> Thanks for your quick reply.
>
> In fact, we don't have a problem in our Eclipse RCP application, which
> manages its resources correctly. Our problem appears in the design of
> our Birt report. This report use a Data Source of type "EMF Ecore Data
> Source". This data source is linked to an instance of the ReqIf model,
> which looks like this :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <REQIF xmlns="...spec/ReqIF/20110401/reqif.xsd"
> xmlns:xsi=".../2001/XMLSchema-instance">
> <THE-HEADER>
> <REQ-IF-HEADER IDENTIFIER="OurCompany">
> <CREATION-TIME>2013-01-24T11:16:31.866+01:00</CREATION-TIME>
> <REQ-IF-TOOL-ID>OurCompanyAndTool</REQ-IF-TOOL-ID>
> <REQ-IF-VERSION>1.0</REQ-IF-VERSION>
> <SOURCE-TOOL-ID>OurCompanyAndTool</SOURCE-TOOL-ID>
> <TITLE>Default Title</TITLE>
> </REQ-IF-HEADER>
> </THE-HEADER>
> <CORE-CONTENT>
> <REQ-IF-CONTENT>
> <DATATYPES>
> <DATATYPE-DEFINITION-BOOLEAN
> IDENTIFIER="_H83NpGYPEeKpTrI2wMp8Jw" LONG-NAME="Category"/>
> <DATATYPE-DEFINITION-STRING
> IDENTIFIER="_H83NpWYPEeKpTrI2wMp8Jw" LONG-NAME="String"/>
> <DATATYPE-DEFINITION-XHTML IDENTIFIER="_H83NpmYPEeKpTrI2wMp8Jw"
> LONG-NAME="RTF"/>
> </DATATYPES>
> <SPEC-TYPES>
> <SPEC-OBJECT-TYPE IDENTIFIER="_H83Np2YPEeKpTrI2wMp8Jw"
> LONG-NAME="Requirement Type">
> <SPEC-ATTRIBUTES>
> (...)
> </REQIF>
>
>
> And in our Eclipse, we have the "reqif.xsd" package correctly
> registered. This package is defined in a ecore file which contains the
> classes with the ExtendedMetaData properties previously descrived :
>
> <eClassifiers xsi:type="ecore:EClass" name="REQIF">
> <eAnnotations
> source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="name" value="REQ-IF"/>
> <details key="kind" value="elementOnly"/>
> </eAnnotations>
> <eStructuralFeatures ....
> </eStructuralFeatures>
> </eClassifiers>
>
>
> In conclusion, if I understand our problem, we need to know if it's
> possible to configure Birt or its Data Source to read correctly the
> ExtendedMetaData, to be able to make the link between the element
> "REQ-IF" and the class "REQIF", and so to build the report design with
> the data source directly pluggued to the xml file.
>
> Regards,
>
> Jonathan
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Ecore Data Source with ExtendedMetaData [message #1006022 is a reply to message #1006019] Tue, 29 January 2013 15:16 Go to previous messageGo to next message
Dumont Jonathan is currently offline Dumont JonathanFriend
Messages: 33
Registered: January 2013
Location: Laval
Member
Thanks for this advise !
I will try to look at this, and come back when I will have more information.


Re: Ecore Data Source with ExtendedMetaData [message #1006409 is a reply to message #1006022] Thu, 31 January 2013 09:35 Go to previous message
Dumont Jonathan is currently offline Dumont JonathanFriend
Messages: 33
Registered: January 2013
Location: Laval
Member
To continue on this problem, I have found a partial solution (I think)...

In fact, for each EMF Ecore Data Source in the report, a connection is created, with this method in the class "org.eclipse.emf.oda.ecore.impl.Connection" :

public void open(Properties connProperties) throws OdaException
  {
    if (appContext != null)
    {
      try
      {
        resourceSet = (ResourceSet)appContext.get(ResourceSet.class.getName());
      }
      catch (Exception e)
      {
        throw new OdaException(e);
      }
    }

    if (resourceSet == null)
    {
      resourceSet = new ResourceSetImpl();

      String uri = connProperties.getProperty(RESOURCE_PROPERTY_NAME);

      if (!StringUtil.isEmpty(uri))
      {
        try
        {
          resourceSet.getResource(URI.createURI(uri), true);
        }
        catch (Exception e)
        {
          throw new OdaException(e);
        }
      }
    }
  }


It seems that the resourceSet used is a basic ResourceSetImpl. Thus, to use a resourceSet which can read the ExtendedMetaData it should be configured with :
resourceSet.getLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, new BasicExtendedMetaData());


Moreover, I managed to give my own resourceSet using the appContext of the report configuration with :
final EngineConfig config = new EngineConfig();
config.getAppContext().put(ResourceSet.class.getName(), getCustomResourceSet());



Finally, the problem is that even if this is working during the build execution of my report, I can't use this during the report design phase (in the Report Design perspective Eclipse). Indeed, when I try to create a Data Source in the report designer, it doesn't use my custom resource set. So this solution avoid the creation of the report in the designer... all will have to be created programmaticaly !

My questions are :
- Is it possible to configure the report designer to use a custom resource set ?
- Is my "solution" the only one and is coherent ?

Regards,

Jonathan



Previous Topic:Custom ODA driver IDataSetMetaData usage
Next Topic: There is no report design object available. exception with birt 3.7.2
Goto Forum:
  


Current Time: Sat Oct 05 14:49:27 GMT 2024

Powered by FUDForum. Page generated in 0.04558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top