Difference between revisions of "SMILA/Development Guidelines/How to set up integration environment"

From Eclipsepedia

Jump to: navigation, search
(Create a new Workspace and setup target platform)
 
(42 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:SMILA]]
 
[[Category:SMILA]]
  
==== WORK IN PROGRESS ====
+
{{note|This is outdated, please refer to [[SMILA/Development Guidelines/Howto set up dev environment|How to set up the development environment]]}}
  
 
This how-to describes the necessary steps for setting up SMILA integration environment. Normally this setup is only interesting for SMILA integrators who just want to integrate their components in SMILA. SMILA committers and contributors should work with another setup described at [[SMILA/Development Guidelines/Howto set up dev environment|How to set up the development environment]].
 
This how-to describes the necessary steps for setting up SMILA integration environment. Normally this setup is only interesting for SMILA integrators who just want to integrate their components in SMILA. SMILA committers and contributors should work with another setup described at [[SMILA/Development Guidelines/Howto set up dev environment|How to set up the development environment]].
Line 9: Line 9:
 
Here is the list of things that you will definitely need for developing SMILA components:
 
Here is the list of things that you will definitely need for developing SMILA components:
 
#JDK 1.6
 
#JDK 1.6
#current Eclipse SDK - This howto was tested with [http://www.eclipse.org/downloads/packages/eclipse-classic-362/heliossr2 Eclipse 3.6]
+
#Eclipse SDK - This howto was tested with [http://download.eclipse.org/eclipse/downloads/drops/R-3.7.1-201109091335/index.php Eclipse SDK 3.7.1 (Indigo SR1)] (it might still work with Eclipse SDK 3.6.2, too).
 
#SMILA binary distribution
 
#SMILA binary distribution
  
 
==== Install the binary distribution ====
 
==== Install the binary distribution ====
  
Just pick up the latest stable version of SMILA - release, milestone or nightly build, whatever you need.
+
Just pick up the latest binary distribution of SMILA:
 
