Java Reference
In-Depth Information
After installing Teneo, we need to create plug-ins in our workspace that wrap
the Hibernate and Derby libraries. This is as simple as adding empty plug-in
projects and dropping the *.jar files from each into a /lib folder and setting
up the manifest to include the archives and expose their packages. It's also
necessary to add an Eclipse-BuddyPolicy: dependent property in the
Hibernate bundle manifest. In the scenario model plug-in, we can add depend-
encies to these plug-ins and to the org.eclipse.emf.teneo.hibernate
plug-in, reexporting each.
With the dependencies established, we need to create an empty scenario data-
base. The DataTools project makes this simple and is described in the tutorial.
It's a matter of configuring the Derby-embedded driver and declaring a path to
where the database will reside. When the simple ping works, the database is
ready for Teneo to use.
As in other diagram extensions, we create a separate org.eclipse.
scenario.diagram.db plug-in to hold our additional classes required to enable
database persistence. In the /src directory, we add a teneo.properties file that
will contain the connection string information and Teneo options we need. These
will ultimately be presented in the user interface, but for now we can simply use a
properties file, as shown here. Adjust the driver_class , url , and dialect
properties as necessary to match your environment.
teneo.mapping.inheritance = JOINED
hibernate.connection.driver_class=org.apache.derby.jdbc.EmbeddedDriver
hibernate.connection.url=jdbc:derby:/derby/databases/scenario
hibernate.connection.username=
hibernate.connection.password=
hibernate.dialect=org.hibernate.dialect.DerbyDialect
Because of the GMF notation model's use of multiple inheritance, Teneo
needs an additional annotations.xml file in the /src folder to map these ele-
ments to a relational store. This shows the contents of the file:
<?xml version="1.0" encoding="utf-8"?>
<persistence-mapping xmlns="http://www.eclipse.org/emft/teneo"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<epackage
namespace-uri="http://www.eclipse.org/gmf/runtime/1.0.1/notation">
<eclass name="ShapeStyle">
<entity extends="LineStyle"/>
</eclass>
<eclass name="DiagramStyle">
Search WWH ::




Custom Search