Jump to: navigation, search

Difference between revisions of "OFMP/Release 1.0.0M1"

(Short term)
Line 153: Line 153:
 
*[http://www.eclipse.org/aspectj/ Eclipse Aspectj]
 
*[http://www.eclipse.org/aspectj/ Eclipse Aspectj]
 
*[http://martinlippert.blogspot.com/2008/07/dependency-injection-for-extensions.html Martin Lippert: Dependency Injection for Extensions, Third Edition]
 
*[http://martinlippert.blogspot.com/2008/07/dependency-injection-for-extensions.html Martin Lippert: Dependency Injection for Extensions, Third Edition]
 +
 +
==Eclipse Procedures et Legal docs==
 +
*[http://www.eclipse.org/org/documents/Eclipse_Policy_and_Procedure_for_3rd_Party_Dependencies_Final.pdf Eclipse_Policy_and_Procedure_for_3rd_Party_Dependencies_Final]
 +
*[http://www.eclipse.org/legal/EclipseLegalProcessPoster.pdf Eclipse Legal Process]

Revision as of 11:20, 9 December 2008

Requirements

  1. Oracle XE 10.2 with system/system credentials
  2. JDK 1.5 (not JRE as Maven requires a JDK)
  3. Eclipse 3.4
  4. Maven 2.0.9
  5. m2eclipse 0.9.6 including the following features: Maven SCM Integration + Maven SCM Handler for Team/CVS
  6. Spring IDE

SCM access

:extssh:<username>@cvs.covariance.org:57022/cvsroot/ofmp.osgi

Build Source

  1. At this stage OracleXE must be up and running
  2. Create an Eclipse Workspace in C:\dev\ofmp
  3. In CVS Repository view, browse to org.eclipse.ofmp project
  4. Right click -> Checkout as Maven project... -> Choose HEAD
  5. Let m2eclipse checkout and compile all the modules (ignore popup errors) => Might take 15 minutes if new Maven local repo
  6. When done, close all modules except the "ofmp" module
  7. Run "mvn clean install" on the "ofmp" module => Might take 10 minutes if new Maven local repo

Datamodel will be setup in the same process

In future runs, if you dont want datamodel to be reset:

mvn -Dignore_database_setup=true clean install

The Eclipse Target is built during the installation process as well with the core-runtime module.

  1. Go to Window -> Preferences -> Plugin Development -> Target
  2. In predefined Targets, load \org.eclipse.ofmp\runtime\server\core-runtime\org.eclipse.ofmp.server.core.target

To have a clearer view of your Eclipse workspace, import /ofmp/workingSets.psf Project Set file and choose Working Sets as Top Level elements in your Package Explorer. All workspace projects must be opened for this operation to work.

Then close all projects in the "dependencies" working set.

Known Building issues

Bundles org.eclipse.ofmp.datasource.oracle and org.eclipse.ofmp.transaction wont compile due to the org.eclipse.ofmp.lib.jencks bundle project config.

Open the org.eclipse.ofmp.lib.jencks project, add all the JARs in the lib folder to the project's build path, go to Project -> Properties -> Java Build Path -> Order and Export, check all the JARs in the lib folder.

Edit org.eclipse.ofmp.datasource.oracle and org.eclipse.ofmp.transaction Manifest files, save them back.

Refresh org.eclipse.ofmp.common Manifest file

OFMP bundles creation

For every service to be extracted from the org.eclipse.ofmp.service.core project we have to:

  • extract bundle (scr and src.tests) from the core, mavenize and OSGify it
  • create an integration test project based on Spring DM test framework and run integration tests on it.

Procedure

  • Create an integrationtests Maven module if required in \org.eclipse.ofmp\core\integration-tests
  • Setup pom.xml (org.eclipse.ofmp.security/pom.xml is a good example)
  • Rename packages to org.eclipse.ofmp (dont use "service" prefix for bundles)
  • Use Bnd to automate generation of Manifest.MF OSGi tags:
    • replace Require-Bundle by Import-Packages as much as possible
    • ensure proper bundles versioning AND dependencies versioning e.g.: Import-Package: osgitut.movies;version="[1.0.0,2.0.0)"
    • Hide Implementation Details: ONLY export public API packages in Manifest

Put implementation details in separate packages from the public API

org.example.foo - exported API package
org.example.foo.internal - private implementation package
  • Remove any specific wordings (victoria/apsys) in source code
  • Enable project Spring nature if required and enlist Spring files in project properties

Naming conventions

  1. every service bundle does not hold the ".service." acronym in its bundle name
  2. every lib bundle(like Jencks) should contain the ".lib." acronym in its bundle name


Test infrastructure

OFMP Test infrastructure is built on Spring DM Test framework

Have a look at

  • org.eclipse.ofmp.test/src/main/java/org/eclipse/ofmp/test/AbstractOFMPDBUnitTest
  • org.eclipse.ofmp.test/src/main/java/org/eclipse/ofmp/test/AbstractOFMSpringDMTest

The org.eclipse.ofmp.test bundle expose the service required to cleanup/initialize the database before any tests.

Tests are run automatically by maven when you install a bundle.

When running tests from Eclipse you need to set a JVM parameter so that Spring DM Test framework locate bundles properly:

-Declipse.target.area=<path/to>\org.eclipse.ofmp\runtime\server\core-runtime\plugins\eclipse_plugins

Open issues

Current issue

Authentication and Authorisation of Service Layer with Spring DM

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean#1': 
Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'currencyRateService': FactoryBean threw exception on object creation; 
nested exception is org.springframework.aop.framework.AopConfigException: 
Unknown advisor type class org.springframework.security.intercept.AbstractSecurityInterceptor$$EnhancerByCGLIB$$c7254c44; 
Can only include Advisor or Advice type beans in interceptorNames chain except for last entry,which may also be target or  TargetSource; 
nested exception is org.springframework.aop.framework.adapter.UnknownAdviceTypeException: 
Advice object [org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor@87ad67] 
is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]

See message on Spring DM forum

Tips

  • Be patient, drink coffee or beers. On first OFMP installation, setting up your local Maven repository might take 30 minutes.
  • Always keep number of opened projects as low as possible
  • MANIFEST.MF files do not always refresh properly after BND generation, open and press F5.

TODO

Short term

  • Continue migrating /cvsroot/victoria/victoria.server (OSGi branch) sources and tests to OSGi bundles.
  • Use EasyMock to replace integration tests
  • Add File headers using proper tool

Long term

  • Run FindBugs plugin on source code
  • Active checkStyle
  • Move event listeners/publishers to JMS/Camel
  • Ensure proper logging and logging levels
  • Ensure proper security on local and remote interface
  • Ensure proper transactional context of methods
  • Improve and generate Javadoc
  • Validate pre-conditions of public/protected methods using Apache Commons Lang Validate
  • Validate pre/post-conditions of private methods with java asserts
  • Use Eclipse API Tools
  • Run Code Coverage tests
  • Fix any TODO or FIXME
  • Return Quickly from Framework Callbacks: If you need to do something that takes some time then either use eventing or spin off a background thread to perform the long running work
  • Check source code copyrights
  • Check source code for copyrighted names (reuters, apsys, ebs, ...)
  • Produce UMLGraph

Troubleshooting

References

Eclipse Procedures et Legal docs