+
* [http://www.eclipse.org/smila/downloads.php release 0.9 or higher] or
The latest stable version can always be found in our [http://www.eclipse.org/smila/downloads.php download section].
+
* [http://build.eclipse.org/rt/smila/nightly/ nightly build]
  
 
Simply unzip the file you downloaded into a new directory on your local hard disk and you've done with the installation.
 
Simply unzip the file you downloaded into a new directory on your local hard disk and you've done with the installation.
Line 22: Line 22:
 
==== Create a new Workspace and setup target platform ====
 
==== Create a new Workspace and setup target platform ====
  
Start your Eclipse SDK and let it create a new workspace at a location of your choice. Then you use the SMILA binaries as the target platform for plugin develoment. This enables you to create own bundles that can use the code in the SMILA bundles:
+
Extract your eclipse SDK (be sure, it's just the plain SDK and no JEE-IDE) into another directory, named e.g. eclipse-SDK). This will save you lots of trouble when setting up the target environment.
  
* Open Windows -> Preferences
+
Start your Eclipse SDK and create a new workspace at a location of your choice. Then use the SMILA binaries as the target platform for plugin develoment. This enables you to create own bundles that can use the code in the SMILA bundles:
* Window --> Preferences --> Plug-in Development --> Target Platform --> Add...
+
* Initialize the target definition with: Nothing --> Next
+
* Insert some sensible name (how about "SMILA", maybe? ;-)
+
* In the "Location" tab, click "Add"
+
** Select "Installation" --> Click "Next"
+
** In the "Location" slot, browse to your directory where you installed SMILA (do not press <Enter>)
+
** --> click "Finish"
+
* In the "Location" tab, click "Add" again
+
** select "Features" --> Click "Next"
+
** in the "Location" slot select "${eclipse_home}"
+
** select Features "org.eclipse.platform" and "org.eclipse.jdt"
+
** --> click "Finish"
+
* switch to "Content" tab:
+
** filter for "junit" and deselect the bundles "org.junit (4.8.1)" and  "org.junit4 (4.8.1)". Only "org.junit (3.8.2)" must be selected.
+
* --> click "Finish"
+
* Set the new target platform active
+
* --> click "OK", you're done.
+
  
==== Create a launch configuration for SMILA ====
+
'''To set up the target platform'''
  
* Open the "Run" menu and select "Run Configurations ..." or "Debug Configurations ..."
+
* Open "Windows" -> "Preferences".
* Create a new configuration under "OSGi framework" by selecting it and using "New" from the context menu. It should look like this:
+
* Select "Plug-in Development" --> "Target Platform" --> "Add".
 +
* Initialize the target definition with: "Nothing --> Next".
 +
* Enter a reasonable name (how about "SMILA", maybe? ;-).
 +
* In the "Locations" tab, click "Add".
 +
** Select "Installation" --> Click "Next".
 +
** Click "Browse" and navigate to the directory where you installed SMILA (do not press <Enter> yet).
 +
** --> Click "Finish".
 +
* Back on the "Locations" tab, click "Add" again.
 +
** Select "Features" --> Click "Next"
 +
** Click "Browse..." and select the eclipse-SDK (see above) and click OK.
 +
** Select the features "org.eclipse.jdt" and "org.eclipse.platform".
 +
** --> Click "Finish"
 +
* Switch to the "Content" tab:
 +
** Filter for "junit" and deselect the bundles "org.junit (4.8.1)" and  "org.junit4 (4.8.1)". Only "org.junit (3.8.2)" must be selected.
 +
* --> Click "Finish"
 +
* Select the new target platform.
 +
* --> Click "OK", you're done.
  
[[Image:SMILA-integrator-launch-bundles.png]]
+
==== Create a launch configuration for SMILA ====
 
+
* Select the "Arguments" tab.
+
* In the "VM arguments" text field, add:
+
 
+
<source lang="text">
+
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
+
-Dlog4j.configuration=file:log4j.properties
+
-Dcom.sun.management.jmxremote
+
-Dcom.sun.management.jmxremote.port=9004
+
-Dcom.sun.management.jmxremote.ssl=false
+
-Dcom.sun.management.jmxremote.authenticate=false
+
</source>
+
  
* Under "Working Directory" select "Other:" and enter: <tt>${target_home}</tt>. It now should look like this:
+
Getting right the launch configuration for SMILA is a bit tedious, so we prepared an example package:  
  
[[Image:SMILA-integrator-launch-arguments.png]]
+
'''To import the example package'''
  
* After clicking the "Run" or "Debug" button at the bottom, SMILA will be started. After a while, some output should appear in the Console view:
+
* Either checkout the contents of [https://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/examples https://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/examples] from our SVN repository into your workspace and your finished.
 +
* Or download them as one package from [http://www.eclipse.org/downloads/download.php?file=/rt/smila/releases/0.9/SMILA-0.9-integrator-examples.zip 0.9 release] or [http://build.eclipse.org/rt/smila/nightly/SMILA-integrator-examples.zip nightly build], unzip them, and do the following:
 +
**Select "File" > "Import".
 +
**Select "General" > "Existing Projects into Workspace" and click "Next".
 +
**Click "Browse", navigate to the folder where you have unpacked the ZIP.
 +
**Confirm with "OK".
 +
**Select all projects, enable the option "Copy projects into workspace", and click "Finish".
 +
*Now you should have the following projects in your workspace:
 +
**<tt>org.eclipse.smila.integration.feature</tt>
 +
**<tt>org.eclipse.smila.integration.pipelet</tt>
 +
**<tt>org.eclipse.smila.integration.worker</tt>
 +
**<tt>org.eclipse.smila.integration.worker.test</tt>
 +
**<tt>SMILA.application</tt>
  
[[Image:SMILA-integrator-console.png|800px]]
+
To launch SMILA, you need only the "SMILA.application" project. The other bundles contain examples for developing integration components like workers, pipelets, etc.
  
* You should shutdown SMILA by entering "close" and <Enter> in the Console view.
+
'''To launch SMILA'''
* There can be error messages in the console output or <tt>SMILA.log</tt> file that come from bundles that have been started (because in this setup '''ALL''' bundles are started), but are missing a configuration in the sample setup. These can be ignored. Alternatively you can deactivate them in the launch configuration.
+
  
==== Testing your code ====
+
* Select "Run" -> "Run Configurations" or "Debug Configurations".
 +
* Select "OSGi Frameworks" -> "SMILA".
 +
* Click "Run" or "Debug" and SMILA should start just like when started from the command line.
  
To be able to use JUnit test your code, you will need to add a JUnit bundle to the target platform. You can do this by copying the directory <tt>plugins/org.junit_3.8.2.v20080602-1318</tt> (the exact version numbers may vary in your installation) from your Eclipse installation to <tt>SMILA/plugins</tt>. You then need to press "Reload" again in the Target Platform pane of Window->Preferences to enable the JUnit bundle.
+
Find the configuration of this SMILA instance in your workspace in "SMILA.application/configuration".
  
You may want to check out <tt>org.eclipse.smila.test</tt> from our SVN repository at <tt>http://dev.eclipse.org/svnroot/rt/org.eclipse.smila/</tt>. It contains some base classes for testing OSGi services and JMX agents. There are a lot of bundles named <tt>*.test</tt> in the repository that can serve you as an example of how to create test cases for crawlers and pipelets.
+
For further information on implementing in SMILA see the [[SMILA/HowTo|HowTo manuals]].
  
 
[[Category:SMILA]]
 
[[Category:SMILA]]

Latest revision as of 05:52, 20 January 2012


Note.png
This is outdated, please refer to How to set up the development environment


This how-to describes the necessary steps for setting up SMILA integration environment. Normally this setup is only interesting for SMILA integrators who just want to integrate their components in SMILA. SMILA committers and contributors should work with another setup described at How to set up the development environment.

Contents

[edit] Preconditions

Here is the list of things that you will definitely need for developing SMILA components:

  1. JDK 1.6
  2. Eclipse SDK - This howto was tested with Eclipse SDK 3.7.1 (Indigo SR1) (it might still work with Eclipse SDK 3.6.2, too).
  3. SMILA binary distribution

[edit] Install the binary distribution

Just pick up the latest binary distribution of SMILA:

Simply unzip the file you downloaded into a new directory on your local hard disk and you've done with the installation.

[edit] Create a new Workspace and setup target platform

Extract your eclipse SDK (be sure, it's just the plain SDK and no JEE-IDE) into another directory, named e.g. eclipse-SDK). This will save you lots of trouble when setting up the target environment.

Start your Eclipse SDK and create a new workspace at a location of your choice. Then use the SMILA binaries as the target platform for plugin develoment. This enables you to create own bundles that can use the code in the SMILA bundles:

To set up the target platform

  • Open "Windows" -> "Preferences".
  • Select "Plug-in Development" --> "Target Platform" --> "Add".
  • Initialize the target definition with: "Nothing --> Next".
  • Enter a reasonable name (how about "SMILA", maybe? ;-).
  • In the "Locations" tab, click "Add".
    • Select "Installation" --> Click "Next".
    • Click "Browse" and navigate to the directory where you installed SMILA (do not press <Enter> yet).
    • --> Click "Finish".
  • Back on the "Locations" tab, click "Add" again.
    • Select "Features" --> Click "Next"
    • Click "Browse..." and select the eclipse-SDK (see above) and click OK.
    • Select the features "org.eclipse.jdt" and "org.eclipse.platform".
    • --> Click "Finish"
  • Switch to the "Content" tab:
    • Filter for "junit" and deselect the bundles "org.junit (4.8.1)" and "org.junit4 (4.8.1)". Only "org.junit (3.8.2)" must be selected.
  • --> Click "Finish"
  • Select the new target platform.
  • --> Click "OK", you're done.

[edit] Create a launch configuration for SMILA

Getting right the launch configuration for SMILA is a bit tedious, so we prepared an example package:

To import the example package

  • Either checkout the contents of https://dev.eclipse.org/svnroot/rt/org.eclipse.smila/trunk/examples from our SVN repository into your workspace and your finished.
  • Or download them as one package from 0.9 release or nightly build, unzip them, and do the following:
    • Select "File" > "Import".
    • Select "General" > "Existing Projects into Workspace" and click "Next".
    • Click "Browse", navigate to the folder where you have unpacked the ZIP.
    • Confirm with "OK".
    • Select all projects, enable the option "Copy projects into workspace", and click "Finish".
  • Now you should have the following projects in your workspace:
    • org.eclipse.smila.integration.feature
    • org.eclipse.smila.integration.pipelet
    • org.eclipse.smila.integration.worker
    • org.eclipse.smila.integration.worker.test
    • SMILA.application

To launch SMILA, you need only the "SMILA.application" project. The other bundles contain examples for developing integration components like workers, pipelets, etc.

To launch SMILA

  • Select "Run" -> "Run Configurations" or "Debug Configurations".
  • Select "OSGi Frameworks" -> "SMILA".
  • Click "Run" or "Debug" and SMILA should start just like when started from the command line.

Find the configuration of this SMILA instance in your workspace in "SMILA.application/configuration".

For further information on implementing in SMILA see the HowTo manuals.