Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Lyo/BuildingOSLC4J"

< Lyo
m (Clone the Lyo Core and RIO (optional, for Change Management sample) git repositories)
(13 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
 
== Prerequisites ==
 
== Prerequisites ==
* [http://eclipse.org/downloads Eclipse 3.6 or 3.7 IDE]
+
* [http://eclipse.org/downloads Eclipse 3.6 or higher IDE]
 
* [http://eclipse.org/egit/download/ EGit] team provider for git (recommended) or [http://git-scm.com/download git command line package].
 
* [http://eclipse.org/egit/download/ EGit] team provider for git (recommended) or [http://git-scm.com/download git command line package].
 
* [http://www.eclipse.org/m2e/download/ m2eclipse] for Maven support in the Eclipse IDE
 
* [http://www.eclipse.org/m2e/download/ m2eclipse] for Maven support in the Eclipse IDE
 
* OSLC4J requires a Java 1.6 compiler and Java 1.6 runtime.  The Eclipse project settings have been set appropriately.  If you are building outside of Eclipse, please use Java 1.6.
 
* OSLC4J requires a Java 1.6 compiler and Java 1.6 runtime.  The Eclipse project settings have been set appropriately.  If you are building outside of Eclipse, please use Java 1.6.
  
== Create an Apache Tomcat runtime environment in Eclipse ==
+
== OSLC4J Sample Application runtimes ==
* Tomcat is the default runtime for OSLC4J samplesConfiguration for other runtimes (Jetty, etc) is possible.
+
The OSLC4J sample applications now use a Jetty app server as the default runtime.  The samples will also work in an Eclipse IDE using a Tomcat runtime. See [http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jst.server.ui.doc.user%2Ftopics%2Ftomcat.html the Eclipse documentation] for instructions on creating a Tomcat server.  
* See [http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jst.server.ui.doc.user%2Ftopics%2Ftomcat.html the Eclipse documentation] for instructions on creating a Tomcat server.  Be sure to name the server '''Apache Tomcat v7.0'''.
+
* Create 1 server on port 8080 for the OSLC4JRegistry catalog application
+
* Create 1 server on port 8081 for any sample applications you want to run.  In the future, the config will change so all apps can run on the same port.
+
  
== Clone the Lyo Core and RIO (optional, for Change Management sample) git repositories ==
+
== Options for running the OSLC4J Samples ==
 +
 
 +
You can develop and run OSLC4J samples one of 2 ways
 +
 
 +
* Build OSLC4J and samples from source
 +
* Download the OSLC4J package with its dependencies [http://eclipse.org/lyo/download.php here] and add the jars to the classpath of your project
 +
 
 +
The remainder of this document explains the process for building from source.
 +
 
 +
== Clone the Lyo Core and RIO (optional, for Change and Quality Management samples) git repositories ==
 
This example assumes EGit is being used
 
This example assumes EGit is being used
  
Line 25: Line 31:
 
The repository should now show up in your Git Repositories view
 
The repository should now show up in your Git Repositories view
  
* If you want to load the OSLC4J Change Management sample provider, repeat the above steps for the RIO Git repository:  git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git
+
* If you want to load the OSLC4J Change or Quality Management sample providers, repeat the above steps in EGit to clone the Lyo RIO Git repository:  git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git
  
 
== Import OSLC4J Eclipse projects from the git repository ==
 
== Import OSLC4J Eclipse projects from the git repository ==
 
* In the Git Repositories view, right click org.eclipse.lyo.core and select Import Projects
 
* In the Git Repositories view, right click org.eclipse.lyo.core and select Import Projects
 
* Select the Import Existing Projects wizard and click next
 
* Select the Import Existing Projects wizard and click next
* Select all components of RIO
+
* Select all components of OSLC4J core.  The org.eclipse.lyo.core.query project is optional and not part of the core of OSLC4J at this point.
 
[[Image:Lyo-core-import-projects.png]]
 
[[Image:Lyo-core-import-projects.png]]
  
Line 39: Line 45:
  
 
== Run the StockQuote sample application ==
 
== Run the StockQuote sample application ==
* By default, the sample applications require that the OSLC4JRegistry application be running on the Tomcat server running on port 8080 and the sample application running on the Tomcat server running on port 8081.
+
 
* Go to the Server view (Window->Show View->Other and select Servers)
+
* Go to Run->Run Configurations
* right click the server running on port 8080 and select Add and Remove
+
* Expand the Maven Build section
* Add OSLC4JRegistry and start this server
+
* Select '''Launch OSLC4JStockQuote''' and click Run
* Test that the server is running by going to this URL in a web browser:  http://localhost:8080/OSLC4JRegistry/catalog.  You should get an OSLC catalog document in response.
+
* Test that the server is running by going to this URL in the web browser:  http://localhost:8080/OSLC4JStockQuote/stockQuotes.  You should get an OSLC response with some recent stock quotes (if you have internet connectivity).
* right click the server running on port 8081 and select Add and Remove
+
** The OSLC Catalog entry for this application can be found at http://localhost:8080/OSLC4JRegistry/catalog/singleton
* Add OSLC4JStockQuote and start this server
+
* Test that the server is running by going to this URL in the web browser:  http://localhost:8081/OSLC4JStockQuote/stockQuotes.  You should get an OSLC response with some recent stock quotes (if you have internet connectivity).
+
  
 
=== Run the StockQuote JUnit tests ===
 
=== Run the StockQuote JUnit tests ===
Line 56: Line 60:
 
'''Note:''' the sample UIs for the Change Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
'''Note:''' the sample UIs for the Change Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
 
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
** Select the OSLC4JChangeManagement, OSLC4JChangeManagementCommon and OSLC4JChangeManagementTest projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.
+
** Select the OSLC4JChangeManagement, OSLC4JChangeManagementCommon and OSLC4JChangeManagementTest projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRIO|Lyo RIOs]] for information on these other reference implementations.
 
* Build each CM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 
* Build each CM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 
   * OSLC4JChangeManagementCommon
 
   * OSLC4JChangeManagementCommon
 
   * OSLC4JChangeManagement
 
   * OSLC4JChangeManagement
 
   * OSLC4JChangeManagementTest
 
   * OSLC4JChangeManagementTest
* Run the application as above (on the Tomcat server on port 8081).
+
* Go to Run->Run Configurations
* You can test by going to this URL in a browser:  http://localhost:8081/OSLC4JChangeManagement/changeRequests.  You should see a few OSLC ChangeRequest resources.
+
* Expand the Maven Build section
 +
* Select '''Launch OSLC4JChangeManagement''' and click Run
 +
* Test that the server is running by going to this URL in the web browser:  http://localhost:8080/OSLC4JChangeManagement/changeRequests.  You should get an OSLC response with some ChangeRequest resources.
 +
** The OSLC Catalog entry for this application can be found at http://localhost:8080/OSLC4JRegistry/catalog/singleton
 +
 
 
=== Run the Change Management JUnit tests ===
 
=== Run the Change Management JUnit tests ===
 
* Expand the OSLC4JChangeManagementTest project down to the Java source
 
* Expand the OSLC4JChangeManagementTest project down to the Java source
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Right click AllTests.java -> Run As -> JUnit test
 
* Results will appear in the JUnit view
 
* Results will appear in the JUnit view
 +
 +
== Run the Quality Management sample provider ==
 +
'''Note:''' the sample UIs for the Quality Management sample provider have not yet been committed to Eclipse.  The delegated selection and creation dialogs will not work yet
 +
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
 +
** Select the OSLC4JQualityManagement, OSLC4JQualityManagementCommon and OSLC4JQualityManagementTest projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.
 +
* Build each QM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 +
  * OSLC4JQualityManagementCommon
 +
  * OSLC4JQualityManagement
 +
  * OSLC4JQualityManagementTest
 +
* Go to Run->Run Configurations
 +
* Expand the Maven Build section
 +
* Select '''Launch OSLC4JQualityManagement''' and click Run
 +
* Test that the server is running by going to this URL in the web browser:  http://localhost:8080/OSLC4JChangeManagement/testPlans.  You should get an OSLC response with some TestPlan resources.
 +
** The OSLC Catalog entry for this application can be found at http://localhost:8080/OSLC4JRegistry/catalog/singleton
 +
 +
=== Run the Quality Management JUnit tests ===
 +
* Expand the OSLC4JQualityManagementTest project down to the Java source
 +
* Right click AllTests.java -> Run As -> JUnit test
 +
* Results will appear in the JUnit view
 +
 +
== Run the Automation sample provider ==
 +
* From the Git Repository view, right click the <tt>git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git</tt> repository (browse it also [http://git.eclipse.org/c/lyo/org.eclipse.lyo.rio.git/ on line]) and import projects :
 +
** Select the OSLC4JAutomation, OSLC4JAutomationCommon and OSLC4JAutomationTest projects.  The other projects in the rio repository are unrelated to OSLC4J.  See [[Lyo/LyoRio|Lyo RIOs]] for information on these other reference implementations.
 +
* Build each QM project by right clicking its pom.xml and selecting Run As->Maven install.  Build them in this order:
 +
  * OSLC4JAutomationCommon
 +
  * OSLC4JAutomation
 +
  * OSLC4JAutomationTest
 +
* Go to Run->Run Configurations
 +
* Expand the Maven Build section
 +
* Select '''Launch OSLC4JAutomation''' and click Run
 +
* Test that the server is running by going to this URL in the web browser:  http://localhost:8080/OSLC4JAutomation/automationPlans.  You should get an OSLC response with some AutomationPlan resources.
 +
** The OSLC Catalog entry for this application can be found at http://localhost:8080/OSLC4JRegistry/catalog/singleton
 +
 +
=== Run the Automation JUnit tests ===
 +
* Expand the OSLC4JAutomationTest project down to the Java source
 +
* Right click AllTests.java -> Run As -> JUnit test
 +
* Results will appear in the JUnit view
 +
 +
 +
= The OSLC4JRegistry web application =
 +
The OSLC4J StockQuote, Test, ChangeManagement and QualityManagement all use the OSLC4JRegistry web application as an OSLC Catalog.  When each application starts, it registers its OSLC service provider details with OSLC4JRegistry. 
 +
 +
The sample applications are currently configured to automatically launch the OSLC4JRegistry in the same application server as the sample application and register with this local OSLC4JRegistry instance.  If you wish to change this behavior and have the applications register with a remote OSLC4JRegistry, two changes are required.
 +
 +
* Edit the pom.xml for the sample application and remove the following lines:
 +
<source lang="xml">
 +
<!-- Also start OSLC4JRegistry webApp -->
 +
<contextHandlers>
 +
  <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
 +
      <war>${basedir}/../../org.eclipse.lyo.core/OSLC4JRegistry/target/oslc4j-registry-0.1.1-SNAPSHOT.war</war>
 +
      <contextPath>/OSLC4JRegistry</contextPath>
 +
      </contextHandler>
 +
</contextHandlers>
 +
</source>
 +
* Add the following system property to the JVM arguments for the application launch:
 +
** -Dorg.eclipse.lyo.oslc4j.client.registryuri=http://<hostname>:<port>/OSLC4JRegistry/catalog/singleton (assuming a context of OSLC4JRegistry)
 +
 +
The system property can also be set by modifying the application code to set it directly, load it from a properties file, etc.

Revision as of 15:49, 7 December 2012

Building and Running Lyo OSLC4J applications in Eclipse

Prerequisites

  • Eclipse 3.6 or higher IDE
  • EGit team provider for git (recommended) or git command line package.
  • m2eclipse for Maven support in the Eclipse IDE
  • OSLC4J requires a Java 1.6 compiler and Java 1.6 runtime. The Eclipse project settings have been set appropriately. If you are building outside of Eclipse, please use Java 1.6.

OSLC4J Sample Application runtimes

The OSLC4J sample applications now use a Jetty app server as the default runtime. The samples will also work in an Eclipse IDE using a Tomcat runtime. See the Eclipse documentation for instructions on creating a Tomcat server.

Options for running the OSLC4J Samples

You can develop and run OSLC4J samples one of 2 ways

  • Build OSLC4J and samples from source
  • Download the OSLC4J package with its dependencies here and add the jars to the classpath of your project

The remainder of this document explains the process for building from source.

Clone the Lyo Core and RIO (optional, for Change and Quality Management samples) git repositories

This example assumes EGit is being used

Lyo-core-git-repo.png

  • On the Branch Selection page, select the master branch
  • On the Local Destination page, specify a location or accept the default and click Finish

The repository should now show up in your Git Repositories view

Import OSLC4J Eclipse projects from the git repository

  • In the Git Repositories view, right click org.eclipse.lyo.core and select Import Projects
  • Select the Import Existing Projects wizard and click next
  • Select all components of OSLC4J core. The org.eclipse.lyo.core.query project is optional and not part of the core of OSLC4J at this point.

Lyo-core-import-projects.png

Build all projects

  • Expand the OSLC4JCoreRelEng project
  • Right click pom.xml -> Run As -> Maven clean
  • Right click pom.xml -> Run As -> Maven install

Run the StockQuote sample application

Run the StockQuote JUnit tests

  • Expand the OSLC4JStockQuoteTest project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Change Management sample provider

Note: the sample UIs for the Change Management sample provider have not yet been committed to Eclipse. The delegated selection and creation dialogs will not work yet

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • Select the OSLC4JChangeManagement, OSLC4JChangeManagementCommon and OSLC4JChangeManagementTest projects. The other projects in the rio repository are unrelated to OSLC4J. See Lyo RIOs for information on these other reference implementations.
  • Build each CM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * OSLC4JChangeManagementCommon
  * OSLC4JChangeManagement
  * OSLC4JChangeManagementTest

Run the Change Management JUnit tests

  • Expand the OSLC4JChangeManagementTest project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Quality Management sample provider

Note: the sample UIs for the Quality Management sample provider have not yet been committed to Eclipse. The delegated selection and creation dialogs will not work yet

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • Select the OSLC4JQualityManagement, OSLC4JQualityManagementCommon and OSLC4JQualityManagementTest projects. The other projects in the rio repository are unrelated to OSLC4J. See Lyo RIOs for information on these other reference implementations.
  • Build each QM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * OSLC4JQualityManagementCommon
  * OSLC4JQualityManagement
  * OSLC4JQualityManagementTest

Run the Quality Management JUnit tests

  • Expand the OSLC4JQualityManagementTest project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view

Run the Automation sample provider

  • From the Git Repository view, right click the git://git.eclipse.org/gitroot/lyo/org.eclipse.lyo.rio.git repository (browse it also on line) and import projects :
    • Select the OSLC4JAutomation, OSLC4JAutomationCommon and OSLC4JAutomationTest projects. The other projects in the rio repository are unrelated to OSLC4J. See Lyo RIOs for information on these other reference implementations.
  • Build each QM project by right clicking its pom.xml and selecting Run As->Maven install. Build them in this order:
  * OSLC4JAutomationCommon
  * OSLC4JAutomation
  * OSLC4JAutomationTest

Run the Automation JUnit tests

  • Expand the OSLC4JAutomationTest project down to the Java source
  • Right click AllTests.java -> Run As -> JUnit test
  • Results will appear in the JUnit view


The OSLC4JRegistry web application

The OSLC4J StockQuote, Test, ChangeManagement and QualityManagement all use the OSLC4JRegistry web application as an OSLC Catalog. When each application starts, it registers its OSLC service provider details with OSLC4JRegistry.

The sample applications are currently configured to automatically launch the OSLC4JRegistry in the same application server as the sample application and register with this local OSLC4JRegistry instance. If you wish to change this behavior and have the applications register with a remote OSLC4JRegistry, two changes are required.

  • Edit the pom.xml for the sample application and remove the following lines:
<!-- Also start OSLC4JRegistry webApp -->
<contextHandlers>
   <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
      <war>${basedir}/../../org.eclipse.lyo.core/OSLC4JRegistry/target/oslc4j-registry-0.1.1-SNAPSHOT.war</war>
      <contextPath>/OSLC4JRegistry</contextPath>
      </contextHandler>
</contextHandlers>
  • Add the following system property to the JVM arguments for the application launch:
    • -Dorg.eclipse.lyo.oslc4j.client.registryuri=http://<hostname>:<port>/OSLC4JRegistry/catalog/singleton (assuming a context of OSLC4JRegistry)

The system property can also be set by modifying the application code to set it directly, load it from a properties file, etc.

Copyright © Eclipse Foundation, Inc. All Rights Reserved.