|
1 |
----
|
|
2 |
Developing with the CDM Library
|
|
3 |
----
|
|
4 |
|
|
5 |
|
1 |
6 |
Developing with the CDM Library
|
2 |
7 |
|
3 |
8 |
<Table of Contents>
|
... | ... | |
5 |
10 |
%{toc|section=0|fromDepth=2|toDepth=3}
|
6 |
11 |
|
7 |
12 |
|
8 |
|
<<Note:>> If you are not familiar with eclipse, maven or subversion please read the {{{http://dev.e-taxonomy.eu/trac/wiki/DeveloperApplications}developer applications document}} for brief introductions. Please see {{{./troubleshooting.html}Troubleshooting}} in case you run into problems or contact {{{mailto:editsupport@bgbm.org}editsupport@bgbm.org}}.
|
|
13 |
<<Note:>> The CDM Library uses Apache Maven for dependency management. If you are not familiar with that please take a look at the {{{https://dev.e-taxonomy.eu/trac/wiki/GeneralDev#Maven}developer resources on the wiki}}. In case you run into problems, you might want to check {{{./troubleshooting.html}Troubleshooting}} or contact {{{mailto:editsupport@bgbm.org}editsupport@bgbm.org}} directly.
|
9 |
14 |
|
10 |
15 |
* Integrating the CDM Library into a maven project
|
11 |
16 |
|
12 |
|
To integrate the CDM Library into your personal maven project pelase add our maven repository to your POM: {{http://wp5.e-taxonomy.eu/cdmlib/mavenrepo/}}. To use the <cdmlib-service> package add the following dependency to you POM (adapt the right version number !!):
|
|
17 |
To integrate the CDM Library into your personal maven project pelase add our maven repository to your POM:
|
|
18 |
{{http://wp5.e-taxonomy.eu/cdmlib/mavenrepo/}}. To use the <cdmlib-service> package add the following
|
|
19 |
dependency to you POM (adapt the right version number !!):
|
13 |
20 |
|
14 |
21 |
---
|
15 |
22 |
<dependency>
|
... | ... | |
22 |
29 |
|
23 |
30 |
* Spring applications with the CDM Library
|
24 |
31 |
|
25 |
|
In your own applicationContext.xml you can simply import the cdm service spring beans from the library. In addition it also needs a datasource bean and a hibernateProperties bean specific for that datasource. The CDM Library comes with an embedded hypersonic database that is super easy to use. All you need to do is to import that hsql specific spring configuration like this:
|
|
32 |
In your own applicationContext.xml you can simply import the cdm service spring beans from the library.
|
|
33 |
In addition it also needs a datasource bean and a hibernateProperties bean specific for that datasource.
|
|
34 |
The CDM Library comes with an embedded hypersonic database that is super easy to use. All you need to do
|
|
35 |
is to import that hsql specific spring configuration like this:
|
26 |
36 |
|
27 |
37 |
---
|
28 |
38 |
applicationContext.xml
|
... | ... | |
39 |
49 |
</beans>
|
40 |
50 |
---
|
41 |
51 |
|
42 |
|
In case you want to define the datasource within your own applicationContext you can surely do so. For a typical mysql database it looks like this:
|
|
52 |
In case you want to define the datasource within your own applicationContext you can surely do so.
|
|
53 |
For a typical mysql database it looks like this:
|
43 |
54 |
|
44 |
55 |
---
|
45 |
56 |
applicationContext.xml
|
... | ... | |
78 |
89 |
---
|
79 |
90 |
|
80 |
91 |
|
81 |
|
* Developing the CDM Library
|
|
92 |
* Developing the CDM Library with Eclipse
|
82 |
93 |
|
83 |
|
To use the entire CDM Library with Eclipse, you need some plugins and to follow this installation guide:
|
|
94 |
To use the entire CDM Library with {{{http://www.eclipse.org/} Eclipse}}, you must meet the following prerequisites:
|
84 |
95 |
|
85 |
|
* install maven 2.0.x commandline tools locally (http://maven.apache.org/download.html). Follow the instruction to install maven on your local machine.
|
|
96 |
* Maven 2.2.1 commandline tools. Follow the instruction to install maven on your local machine. See {{{https://dev.e-taxonomy.eu/trac/wiki/GeneralDev#Maven}}} for installation instructions.
|
86 |
97 |
|
87 |
|
* install subclipse 1.6.x in eclipse if not yet installed (Update Site: http://subclipse.tigris.org/update_1.6.x).
|
|
98 |
* Subclipse 1.6.x (for convenient subversion access from Eclipse). {{{http://subclipse.tigris.org/}}}
|
88 |
99 |
|
89 |
|
* make sure Java JDK >= 1.6 is installed (JRE is not enough) and JAVA_HOME is set to JDK path
|
|
100 |
* Java JDK >= 1.6 (JRE is not enough) and JAVA_HOME is set to JDK path
|
90 |
101 |
|
91 |
|
* checkout cdmlib and create eclipse artifacts (using e.g. tortoiseSVN):
|
|
102 |
[]
|
|
103 |
|
|
104 |
** Preparing the CDM Library
|
|
105 |
|
|
106 |
Start by checking out the source code from the subversion repository:
|
92 |
107 |
|
93 |
108 |
---
|
94 |
109 |
$ svn co http://dev.e-taxonomy.eu/svn/trunk/cdmlib/ .
|
95 |
110 |
---
|
96 |
111 |
|
97 |
|
* make sure maven has run at least one time (to create the .m2 folder). If unsure how to do this, run <<<mvn install>>> in the new checked out folder ../cdmlib/cmlib-commons
|
98 |
|
|
99 |
|
* Set in Eclipse preferences (not project properties) M2_REPO java class variable (menue: java-buildPath-Classpath), pointing to your local repository.
|
100 |
|
|
101 |
|
* In OSX for example /Users/USERNAME/.m2/repository
|
102 |
|
|
103 |
|
* In WinXP for example C:\Documents and Settings\USERNAME\.m2\repository
|
104 |
|
|
105 |
|
* setup new eclipse workspace (where ever you want but using the cdmlib folder may be comfortable
|
106 |
|
|
107 |
|
* run the following commands in your cdmlib folder
|
|
112 |
Change into the cdmlib directory, compile and install the cdmlib packages in your local repository. This will also download the dependencies into your local repository.
|
108 |
113 |
|
109 |
114 |
---
|
|
115 |
$ cd cdmlib
|
110 |
116 |
$ mvn install
|
111 |
117 |
---
|
112 |
|
|
113 |
|
to compile and install the cdmlib packages in your local repository.
|
|
118 |
|
|
119 |
Let maven create project dependencies and Eclipse metafiles (.project s.o.)
|
114 |
120 |
|
115 |
121 |
---
|
116 |
122 |
$ mvn eclipse:eclipse
|
117 |
123 |
---
|
118 |
124 |
|
119 |
|
to let maven create project dependencies and Eclipse metafiles (.project s.o.)
|
120 |
|
|
121 |
|
* create the java projects:
|
122 |
|
|
123 |
|
* In Eclipse open the Import Wizard: File->Import->General->Existing Projects into Workspace.
|
124 |
|
|
125 |
|
* Choose "Select root directory". Click "Browse" and navigate to your cdmlib folder (should open by default) and confirm the file dialog.
|
|
125 |
** Configuring Eclipse
|
|
126 |
|
|
127 |
* Setup a new Eclipse workspace (where ever you want but using the cdmlib folder may be comfortable)
|
126 |
128 |
|
127 |
|
* The projects should now show in the Import Wizard window. Select the projects you want wo work on and hit OK.
|
|
129 |
* In Eclipse preferences (not project properties) set a java class variable called <<<M2_REPO>>>, pointing to your local repository.
|
128 |
130 |
|
129 |
|
* Install AspectJ compiler {{http://www.eclipse.org/aspectj/downloads.php}} , make sure you add the \<aspectj install dir\>/lib/aspectjrt.jar to your class path and <aspectj install dir>/lib/ to your path
|
|
131 |
* Eclipse Preferences: Java -> Build Path -> Classpath
|
|
132 |
|
|
133 |
* Click <<<New>>>. In the upcoming dialog, enter <<<M2_REPO>>> as the variables name and browse the filesystem for the location of the maven repository
|
|
134 |
|
|
135 |
* In OSX for example <<</Users/USERNAME/.m2/repository>>>
|
|
136 |
|
|
137 |
* In WinXP for example <<<C:\Documents and Settings\USERNAME\.m2\repository>>>
|
130 |
138 |
|
131 |
|
* Install AspectJ Development Tools (AJDT) - Plugin (for eclipse) (Update-Site:{{http://download.eclipse.org/tools/ajdt/xx/dev/update}}) where xx depends on your eclipse installation: xx=35 for eclipse 3.5 and xx=36 for eclipse 3.6
|
|
139 |
* Import the cdmlib projects:
|
132 |
140 |
|
133 |
|
* Referesh cdmlib-model project within eclipse
|
|
141 |
* In Eclipse open the Import Wizard: File -> Import -> General -> Existing Projects into Workspace
|
134 |
142 |
|
135 |
|
* Convert the cdmlib-model to AspectJ (right mouse click on project -> AspectJ Tools -> ...).
|
136 |
|
!! Each time when running mvn eclipse:eclipse on cdmlib-model (or on cdmlib parent folder) you have to first remove and then add AspectJ anew!!
|
|
143 |
* Choose "Select root directory". Click "Browse" and navigate to your cdmlib folder and confirm the file dialog.
|
137 |
144 |
|
138 |
|
* It is also recommended to use the EclipseCodeTemplate
|
|
145 |
* The projects should now show in the Import Wizard window. Select the projects you want wo work on (usually all) and hit OK.
|
139 |
146 |
|
140 |
147 |
|
141 |
148 |
* Where do I go from here?
|
142 |
149 |
|
143 |
|
Now that you have integrated or installed the CDM Library you are probably looking for documentation on how to develop with it. A good start is to read the {{{./reference.html}reference documentation}} of the CDM Library. The {{{./cdm-uml}UML diagrams}} are also a good starting point to get familiar with the structure of the Common Data Model itself or consult the {{{./apidocs}javadoc}} for the API documentation.
|
|
150 |
Now that you have integrated or installed the CDM Library you are probably looking for documentation
|
|
151 |
on how to develop with it. A good start is to read the {{{./reference.html}reference documentation}}
|
|
152 |
of the CDM Library. The {{{./cdm-uml}UML diagrams}} are also a good starting point to get familiar
|
|
153 |
with the structure of the Common Data Model itself or consult the {{{./apidocs}javadoc}} for the API documentation.
|
|
154 |
Please also have a look at the {{{http://dev.e-taxonomy.eu/trac/wiki/GeneralDev} general information}} and
|
|
155 |
{{{http://dev.e-taxonomy.eu/trac/wiki/CdmLibraryDev} further information about coding with the CDM Library}} in the development wiki.
|
144 |
156 |
|
145 |
|
If you want to start coding immediately, we prepared some {{{https://dev.e-taxonomy.eu/trac/wiki/CDMLibraryExamples}code examples}} in the developers wiki.
|
146 |
157 |
|
147 |
158 |
|
fixed jboss maven repository location