Download Export as RTF

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
cea - How to Build jBEAM CEA Components with Eclipse
H
o
w
to
B
uil
d
jB
E
A
M
C
E
A
C
o
m
po
ne
nt
s
wi
th
Ec
lip
se
Jette
Nebe
l
21.1
0.20
14
Page 1 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Table of Contents
How to Build jBEAM CEA Components with Eclipse ..........................................................................................................................................................
Software Prerequisites ...............................................................................................................................................................................................................
Page 2 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Starting Eclipse .............................................................................................................................................................................................................................
Creating an empty Java-Project & Importing Cea2SampleImporter Sources .........................................................................................................
Adding jBEAM to the Classpath ..............................................................................................................................................................................................
Run the Cea2SampleImporter Project ..................................................................................................................................................................................
Debug the Cea2SampleImporter Project .............................................................................................................................................................................
Résumé ...........................................................................................................................................................................................................................................
•
•
•
•
•
•
•
ContentsHow to Build jBEAM CEA Components with EclipseSoftware Prerequisites
Starting Eclipse
Creating an empty Java-Project & Importing Cea2SampleImporter Sources
Adding jBEAM to the Classpath
Run the Cea2SampleImporter Project
Debug the Cea2SampleImporter Project
Résumé
How to Build jBEAM CEA Components with Eclipse
This How-to is the first one in a series of three wiki posts. All are focused on getting you started with CEA
component development in Java & Eclipse.
This tutorial clearly focuses on Eclipse newcomers, as all steps are supported by screenshots and Eclipse
specific instructions. In addition, we prepared a small demo project, containing the Java sources for a simple
CEA component called Cea2SampleImporter. As its name suggests, it provides (file-) import functionality to the
CEA system.
The main objective of this article is to guide you through the set-up of this sample CEA component in Eclipse, so
that you are able to reproduce these steps with your own CEA components.
At the end you’re abled to build, run and debug this CEA component. And you are well prepared for the next
How-tos in this series as they are more feature specific: I.e. the structure of CEA files, the xml descriptor file, the
CEA component lifecycle a.s.o.
Software Prerequisites
We’re using:
1.
1.
1.
1.
... the Eclipse Java IDE (version Kepler SR2) on a Windows 7 64-bit operating system, The Eclipse IDE
could be downloaded here.
... a Java 1.6 SDK or above. We recommend Java 1.7 from Oracles download page.
... the Cea2SampleImporter souces as zip-package: Cea2SampleImporter.zip
... a jBEAM jar-file like the one customized for your company e.g. jBEAM_your-company-name.jar.
Be sure you have installed all the required software.
Starting Eclipse
When you start the Eclipse IDE for the first time you have to select a location for your workspace. You can leave
the default settings or you can create a new folder especially for your jBEAM projects. This two-step Eclipse
process is depicted below.
Page 3 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Creating an empty Java-Project & Importing Cea2SampleImporter
Sources
To create a new CEA component, we start with a new Java project as depicted below. Therefore navigate in the
Eclipse menu bar to File > New > Java Project as shown below (1). Eclipse opens the New Java Project dialog.
Set the Project name to Cea2SampleImporter, verify the selected JRE is at least JavaSE-1.7 and click Finish
(2). After that, Eclipse shows your newly created project in the Package Explorer View. Verify that it looks similar
to the pictures below.
Page 4 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
The next step is to copy the content of the Cea2SampleImporter zip-file into your newly created Eclipse project.
This file contains some - Java source files (/src folder), - sample input files (/data) and - pre-configured CEA
component files (/CEAComponents). You could import/copy these files using your preferred zip-tool or simply by
importing it with the Eclipse IDE (see the picture below). To follow the Eclipse procedure: Be sure that the
Cea2SampleImporter-project is selected in the Package Explorer View. Navigate in the Eclipse main menu to
File > Import… (1) and select General > Archive File inside the Import dialog and click Next to proceed (2).
Finish this import process by pressing Finish, but verify that all files are selected as depicted below.
Now, that all Java source files of our Cea2SampleImporter project are in place, Eclipse encounters various errors
while building the project (be sure that the Project > Build Automatically feature is activated). As shown below.
But this behavior was to be expected as we didn’t provide any libraries.
Adding jBEAM to the Classpath
Page 5 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
To resolve these problems we have to add the jBEAM.jar to the classpath of our project. Again, be sure that the
Cea2SampleImporter-project is selected in the Package Explorer View. Now select File > Properties in the
Eclipse main menu - the dialog Properties for Cea2SampleImporter gets displayed. In there, navigate to Java
Build Path > Libraries (see step 1 in the pictures below) and select Add External JARs… (2). A file selection
dialog titled JAR Selection appears in which you navigate to your jBEAM library archive file jBEAM.jar (3).
After adding this library the Eclipse Problems view shall be empty - except for some minor warnings. As shown
below.
Page 6 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Run the Cea2SampleImporter Project
Now all compiler errors are resolved, so we can test-drive the project for the very first time. But first we need a
suitable Eclipse run configuration. As always, be sure the Cea2SampleImporter is selected in the Package
Explorer view.
Navigate to Run > Run Configurations… in the Eclipse menu bar. The Run Configuration dialog appears, select
Java Application as depicted in step 2 below. Click on New launch configuration icon (3). The dialog changes
a bit, giving you more input boxes to customize your new run configuration.
And follow these final steps to create your Run Configuration:
•
•
•
•
(4) type in an appropriate Name for this Run Configuration. (optional)
(5) click Browse... to select the Cea2SampleImporter project.
(6) click on Search...
(7) ... to find and select the executable Java-class named com.AMS.jBEAM_Extern.jBMain in your
project’s classpath.
Page 7 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Running this configuration opens the jBEAM application main window. To actually find this Cea2SampleImporter
component, you have to navigate along the jBEAM menu structure to File > Import Values >
Cea2-SampleImporter as depicted below (1). Clicking on it gives you a File input dialog named CEA v2
File-Import Demo. As described above, the Cea2SampleImporter zip-file contains a folder named /data, inside of
it there are three demo data files. Select one them (2) and click OK (3) to see the imported channels + values.
Page 8 - last modified by Jette Nebel on 21.10.2014
cea - How to Build jBEAM CEA Components with Eclipse
Debug the Cea2SampleImporter Project
Back in the Eclipse IDE, use the Package Explorer view to navigate to Cea2SampleImporter.java (inside the
Cea2SampleImporter project, in package: org.asam.cea2). Do double-click on it to open its Java source content.
See step 1 in the picture below. After that, look for the text line that reads: public void cea2Customize() … (line
652) and double-click on the hatched blue bar on that line (2). This sets a breakpoint, forcing the Java runtine to
pause when reaching this line.
Let’s see that in action – click on the Debug jBMain button (or the name you selected previously for that run
configuration), as indicated in step 1 of the picture below. Now jBEAM starts again and you navigate in the
jBEAM main menu to Cea2-SampleImporter menu item. Select it and you will notice in the Eclipse source view,
the newly created breakpoint got hit as indicated by the green line (2) in the picture below.
Résumé
You clearly noticed, this article does not dive-deep into these topics. The next how-tos in this series will try to
clearify that. And, as you may notice, the zip-file and package of Cea2SampleImporter contain some
preconfigured files, we have not touched yet. To configure these items is introduced in the following articles.
Page 9 - last modified by Jette Nebel on 21.10.2014